summaryrefslogtreecommitdiff
path: root/lib/oxidized/model/asa.rb
diff options
context:
space:
mode:
authorTomi Hakala <tomi.hakala@itvirtuoosit.fi>2014-07-22 19:57:48 +0300
committerTomi Hakala <tomi.hakala@itvirtuoosit.fi>2014-07-22 19:57:48 +0300
commit8dda557fc3d1cee63e54329260b10a66db147131 (patch)
treec6aa600d1958441e269dc50af8bfdd6d06a75029 /lib/oxidized/model/asa.rb
parent983a4ad32cddefcec69cdb0aab0713a420009b3a (diff)
Cisco ASA model added
Diffstat (limited to 'lib/oxidized/model/asa.rb')
-rw-r--r--lib/oxidized/model/asa.rb48
1 files changed, 48 insertions, 0 deletions
diff --git a/lib/oxidized/model/asa.rb b/lib/oxidized/model/asa.rb
new file mode 100644
index 0000000..3ee4e2d
--- /dev/null
+++ b/lib/oxidized/model/asa.rb
@@ -0,0 +1,48 @@
+class ASA < Oxidized::Model
+
+ # Cisco ASA model #
+ # Only SSH supported for the sake of security
+
+ prompt /^\r*([\w]+[#>]\s?)$/
+ comment '! '
+
+ cmd :all do |cfg|
+ cfg.each_line.to_a[1..-2].join
+ end
+
+ cmd :secret do |cfg|
+ cfg.gsub! /enable password (\S+) (.*)/, 'enable password <secret hidden> \2'
+ cfg.gsub! /username (\S+) password (\S+) (.*)/, 'username \1 password <secret hidden> \3'
+ cfg
+ end
+
+ cmd 'show clock' do |cfg|
+ comment cfg
+ end
+
+ cmd 'show version' do |cfg|
+ comment cfg
+ end
+
+ cmd 'show running-config' do |cfg|
+ cfg = cfg.each_line.to_a[3..-1].join
+ cfg.gsub! /^: [^\n]*\n/, ''
+ cfg
+ end
+
+ cmd 'show inventory' do |cfg|
+ comment cfg
+ end
+
+ cfg :ssh do
+ if vars :enable
+ post_login do
+ send "enable\n"
+ send vars(:enable) + "\n"
+ end
+ end
+ post_login 'terminal pager 0'
+ pre_logout 'exit'
+ end
+
+end