summaryrefslogtreecommitdiff
path: root/lib/oxidized/model/cumulus.rb
blob: 6e9a9b15e514a45edb3d1c73fa6e138f645a39c4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
class Cumulus < Oxidized::Model
  
  prompt /^((\w*)@(.*)):/
  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 'grep -r "" /etc/network/interface* | cut -d "/" -f 4-'
    
    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 'IP Routes'
    cfg += cmd 'netstat -rn'

    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 'QUAGGA CONF'
    cfg += cmd 'cat /etc/quagga/Quagga.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 -n'
    
    cfg += add_comment 'VERSION'
    cfg += cmd 'cat /etc/cumulus/etc.replace/os-release'

    cfg += add_comment 'License'
    cfg += cmd 'cl-license'
    
  end
  

  cfg :telnet do
    username /^Username:/
    password /^Password:/
  end

  cfg :telnet, :ssh do
    pre_logout 'exit'
  end
 

end