diff options
Diffstat (limited to 'lib/oxidized')
-rw-r--r-- | lib/oxidized/model/comtrol.rb | 41 |
1 files changed, 41 insertions, 0 deletions
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 |