X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=bin%2Facs.pl;h=cc1a2ad95e5d4bc5f6f725a0d2244ac0ad140b79;hb=0c93eb28451495f2bd053d8d5eb6c9ed07a68e58;hp=f143b4c70d6b4d1646d45a7dc4ec395c1247905f;hpb=62c20794ecd1b3f97e365fe00e25fb14b9ed56c8;p=perl-cwmp.git diff --git a/bin/acs.pl b/bin/acs.pl index f143b4c..cc1a2ad 100755 --- a/bin/acs.pl +++ b/bin/acs.pl @@ -8,56 +8,55 @@ use strict; use lib './lib'; use CWMP::Server; +use CWMP::Session; +use CWMP::Vendor; use Getopt::Long; +use Data::Dump qw/dump/; +use File::Find; + +#use Devel::LeakTrace::Fast; my $port = 3333; my $debug = 0; my $store_path = './'; my $store_plugin = 'YAML'; -my $protocol_dump = 0; +my $create_dump = 1; GetOptions( 'debug+' => \$debug, 'port=i' => \$port, 'store-path=s' => \$store_path, 'store-plugin=s' => \$store_plugin, - 'protocol-dump!' => \$protocol_dump, + 'create_dump!' => \$create_dump, ); -my $queue; - -if ( $protocol_dump ) { - - warn "generating dump of xml protocol with CPE\n"; - - $queue = [ - 'GetRPCMethods', - 'GetParameterNames', -# [ 'GetParameterNames', 'InternetGatewayDevice.DeviceInfo.SerialNumber', 0 ], -# [ 'GetParameterNames', 'InternetGatewayDevice.DeviceInfo.', 1 ], - [ 'GetParameterValues', - 'InternetGatewayDevice.DeviceInfo.SerialNumber', - 'InternetGatewayDevice.DeviceInfo.VendorConfigFile.', - 'InternetGatewayDevice.DeviceInfo.X_000E50_Country', - ], - [ 'SetParameterValues', - 'InternetGatewayDevice.DeviceInfo.ProvisioningCode' => 'test provision', -# 'InternetGatewayDevice.DeviceInfo.X_000E50_Country' => 1, - ], -# 'Reboot', - ]; -}; - +if ( $create_dump ) { + warn "## cleaning dump directory\n" if $debug; + find({ + wanted => sub { + my $path = $File::Find::name; + return if -d $path; + unlink($path) || die "can't remove $path: $!"; + warn "## removed $path\n" if $debug; + }, + no_chdir => 1, + }, 'dump/' ); +} my $server = CWMP::Server->new({ port => $port, - store => { - module => $store_plugin, - path => $store_path, - debug => $debug, + session => { + store => { + module => $store_plugin, + path => $store_path, + debug => $debug, + }, + create_dump => $create_dump, }, debug => $debug, - default_queue => [ $queue ], }); + +CWMP::Vendor->add_triggers; + $server->run();