summaryrefslogtreecommitdiff
path: root/lib/oxidized/model/procurve.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/oxidized/model/procurve.rb')
-rw-r--r--lib/oxidized/model/procurve.rb45
1 files changed, 45 insertions, 0 deletions
diff --git a/lib/oxidized/model/procurve.rb b/lib/oxidized/model/procurve.rb
new file mode 100644
index 0000000..b431629
--- /dev/null
+++ b/lib/oxidized/model/procurve.rb
@@ -0,0 +1,45 @@
+class Procurve < Oxidized::Model
+
+ # FIXME: this is way too unsafe
+ prompt /.*?([\w\d_]+# ).*/m
+
+ comment '! '
+
+ expect /Press any key to continue/ do
+ send ' '
+ ""
+ end
+
+ cmd :all do |cfg|
+ cfg = cfg.each_line.to_a[1..-3].join
+ cfg = cfg.gsub /\r/, ''
+ new_cfg = ''
+ cfg.each_line do |line|
+ line.sub! /^\e.*(\e.*)/, '\1' #leave last escape
+ line.sub! /\e\[24;1H/, '' #remove last escape, is it always this?
+ new_cfg << line
+ end
+ new_cfg
+ end
+
+ cmd 'show running-config'
+
+ cmd 'show version' do |cfg|
+ comment cfg
+ end
+
+ cmd 'show system-information' do |cfg|
+ comment cfg
+ end
+
+ cfg :telnet do
+ username /^\r?Username:/
+ password /Password: /
+ end
+
+ cfg :telnet, :ssh do
+ post_login 'no page'
+ pre_logout "logout\ny"
+ end
+
+end