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/br6910.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/br6910.rb')
| -rw-r--r-- | lib/oxidized/model/br6910.rb | 88 | 
1 files changed, 43 insertions, 45 deletions
diff --git a/lib/oxidized/model/br6910.rb b/lib/oxidized/model/br6910.rb index df93793..1e79da3 100644 --- a/lib/oxidized/model/br6910.rb +++ b/lib/oxidized/model/br6910.rb @@ -1,45 +1,43 @@ -
 -class BR6910 < Oxidized::Model
 -
 -  prompt /^([\w.@()-]+[#>]\s?)$/
 -  comment  '! '
 -
 -  # not possible to disable paging prior to show running-config
 -  expect /^((.*)Others to exit ---(.*))$/ do |data, re|
 -    send 'a'
 -    data.sub re, ''
 -  end
 -
 -  cmd :all do |cfg|
 -    # sometimes br6910s inserts arbitrary whitespace after commands are
 -    # issued on the CLI, from run to run.  this normalises the output.
 -    cfg.each_line.to_a[1..-2].drop_while { |e| e.match /^\s+$/ }.join
 -  end
 -
 -  cmd 'show version' do |cfg|
 -    comment cfg
 -  end
 -
 -  # show flash is not possible on a brocade 6910, do dir instead 
 -  # to see flash contents (includes config file names)
 -  cmd 'dir' do |cfg|
 -    comment cfg
 -  end
 -
 -  cmd 'show running-config' do |cfg|
 -    arr = cfg.each_line.to_a
 -    arr[2..-1].join unless arr.length < 2
 -  end
 -
 -  cfg :telnet do
 -    username /^Username:/
 -    password /^Password:/
 -  end
 -
 -  # post login and post logout 
 -  cfg :telnet, :ssh do
 -    post_login ''
 -    pre_logout 'exit'
 -  end
 -
 -end
 + +class BR6910 < Oxidized::Model +  prompt /^([\w.@()-]+[#>]\s?)$/ +  comment '! ' + +  # not possible to disable paging prior to show running-config +  expect /^((.*)Others to exit ---(.*))$/ do |data, re| +    send 'a' +    data.sub re, '' +  end + +  cmd :all do |cfg| +    # sometimes br6910s inserts arbitrary whitespace after commands are +    # issued on the CLI, from run to run.  this normalises the output. +    cfg.each_line.to_a[1..-2].drop_while { |e| e.match /^\s+$/ }.join +  end + +  cmd 'show version' do |cfg| +    comment cfg +  end + +  # show flash is not possible on a brocade 6910, do dir instead +  # to see flash contents (includes config file names) +  cmd 'dir' do |cfg| +    comment cfg +  end + +  cmd 'show running-config' do |cfg| +    arr = cfg.each_line.to_a +    arr[2..-1].join unless arr.length < 2 +  end + +  cfg :telnet do +    username /^Username:/ +    password /^Password:/ +  end + +  # post login and post logout +  cfg :telnet, :ssh do +    post_login '' +    pre_logout 'exit' +  end +end  | 
