From 92fbaa712c99ae5b523be0ebbc46fca9cdddef4e Mon Sep 17 00:00:00 2001 From: Saku Ytti Date: Fri, 7 Feb 2014 16:37:02 +0200 Subject: Add AOS (ALU OmniSwitch) support Specifically AOS 6, vxworks era, not linux era 7 --- lib/oxidized/input/ssh.rb | 3 ++- lib/oxidized/model/aos.rb | 38 ++++++++++++++++++++++++++++++++++++++ lib/oxidized/node.rb | 2 +- 3 files changed, 41 insertions(+), 2 deletions(-) create mode 100644 lib/oxidized/model/aos.rb (limited to 'lib/oxidized') diff --git a/lib/oxidized/input/ssh.rb b/lib/oxidized/input/ssh.rb index b060418..3fdaa70 100644 --- a/lib/oxidized/input/ssh.rb +++ b/lib/oxidized/input/ssh.rb @@ -5,6 +5,7 @@ module Oxidized RescueFail = [ Net::SSH::Disconnect, Net::SSH::AuthenticationFailed, + RuntimeError, ] include CLI class NoShell < StandardError; end @@ -41,7 +42,7 @@ module Oxidized disconnect_cli @ssh.loop @ssh.close if not @ssh.closed? - rescue Errno::ECONNRESET, Net::SSH::Disconnect + rescue Errno::ECONNRESET, Net::SSH::Disconnect, IOError end end diff --git a/lib/oxidized/model/aos.rb b/lib/oxidized/model/aos.rb new file mode 100644 index 0000000..ec73b92 --- /dev/null +++ b/lib/oxidized/model/aos.rb @@ -0,0 +1,38 @@ +class AOS < Oxidized::Model + + # Alcatel-Lucent Operating System + # used in OmniSwitch + + comment '! ' + + cmd :all do |cfg| + cfg.each_line.to_a[1..-2].join + end + + cmd 'show system' do |cfg| + cfg = cfg.each_line.find{|line|line.match 'Description'} + comment cfg.to_s.strip + end + + cmd 'show chassis' do |cfg| + comment cfg + end + + cmd 'show hardware info' do |cfg| + comment cfg + end + + cmd 'show configuration snapshot' do |cfg| + cfg + end + + cfg :telnet do + username /^login : / + password /^password : / + end + + cfg :telnet, :ssh do + pre_logout 'exit' + end + +end diff --git a/lib/oxidized/node.rb b/lib/oxidized/node.rb index 31f26a9..b7dc134 100644 --- a/lib/oxidized/node.rb +++ b/lib/oxidized/node.rb @@ -37,7 +37,7 @@ module Oxidized begin input.connect self rescue *rescue_fail => err - Log.warn '%s raised %s with msg' % [self.ip, err.class, err.message] + Log.warn '%s raised %s with msg "%s"' % [self.ip, err.class, err.message] return false end end -- cgit v1.2.1