From a42d1bad82e37975d674b560b18bc153a2786669 Mon Sep 17 00:00:00 2001 From: dhooper6430 Date: Wed, 21 Feb 2018 17:25:49 +0800 Subject: model: Update br6910 model prompt detection (#1188) The BR6910 switch can be configured to display anything on the prompt, by default it's vty-, I have modified the prompt statement to allow for whatever the user has configured the prompt to be. --- lib/oxidized/model/br6910.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/oxidized/model/br6910.rb') diff --git a/lib/oxidized/model/br6910.rb b/lib/oxidized/model/br6910.rb index b5c9bcf..df93793 100644 --- a/lib/oxidized/model/br6910.rb +++ b/lib/oxidized/model/br6910.rb @@ -1,7 +1,7 @@ class BR6910 < Oxidized::Model - prompt /^Vty-[0-9]\#$/ + prompt /^([\w.@()-]+[#>]\s?)$/ comment '! ' # not possible to disable paging prior to show running-config -- cgit v1.2.1 From 21e3d6490496573f25ef77fe8172766ac7d1a736 Mon Sep 17 00:00:00 2001 From: Wild Kat Date: Sat, 21 Apr 2018 13:27:05 +0200 Subject: the great makeover - standardize layout, alignment, indentation --- lib/oxidized/model/br6910.rb | 88 ++++++++++++++++++++++---------------------- 1 file changed, 43 insertions(+), 45 deletions(-) (limited to 'lib/oxidized/model/br6910.rb') 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 -- cgit v1.2.1