From b64def6743003d57698a1faa790408b48bc49a26 Mon Sep 17 00:00:00 2001 From: RobbFromIT <38932246+RobbFromIT@users.noreply.github.com> Date: Thu, 13 Sep 2018 02:40:13 -0500 Subject: Add comtrol model (#1507) --- lib/oxidized/model/comtrol.rb | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 lib/oxidized/model/comtrol.rb (limited to 'lib') 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 "#" + 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 -- cgit v1.2.1