Merge branch 'master' of github.com:dpavlin/perl-cwmp
[perl-cwmp.git] / bin / cpe-queue.pl
index 0158753..a4b6f73 100755 (executable)
@@ -14,14 +14,16 @@ use File::Slurp;
 my $debug = 1;
 my $protocol_dump = 0;
 my $list = 0;
+my $introspect = 0;
 
 GetOptions(
        'debug+' => \$debug,
        'protocol-dump!' => \$protocol_dump,
        'list!' => \$list,
+       'introspect!' => \$introspect,
 );
 
-die "usage: $0 CPE_id [--protocol-dump]\n" unless @ARGV;
+die "usage: $0 [...queue/]CPE_id [ --list | --introspect | --protocol-dump ]\n" unless @ARGV;
 
 foreach my $id ( @ARGV ) {
 
@@ -110,18 +112,19 @@ foreach my $id ( @ARGV ) {
                print "Active jobs [", scalar @active, "]\n",join("\n\n", @active) if @active;
                print "Queued jobs [", scalar @queued, "]\n",join("\n\n", @queued) if @queued;
 
-       } else {
+       } elsif ( $introspect ) {
 
-               warn "injecting some tests commands\n";
+               $q->enqueue( 'GetRPCMethods' ); # XXX not supported by ZTE
 
-               $q->enqueue( 'GetRPCMethods' );
+               $q->enqueue( 'GetParameterNames', [ 'InternetGatewayDevice.', 1 ] );
 
-#              $q->enqueue( 'GetParameterNames', [ 'InternetGatewayDevice.LANDevice.', 1 ] );
+#              $q->enqueue( 'GetRPCMethods' ); # XXX not supported by ZTE
 
                $q->enqueue( 'GetParameterValues', [
                'InternetGatewayDevice.',
                ]);
 
+
 #              $q->enqueue( 'GetParameterNames', [ '.ExternalIPAddress', 1 ] );
 
                $q->enqueue( 'GetParameterNames', [ 'InternetGatewayDevice.', 1 ] );
@@ -133,15 +136,55 @@ foreach my $id ( @ARGV ) {
 
                $q->enqueue( 'GetParameterNames', [ 'InternetGatewayDevice.', 0 ] );
                $q->enqueue( 'GetParameterValues', [
-                       'InternetGatewayDevice.',
+                       #'InternetGatewayDevice.',      # too big for ZTE 
+                       'InternetGatewayDevice.DeviceConfig.',
+                       'InternetGatewayDevice.DeviceInfo.',
+                       'InternetGatewayDevice.DeviceSummary',
+                       'InternetGatewayDevice.ManagementServer.',
                ]);
 
+               $q->enqueue( 'GetParameterValues' => [ $_ ] ) foreach ( qw/
+InternetGatewayDevice.IPPingDiagnostics.
+InternetGatewayDevice.LANConfigSecurity.
+InternetGatewayDevice.LANDevice.
+InternetGatewayDevice.Layer2Bridging.
+InternetGatewayDevice.Layer3Forwarding.
+InternetGatewayDevice.ManagementServer.
+InternetGatewayDevice.QueueManagement.
+InternetGatewayDevice.Time.
+InternetGatewayDevice.UserInterface.
+InternetGatewayDevice.WANDevice.
+               / );
+
                $q->enqueue( 'GetParameterAttributes', [
                        'InternetGatewayDevice.DeviceInfo.SerialNumber',
                        'InternetGatewayDevice.DeviceInfo.SoftwareVersion',
                ]);
 
 #              $q->enqueue( 'SetParameterAttributes', [ '
+
+       } else {
+
+               warn "injecting some tests commands\n";
+
+               # turn on periodic reporting to ACS server
+
+#              $q->enqueue( 'GetParameterValues', [ 'InternetGatewayDevice.ManagementServer.' ] );
+               $q->enqueue( 'SetParameterValues', {
+                       'InternetGatewayDevice.DeviceInfo.ProvisioningCode' => 'perl-cwmp provision',
+               } );
+               $q->enqueue( 'SetParameterValues', {
+                       'InternetGatewayDevice.ManagementServer.PeriodicInformInterval' => 15, # s
+               } );
+               $q->enqueue( 'SetParameterValues', {
+                       'InternetGatewayDevice.ManagementServer.PeriodicInformEnable' => 1,
+               } );
+
+               $q->enqueue( 'GetParameterValues', [
+                       'InternetGatewayDevice.ManagementServer.',
+                       'InternetGatewayDevice.DeviceInfo.ProvisioningCode',
+               ] );
+
        }
 
 }