summaryrefslogtreecommitdiff
path: root/lib/oxidized/model/aosw.rb
diff options
context:
space:
mode:
authornertwork <webmaster@nertwork.com>2016-12-20 10:49:24 -0800
committernertwork <webmaster@nertwork.com>2016-12-20 10:49:24 -0800
commite0621bbb81daab0de9fccc031c3e875031c2b67b (patch)
tree9b527895c0a07d216f67728526b0ed7f82a40d12 /lib/oxidized/model/aosw.rb
parentbcdd40d552cbf5e32dafebf4e531d407eb85bc84 (diff)
parent1466f0f635d1e014ea993179729306d3a9a8d381 (diff)
Merge remote-tracking branch 'upstream/master'
* upstream/master: (109 commits) delete secret password if it is called secret bump up version update changelogs Recursively search from one dir above specified Fix suggested by ytti for issue #610 Remove trailing whitespace and enable prompt detection Update eos.rb exclude time from output New hook: awssns - Publish messages to AWS SNS topics Updated config options Added option to disable ssl verification checks for http source Update ciscosmb.rb Update ciscosmb.rb Update ciscosmb.rb expect prompt after entering enable password add support for PLANET SG switches renamed alvarion -> alvarion.rb This adds support for Hatteras Networks devices This adds support for D-Link switches This adds support for the Casa C1G CMTS ...
Diffstat (limited to 'lib/oxidized/model/aosw.rb')
-rw-r--r--lib/oxidized/model/aosw.rb23
1 files changed, 17 insertions, 6 deletions
diff --git a/lib/oxidized/model/aosw.rb b/lib/oxidized/model/aosw.rb
index 394561f..11d8442 100644
--- a/lib/oxidized/model/aosw.rb
+++ b/lib/oxidized/model/aosw.rb
@@ -28,19 +28,21 @@ class AOSW < Oxidized::Model
cmd 'show version' do |cfg|
cfg = cfg.each_line.select { |line| not line.match /Switch uptime/i }
- comment cfg.join
+ rstrip_cfg comment cfg.join
end
cmd 'show inventory' do |cfg|
- clean cfg
+ rstrip_cfg clean cfg
end
cmd 'show slots' do |cfg|
- comment cfg
+ rstrip_cfg comment cfg
end
+
cmd 'show license' do |cfg|
- comment cfg
+ rstrip_cfg comment cfg
end
+
cmd 'show running-config' do |cfg|
out = []
cfg.each_line do |line|
@@ -60,8 +62,8 @@ class AOSW < Oxidized::Model
cfg :telnet, :ssh do
if vars :enable
post_login do
- send 'enable\n'
- send vars(:enable) + '\n'
+ send "enable\n"
+ cmd vars(:enable)
end
end
post_login 'no paging'
@@ -72,6 +74,15 @@ class AOSW < Oxidized::Model
pre_logout 'exit'
end
+ def rstrip_cfg cfg
+ out = []
+ cfg.each_line do |line|
+ out << line.rstrip
+ end
+ out = out.join "\n"
+ out << "\n"
+ end
+
def clean cfg
out = []
cfg.each_line do |line|