diff options
author | ytti <saku@ytti.fi> | 2018-04-25 16:12:44 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-04-25 16:12:44 +0300 |
commit | 583bc422448a234a215113a15f8a6976c50b2296 (patch) | |
tree | b3f757e6f37aa058a0c80e4ded3ef82553bc98c1 /lib/oxidized/model/planet.rb | |
parent | 9a7d16c00163c421d2c9f3cb2783c76633860336 (diff) | |
parent | dffae0f76656a57da8f5473ce21955638cbe1f7f (diff) |
Merge pull request #1296 from wk/the-great-makeover
the great makeover - standardize layout, alignment, indentation
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 |