diff options
author | Saku Ytti <saku@ytti.fi> | 2014-02-07 16:37:02 +0200 |
---|---|---|
committer | Saku Ytti <saku@ytti.fi> | 2014-02-07 16:37:02 +0200 |
commit | 92fbaa712c99ae5b523be0ebbc46fca9cdddef4e (patch) | |
tree | 7e932962fa251dbf7c6d4f4e539abf035c8ad002 | |
parent | 028bada99a02f2bc9b5b4409f09715ca49858675 (diff) |
Add AOS (ALU OmniSwitch) support
Specifically AOS 6, vxworks era, not linux era 7
-rw-r--r-- | Gemfile | 16 | ||||
-rw-r--r-- | Gemfile.lock | 31 | ||||
-rw-r--r-- | lib/oxidized/input/ssh.rb | 3 | ||||
-rw-r--r-- | lib/oxidized/model/aos.rb | 38 | ||||
-rw-r--r-- | lib/oxidized/node.rb | 2 | ||||
-rw-r--r-- | oxidized.gemspec | 2 |
6 files changed, 53 insertions, 39 deletions
@@ -1,17 +1,3 @@ source 'https://rubygems.org' -ruby '2.0.0' -gem 'sequel' -gem 'sqlite3' -#gem 'sidekiq' -gem 'net-ssh' -gem 'grit' -#gem 'rugged', '~> 0.17.0.b7' - -group :development do - gem 'pry' -end - -group :test do - gem 'rspec' -end +gemspec diff --git a/Gemfile.lock b/Gemfile.lock index 53f4caf..cd39511 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,39 +1,28 @@ +PATH + remote: . + specs: + oxidized (0.0.18) + grit + net-ssh + sequel + sqlite3 + GEM remote: https://rubygems.org/ specs: - coderay (1.1.0) diff-lcs (1.2.4) grit (2.5.0) diff-lcs (~> 1.1) mime-types (~> 1.15) posix-spawn (~> 0.3.6) - method_source (0.8.2) mime-types (1.25) net-ssh (2.7.0) posix-spawn (0.3.6) - pry (0.9.12.3) - coderay (~> 1.0) - method_source (~> 0.8) - slop (~> 3.4) - rspec (2.14.1) - rspec-core (~> 2.14.0) - rspec-expectations (~> 2.14.0) - rspec-mocks (~> 2.14.0) - rspec-core (2.14.7) - rspec-expectations (2.14.4) - diff-lcs (>= 1.1.3, < 2.0) - rspec-mocks (2.14.4) sequel (4.4.0) - slop (3.4.7) sqlite3 (1.3.8) PLATFORMS ruby DEPENDENCIES - grit - net-ssh - pry - rspec - sequel - sqlite3 + 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 diff --git a/oxidized.gemspec b/oxidized.gemspec index 6b0ebfb..48eee08 100644 --- a/oxidized.gemspec +++ b/oxidized.gemspec @@ -1,6 +1,6 @@ Gem::Specification.new do |s| s.name = 'oxidized' - s.version = '0.0.17' + s.version = '0.0.18' s.platform = Gem::Platform::RUBY s.authors = [ 'Saku Ytti' ] s.email = %w( saku@ytti.fi ) |