summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamer Abdel-Hafez <sam@arahant.net>2015-02-07 09:33:38 +0100
committerSamer Abdel-Hafez <sam@arahant.net>2015-02-07 09:33:38 +0100
commit9492a36ae2bb93299cc3bb35deceba4c07511c26 (patch)
treec9f623bb77691d50a933f3624cc3d5b5cf30f5aa
parent843098bc0de0c22b39fa665265e4e061dee97428 (diff)
parent201f4d8320768e2cc9fcba61f1ea6584783ac724 (diff)
Merge pull request #73 from erJasp/master
Added model for Comware based devices
-rw-r--r--README.md1
-rw-r--r--lib/oxidized/model/comware.rb41
2 files changed, 42 insertions, 0 deletions
diff --git a/README.md b/README.md
index 5c4ea0c..3d4ba40 100644
--- a/README.md
+++ b/README.md
@@ -57,6 +57,7 @@ Oxidized is a network device configration backup tool. Its a RANCID replacment!
* Extreme Networks XOS
* Force10 FTOS
* FortiGate FortiOS
+ * HP Comware (HP A-series, H3C, 3Com)
* HP ProCurve
* Huawei VRP
* Juniper JunOS
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