diff options
Diffstat (limited to 'lib/oxidized/model/acos.rb')
-rw-r--r-- | lib/oxidized/model/acos.rb | 37 |
1 files changed, 27 insertions, 10 deletions
diff --git a/lib/oxidized/model/acos.rb b/lib/oxidized/model/acos.rb index 75fbacf..bb9846e 100644 --- a/lib/oxidized/model/acos.rb +++ b/lib/oxidized/model/acos.rb @@ -1,5 +1,5 @@ class ACOS < Oxidized::Model - # A10 ACOS model for AX and Thunder series + # A10 ACOS model for AX and Thunder series comment '! ' @@ -7,6 +7,14 @@ class ACOS < Oxidized::Model prompt /^([-\w.\/:?\[\]\(\)]+[#>]\s?)$/ cmd 'show version' do |cfg| + cfg.gsub! /\s(Last configuration saved at).*/, ' \\1 <removed>' + cfg.gsub! /\s(Memory).*/, ' \\1 <removed>' + cfg.gsub! /\s(Current time is).*/, ' \\1 <removed>' + cfg.gsub! /\s(The system has been up).*/, ' \\1 <removed>' + comment cfg + end + + cmd 'show bootimage' do |cfg| comment cfg end @@ -14,13 +22,22 @@ class ACOS < Oxidized::Model comment cfg end - cmd 'show running-config all-partitions' + cmd 'show running-config all-partitions' do |cfg| + cfg.gsub! /(Current configuration).*/, '\\1 <removed>' + cfg.gsub! /(Configuration last updated at).*/, '\\1 <removed>' + cfg.gsub! /(Configuration last saved at).*/, '\\1 <removed>' + cfg.gsub! /(Configuration last synchronized at).*/, '\\1 <removed>' + end + + cmd 'show aflex all-partitions' do |cfg| + comment cfg + end cmd 'show aflex all-partitions' do |cfg| @partitions_aflex = cfg.lines.each_with_object({}) do |l,h| h[$1] = [] if l.match /partition: (.+)/ # only consider scripts that have passed syntax check - h[h.keys.last] << $1 if l.match /^([\w-]+) +Check/ + h[h.keys.last] << $1 if l.match /^([\w-]+) +Check/ end '' end @@ -52,18 +69,18 @@ class ACOS < Oxidized::Model username /login:/ password /^Password:/ end - + cfg :telnet, :ssh do # preferred way to handle additional passwords - if vars :enable - post_login do - send "enable\n" - send vars(:enable) + "\n" - end + post_login do + pw = vars(:enable) + pw ||= "" + send "enable\r\n" + cmd pw end post_login 'terminal length 0' post_login 'terminal width 0' - pre_logout "exit\nexit\ny" + pre_logout "exit\nexit\nY\r\n" end end |