Skip to content

Commit

Permalink
huawei support
Browse files Browse the repository at this point in the history
  • Loading branch information
jamhed@pfr committed Dec 23, 2014
1 parent 54f50f3 commit f9f690f
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions exec
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,24 @@ sub read_cfg {

my ($cfg, @cmd) = @ARGV;

unless ($cfg or -f $cfg) {
print "Usage: config_file commands\n";
if (not defined $cfg or not -f $cfg) {
print "Usage: $0 config_file commands\n";
exit;
}

my ($host, $login, $password) = read_cfg($cfg);
my ($host, $login, $password, $type) = read_cfg($cfg);
$type ||= 'juniper';

my $c = Net::Telnet->new( Host => $host, Timeout => 5 );
$c->login($login, $password);
$c->cmd('set cli screen-length 0');

print $type, "\n";
if ($type eq 'juniper') {
$c->login($login, $password);
$c->cmd('set cli screen-length 0');
}
elsif ($type eq 'huawei') {
$c->prompt('/<.+>$/');
$c->login($login, $password);
}

print $c->cmd(join " ", @cmd);

0 comments on commit f9f690f

Please sign in to comment.