summaryrefslogtreecommitdiff
path: root/lib/oxidized/model
diff options
context:
space:
mode:
authorytti <saku@ytti.fi>2016-06-13 15:47:49 +0300
committerGitHub <noreply@github.com>2016-06-13 15:47:49 +0300
commit3f150f372d7941b33c4ad8a1c1456aaf4751e346 (patch)
treec43aeac89540a6a90c2cd5d886cadf2f9764a831 /lib/oxidized/model
parent61eb0f24eb9d246a9b92742321770667878ecc59 (diff)
parent5c470d33d5c114c07a41650009753b388643d57e (diff)
Merge pull request #469 from f0o/feature-quanta
Added Quanta OS
Diffstat (limited to 'lib/oxidized/model')
-rw-r--r--lib/oxidized/model/quantaos.rb35
1 files changed, 35 insertions, 0 deletions
diff --git a/lib/oxidized/model/quantaos.rb b/lib/oxidized/model/quantaos.rb
new file mode 100644
index 0000000..274440d
--- /dev/null
+++ b/lib/oxidized/model/quantaos.rb
@@ -0,0 +1,35 @@
+class QuantaOS < Oxidized::Model
+
+ prompt /^\((\w|\S)+\) (>|#)$/
+ comment '! '
+
+ cmd 'show run' do |cfg|
+ cfg.each_line.select do |line|
+ not line.match /^!.*$/ and
+ not line.match /^\((\w|\S)+\) (>|#)$/ and
+ not line.match /^show run$/
+ end.join
+ end
+
+ cfg :telnet do
+ username /^Username:/
+ password /^Password:/
+ end
+
+ cfg :telnet, :ssh do
+ post_login do
+ send "enable\n"
+ if vars :enable
+ cmd vars(:enable)
+ else
+ cmd ""
+ end
+ end
+ post_login 'terminal length 0'
+ pre_logout do
+ send "quit\n"
+ send "n\n"
+ end
+ end
+
+end