summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/oxidized/model/airos.rb20
-rw-r--r--lib/oxidized/model/powerconnect.rb13
2 files changed, 29 insertions, 4 deletions
diff --git a/lib/oxidized/model/airos.rb b/lib/oxidized/model/airos.rb
new file mode 100644
index 0000000..316c4f0
--- /dev/null
+++ b/lib/oxidized/model/airos.rb
@@ -0,0 +1,20 @@
+class Airos < Oxidized::Model
+ # Ubiquiti AirOS circa 5.x
+
+ prompt /^[^#]+# /
+
+ cmd 'cat /etc/board.info' do |cfg|
+ cfg.split("\n").map { |line| "# #{line}" }.join("\n") + "\n"
+ end
+
+ cmd 'cat /tmp/system.cfg'
+
+ cmd :secret do |cfg|
+ cfg.gsub! /^(users\.\d+\.password|snmp\.community)=.+/, "# \\1=<hidden>"
+ cfg
+ end
+
+ cfg :ssh do
+ exec true
+ end
+end
diff --git a/lib/oxidized/model/powerconnect.rb b/lib/oxidized/model/powerconnect.rb
index 4f90b77..1d0352e 100644
--- a/lib/oxidized/model/powerconnect.rb
+++ b/lib/oxidized/model/powerconnect.rb
@@ -19,7 +19,7 @@ class PowerConnect < Oxidized::Model
cmd 'show system' do |cfg|
cfg = cfg.each_line.take_while { |line| not line.match(/uptime/i) }
- comment cfg
+ comment cfg.join "\n"
end
cmd 'show running-config'
@@ -30,9 +30,14 @@ class PowerConnect < Oxidized::Model
end
cfg :telnet, :ssh do
- post_login 'terminal datadump'
- post_login 'enable'
- pre_logout 'exit'
+ if vars :enable
+ send "enable\n"
+ send vars(:enable) + "\n"
+ end
+
+ post_login "terminal length 0"
+ pre_logout "logout"
+
end
end