diff options
Diffstat (limited to 'lib/oxidized')
-rw-r--r-- | lib/oxidized/model/asa.rb | 8 | ||||
-rw-r--r-- | lib/oxidized/model/ironware.rb | 25 | ||||
-rw-r--r-- | lib/oxidized/model/junos.rb | 2 | ||||
-rw-r--r-- | lib/oxidized/model/xos.rb | 1 |
4 files changed, 20 insertions, 16 deletions
diff --git a/lib/oxidized/model/asa.rb b/lib/oxidized/model/asa.rb index d257e9e..547afd7 100644 --- a/lib/oxidized/model/asa.rb +++ b/lib/oxidized/model/asa.rb @@ -23,16 +23,16 @@ class ASA < Oxidized::Model comment cfg end + cmd 'show inventory' do |cfg| + comment cfg + end + cmd 'more system:running-config' do |cfg| cfg = cfg.each_line.to_a[3..-1].join cfg.gsub! /^: [^\n]*\n/, '' cfg end - cmd 'show inventory' do |cfg| - comment cfg - end - cfg :ssh do if vars :enable post_login do diff --git a/lib/oxidized/model/ironware.rb b/lib/oxidized/model/ironware.rb index 805e07b..2975651 100644 --- a/lib/oxidized/model/ironware.rb +++ b/lib/oxidized/model/ironware.rb @@ -19,11 +19,6 @@ class IronWare < Oxidized::Model cfg.each_line.to_a[1..-2].join end - cmd 'show running-config' do |cfg| - cfg = cfg.each_line.to_a[3..-1].join - cfg - end - cmd 'show version' do |cfg| cfg.gsub! /(^((.*)[Ss]ystem uptime(.*))$)/, '' #remove unwanted line system uptime cfg.gsub! /[Uu]p\s?[Tt]ime is .*/,'' @@ -36,7 +31,7 @@ class IronWare < Oxidized::Model cfg.gsub! /(^((.*)Current temp(.*))$)/, '' #remove unwanted lines current temperature cfg.gsub! /Speed = [A-Z]{3} \(\d{2}\%\)/, '' #remove unwanted lines Speed Fans cfg.gsub! /current speed is [A-Z]{3} \(\d{2}\%\)/, '' - cfg.gsub! /Fan controlled temperature: \d{2}\.\d deg-C/, 'Fan controlled temperature: XX.X d deg-C' + cfg.gsub! /\d{2}\.\d deg-C/, 'XX.X deg-C' if cfg.include? "TEMPERATURE" sc = StringScanner.new cfg out = '' @@ -55,20 +50,28 @@ class IronWare < Oxidized::Model end cmd 'show module' do |cfg| + cfg.gsub! /^((Invalid input)|(Type \?)).*$/, '' # some ironware devices are fixed config comment cfg end + cmd 'show running-config' do |cfg| + arr = cfg.each_line.to_a + arr[3..-1].join unless arr.length < 3 + end + cfg :telnet do - username /^Username:/ - password /^Password:/ + # match expected prompts on both older and newer + # versions of IronWare + username /^(Please Enter Login Name|Username):/ + password /^(Please Enter )Password:/ end #handle pager with enable cfg :telnet, :ssh do if vars :enable post_login do - send "enable\n" - send vars(:enable) + "\n" + send "enable\r\n" + send vars(:enable) + "\r\n" end end post_login '' @@ -79,4 +82,4 @@ class IronWare < Oxidized::Model pre_logout 'exit' end -end
\ No newline at end of file +end diff --git a/lib/oxidized/model/junos.rb b/lib/oxidized/model/junos.rb index e43d71a..0e921d2 100644 --- a/lib/oxidized/model/junos.rb +++ b/lib/oxidized/model/junos.rb @@ -9,7 +9,7 @@ class JunOS < Oxidized::Model cmd :all do |cfg| # we don't need screen-scraping in ssh due to exec cfg = cfg.lines.to_a[1..-2].join if telnet - cfg.lines.map { |line| line.rstrip }.join "\n" + cfg.lines.map { |line| line.rstrip }.join("\n") + "\n" end cmd :secret do |cfg| diff --git a/lib/oxidized/model/xos.rb b/lib/oxidized/model/xos.rb index e4a1ed4..de8ec39 100644 --- a/lib/oxidized/model/xos.rb +++ b/lib/oxidized/model/xos.rb @@ -37,6 +37,7 @@ class XOS < Oxidized::Model cfg :telnet, :ssh do post_login 'disable clipaging' pre_logout 'exit' + pre_logout 'n' end end |