From c396eafd3dcd7f2853665a9b6771e346a8b24eac Mon Sep 17 00:00:00 2001 From: broxio Date: Fri, 13 May 2016 16:40:41 +0800 Subject: Update acos.rb Modified pre_logout and change \n to \r --- lib/oxidized/model/acos.rb | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/lib/oxidized/model/acos.rb b/lib/oxidized/model/acos.rb index 75fbacf..ec3ef11 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 '! ' @@ -16,11 +16,15 @@ 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,20 @@ 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" + send "enable\r" + send vars(:enable) + "\r" end end post_login 'terminal length 0' post_login 'terminal width 0' - pre_logout "exit\nexit\ny" + post_login 'terminal idle-timeout 10' + post_login "en\n" + pre_logout "exit\nexit\nY\r\n" end end -- cgit v1.2.1 From ed360a3ec0cc3e61d6cfc426e106b6e188561830 Mon Sep 17 00:00:00 2001 From: broxio Date: Sun, 15 May 2016 06:47:09 +0800 Subject: Update acos.rb add post_login to send "en" to enter privilege mode with-out password --- lib/oxidized/model/acos.rb | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/lib/oxidized/model/acos.rb b/lib/oxidized/model/acos.rb index ec3ef11..e686a59 100644 --- a/lib/oxidized/model/acos.rb +++ b/lib/oxidized/model/acos.rb @@ -56,20 +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\r" - send vars(:enable) + "\r" + send "enable\r\n" + send vars(:enable) + "\r\n" end end + post_login "en\r\n" post_login 'terminal length 0' post_login 'terminal width 0' - post_login 'terminal idle-timeout 10' - post_login "en\n" pre_logout "exit\nexit\nY\r\n" end - end -- cgit v1.2.1 From 3ff3b0d63c16a650c7ff453ec901244d08ccba7f Mon Sep 17 00:00:00 2001 From: broxio Date: Mon, 16 May 2016 13:08:32 +0800 Subject: Update acos.rb Update enable logic to support enable without password on ACOS device. --- lib/oxidized/model/acos.rb | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/oxidized/model/acos.rb b/lib/oxidized/model/acos.rb index e686a59..fa38a60 100644 --- a/lib/oxidized/model/acos.rb +++ b/lib/oxidized/model/acos.rb @@ -58,16 +58,18 @@ class ACOS < Oxidized::Model end cfg :telnet, :ssh do - # preferred way to handle additional passwords - if vars :enable - post_login do + post_login do + if vars :enable send "enable\r\n" send vars(:enable) + "\r\n" + else + send "enable\r\n" + send "\r\n" end end - post_login "en\r\n" post_login 'terminal length 0' - post_login 'terminal width 0' + post_login 'terminal width 0' pre_logout "exit\nexit\nY\r\n" end + end -- cgit v1.2.1 From 277428321ee457682805232bf8de43adb12cebdb Mon Sep 17 00:00:00 2001 From: broxio Date: Mon, 16 May 2016 13:11:04 +0800 Subject: Update acos.rb Update code format --- lib/oxidized/model/acos.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/oxidized/model/acos.rb b/lib/oxidized/model/acos.rb index fa38a60..66b62ee 100644 --- a/lib/oxidized/model/acos.rb +++ b/lib/oxidized/model/acos.rb @@ -68,7 +68,7 @@ class ACOS < Oxidized::Model end end post_login 'terminal length 0' - post_login 'terminal width 0' + post_login 'terminal width 0' pre_logout "exit\nexit\nY\r\n" end -- cgit v1.2.1 From f42a5020f996d8f587b86baf4492214717d15cba Mon Sep 17 00:00:00 2001 From: broxio Date: Tue, 17 May 2016 13:31:41 +0800 Subject: Update acos.rb Update enable logic suggested by @ytti --- lib/oxidized/model/acos.rb | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/lib/oxidized/model/acos.rb b/lib/oxidized/model/acos.rb index 66b62ee..95a6954 100644 --- a/lib/oxidized/model/acos.rb +++ b/lib/oxidized/model/acos.rb @@ -58,14 +58,12 @@ class ACOS < Oxidized::Model end cfg :telnet, :ssh do + # preferred way to handle additional passwords post_login do - if vars :enable - send "enable\r\n" - send vars(:enable) + "\r\n" - else - send "enable\r\n" - send "\r\n" - end + pw = vars(:enable) + pw ||= "" + send "enable\r\n" + cmd pw end post_login 'terminal length 0' post_login 'terminal width 0' -- cgit v1.2.1 From 6160cb201ec5b98c6db952fc66c4ccd8a27113f0 Mon Sep 17 00:00:00 2001 From: broxio Date: Wed, 18 May 2016 11:17:54 +0800 Subject: Update acos.rb Update way to handle pw suggested by @ytti --- lib/oxidized/model/acos.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/oxidized/model/acos.rb b/lib/oxidized/model/acos.rb index 95a6954..3938b2c 100644 --- a/lib/oxidized/model/acos.rb +++ b/lib/oxidized/model/acos.rb @@ -56,7 +56,6 @@ class ACOS < Oxidized::Model username /login:/ password /^Password:/ end - cfg :telnet, :ssh do # preferred way to handle additional passwords post_login do -- cgit v1.2.1 From 55f32d5ab5c3dc25245df93ec8bca0716c5dd9f6 Mon Sep 17 00:00:00 2001 From: broxio Date: Wed, 18 May 2016 11:22:06 +0800 Subject: Update acos.rb Corrected some code format and white space. --- lib/oxidized/model/acos.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/oxidized/model/acos.rb b/lib/oxidized/model/acos.rb index 3938b2c..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 '! ' @@ -56,6 +56,7 @@ class ACOS < Oxidized::Model username /login:/ password /^Password:/ end + cfg :telnet, :ssh do # preferred way to handle additional passwords post_login do -- cgit v1.2.1