summaryrefslogtreecommitdiff
path: root/lib/oxidized/model
diff options
context:
space:
mode:
Diffstat (limited to 'lib/oxidized/model')
-rw-r--r--lib/oxidized/model/asa.rb9
-rw-r--r--lib/oxidized/model/ios.rb4
-rw-r--r--lib/oxidized/model/nos.rb45
-rw-r--r--lib/oxidized/model/nxos.rb23
-rw-r--r--lib/oxidized/model/powerconnect.rb14
-rw-r--r--lib/oxidized/model/xos.rb40
6 files changed, 123 insertions, 12 deletions
diff --git a/lib/oxidized/model/asa.rb b/lib/oxidized/model/asa.rb
index 3ee4e2d..8335b1d 100644
--- a/lib/oxidized/model/asa.rb
+++ b/lib/oxidized/model/asa.rb
@@ -3,7 +3,7 @@ class ASA < Oxidized::Model
# Cisco ASA model #
# Only SSH supported for the sake of security
- prompt /^\r*([\w]+[#>]\s?)$/
+ prompt /^\r*([\w.@()-\/]+[#>]\s?)$/
comment '! '
cmd :all do |cfg|
@@ -16,11 +16,10 @@ class ASA < Oxidized::Model
cfg
end
- cmd 'show clock' do |cfg|
- comment cfg
- end
-
cmd 'show version' do |cfg|
+ # avoid commits due to uptime / ixo-router01 up 2 mins 28 secs / ixo-router01 up 1 days 2 hours
+ cfg = cfg.each_line.select { |line| not line.match /\s+up\s+\d+\s+/ }
+ cfg = cfg.join
comment cfg
end
diff --git a/lib/oxidized/model/ios.rb b/lib/oxidized/model/ios.rb
index d2b4996..6fa3c5c 100644
--- a/lib/oxidized/model/ios.rb
+++ b/lib/oxidized/model/ios.rb
@@ -37,9 +37,9 @@ class IOS < Oxidized::Model
end
cmd 'show running-config' do |cfg|
- cfg = cfg.each_line.to_a[3..-1].join
+ cfg = cfg.each_line.to_a[3..-1]
+ cfg = cfg.reject { |line| line.match /^ntp clock-period / }.join
cfg.gsub! /^Current configuration : [^\n]*\n/, ''
- cfg.sub! /^(ntp clock-period).*/, '! \1'
cfg.gsub! /^\ tunnel\ mpls\ traffic-eng\ bandwidth[^\n]*\n*(
(?:\ [^\n]*\n*)*
tunnel\ mpls\ traffic-eng\ auto-bw)/mx, '\1'
diff --git a/lib/oxidized/model/nos.rb b/lib/oxidized/model/nos.rb
new file mode 100644
index 0000000..c2f4319
--- /dev/null
+++ b/lib/oxidized/model/nos.rb
@@ -0,0 +1,45 @@
+class NOS < Oxidized::Model
+
+ # Brocade Network Operating System
+
+ prompt /^(?:\e\[..h)?[\w.-]+# $/
+ comment '! '
+
+ cmd :all do |cfg|
+ cfg.each_line.to_a[1..-2].join
+ end
+
+ cmd 'show version' do |cfg|
+ comment cfg
+ end
+
+ cmd 'show inventory' do |cfg|
+ comment cfg
+ end
+
+ cmd 'show license' do |cfg|
+ comment cfg
+ end
+
+ cmd 'show chassis' do |cfg|
+ comment cfg.each_line.reject { |line| line.match /Time/ }.join
+ end
+
+ cfg 'show system' do |cfg|
+ commen cfg.each_line.reject { |line| line.match /Time/ or line.match /speed/ }
+ end
+
+ cmd 'show running-config'
+
+ cfg :telnet do
+ username /^.* login: /
+ username /^Password:/
+ end
+
+ cfg :telnet, :ssh do
+ post_login 'terminal length 0'
+ #post_login 'terminal width 0'
+ pre_logout 'exit'
+ end
+
+end
diff --git a/lib/oxidized/model/nxos.rb b/lib/oxidized/model/nxos.rb
new file mode 100644
index 0000000..6163724
--- /dev/null
+++ b/lib/oxidized/model/nxos.rb
@@ -0,0 +1,23 @@
+class NXOS < Oxidized::Model
+
+ prompt /^(\r?[\w.@_()-]+[#]\s?)$/
+ comment '! '
+
+ cmd 'show version' do |cfg|
+ cfg = cfg.each_line.take_while { |line| not line.match(/uptime/i) }
+ comment cfg.join ""
+ end
+
+ cmd 'show inventory' do |cfg|
+ comment cfg
+ end
+
+ cmd 'show running-config' do |cfg|
+ cfg.gsub! /^!Time:[^\n]*\n/, ''
+ end
+
+ cfg :ssh do
+ post_login 'terminal length 0'
+ pre_logout 'exit'
+ end
+end
diff --git a/lib/oxidized/model/powerconnect.rb b/lib/oxidized/model/powerconnect.rb
index 1d0352e..a1fe229 100644
--- a/lib/oxidized/model/powerconnect.rb
+++ b/lib/oxidized/model/powerconnect.rb
@@ -14,12 +14,14 @@ class PowerConnect < Oxidized::Model
end
cmd 'show version' do |cfg|
- comment cfg
+ cfg = cfg.split("\n").select { |line| not line[/Up\sTime/] }
+ comment cfg.join("\n") + "\n"
end
cmd 'show system' do |cfg|
- cfg = cfg.each_line.take_while { |line| not line.match(/uptime/i) }
- comment cfg.join "\n"
+ cfg = cfg.split("\n").select { |line| not line[/Up\sTime/] }
+ cfg = cfg[0..-28]<<" "
+ comment cfg.join("\n")
end
cmd 'show running-config'
@@ -31,8 +33,10 @@ class PowerConnect < Oxidized::Model
cfg :telnet, :ssh do
if vars :enable
- send "enable\n"
- send vars(:enable) + "\n"
+ post_login do
+ send "enable\n"
+ send vars(:enable) + "\n"
+ end
end
post_login "terminal length 0"
diff --git a/lib/oxidized/model/xos.rb b/lib/oxidized/model/xos.rb
new file mode 100644
index 0000000..a8292ca
--- /dev/null
+++ b/lib/oxidized/model/xos.rb
@@ -0,0 +1,40 @@
+class XOS < Oxidized::Model
+
+ # Extreme Networks XOS
+
+ prompt /^*?[\w .-]+# $/
+ comment '# '
+
+ cmd :all do |cfg|
+ cfg.each_line.to_a[1..-2].join.rstrip
+ end
+
+ cmd 'show version' do |cfg|
+ comment cfg
+ end
+
+ cmd 'show diagnostics' do |cfg|
+ comment cfg
+ end
+
+ cmd 'show licenses' do |cfg|
+ comment cfg
+ end
+
+ cmd 'show switch'do |cfg|
+ comment cfg.each_line.reject { |line| line.match /Time:/ or line.match /boot/i }.join
+ end
+
+ cmd 'show configuration'
+
+ cfg :telnet do
+ username /^login:/
+ password /^passowrd:/
+ end
+
+ cfg :telnet, :ssh do
+ post_login 'disable clipaging'
+ pre_logout 'exit'
+ end
+
+end