diff options
Diffstat (limited to 'lib/oxidized/model/edgeswitch.rb')
-rw-r--r-- | lib/oxidized/model/edgeswitch.rb | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/lib/oxidized/model/edgeswitch.rb b/lib/oxidized/model/edgeswitch.rb index 89a5690..7c82639 100644 --- a/lib/oxidized/model/edgeswitch.rb +++ b/lib/oxidized/model/edgeswitch.rb @@ -4,22 +4,29 @@ class EdgeSwitch < Oxidized::Model comment '!' - prompt /[(]\w*\s\w*[)][\s#>]*[\s#>]/ + prompt /\(.*\)\s[#>]/ cmd 'show running-config' do |cfg| - comment cfg.each_line.reject { |line| line.match /System Up Time.*/ or line.match /Current SNTP Synchronized Time.*/ }.join + cfg.each_line.to_a[2..-2].reject { |line| line.match /System Up Time.*/ or line.match /Current SNTP Synchronized Time.*/ }.join end cfg :telnet do username /Username:\s/ - passsword /^Password:\s/ + password /^Password:\s/ end cfg :telnet, :ssh do - post_login 'enable' - post_login 'terminal length 0' - pre_logout 'exit' - pre_logout 'exit' + post_login do + if vars :enable + send "enable\n" + cmd vars(:enable) + else + cmd 'enable' + end + cmd 'terminal length 0' + end + pre_logout 'quit' + pre_logout 'n' end -end
\ No newline at end of file +end |