summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorRobbFromIT <38932246+RobbFromIT@users.noreply.github.com>2018-09-13 02:40:13 -0500
committerWild Kat <wk@users.noreply.github.com>2018-09-13 09:40:13 +0200
commitb64def6743003d57698a1faa790408b48bc49a26 (patch)
treea0fc836adc82e7509a13e6c341a0e70f65d51bea /lib
parentef48dbf7b126dd37afe637d09ea0878572639093 (diff)
Add comtrol model (#1507)
Diffstat (limited to 'lib')
-rw-r--r--lib/oxidized/model/comtrol.rb41
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