diff options
-rw-r--r-- | CHANGELOG.md | 1 | ||||
-rw-r--r-- | docs/Supported-OS-Types.md | 2 | ||||
-rw-r--r-- | lib/oxidized/model/comtrol.rb | 41 |
3 files changed, 44 insertions, 0 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 6fdf459..07a9b64 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ * FEATURE: add viptela model (@bobthebutcher) * FEATURE: add ECI Telecom Appolo platform bij arien.vijn@linklight.nl * FEATURE: ssh keepalive now configurable per node with ssh_no_keepalive boolean +* FEATURE: add Comtrol model (@RobbFromIT) * MISC: add gpgme and sequel gems to Dockerfile for sources ## 0.24.0 diff --git a/docs/Supported-OS-Types.md b/docs/Supported-OS-Types.md index 430fc45..bb37597 100644 --- a/docs/Supported-OS-Types.md +++ b/docs/Supported-OS-Types.md @@ -67,6 +67,8 @@ * [Groove](/lib/oxidized/model/coriantgroove.rb) * ComNet * [ComNet Microsemi Switch](/lib/oxidized/model/comnetms.rb) +* Comtrol + * [RocketLinx](/lib/oxidized/model/comtrol.rb) * Cumulus * [Linux](/lib/oxidized/model/cumulus.rb) * DataCom diff --git a/lib/oxidized/model/comtrol.rb b/lib/oxidized/model/comtrol.rb new file mode 100644 index 0000000..a325e2b --- /dev/null +++ b/lib/oxidized/model/comtrol.rb @@ -0,0 +1,41 @@ +class Comtrol < Oxidized::Model + # Used in Comtrol Industrial Switches, such as RocketLinx ES8510 + + # Typical prompt "<hostname>#" + prompt /([#>]\s?)$/ + comment '! ' + + # how to handle pager + expect /--More--+\s$/ do |data, re| + send ' ' + data.sub re, '' + end + + cmd :all do |cfg| + cfg.gsub! /^.*\e7/, '' + end + + 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 /^.+[#]\s?$/ + end + end + pre_logout 'exit' + end +end |