summaryrefslogtreecommitdiff
path: root/lib/oxidized/model/cumulus.rb
diff options
context:
space:
mode:
authorytti <saku@ytti.fi>2015-04-14 14:28:35 +0300
committerytti <saku@ytti.fi>2015-04-14 14:28:35 +0300
commit75b97a38262c93c20bd6e2e372b40787ffdccb41 (patch)
tree1dfb431490a73839c166ba3770633e37f28541f9 /lib/oxidized/model/cumulus.rb
parent130c46b33f6a2e5c774587874fc67f91192c6bf1 (diff)
parentc2b85289d4943a6807d1da4f3c55f30bf5bdf3a5 (diff)
Merge pull request #102 from FlorianDoublet/addCumulusFeature
Add the Cumulus feature
Diffstat (limited to 'lib/oxidized/model/cumulus.rb')
-rw-r--r--lib/oxidized/model/cumulus.rb76
1 files changed, 76 insertions, 0 deletions
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