6 use Data::Dump qw(dump);
12 warn "# info ", dump($args);
14 my $t = Net::Telnet->new( Timeout => 20, Port => 1123, Prompt => '/#/' );
16 $t->dump_log('/tmp/log') if $ENV{DEBUG};
19 $t->open( $args->{ip} );
21 $t->waitfor('/Login:/');
23 $t->waitfor('/Password:/');
27 #$t->waitfor('/Please input password:/');
33 my $port = "$args->{shelf}/$args->{slot}/$args->{port}";
38 warn "# command $command\n";
44 my($prematch, $match) = $t->waitfor('/(Press any key to continue \(Q to quit\)|#)/');
46 last if $match eq '#';
51 warn "## out = [$out]";
56 foreach my $line ( split(/[\n\r]+/, $out) ) {
58 if ( $line =~ m/^(\S+.*?)\s+:\s+(\S+.*?)\s*$/ ) {
61 $hash->{ $section . $n } = $v;
63 } elsif ( $line =~ m/^-+$/ ) {
64 $section = $last_line . '.'
69 warn "## hash = ",dump $hash;
74 $path = "/tmp/dump.$path";
75 open( my $fh, '>', $path ) || die "$path: $!";
78 warn "DEBUG ",$path, " ", -s $path, " bytes\n";
87 my @what = @_ ? @_ : keys %$hash;
88 foreach my $name (@what) {
89 warn "# copy $name ", dump( $hash->{$name} ),$/;
90 $row->{$name} = $hash->{$name};
94 $hash = command "show adsl port $port";
97 $hash = command "show adsl port $port line-config";
100 $hash = command "show adsl port $port physical-table";
103 warn "# row = ",dump $row;