1 |
#!/usr/bin/perl |
2 |
use strict; |
3 |
use warnings; |
4 |
|
5 |
my $debug = shift @ARGV; |
6 |
|
7 |
use Test::More tests => 4; |
8 |
use Data::Dump qw/dump/; |
9 |
use blib; |
10 |
|
11 |
BEGIN { |
12 |
use_ok('CWMP::Request'); |
13 |
} |
14 |
|
15 |
ok( my $xml = join("",<DATA>), 'xml' ); |
16 |
|
17 |
diag $xml if $debug; |
18 |
|
19 |
ok( my $state = CWMP::Request->parse( $xml ), 'parse' ); |
20 |
|
21 |
is_deeply( $state, { |
22 |
CurrentTime => "1970-01-01T00:04:33Z", |
23 |
DeviceID => { |
24 |
Manufacturer => "THOMSON", |
25 |
OUI => "00147F", |
26 |
ProductClass => "SpeedTouch 780", |
27 |
SerialNumber => "CP0644JTHJ4", |
28 |
}, |
29 |
EventStruct => ["0 BOOTSTRAP", "1 BOOT", "4 VALUE CHANGE"], |
30 |
ID => "1_THOM_TR69_ID", |
31 |
MaxEnvelopes => 2, |
32 |
Parameter => { |
33 |
".ExternalIPAddress" => "192.168.1.254", |
34 |
"InternetGatewayDevice.DeviceInfo.HardwareVersion" => "BANT-R", |
35 |
"InternetGatewayDevice.DeviceInfo.ProvisioningCode" => undef, |
36 |
"InternetGatewayDevice.DeviceInfo.SoftwareVersion" => "6.2.15.5", |
37 |
"InternetGatewayDevice.DeviceInfo.SpecVersion" => "1.1", |
38 |
"InternetGatewayDevice.DeviceInfo.VendorConfigFile.1.Date" => "0000-00-00T00:00:00", |
39 |
"InternetGatewayDevice.DeviceInfo.VendorConfigFile.1.Description" => "Factory Defaults", |
40 |
"InternetGatewayDevice.DeviceInfo.VendorConfigFile.1.Name" => "Routed PPPoE on 0/35 and 8/35", |
41 |
"InternetGatewayDevice.DeviceInfo.VendorConfigFile.1.Version" => undef, |
42 |
"InternetGatewayDevice.DeviceSummary" => "InternetGatewayDevice:1.1[] (Baseline:1, EthernetLAN:1, ADSLWAN:1, Bridging:1, Time:1, WiFiLAN:1)", |
43 |
"InternetGatewayDevice.ManagementServer.ConnectionRequestURL" => "http://192.168.1.254:51005/", |
44 |
"InternetGatewayDevice.ManagementServer.ParameterKey" => undef, |
45 |
}, |
46 |
RetryCount => "01", |
47 |
_dispatch => "Inform", |
48 |
}, 'state' ); |
49 |
|
50 |
diag dump( $state ) if $debug; |
51 |
|
52 |
|
53 |
__DATA__ |
54 |
<soapenv:Envelope soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soap="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:cwmp="urn:dslforum-org:cwmp-1-0"> |
55 |
<soapenv:Header> |
56 |
<cwmp:ID soapenv:mustUnderstand="1">1_THOM_TR69_ID</cwmp:ID> |
57 |
</soapenv:Header> |
58 |
<soapenv:Body> |
59 |
<cwmp:Inform> |
60 |
<DeviceId> |
61 |
<Manufacturer>THOMSON</Manufacturer> |
62 |
<OUI>00147F</OUI> |
63 |
<ProductClass>SpeedTouch 780</ProductClass> |
64 |
<SerialNumber>CP0644JTHJ4</SerialNumber> |
65 |
</DeviceId> |
66 |
<Event soap:arrayType="cwmp:EventStruct[03]"> |
67 |
<EventStruct> |
68 |
<EventCode>0 BOOTSTRAP</EventCode> |
69 |
<CommandKey></CommandKey> |
70 |
</EventStruct> |
71 |
<EventStruct> |
72 |
<EventCode>1 BOOT</EventCode> |
73 |
<CommandKey></CommandKey> |
74 |
</EventStruct> |
75 |
<EventStruct> |
76 |
<EventCode>4 VALUE CHANGE</EventCode> |
77 |
<CommandKey></CommandKey> |
78 |
</EventStruct> |
79 |
</Event> |
80 |
<MaxEnvelopes>2</MaxEnvelopes> |
81 |
<CurrentTime>1970-01-01T00:04:33Z</CurrentTime> |
82 |
<RetryCount>01</RetryCount> |
83 |
<ParameterList soap:arrayType="cwmp:ParameterValueStruct[12]"> |
84 |
<ParameterValueStruct> |
85 |
<Name>InternetGatewayDevice.DeviceSummary</Name> |
86 |
<Value xsi:type="xsd:string">InternetGatewayDevice:1.1[] (Baseline:1, EthernetLAN:1, ADSLWAN:1, Bridging:1, Time:1, WiFiLAN:1)</Value> |
87 |
</ParameterValueStruct> |
88 |
<ParameterValueStruct> |
89 |
<Name>InternetGatewayDevice.DeviceInfo.SpecVersion</Name> |
90 |
<Value xsi:type="xsd:string">1.1</Value> |
91 |
</ParameterValueStruct> |
92 |
<ParameterValueStruct> |
93 |
<Name>InternetGatewayDevice.DeviceInfo.HardwareVersion</Name> |
94 |
<Value xsi:type="xsd:string">BANT-R</Value> |
95 |
</ParameterValueStruct> |
96 |
<ParameterValueStruct> |
97 |
<Name>InternetGatewayDevice.DeviceInfo.SoftwareVersion</Name> |
98 |
<Value xsi:type="xsd:string">6.2.15.5</Value> |
99 |
</ParameterValueStruct> |
100 |
<ParameterValueStruct> |
101 |
<Name>InternetGatewayDevice.DeviceInfo.ProvisioningCode</Name> |
102 |
<Value xsi:type="xsd:string"></Value> |
103 |
</ParameterValueStruct> |
104 |
<ParameterValueStruct> |
105 |
<Name>InternetGatewayDevice.DeviceInfo.VendorConfigFile.1.Name</Name> |
106 |
<Value xsi:type="xsd:string">Routed PPPoE on 0/35 and 8/35</Value> |
107 |
</ParameterValueStruct> |
108 |
<ParameterValueStruct> |
109 |
<Name>InternetGatewayDevice.DeviceInfo.VendorConfigFile.1.Version</Name> |
110 |
<Value xsi:type="xsd:string"></Value> |
111 |
</ParameterValueStruct> |
112 |
<ParameterValueStruct> |
113 |
<Name>InternetGatewayDevice.DeviceInfo.VendorConfigFile.1.Date</Name> |
114 |
<Value xsi:type="xsd:dateTime">0000-00-00T00:00:00</Value> |
115 |
</ParameterValueStruct> |
116 |
<ParameterValueStruct> |
117 |
<Name>InternetGatewayDevice.DeviceInfo.VendorConfigFile.1.Description</Name> |
118 |
<Value xsi:type="xsd:string">Factory Defaults</Value> |
119 |
</ParameterValueStruct> |
120 |
<ParameterValueStruct> |
121 |
<Name>InternetGatewayDevice.ManagementServer.ConnectionRequestURL</Name> |
122 |
<Value xsi:type="xsd:string">http://192.168.1.254:51005/</Value> |
123 |
</ParameterValueStruct> |
124 |
<ParameterValueStruct> |
125 |
<Name>InternetGatewayDevice.ManagementServer.ParameterKey</Name> |
126 |
<Value xsi:type="xsd:string"></Value> |
127 |
</ParameterValueStruct> |
128 |
<ParameterValueStruct> |
129 |
<Name>.ExternalIPAddress</Name> |
130 |
<Value xsi:type="xsd:string">192.168.1.254</Value> |
131 |
</ParameterValueStruct> |
132 |
</ParameterList> |
133 |
</cwmp:Inform> |
134 |
</soapenv:Body> |
135 |
</soapenv:Envelope> |