diff options
author | ytti <saku@ytti.fi> | 2018-04-27 18:06:53 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-04-27 18:06:53 +0300 |
commit | f4be8c0665eb33e07a81450882162deb3c9b6022 (patch) | |
tree | 4dc7a447d43d3241442c0a09e21d5d8f68aae806 /lib/oxidized/model | |
parent | 94cc123723aa42d7d1a35af39f51427fdd15cc5f (diff) | |
parent | be6872a004f3422471edcc3cab8479e7adff07dd (diff) |
Merge pull request #1242 from cppmonkey/xgs4600-cli
Zyxel XGS4600 ssh/telnet
Diffstat (limited to 'lib/oxidized/model')
-rw-r--r-- | lib/oxidized/model/zynoscli.rb | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/lib/oxidized/model/zynoscli.rb b/lib/oxidized/model/zynoscli.rb new file mode 100644 index 0000000..ae64b04 --- /dev/null +++ b/lib/oxidized/model/zynoscli.rb @@ -0,0 +1,36 @@ +class ZyNOSCLI < Oxidized::Model + # Used in Zyxel DSLAMs, such as SAM1316 + + # Typical prompt "XGS4600#" + prompt /^([\w.@()-]+[#>]\s\e7)$/ + comment ';; ' + + cmd :all do |cfg| + cfg.gsub! /^.*\e7/, '' + end + cmd 'show stacking' + + cmd 'show version' + + cmd 'show running-config' + + cfg :telnet do + username /^User name:/i + password /^Password:/i + end + + cfg :telnet, :ssh do + if vars :enable + post_login do + send "enable\n" + # Interpret enable: true as meaning we won't be prompted for a password + unless vars(:enable).is_a? TrueClass + expect /[pP]assword:\s?$/ + send vars(:enable) + "\n" + end + expect /^.+[#]$/ + end + end + pre_logout 'exit' + end +end |