1 |
package MDAP::Commands; |
2 |
|
3 |
use strict; |
4 |
use warnings; |
5 |
|
6 |
use Module::Pluggable; |
7 |
use Data::Dump qw/dump/; |
8 |
|
9 |
my $debug = 0; |
10 |
my $verbose = 1; |
11 |
|
12 |
my $commands = [ |
13 |
'service system modify name=MDAP log=enabled', |
14 |
'cwmp debug traceconfig level=1', |
15 |
'cwmp server config url=http://10.0.0.100:3333/', |
16 |
'cwmp config state=enabled mode=full periodicInform=enabled periodicInfInt=15', |
17 |
]; |
18 |
|
19 |
my $ant_command; |
20 |
|
21 |
sub check { |
22 |
my ( $self, $h ) = @_; |
23 |
warn "## ",__PACKAGE__,"check(",dump($h),")" if $debug; |
24 |
|
25 |
my $serial = $h->{'_PROD_SERIAL_NBR'} || die "no serial?"; |
26 |
|
27 |
foreach my $command ( @$commands ) { |
28 |
next if $ant_command->{$serial}->{$command}++; |
29 |
|
30 |
warn "## sending command $command to $serial ", |
31 |
$h->{'_VARIANT_FRIENDLY_NAME'}, " ", |
32 |
$h->{'_BOARD_NAME'}, " ", |
33 |
$h->{'_BUILD'}, |
34 |
"\n" if $verbose; |
35 |
|
36 |
return $command; |
37 |
} |
38 |
|
39 |
warn "OK ",__PACKAGE__," $serial all commands sent\n" if $verbose; |
40 |
return; |
41 |
} |
42 |
|
43 |
1; |