diff options
author | Neil Lathwood <neil@lathwood.co.uk> | 2018-04-27 11:38:06 +0100 |
---|---|---|
committer | Neil Lathwood <neil@lathwood.co.uk> | 2018-04-27 11:38:06 +0100 |
commit | b1194745929043b578c409f794ecb433aa515fa9 (patch) | |
tree | 133e7103073b707aaca855eb3df4d5025bebae06 /lib/oxidized/model/planet.rb | |
parent | 9156243b9debfc0bc2b05dfe98a910ce5153bf49 (diff) | |
parent | 34fd5369feee94ab45c5a81d7769b1df717e4c8c (diff) |
Rebased and fixed conflicts
Diffstat (limited to 'lib/oxidized/model/planet.rb')
-rw-r--r-- | lib/oxidized/model/planet.rb | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/lib/oxidized/model/planet.rb b/lib/oxidized/model/planet.rb index 9ce9cf9..56e688c 100644 --- a/lib/oxidized/model/planet.rb +++ b/lib/oxidized/model/planet.rb @@ -1,24 +1,23 @@ class Planet < Oxidized::Model - prompt /^\r?([\w.@()-]+[#>]\s?)$/ comment '! ' # example how to handle pager - #expect /^\s--More--\s+.*$/ do |data, re| + # expect /^\s--More--\s+.*$/ do |data, re| # send ' ' # data.sub re, '' - #end + # end # non-preferred way to handle additional PW prompt - #expect /^[\w.]+>$/ do |data| + # expect /^[\w.]+>$/ do |data| # send "enable\n" # send vars(:enable) + "\n" # data - #end + # end cmd :all do |cfg| - #cfg.gsub! /\cH+\s{8}/, '' # example how to handle pager - #cfg.gsub! /\cH+/, '' # example how to handle pager + # cfg.gsub! /\cH+\s{8}/, '' # example how to handle pager + # cfg.gsub! /\cH+/, '' # example how to handle pager cfg.each_line.to_a[1..-2].join end @@ -39,7 +38,7 @@ class Planet < Oxidized::Model cfg = cfg.each_line.to_a[0...-2] - # Strip system (up)time and temperature + # Strip system (up)time and temperature cfg = cfg.reject { |line| line.match /System Time\s*:.*/ } cfg = cfg.reject { |line| line.match /System Uptime\s*:.*/ } cfg = cfg.reject { |line| line.match /Temperature\s*:.*/ } @@ -47,13 +46,12 @@ class Planet < Oxidized::Model comment cfg.join end - cmd 'show running-config' do |cfg| cfg.gsub! "\n\r", "\n" cfg = cfg.each_line.to_a cfg = cfg.reject { |line| line.match "Building configuration..." } - + if @planetsgs cfg << cmd('show transceiver detail | include transceiver detail information|found|Type|length|Nominal|wavelength|Base information') do |cfg| comment cfg @@ -62,7 +60,6 @@ class Planet < Oxidized::Model cfg.join end - cfg :telnet do username /^Username:/ @@ -80,5 +77,4 @@ class Planet < Oxidized::Model end pre_logout 'exit' end - end |