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 if ( $v =~ s/\s+(\S+)\s*:\s+(\S+.+)// ) {
63 my ($n2,$v2) = ($1,$2);
65 $hash->{ $section . $n2 } = $2;
67 $hash->{ $section . $n } = $v;
69 } elsif ( $line =~ m/^-+$/ ) {
70 $section = $last_line . '.'
75 warn "## hash = ",dump $hash;
80 $path = "/tmp/dump.$path";
81 open( my $fh, '>', $path ) || die "$path: $!";
84 warn "DEBUG ",$path, " ", -s $path, " bytes\n";
93 my @what = @_ ? @_ : keys %$hash;
94 foreach my $name (@what) {
95 warn "# copy $name ", dump( $hash->{$name} ),$/;
96 $row->{$name} = $hash->{$name};
100 $hash = command "show adsl port $port";
103 $hash = command "show adsl port $port line-config";
106 $hash = command "show adsl port $port physical-table";
109 warn "# row = ",dump $row;