summaryrefslogtreecommitdiff
path: root/lib/oxidized/model/ironware.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/oxidized/model/ironware.rb')
-rw-r--r--lib/oxidized/model/ironware.rb38
1 files changed, 18 insertions, 20 deletions
diff --git a/lib/oxidized/model/ironware.rb b/lib/oxidized/model/ironware.rb
index 5b58f22..32dbf47 100644
--- a/lib/oxidized/model/ironware.rb
+++ b/lib/oxidized/model/ironware.rb
@@ -1,19 +1,17 @@
class IronWare < Oxidized::Model
-
prompt /^.*(telnet|ssh)\@.+[>#]\s?$/i
comment '! '
- #to handle pager without enable
- #expect /^((.*)--More--(.*))$/ do |data, re|
+ # to handle pager without enable
+ # expect /^((.*)--More--(.*))$/ do |data, re|
# send ' '
# data.sub re, ''
- #end
-
+ # end
- #to remove backspace (if handle pager without enable)
- #expect /^((.*)[\b](.*))$/ do |data, re|
+ # to remove backspace (if handle pager without enable)
+ # expect /^((.*)[\b](.*))$/ do |data, re|
# data.sub re, ''
- #end
+ # end
cmd :all do |cfg|
# sometimes ironware inserts arbitrary whitespace after commands are
@@ -22,18 +20,20 @@ class IronWare < Oxidized::Model
end
cmd 'show version' do |cfg|
- cfg.gsub! /(^((.*)[Ss]ystem uptime(.*))$)/, '' #remove unwanted line system uptime
+ cfg.gsub! /(^((.*)[Ss]ystem uptime(.*))$)/, '' # remove unwanted line system uptime
cfg.gsub! /(^((.*)[Tt]he system started at(.*))$)/, ''
- cfg.gsub! /[Uu]p\s?[Tt]ime is .*/,''
+ cfg.gsub! /[Uu]p\s?[Tt]ime is .*/, ''
comment cfg
end
cmd 'show chassis' do |cfg|
- cfg.encode!("UTF-8", :invalid => :replace, :undef => :replace) #sometimes ironware returns broken encoding
- cfg.gsub! /(^((.*)Current temp(.*))$)/, '' #remove unwanted lines current temperature
- cfg.gsub! /Speed = [A-Z-]{2,6} \(\d{2,3}\%\)/, '' #remove unwanted lines Speed Fans
+ cfg.encode!("UTF-8", :invalid => :replace, :undef => :replace) # sometimes ironware returns broken encoding
+ cfg.gsub! /(^((.*)Current temp(.*))$)/, '' # remove unwanted lines current temperature
+ cfg.gsub! /Speed = [A-Z-]{2,6} \(\d{2,3}\%\)/, '' # remove unwanted lines Speed Fans
cfg.gsub! /current speed is [A-Z]{2,6} \(\d{2,3}\%\)/, ''
+ cfg.gsub! /Fan \d* - STATUS: OK \D*\d*./, '' # Fix for ADX Fan speed reporting
+ cfg.gsub! /\d* deg C/, '' # Fix for ADX temperature reporting
cfg.gsub! /([\[]*)1([\]]*)<->([\[]*)2([\]]*)(<->([\[]*)3([\]]*))*/, ''
cfg.gsub! /\d{2}\.\d deg-C/, 'XX.X deg-C'
if cfg.include? "TEMPERATURE"
@@ -50,6 +50,7 @@ class IronWare < Oxidized::Model
end
cmd 'show flash' do |cfg|
+ cfg.gsub! /(\d+) bytes/, '' # Fix for ADX flash size
comment cfg
end
@@ -67,23 +68,20 @@ class IronWare < Oxidized::Model
# match expected prompts on both older and newer
# versions of IronWare
username /^(Please Enter Login Name|Username):/
- password /^(Please Enter )Password:/
+ password /^(Please Enter Password ?|Password):/
end
- #handle pager with enable
+ # handle pager with enable
cfg :telnet, :ssh do
if vars :enable
post_login do
- send "enable\r\n"
+ send "enable\n"
cmd vars(:enable)
end
end
post_login ''
post_login 'skip-page-display'
post_login 'terminal length 0'
- pre_logout 'logout'
- pre_logout 'exit'
- pre_logout 'exit'
+ pre_logout "logout\nexit\nexit\n"
end
-
end