From 201f4d8320768e2cc9fcba61f1ea6584783ac724 Mon Sep 17 00:00:00 2001 From: Jasper Date: Sat, 7 Feb 2015 01:20:12 +0100 Subject: Added model for Comware based devices Added support for Comware based devices from HP (A-series), H3C and 3Com. --- lib/oxidized/model/comware.rb | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 lib/oxidized/model/comware.rb (limited to 'lib/oxidized') diff --git a/lib/oxidized/model/comware.rb b/lib/oxidized/model/comware.rb new file mode 100644 index 0000000..c09a128 --- /dev/null +++ b/lib/oxidized/model/comware.rb @@ -0,0 +1,41 @@ +class Comware < Oxidized::Model + # HP (A-series)/H3C/3Com Comware + + prompt /^(<[\w.-]+>)$/ + comment '# ' + + # example how to handle pager + #expect /^\s*---- More ----$/ do |data, re| + # send ' ' + # data.sub re, '' + #end + + cmd :all do |cfg| + #cfg.gsub! /^.*\e\[42D/, '' # example how to handle pager + cfg.each_line.to_a[1..-2].join + end + + cfg :telnet do + username /^Username:$/ + password /^Password:$/ + end + + cfg :telnet, :ssh do + post_login 'screen-length disable' + post_login 'undo terminal monitor' + pre_logout 'quit' + end + + cmd 'display version' do |cfg| + cfg = cfg.each_line.select {|l| not l.match /uptime/ }.join + comment cfg + end + + cmd 'display device' do |cfg| + comment cfg + end + + cmd 'display current-configuration' do |cfg| + cfg + end +end -- cgit v1.2.1