diff options
author | root <root@frank.tg14.gathering.org> | 2014-04-16 00:07:21 +0200 |
---|---|---|
committer | root <root@frank.tg14.gathering.org> | 2014-04-16 00:07:21 +0200 |
commit | c1413d078530854af1aeadbf315ec931e3ef6635 (patch) | |
tree | 1a3fc67be7de844d69b91d3d81585fea5f7c5fd2 | |
parent | de809ea6caf08b836fe8f59908d4681714290d13 (diff) |
Fixed nms.pm to make smanagrun work as it should when
sending commands to the D-Link switches.
-rw-r--r-- | include/nms.pm | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/include/nms.pm b/include/nms.pm index 3f89384..af7702d 100644 --- a/include/nms.pm +++ b/include/nms.pm @@ -57,7 +57,7 @@ sub switch_connect($) { Dump_Log => $dumplog, Input_Log => $inputlog, Errmode => 'return', - Prompt => '/DGS-3100# (?!\x1b\[K)/'); + Prompt => '/[\S\-\_]+[#>]/'); my $ret = $conn->open( Host => $ip); if (!$ret || $ret != 1) { return (undef); @@ -84,6 +84,8 @@ sub switch_connect($) { sub switch_exec { my ($cmd, $conn, $print) = @_; + sleep 1; # don't overload the D-Link + # Send the command and get data from switch my @data; if (defined($print)) { @@ -91,16 +93,9 @@ sub switch_exec { return; } else { @data = $conn->cmd($cmd); - print $conn->errmsg, "\n"; + print "ERROR: " . $conn->errmsg . "\n" if $conn->errmsg; } return @data; -# my @lines = (); -# foreach my $line (@data) { -# # Remove escape-7 sequence -## $line =~ s/\x1b\x37//g; -# push (@lines, $line); -# } -# return @lines; } sub switch_timeout { |