package H1::ZTEDSLAM;
use warnings;
use strict;

use Moose;

with 'H1::ZTE';

use Data::Dump qw(dump);


sub login {
	my ( $self, $t ) = @_;

	$t->print("");
	$t->waitfor('/Login:/');
	$t->print('admin');
	$t->waitfor('/Password:/');
	$t->print('admin');
	$t->waitfor('/>/');
	$t->print('en');
	$t->waitfor('/Please input password:/');
	$t->print('admin');
	$t->waitfor('/#/');

	warn "login OK";
}


sub parse {
	my ( $self, $out ) = @_;

	my $hash;
	foreach my $line ( split(/[\n\r]+/, $out) ) {
		warn "# $line\n" if $ENV{DEBUG};
		if ( $line =~ m/^(\S+.*?)\s+:\s+(\S+.*)$/ ) {
			my ($n,$v) = ($1,$2);
			$n =~ s/\(.+\)//;
			$hash->{$n} = $v;
			warn "## $n = $v\n" if $ENV{DEBUG};
		}

	}

	return $hash;
}

sub commands {{
	'show interface ##' => [ qw(
AdminStatus
LinkStatus
LastLinkUpTime
	)],
	'show adsl status ##' => [ qw(
LineConfProfile
	)],
	'show adsl physical ##' => [ qw(
AtucCurrSnrMgn
AtucCurrAtn
AtucCurrStatus
AtucOutputPwr
AtucAttainableRate
AtucDMTState
AtucPrevSnrMgn
AturCurrAtn
AturCurrStatus
AturCurrOutputPwr
AturAttainableRate
AturDMTState
	)],
}}

1;

