summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Laermans <tom.laermans@powersource.cx>2015-04-16 10:54:07 +0200
committerTom Laermans <tom.laermans@powersource.cx>2015-04-16 10:54:07 +0200
commit6df0b0606de5fb4a8ec4e2dc936e75a9bd89c3a6 (patch)
treeaf0157d7b9a2a378801ec337f12d630b8380cd64
parent1ef909b49313ad87168adfd3bb7b8d62406e2812 (diff)
Add support for HP Comware SMB switches
Some SMB HP switches (V1910, V1920) run Comware, but have the CLI hidden behind a "secret" toggle - it needs to be activated by _cmdline-mode on. The password to enable it varies per model, so this patch introduces a new var, comware_cmdline to contain the password. Unfortunately we cannot easily autodetect this, as only the "summary" command can give us the model number, but this command is paged and we cannot disable the pager until we are in the full CLI. Tested on HP V1910-24G-POE.
-rw-r--r--lib/oxidized/model/comware.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/oxidized/model/comware.rb b/lib/oxidized/model/comware.rb
index c09a128..bfc1524 100644
--- a/lib/oxidized/model/comware.rb
+++ b/lib/oxidized/model/comware.rb
@@ -21,6 +21,17 @@ class Comware < Oxidized::Model
end
cfg :telnet, :ssh do
+ # enable command-line mode on SMB comware switches (HP V1910, V1920)
+ # autodetection is hard, because the 'summary' command is paged, and
+ # the pager cannot be disabled before _cmdline-mode on.
+ if vars :comware_cmdline
+ post_login do
+ send "_cmdline-mode on\n"
+ send "y\n"
+ send vars(:comware_cmdline) + "\n"
+ end
+ end
+
post_login 'screen-length disable'
post_login 'undo terminal monitor'
pre_logout 'quit'