next if $name eq '_content';
my $key = $name;
$key =~ s/^\w+://; # stip namespace
- $state->{DeviceID}->{ $key } = _tag( $tag_hash, $name, '_content' );
+ $state->{DeviceId}->{ $key } = _tag( $tag_hash, $name, '_content' );
}
},
'EventStruct' => sub {
use Data::Dump qw/dump/;
use Carp qw/carp confess cluck croak/;
-use CWMP::Request;
+use CWMP::Parser;
use CWMP::Methods;
use CWMP::Store;
warn "## request payload: ",length($xml)," bytes\n$xml\n" if $self->debug;
- $state = CWMP::Request->parse( $xml );
+ $state = CWMP::Parser->parse( $xml );
warn "## acquired state = ", dump( $state ), "\n" if $self->debug;
- if ( ! defined( $state->{DeviceID} ) ) {
+ if ( ! defined( $state->{DeviceId} ) ) {
if ( $self->state ) {
- warn "## state without DeviceID, using old one...\n";
- $state->{DeviceID} = $self->state->{DeviceID};
+ warn "## state without DeviceId, using old one...\n";
+ $state->{DeviceId} = $self->state->{DeviceId};
} else {
- warn "WARNING: state without DeviceID, and I don't have old one!\n";
+ warn "WARNING: state without DeviceId, and I don't have old one!\n";
warn "## state = ",dump( $state );
}
}
my $CPE_uid = $store->ID_to_uid( $state );
-It uses C<< DeviceID.SerialNumber >> from C<Inform> message as unique ID
+It uses C<< DeviceId.SerialNumber >> from C<Inform> message as unique ID
for each CPE.
=cut
warn "#### state_to_uid",dump( $state ),$/ if $self->debug > 4;
- my $uid = $state->{DeviceID}->{SerialNumber} ||
- confess "no DeviceID.SerialNumber in ",dump( $state );
+ my $uid = $state->{DeviceId}->{SerialNumber} ||
+ confess "no DeviceId.SerialNumber in ",dump( $state );
chomp($uid);
return $uid;
sub state2serial {
my $state = shift;
- my $serial = $state->{DeviceID}->{SerialNumber} || die "no DeviceID.SerialNumber in ",dump($state);
+ my $serial = $state->{DeviceId}->{SerialNumber} || die "no DeviceId.SerialNumber in ",dump($state);
chomp($serial);
my $ip =
$state->{Parameter}->{'.ExternalIPAddress'} ||
=cut
sub add_triggers {
+}
+
+1;
+
+__END__
warn __PACKAGE__, "->add_triggers\n" if $debug;
{
Fault => { FaultCode => 9001, FaultString => "Request Denied" },
ID => "22_THOM_TR69_ID",
- _trigger => "Fault",
}
\ No newline at end of file
"InternetGatewayDevice.X_000E50_Firewall.LevelNumberOfEntries" => 0,
"InternetGatewayDevice.X_000E50_Firewall.SelectedLevel" => 1,
},
- _trigger => "GetParameterNamesResponse",
}
\ No newline at end of file
"Reboot",
"FactoryReset",
],
- _trigger => "GetRPCMethodsResponse",
}
\ No newline at end of file
{
- CurrentTime => "1970-01-01T03:18:53Z",
- DeviceID => {
- Manufacturer => "THOMSON",
- OUI => "00147F",
- ProductClass => "SpeedTouch 706",
- SerialNumber => "CP0636JT3SH",
- },
- EventStruct => ["2 PERIODIC"],
- ID => "22_THOM_TR69_ID",
+ CurrentTime => "1970-01-01T03:18:53Z",
+ DeviceId => {
+ Manufacturer => "THOMSON",
+ OUI => "00147F",
+ ProductClass => "SpeedTouch 706",
+ SerialNumber => "CP0636JT3SH",
+ },
+ Event => [{ CommandKey => undef, EventCode => "2 PERIODIC" }],
+ ID => "22_THOM_TR69_ID",
MaxEnvelopes => 2,
- Parameter => {
- ".ExternalIPAddress" => "192.168.1.254",
- "InternetGatewayDevice.DeviceInfo.HardwareVersion" => "BANT-S",
- "InternetGatewayDevice.DeviceInfo.ProvisioningCode" => undef,
- "InternetGatewayDevice.DeviceInfo.SoftwareVersion" => "6.2.15.5",
- "InternetGatewayDevice.DeviceInfo.SpecVersion" => "1.1",
- "InternetGatewayDevice.DeviceInfo.VendorConfigFile.1.Date" => "0000-00-00T00:00:00",
- "InternetGatewayDevice.DeviceInfo.VendorConfigFile.1.Description" => "Factory Defaults",
- "InternetGatewayDevice.DeviceInfo.VendorConfigFile.1.Name" => "Routed PPPoE on 0/35 and 8/35",
- "InternetGatewayDevice.DeviceInfo.VendorConfigFile.1.Version" => undef,
- "InternetGatewayDevice.DeviceSummary" => "InternetGatewayDevice:1.1[] (Baseline:1, EthernetLAN:1, ADSLWAN:1, Bridging:1, Time:1)",
- "InternetGatewayDevice.ManagementServer.ConnectionRequestURL" => "http://192.168.1.254:51005/",
- "InternetGatewayDevice.ManagementServer.ParameterKey" => undef,
- },
- RetryCount => 10,
- _dispatch => "InformResponse",
- _trigger => "Inform",
+ Parameter => {
+ ".ExternalIPAddress" => "192.168.1.254",
+ "InternetGatewayDevice.DeviceInfo.HardwareVersion" => "BANT-S",
+ "InternetGatewayDevice.DeviceInfo.ProvisioningCode" => undef,
+ "InternetGatewayDevice.DeviceInfo.SoftwareVersion" => "6.2.15.5",
+ "InternetGatewayDevice.DeviceInfo.SpecVersion" => "1.1",
+ "InternetGatewayDevice.DeviceInfo.VendorConfigFile.1.Date" => "0000-00-00T00:00:00",
+ "InternetGatewayDevice.DeviceInfo.VendorConfigFile.1.Description" => "Factory Defaults",
+ "InternetGatewayDevice.DeviceInfo.VendorConfigFile.1.Name" => "Routed PPPoE on 0/35 and 8/35",
+ "InternetGatewayDevice.DeviceInfo.VendorConfigFile.1.Version" => undef,
+ "InternetGatewayDevice.DeviceSummary" => "InternetGatewayDevice:1.1[] (Baseline:1, EthernetLAN:1, ADSLWAN:1, Bridging:1, Time:1)",
+ "InternetGatewayDevice.ManagementServer.ConnectionRequestURL" => "http://192.168.1.254:51005/",
+ "InternetGatewayDevice.ManagementServer.ParameterKey" => undef,
+ },
+ RetryCount => 10,
+ _dispatch => "InformResponse",
}
\ No newline at end of file
{
Fault => { FaultCode => 9001, FaultString => "Request Denied" },
ID => "0_THOM_TR69_ID",
- _trigger => "Fault",
}
\ No newline at end of file
"InternetGatewayDevice.X_000E50_Firewall.LevelNumberOfEntries" => 0,
"InternetGatewayDevice.X_000E50_Firewall.SelectedLevel" => 1,
},
- _trigger => "GetParameterNamesResponse",
}
\ No newline at end of file
"Reboot",
"FactoryReset",
],
- _trigger => "GetRPCMethodsResponse",
}
\ No newline at end of file
{
- CurrentTime => "1970-01-01T00:01:31Z",
- DeviceID => {
- Manufacturer => "THOMSON",
- OUI => "00147F",
- ProductClass => "SpeedTouch 780",
- SerialNumber => "CP0644JTHJ4",
- },
- EventStruct => ["1 BOOT", "2 PERIODIC", "4 VALUE CHANGE"],
- ID => "0_THOM_TR69_ID",
+ CurrentTime => "1970-01-01T00:01:31Z",
+ DeviceId => {
+ Manufacturer => "THOMSON",
+ OUI => "00147F",
+ ProductClass => "SpeedTouch 780",
+ SerialNumber => "CP0644JTHJ4",
+ },
+ Event => [
+ { CommandKey => undef, EventCode => "1 BOOT" },
+ { CommandKey => undef, EventCode => "2 PERIODIC" },
+ { CommandKey => undef, EventCode => "4 VALUE CHANGE" },
+ ],
+ ID => "0_THOM_TR69_ID",
MaxEnvelopes => 2,
- Parameter => {
- ".ExternalIPAddress" => "192.168.1.254",
- "InternetGatewayDevice.DeviceInfo.HardwareVersion" => "BANT-R",
- "InternetGatewayDevice.DeviceInfo.ProvisioningCode" => undef,
- "InternetGatewayDevice.DeviceInfo.SoftwareVersion" => "6.2.15.5",
- "InternetGatewayDevice.DeviceInfo.SpecVersion" => "1.1",
- "InternetGatewayDevice.DeviceInfo.VendorConfigFile.1.Date" => "0000-00-00T00:00:00",
- "InternetGatewayDevice.DeviceInfo.VendorConfigFile.1.Description" => "Factory Defaults",
- "InternetGatewayDevice.DeviceInfo.VendorConfigFile.1.Name" => "Routed PPPoE on 0/35 and 8/35",
- "InternetGatewayDevice.DeviceInfo.VendorConfigFile.1.Version" => undef,
- "InternetGatewayDevice.DeviceSummary" => "InternetGatewayDevice:1.1[] (Baseline:1, EthernetLAN:1, ADSLWAN:1, Bridging:1, Time:1, WiFiLAN:1)",
- "InternetGatewayDevice.ManagementServer.ConnectionRequestURL" => "http://192.168.1.254:51005/",
- "InternetGatewayDevice.ManagementServer.ParameterKey" => undef,
- },
- RetryCount => "05",
- _dispatch => "InformResponse",
- _trigger => "Inform",
+ Parameter => {
+ ".ExternalIPAddress" => "192.168.1.254",
+ "InternetGatewayDevice.DeviceInfo.HardwareVersion" => "BANT-R",
+ "InternetGatewayDevice.DeviceInfo.ProvisioningCode" => undef,
+ "InternetGatewayDevice.DeviceInfo.SoftwareVersion" => "6.2.15.5",
+ "InternetGatewayDevice.DeviceInfo.SpecVersion" => "1.1",
+ "InternetGatewayDevice.DeviceInfo.VendorConfigFile.1.Date" => "0000-00-00T00:00:00",
+ "InternetGatewayDevice.DeviceInfo.VendorConfigFile.1.Description" => "Factory Defaults",
+ "InternetGatewayDevice.DeviceInfo.VendorConfigFile.1.Name" => "Routed PPPoE on 0/35 and 8/35",
+ "InternetGatewayDevice.DeviceInfo.VendorConfigFile.1.Version" => undef,
+ "InternetGatewayDevice.DeviceSummary" => "InternetGatewayDevice:1.1[] (Baseline:1, EthernetLAN:1, ADSLWAN:1, Bridging:1, Time:1, WiFiLAN:1)",
+ "InternetGatewayDevice.ManagementServer.ConnectionRequestURL" => "http://192.168.1.254:51005/",
+ "InternetGatewayDevice.ManagementServer.ParameterKey" => undef,
+ },
+ RetryCount => "05",
+ _dispatch => "InformResponse",
}
\ No newline at end of file