From 8bef76580a3e848836f3f12fe9e6c50380dbe01e Mon Sep 17 00:00:00 2001 From: pv2b Date: Sat, 18 Nov 2017 10:59:28 +0100 Subject: model: Procurve Handle switch selection for stack commanders (#1104) When trying to connect to a HP Procurve Switch with stacking enabled, you are asked to choose which switch to connect to to manage. This patch makes it so that if this question is encountered, just press "Enter" to choose the stack commander. This won't make backing up stack members work (they still need to be configured seperately and given IP addresses, making stacking useless) but at least it makes it possible to back up a commander in a stack seperately. Fixed #1070 Credit to @stiltzkin10 for this fix. --- lib/oxidized/model/procurve.rb | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'lib/oxidized/model/procurve.rb') diff --git a/lib/oxidized/model/procurve.rb b/lib/oxidized/model/procurve.rb index 180b703..11d7ea9 100644 --- a/lib/oxidized/model/procurve.rb +++ b/lib/oxidized/model/procurve.rb @@ -21,6 +21,11 @@ class Procurve < Oxidized::Model "" end + expect /Enter switch number/ do + send "\n" + "" + end + cmd :all do |cfg| cfg = cfg.each_line.to_a[1..-2].join cfg = cfg.gsub /^\r/, '' -- cgit v1.2.1 From a9e5eed60b687b4a488eb1d11b5147e9f932c6fa Mon Sep 17 00:00:00 2001 From: Dave Date: Sat, 10 Feb 2018 17:10:23 -0500 Subject: mode: Procurve model add show commands (#1176) Sanitized output: ``` Power Supply Status: PS# Model State AC/DC + V Wattage ---- --------- ------------- ----------------- --------- 1 Unknwn Powered AC 220V 1500 2 Unknwn Powered AC 220V 1500 2 / 2 supply bays delivering power. Total power: 3000 W ``` Of course you see `unknwn` but that is addressed in latest firmware release. Thanks! --- lib/oxidized/model/procurve.rb | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'lib/oxidized/model/procurve.rb') diff --git a/lib/oxidized/model/procurve.rb b/lib/oxidized/model/procurve.rb index 11d7ea9..444fb5b 100644 --- a/lib/oxidized/model/procurve.rb +++ b/lib/oxidized/model/procurve.rb @@ -47,6 +47,10 @@ class Procurve < Oxidized::Model comment cfg end + cmd 'show system power-supply' do |cfg| + comment cfg + end + cmd 'show interfaces transceiver' do |cfg| comment cfg end -- cgit v1.2.1 From a4bd3e5ca5ab747fdbf2bd876d7be7a947e74f46 Mon Sep 17 00:00:00 2001 From: Wild Kat Date: Sun, 8 Apr 2018 00:35:47 +0200 Subject: eliminate inverse methods from models --- lib/oxidized/model/procurve.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/oxidized/model/procurve.rb') diff --git a/lib/oxidized/model/procurve.rb b/lib/oxidized/model/procurve.rb index 444fb5b..705a814 100644 --- a/lib/oxidized/model/procurve.rb +++ b/lib/oxidized/model/procurve.rb @@ -67,7 +67,7 @@ class Procurve < Oxidized::Model # not supported on all models cmd 'show system information' do |cfg| - cfg = cfg.each_line.select { |line| not line.match /(.*CPU.*)|(.*Up Time.*)|(.*Total.*)|(.*Free.*)|(.*Lowest.*)|(.*Missed.*)/ } + cfg = cfg.each_line.reject { |line| line.match /(.*CPU.*)|(.*Up Time.*)|(.*Total.*)|(.*Free.*)|(.*Lowest.*)|(.*Missed.*)/ } cfg = cfg.join comment cfg end -- 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/procurve.rb | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'lib/oxidized/model/procurve.rb') diff --git a/lib/oxidized/model/procurve.rb b/lib/oxidized/model/procurve.rb index 705a814..930dc53 100644 --- a/lib/oxidized/model/procurve.rb +++ b/lib/oxidized/model/procurve.rb @@ -1,10 +1,9 @@ class Procurve < Oxidized::Model - # some models start lines with \r # previous command is repeated followed by "\eE", which sometimes ends up on last line prompt /^\r?([\w.-]+# )$/ - comment '! ' + comment '! ' # replace next line control sequence with a new line expect /(\e\[1M\e\[\??\d+(;\d+)*[A-Za-z]\e\[1L)|(\eE)/ do |data, re| @@ -87,5 +86,4 @@ class Procurve < Oxidized::Model cfg :ssh do pty_options({ chars_wide: 1000 }) end - end -- cgit v1.2.1