fix space before semicolumn
[APKPM.git] / lib / H1 / ZTEDSLAM.pm
old mode 100755 (executable)
new mode 100644 (file)
index 1caef2d..8f9e856
@@ -1,16 +1,16 @@
 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:/');
@@ -24,6 +24,8 @@ sub login {
        $t->waitfor('/#/');
 
        warn "login OK";
+
+       return $t;
 }
 
 
@@ -33,7 +35,7 @@ sub parse {
        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;
@@ -46,15 +48,15 @@ sub parse {
 }
 
 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