From 0f33b1e478ba38590dddec2673f8efaddde91ec6 Mon Sep 17 00:00:00 2001 From: Christopher Date: Fri, 24 Jun 2016 17:31:31 +1000 Subject: Add support for Brocade 6910 (br6910) The Brocade 6910 switch has a significantly different CLI to Ironware/Fastiron and requires different treatment to pull config. --- lib/oxidized/model/br6910.rb | 45 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 lib/oxidized/model/br6910.rb (limited to 'lib') diff --git a/lib/oxidized/model/br6910.rb b/lib/oxidized/model/br6910.rb new file mode 100644 index 0000000..3ca7b67 --- /dev/null +++ b/lib/oxidized/model/br6910.rb @@ -0,0 +1,45 @@ + +class BR6910 < Oxidized::Model + + prompt /^Vty-1\#$/ + 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 \ No newline at end of file -- cgit v1.2.1 From aa41b3676b8238b34d9aeda21fa6d79052f06609 Mon Sep 17 00:00:00 2001 From: Christopher Date: Fri, 24 Jun 2016 18:31:41 +1000 Subject: Update br6910.rb --- lib/oxidized/model/br6910.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/oxidized/model/br6910.rb b/lib/oxidized/model/br6910.rb index 3ca7b67..b5c9bcf 100644 --- a/lib/oxidized/model/br6910.rb +++ b/lib/oxidized/model/br6910.rb @@ -1,7 +1,7 @@ class BR6910 < Oxidized::Model - prompt /^Vty-1\#$/ + prompt /^Vty-[0-9]\#$/ comment '! ' # not possible to disable paging prior to show running-config @@ -42,4 +42,4 @@ class BR6910 < Oxidized::Model pre_logout 'exit' end -end \ No newline at end of file +end -- cgit v1.2.1