r287@brr: dpavlin | 2007-11-26 01:28:00 +0100
authorDobrica Pavlinusic <dpavlin@rot13.org>
Mon, 26 Nov 2007 00:28:54 +0000 (00:28 +0000)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Mon, 26 Nov 2007 00:28:54 +0000 (00:28 +0000)
 implemented parsing into $state->{ParameterAttribute}

git-svn-id: https://perl-cwmp.googlecode.com/svn/trunk@237 836a5e1a-633d-0410-964b-294494ad4392

lib/CWMP/Request.pm
t/30-server.t
t/dump/BANT-R/7.4.1.7/GetParameterAttributesResponse [new file with mode: 0644]
t/dump/BANT-R/7.4.1.7/GetParameterAttributesResponse.yml [new file with mode: 0644]

index 4ca8d45..99770fa 100644 (file)
@@ -108,9 +108,20 @@ push @$rules,
 =cut
 
 push @$rules,
-               'GetParameterAttributesResponse' => sub {
+               'ParameterAttributeStruct' => sub {
                        my ($tag_name, $tag_hash, $context, $parent_data) = @_;
                        warn dump( $tag_name, $tag_hash, $context );
+       
+                       confess "need state" unless ( $state ); # don't remove!
+
+                       my $name = _tag($tag_hash, 'Name', '_content');
+
+
+                       $state->{ParameterAttribute}->{$name} = {
+                               Notification => _tag($tag_hash, 'Notification', '_content' ),
+                               AccessList => _tag($tag_hash, 'AccessList', 'string' ),
+                       };
+
                        $state->{_trigger} = 'GetParameterAttributesResponse';
                };
 
index 94a2245..2360584 100755 (executable)
@@ -4,7 +4,7 @@ use warnings;
 
 my $debug = shift @ARGV;
 
-use Test::More tests => 144;
+use Test::More tests => 153;
 use Data::Dump qw/dump/;
 use Cwd qw/abs_path/;
 use File::Find;
diff --git a/t/dump/BANT-R/7.4.1.7/GetParameterAttributesResponse b/t/dump/BANT-R/7.4.1.7/GetParameterAttributesResponse
new file mode 100644 (file)
index 0000000..0ad6d43
--- /dev/null
@@ -0,0 +1,27 @@
+POST / HTTP/1.1
+Host: 10.0.0.100
+User-Agent: Thomson_cwmp-engine/r7.4.1.7
+Content-Length: 1184
+Content-Type: text/xml; charset=ISO-8859-1
+Cookie: $Version="0"; ID=11_THOM_TR69_ID;$Path=/
+SOAPAction: 
+
+<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">\r
+ <soapenv:Header>\r
+<cwmp:ID soapenv:mustUnderstand="1">11_THOM_TR69_ID</cwmp:ID>\r
+ </soapenv:Header>\r
+ <soapenv:Body>\r
+  <cwmp:GetParameterAttributesResponse>   <ParameterList soap:arrayType="cwmp:ParameterAttributeStruct[02]">    <ParameterAttributeStruct>     <Name>InternetGatewayDevice.DeviceInfo.SerialNumber</Name>\r
+     <Notification>0</Notification>\r
+     <AccessList soap:arrayType="cwmp:string[01]">      <string>subscriber</string>\r
+</AccessList>\r
+</ParameterAttributeStruct>\r
+    <ParameterAttributeStruct>     <Name>InternetGatewayDevice.DeviceInfo.SoftwareVersion</Name>\r
+     <Notification>0</Notification>\r
+     <AccessList soap:arrayType="cwmp:string[01]">      <string>subscriber</string>\r
+</AccessList>\r
+</ParameterAttributeStruct>\r
+</ParameterList>\r
+</cwmp:GetParameterAttributesResponse>\r
+ </soapenv:Body>\r
+</soapenv:Envelope>
diff --git a/t/dump/BANT-R/7.4.1.7/GetParameterAttributesResponse.yml b/t/dump/BANT-R/7.4.1.7/GetParameterAttributesResponse.yml
new file mode 100644 (file)
index 0000000..fe97b43
--- /dev/null
@@ -0,0 +1,12 @@
+--- 
+ID: 11_THOM_TR69_ID
+ParameterAttribute: 
+  InternetGatewayDevice.DeviceInfo.SerialNumber: 
+    AccessList: 
+      - subscriber
+    Notification: 0
+  InternetGatewayDevice.DeviceInfo.SoftwareVersion: 
+    AccessList: 
+      - subscriber
+    Notification: 0
+_trigger: GetParameterAttributesResponse