summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md1
-rw-r--r--lib/oxidized/model/comware.rb11
-rw-r--r--lib/oxidized/model/cumulus.rb76
-rw-r--r--lib/oxidized/model/model.rb1
-rw-r--r--lib/oxidized/model/powerconnect.rb7
5 files changed, 92 insertions, 4 deletions
diff --git a/README.md b/README.md
index ba294c1..c9a5b0d 100644
--- a/README.md
+++ b/README.md
@@ -55,6 +55,7 @@ Oxidized is a network device configuration backup tool. It's a RANCID replacment
* Cisco IOS-XR
* Cisco NXOS
* Cisco SMB (Nikola series)
+ * Cumulus Linux
* DELL PowerConnect
* Extreme Networks XOS
* Force10 FTOS
diff --git a/lib/oxidized/model/comware.rb b/lib/oxidized/model/comware.rb
index c09a128..bfc1524 100644
--- a/lib/oxidized/model/comware.rb
+++ b/lib/oxidized/model/comware.rb
@@ -21,6 +21,17 @@ class Comware < Oxidized::Model
end
cfg :telnet, :ssh do
+ # enable command-line mode on SMB comware switches (HP V1910, V1920)
+ # autodetection is hard, because the 'summary' command is paged, and
+ # the pager cannot be disabled before _cmdline-mode on.
+ if vars :comware_cmdline
+ post_login do
+ send "_cmdline-mode on\n"
+ send "y\n"
+ send vars(:comware_cmdline) + "\n"
+ end
+ end
+
post_login 'screen-length disable'
post_login 'undo terminal monitor'
pre_logout 'quit'
diff --git a/lib/oxidized/model/cumulus.rb b/lib/oxidized/model/cumulus.rb
new file mode 100644
index 0000000..68d856e
--- /dev/null
+++ b/lib/oxidized/model/cumulus.rb
@@ -0,0 +1,76 @@
+class Cumulus < Oxidized::Model
+
+ prompt /^((\w*)@(.*)([>#]\s)+)$/
+ comment '# '
+
+
+ #add a comment in the final conf
+ def add_comment comment
+ "\n###### #{comment} ######\n"
+ end
+
+ cmd :all do |cfg|
+ cfg.each_line.to_a[1..-2].join
+ end
+
+ #show the persistent configuration
+ pre do
+ cfg = add_comment 'THE HOSTNAME'
+ cfg += cmd 'cat /etc/hostname'
+
+ cfg += add_comment 'THE HOSTS'
+ cfg += cmd 'cat /etc/hosts'
+
+ cfg += add_comment 'THE INTERFACES'
+ cfg += cmd 'cat /etc/network/interfaces'
+
+ cfg += add_comment 'RESOLV.CONF'
+ cfg += cmd 'cat /etc/resolv.conf'
+
+ cfg += add_comment 'NTP.CONF'
+ cfg += cmd 'cat /etc/ntp.conf'
+
+ cfg += add_comment 'QUAGGA DAEMONS'
+ cfg += cmd 'cat /etc/quagga/daemons'
+
+ cfg += add_comment 'QUAGGA ZEBRA'
+ cfg += cmd 'cat /etc/quagga/zebra.conf'
+
+ cfg += add_comment 'QUAGGA BGP'
+ cfg += cmd 'cat /etc/quagga/bgpd.conf'
+
+ cfg += add_comment 'QUAGGA OSPF'
+ cfg += cmd 'cat /etc/quagga/ospfd.conf'
+
+ cfg += add_comment 'QUAGGA OSPF6'
+ cfg += cmd 'cat /etc/quagga/ospf6d.conf'
+
+ cfg += add_comment 'MOTD'
+ cfg += cmd 'cat /etc/motd'
+
+ cfg += add_comment 'PASSWD'
+ cfg += cmd 'cat /etc/passwd'
+
+ cfg += add_comment ' SWITCHD'
+ cfg += cmd 'cat /etc/cumulus/switchd.conf'
+
+ cfg += add_comment 'ACL'
+ cfg += cmd 'iptables -L'
+
+ cfg += add_comment 'VERSION'
+ cfg += cmd 'cat /etc/cumulus/etc.replace/os-release'
+
+ end
+
+
+ cfg :telnet do
+ username /^Username:/
+ password /^Password:/
+ end
+
+ cfg :telnet, :ssh do
+ pre_logout 'exit'
+ end
+
+
+end \ No newline at end of file
diff --git a/lib/oxidized/model/model.rb b/lib/oxidized/model/model.rb
index 899b40a..e0e3941 100644
--- a/lib/oxidized/model/model.rb
+++ b/lib/oxidized/model/model.rb
@@ -1,3 +1,4 @@
+require 'strscan'
require_relative 'outputs'
module Oxidized
diff --git a/lib/oxidized/model/powerconnect.rb b/lib/oxidized/model/powerconnect.rb
index 531ad0b..0b28f37 100644
--- a/lib/oxidized/model/powerconnect.rb
+++ b/lib/oxidized/model/powerconnect.rb
@@ -4,7 +4,7 @@ class PowerConnect < Oxidized::Model
comment '! '
- expect /^\s--More--\s+.*$/ do |data, re|
+ expect /^\s*--More--\s+.*$/ do |data, re|
send ' '
data.sub re, ''
end
@@ -50,8 +50,8 @@ class PowerConnect < Oxidized::Model
skip_block = false
cfg.each_line do |line|
if line.match /Up\sTime|Temperature|Power Supplies/i
- # For 34xx, 54xx, 55xx, and 8024F we should skip this block (terminated by a blank line)
- skip_block = true if @model =~ /^(34|35)(24|48)$|^(54|55)(24|48)$|^8024$/
+ # For 34xx, 35xx, 54xx, 55xx, 62xx and 8024F we should skip this block (terminated by a blank line)
+ skip_block = true if @model =~ /^(34|35)(24|48)$|^(54|55)(24|48)$|^(62)(24|48)$|^8024$/
end
# If we have lines to skip do this until we reach and empty line
if skip_block
@@ -64,5 +64,4 @@ class PowerConnect < Oxidized::Model
out << "\n"
end
-
end