package H1::ZTEDSLAM;
-use warnings;
-use strict;
-
use Moose;
with 'H1::ZTE';
-use Data::Dump qw(dump);
+sub connect {
+ my ( $self, $ip ) = @_;
+
+ my $t = Net::Telnet->new( Timeout => 10, Prompt => '/#/' );
+ $t->dump_log('/tmp/log') if $ENV{DEBUG};
-sub login {
- my ( $self, $t ) = @_;
+ $t->open( $ip );
$t->print("");
$t->waitfor('/Login:/');
$t->waitfor('/#/');
warn "login OK";
+
+ return $t;
}
my $hash;
foreach my $line ( split(/[\n\r]+/, $out) ) {
warn "# $line\n" if $ENV{DEBUG};
- if ( $line =~ m/^(\S+.*?)\s+:\s+(\S+.*)$/ ) {
+ if ( $line =~ m/^(\S+.*?)\s*:\s+(\S+.*)$/ ) {
my ($n,$v) = ($1,$2);
$n =~ s/\(.+\)//;
$hash->{$n} = $v;
}
sub commands {{
- 'show interface ##' => [ qw(
+ 'show interface %s' => [ qw(
AdminStatus
LinkStatus
LastLinkUpTime
)],
- 'show adsl status ##' => [ qw(
+ 'show adsl status %s' => [ qw(
LineConfProfile
)],
- 'show adsl physical ##' => [ qw(
+ 'show adsl physical %s' => [ qw(
AtucCurrSnrMgn
AtucCurrAtn
AtucCurrStatus