summaryrefslogtreecommitdiff
path: root/lib/oxidized/model/netgear.rb
diff options
context:
space:
mode:
authorMatthias Cramer <matthias.cramer@iway.ch>2017-06-16 11:52:47 +0200
committerMatthias Cramer <matthias.cramer@iway.ch>2017-06-16 11:52:47 +0200
commitb7569965d1ec6112d0cd588ebd0b13a541bb6ef7 (patch)
treefbf410ebdfc268e55df73571fc85c426e8b25dbf /lib/oxidized/model/netgear.rb
parentbb06ac367daeed2f11682b8ef6e1182923570b42 (diff)
parentdc425ce5bc3143cf4b8322602d7b7521aca37134 (diff)
Merge branch 'master' of https://github.com/ytti/oxidized
Diffstat (limited to 'lib/oxidized/model/netgear.rb')
-rw-r--r--lib/oxidized/model/netgear.rb32
1 files changed, 32 insertions, 0 deletions
diff --git a/lib/oxidized/model/netgear.rb b/lib/oxidized/model/netgear.rb
new file mode 100644
index 0000000..08c64d3
--- /dev/null
+++ b/lib/oxidized/model/netgear.rb
@@ -0,0 +1,32 @@
+class Netgear < Oxidized::Model
+
+ comment '!'
+ prompt /^(\([\w-]+\)\s[#>])$/
+
+ cmd :secret do |cfg|
+ cfg.gsub!(/password (\S+)/, 'password <hidden>')
+ cfg
+ end
+
+ cfg :telnet, :ssh do
+ if vars :enable
+ post_login do
+ cmd 'enable'
+ # Interpret enable: true as meaning we won't be prompted for a password
+ unless vars(:enable).is_a? TrueClass
+ expect /[pP]assword:\s?$/
+ cmd vars(:enable) + "\n"
+ end
+ expect /^.+[#]$/
+ end
+ end
+ post_login 'terminal length 0'
+ pre_logout 'exit'
+ pre_logout 'quit'
+ end
+
+ cmd 'show running-config' do |cfg|
+ cfg.gsub! /^(!.*Time).*$/, '\1'
+ end
+
+end