diff options
author | Saku Ytti <saku@ytti.fi> | 2016-05-20 00:21:47 +0300 |
---|---|---|
committer | Saku Ytti <saku@ytti.fi> | 2016-05-20 00:21:47 +0300 |
commit | 731213142eabae0c78aeb2c3adafc5ccd4c22561 (patch) | |
tree | 35935cafad0d4cc1f3b3c7f688daaf62e31dca93 /lib/oxidized/model/acos.rb | |
parent | 11d9fa28ebcc9c7fec67a0446a4a0bcaf54d34e3 (diff) | |
parent | a0983e6122f8ea2a992ab0d04491a1ab2f02097d (diff) |
Merge branch 'master' of github.com:ytti/oxidized
Diffstat (limited to 'lib/oxidized/model/acos.rb')
-rw-r--r-- | lib/oxidized/model/acos.rb | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/lib/oxidized/model/acos.rb b/lib/oxidized/model/acos.rb index 75fbacf..7db8b00 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 '! ' @@ -17,10 +17,14 @@ class ACOS < Oxidized::Model cmd 'show running-config all-partitions' 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 +56,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 |