oxidized 0.21.0 → 0.22.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.github/no-response.yml +13 -0
- data/.gitignore +3 -0
- data/.rubocop.yml +37 -0
- data/.rubocop_todo.yml +714 -0
- data/.travis.yml +7 -1
- data/CHANGELOG.md +341 -243
- data/Dockerfile +44 -16
- data/LICENSE +201 -0
- data/README.md +114 -82
- data/Rakefile +19 -0
- data/TODO.md +29 -23
- data/bin/oxidized +1 -2
- data/docs/Configuration.md +71 -31
- data/docs/Creating-Models.md +78 -0
- data/docs/Hooks.md +145 -41
- data/docs/Model-Notes/AireOS.md +12 -0
- data/docs/Model-Notes/ArbOS.md +12 -0
- data/docs/Model-Notes/Comware.md +14 -0
- data/docs/Model-Notes/EOS.md +9 -0
- data/docs/Model-Notes/JunOS.md +34 -0
- data/docs/Model-Notes/Netgear.md +68 -0
- data/docs/Model-Notes/README.md +19 -0
- data/docs/{VRP-Huawei.md → Model-Notes/VRP-Huawei.md} +10 -2
- data/docs/Model-Notes/XGS4600-Zyxel.md +39 -0
- data/docs/Outputs.md +27 -28
- data/docs/Ruby-API.md +38 -18
- data/docs/Sources.md +78 -16
- data/docs/Supported-OS-Types.md +171 -148
- data/extra/oxidized.logrotate +7 -0
- data/extra/oxidized.service +1 -1
- data/extra/rest_client.rb +4 -5
- data/extra/syslog.rb +16 -16
- data/lib/oxidized/cli.rb +3 -3
- data/lib/oxidized/config.rb +7 -4
- data/lib/oxidized/core.rb +3 -3
- data/lib/oxidized/hook.rb +64 -65
- data/lib/oxidized/hook/awssns.rb +2 -3
- data/lib/oxidized/hook/ciscosparkdiff.rb +49 -0
- data/lib/oxidized/hook/exec.rb +5 -5
- data/lib/oxidized/hook/githubrepo.rb +20 -14
- data/lib/oxidized/hook/slackdiff.rb +38 -19
- data/lib/oxidized/hook/xmppdiff.rb +58 -0
- data/lib/oxidized/input/cli.rb +5 -6
- data/lib/oxidized/input/ftp.rb +8 -7
- data/lib/oxidized/input/http.rb +39 -0
- data/lib/oxidized/input/ssh.rb +24 -22
- data/lib/oxidized/input/telnet.rb +38 -32
- data/lib/oxidized/jobs.rb +3 -4
- data/lib/oxidized/manager.rb +9 -4
- data/lib/oxidized/model/acos.rb +15 -16
- data/lib/oxidized/model/acsw.rb +3 -8
- data/lib/oxidized/model/aen.rb +1 -2
- data/lib/oxidized/model/aireos.rb +3 -5
- data/lib/oxidized/model/alteonos.rb +16 -18
- data/lib/oxidized/model/alvarion.rb +0 -4
- data/lib/oxidized/model/aos.rb +2 -4
- data/lib/oxidized/model/aos7.rb +2 -3
- data/lib/oxidized/model/aosw.rb +13 -15
- data/lib/oxidized/model/apc_aos.rb +0 -3
- data/lib/oxidized/model/arbos.rb +26 -0
- data/lib/oxidized/model/aricentiss.rb +51 -0
- data/lib/oxidized/model/asa.rb +33 -35
- data/lib/oxidized/model/asyncos.rb +41 -44
- data/lib/oxidized/model/audiocodes.rb +4 -8
- data/lib/oxidized/model/awplus.rb +84 -0
- data/lib/oxidized/model/boss.rb +6 -5
- data/lib/oxidized/model/br6910.rb +43 -45
- data/lib/oxidized/model/c4cmts.rb +3 -5
- data/lib/oxidized/model/cambium.rb +22 -0
- data/lib/oxidized/model/catos.rb +0 -2
- data/lib/oxidized/model/cisconga.rb +1 -3
- data/lib/oxidized/model/ciscosma.rb +37 -40
- data/lib/oxidized/model/ciscosmb.rb +7 -4
- data/lib/oxidized/model/comnetms.rb +43 -0
- data/lib/oxidized/model/comware.rb +9 -9
- data/lib/oxidized/model/coriant8600.rb +3 -5
- data/lib/oxidized/model/coriantgroove.rb +3 -5
- data/lib/oxidized/model/corianttmos.rb +1 -3
- data/lib/oxidized/model/cumulus.rb +26 -32
- data/lib/oxidized/model/datacom.rb +0 -2
- data/lib/oxidized/model/dcnos.rb +46 -0
- data/lib/oxidized/model/dlink.rb +1 -1
- data/lib/oxidized/model/dnos.rb +9 -5
- data/lib/oxidized/model/edgecos.rb +45 -0
- data/lib/oxidized/model/edgeos.rb +5 -3
- data/lib/oxidized/model/edgeswitch.rb +1 -3
- data/lib/oxidized/model/enterasys.rb +1 -3
- data/lib/oxidized/model/eos.rb +6 -8
- data/lib/oxidized/model/fabricos.rb +3 -5
- data/lib/oxidized/model/firewareos.rb +2 -5
- data/lib/oxidized/model/fortios.rb +21 -17
- data/lib/oxidized/model/ftos.rb +2 -4
- data/lib/oxidized/model/fujitsupy.rb +2 -4
- data/lib/oxidized/model/gaiaos.rb +6 -10
- data/lib/oxidized/model/gcombnps.rb +82 -0
- data/lib/oxidized/model/hatteras.rb +8 -5
- data/lib/oxidized/model/hirschmann.rb +8 -10
- data/lib/oxidized/model/hpebladesystem.rb +19 -17
- data/lib/oxidized/model/hpemsa.rb +0 -3
- data/lib/oxidized/model/ios.rb +54 -55
- data/lib/oxidized/model/iosxe.rb +5 -0
- data/lib/oxidized/model/iosxr.rb +1 -3
- data/lib/oxidized/model/ipos.rb +1 -3
- data/lib/oxidized/model/ironware.rb +12 -15
- data/lib/oxidized/model/isam.rb +4 -5
- data/lib/oxidized/model/junos.rb +8 -7
- data/lib/oxidized/model/masteros.rb +1 -3
- data/lib/oxidized/model/mlnxos.rb +3 -4
- data/lib/oxidized/model/model.rb +15 -7
- data/lib/oxidized/model/mtrlrfs.rb +1 -4
- data/lib/oxidized/model/ndms.rb +24 -0
- data/lib/oxidized/model/netgear.rb +3 -4
- data/lib/oxidized/model/netscaler.rb +0 -2
- data/lib/oxidized/model/nos.rb +1 -3
- data/lib/oxidized/model/nxos.rb +13 -3
- data/lib/oxidized/model/oneos.rb +6 -8
- data/lib/oxidized/model/openbsd.rb +76 -0
- data/lib/oxidized/model/opengear.rb +3 -5
- data/lib/oxidized/model/openwrt.rb +77 -0
- data/lib/oxidized/model/opnsense.rb +19 -0
- data/lib/oxidized/model/outputs.rb +1 -3
- data/lib/oxidized/model/panos.rb +1 -2
- data/lib/oxidized/model/pfsense.rb +9 -5
- data/lib/oxidized/model/planet.rb +8 -12
- data/lib/oxidized/model/powerconnect.rb +6 -9
- data/lib/oxidized/model/procurve.rb +18 -4
- data/lib/oxidized/model/quantaos.rb +3 -5
- data/lib/oxidized/model/routeros.rb +3 -2
- data/lib/oxidized/model/saos.rb +0 -1
- data/lib/oxidized/model/screenos.rb +3 -5
- data/lib/oxidized/model/sgos.rb +2 -3
- data/lib/oxidized/model/siklu.rb +0 -2
- data/lib/oxidized/model/slxos.rb +59 -0
- data/lib/oxidized/model/sros.rb +117 -0
- data/lib/oxidized/model/stoneos.rb +32 -0
- data/lib/oxidized/model/supermicro.rb +6 -41
- data/lib/oxidized/model/timos.rb +6 -114
- data/lib/oxidized/model/tmos.rb +1 -3
- data/lib/oxidized/model/tplink.rb +7 -11
- data/lib/oxidized/model/trango.rb +6 -7
- data/lib/oxidized/model/ucs.rb +0 -1
- data/lib/oxidized/model/voltaire.rb +3 -6
- data/lib/oxidized/model/voss.rb +1 -2
- data/lib/oxidized/model/vrp.rb +4 -5
- data/lib/oxidized/model/vyatta.rb +6 -4
- data/lib/oxidized/model/weos.rb +1 -3
- data/lib/oxidized/model/xos.rb +6 -5
- data/lib/oxidized/model/zhoneolt.rb +2 -2
- data/lib/oxidized/model/zynos.rb +1 -3
- data/lib/oxidized/model/zynoscli.rb +36 -0
- data/lib/oxidized/node.rb +11 -11
- data/lib/oxidized/node/stats.rb +15 -2
- data/lib/oxidized/nodes.rb +8 -8
- data/lib/oxidized/output/file.rb +41 -42
- data/lib/oxidized/output/git.rb +113 -115
- data/lib/oxidized/output/gitcrypt.rb +241 -242
- data/lib/oxidized/output/http.rb +23 -27
- data/lib/oxidized/output/output.rb +1 -2
- data/lib/oxidized/source/csv.rb +44 -45
- data/lib/oxidized/source/http.rb +52 -49
- data/lib/oxidized/source/source.rb +6 -7
- data/lib/oxidized/source/sql.rb +55 -51
- data/lib/oxidized/string.rb +3 -4
- data/lib/oxidized/version.rb +17 -1
- data/lib/oxidized/worker.rb +12 -3
- data/oxidized.gemspec +19 -13
- metadata +139 -51
- data/.ruby-version +0 -1
- data/Gemfile.lock +0 -44
@@ -0,0 +1,82 @@
|
|
1
|
+
class GcomBNPS < Oxidized::Model
|
2
|
+
# For switches from GCOM Technologies Co.,Ltd. running the "Broadband Network Platform Software"
|
3
|
+
# Author: Frederik Kriewitz <frederik@kriewitz.eu>
|
4
|
+
#
|
5
|
+
# tested with:
|
6
|
+
# - S5330 (aka Fiberstore S3800)
|
7
|
+
|
8
|
+
prompt /^\r?([\w.@()-]+?(\(1-16 chars\))?[#>:]\s?)$/ # also match SSH password promt (post_login commands are sent after the first prompt)
|
9
|
+
comment '! '
|
10
|
+
|
11
|
+
# alternative to handle the SSH login, but this breaks telnet
|
12
|
+
# expect /^Password\(1-16 chars\):/ do |data|
|
13
|
+
# send @node.auth[:password] + "\n"
|
14
|
+
# ''
|
15
|
+
# end
|
16
|
+
|
17
|
+
# handle pager (can't be disabled?)
|
18
|
+
expect /^\.\.\.\.press ENTER to next line, CTRL_C to quit, other key to next page\.\.\.\.$/ do |data, re|
|
19
|
+
send ' '
|
20
|
+
data.sub re, ''
|
21
|
+
end
|
22
|
+
|
23
|
+
cmd :all do |cfg|
|
24
|
+
cfg = cfg.gsub " \e[73D\e[K", '' # remove garbage remaining from the pager
|
25
|
+
cfg.each_line.to_a[1..-2].join
|
26
|
+
end
|
27
|
+
|
28
|
+
cmd :secret do |cfg|
|
29
|
+
cfg.gsub! /^(snmp-server community)\s+[^\s]+\s+(.*)/, '\\1 <community hidden> \\2'
|
30
|
+
cfg
|
31
|
+
end
|
32
|
+
|
33
|
+
cmd 'show running-config' do |cfg|
|
34
|
+
cfg
|
35
|
+
end
|
36
|
+
|
37
|
+
cmd 'show interface sfp' do |cfg|
|
38
|
+
out = []
|
39
|
+
cfg.each_line do |line|
|
40
|
+
next if line.match /^ Temperature/
|
41
|
+
next if line.match /^ Voltage\(V\)/
|
42
|
+
next if line.match /^ Bias Current\(mA\)/
|
43
|
+
next if line.match /^ RX Power\(dBM\)/
|
44
|
+
next if line.match /^ TX Power\(dBM\)/
|
45
|
+
out << line
|
46
|
+
end
|
47
|
+
|
48
|
+
comment out.join
|
49
|
+
end
|
50
|
+
|
51
|
+
cmd 'show version' do |cfg|
|
52
|
+
comment cfg
|
53
|
+
end
|
54
|
+
|
55
|
+
cmd 'show system' do |cfg|
|
56
|
+
out = []
|
57
|
+
cfg.each_line do |line|
|
58
|
+
next if line.match /^system run time :/
|
59
|
+
next if line.match /^switch temperature :/
|
60
|
+
out << line
|
61
|
+
end
|
62
|
+
|
63
|
+
comment out.join
|
64
|
+
end
|
65
|
+
|
66
|
+
cfg :telnet do
|
67
|
+
username /^Username\(1-32 chars\):/
|
68
|
+
password /^Password\(1-16 chars\):/
|
69
|
+
end
|
70
|
+
|
71
|
+
cfg :ssh do
|
72
|
+
# the switch blindy accepts the SSH connection without password validation and then spawns a telnet login prompt
|
73
|
+
# first thing we've to send is the password
|
74
|
+
post_login do
|
75
|
+
send @node.auth[:password] + "\n"
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
cfg :telnet, :ssh do
|
80
|
+
pre_logout 'exit'
|
81
|
+
end
|
82
|
+
end
|
@@ -9,7 +9,6 @@ class Hatteras < Oxidized::Model
|
|
9
9
|
data.sub re, ''
|
10
10
|
end
|
11
11
|
|
12
|
-
|
13
12
|
cmd :secret do |cfg|
|
14
13
|
cfg.gsub! /^(community) \S+/, '\\1 "<configuration removed>"'
|
15
14
|
cfg.gsub! /^(communityString) "\S+"/, '\\1 "<configuration removed>"'
|
@@ -22,14 +21,18 @@ class Hatteras < Oxidized::Model
|
|
22
21
|
end
|
23
22
|
|
24
23
|
cmd "show switch\r" do |cfg|
|
25
|
-
cfg = cfg.each_line.reject { |line|
|
26
|
-
|
24
|
+
cfg = cfg.each_line.reject { |line|
|
25
|
+
line.match /Switch uptime|Switch temperature|Last reset reason/ or
|
26
|
+
line.match /TermCpuUtil|^\s+\^$|ERROR: Bad command/
|
27
|
+
} .join
|
27
28
|
comment cfg
|
28
29
|
end
|
29
30
|
|
30
31
|
cmd "show card\r" do |cfg|
|
31
|
-
cfg = cfg.each_line.reject { |line|
|
32
|
-
|
32
|
+
cfg = cfg.each_line.reject { |line|
|
33
|
+
line.match /Card uptime|Card temperature|Last reset reason/ or
|
34
|
+
line.match /TermCpuUtil|^\s+\^$|ERROR: Bad command/
|
35
|
+
} .join
|
33
36
|
comment cfg
|
34
37
|
end
|
35
38
|
|
@@ -1,10 +1,9 @@
|
|
1
1
|
class Hirschmann < Oxidized::Model
|
2
|
+
prompt /^[\(\w\s\w\)]+\s[>|#]+?$/
|
2
3
|
|
3
|
-
prompt /^[\(\w\s\w\)]+\s[>|#]+?$/
|
4
|
-
|
5
4
|
comment '## '
|
6
|
-
|
7
|
-
#Handle pager
|
5
|
+
|
6
|
+
# Handle pager
|
8
7
|
expect /^--More--.*$/ do |data, re|
|
9
8
|
send 'a'
|
10
9
|
data.sub re, ''
|
@@ -22,11 +21,11 @@ class Hirschmann < Oxidized::Model
|
|
22
21
|
cfg.gsub! /^Average CPU Utilization.*\n/, ""
|
23
22
|
comment cfg
|
24
23
|
end
|
25
|
-
|
24
|
+
|
26
25
|
cmd 'show running-config' do |cfg|
|
27
|
-
cfg.gsub! /^users.*\n/, ""
|
26
|
+
cfg.gsub! /^users.*\n/, ""
|
28
27
|
cfg
|
29
|
-
end
|
28
|
+
end
|
30
29
|
|
31
30
|
cfg :telnet do
|
32
31
|
username /^User:/
|
@@ -34,8 +33,7 @@ class Hirschmann < Oxidized::Model
|
|
34
33
|
end
|
35
34
|
|
36
35
|
cfg :telnet, :ssh do
|
37
|
-
|
38
|
-
|
36
|
+
post_login 'enable'
|
37
|
+
pre_logout 'logout'
|
39
38
|
end
|
40
|
-
|
41
39
|
end
|
@@ -4,13 +4,13 @@ class HPEBladeSystem < Oxidized::Model
|
|
4
4
|
prompt /.*> /
|
5
5
|
comment '# '
|
6
6
|
|
7
|
-
expect /^\s*--More--\s+.*$/ do |data, re|
|
8
|
-
|
9
|
-
|
10
|
-
end
|
7
|
+
# expect /^\s*--More--\s+.*$/ do |data, re|
|
8
|
+
# send ' '
|
9
|
+
# data.sub re, ''
|
10
|
+
# end
|
11
11
|
|
12
12
|
cmd :all do |cfg|
|
13
|
-
cfg = cfg.delete("\r").each_line.to_a[0..-1].map{|line|line.rstrip}.join("\n") + "\n"
|
13
|
+
cfg = cfg.delete("\r").each_line.to_a[0..-1].map { |line| line.rstrip }.join("\n") + "\n"
|
14
14
|
cfg.each_line.to_a[0..-2].join
|
15
15
|
end
|
16
16
|
|
@@ -22,7 +22,7 @@ class HPEBladeSystem < Oxidized::Model
|
|
22
22
|
cmd 'show oa info' do |cfg|
|
23
23
|
comment cfg
|
24
24
|
end
|
25
|
-
|
25
|
+
|
26
26
|
cmd 'show oa network' do |cfg|
|
27
27
|
comment cfg
|
28
28
|
end
|
@@ -30,16 +30,17 @@ class HPEBladeSystem < Oxidized::Model
|
|
30
30
|
cmd 'show oa certificate' do |cfg|
|
31
31
|
comment cfg
|
32
32
|
end
|
33
|
-
|
33
|
+
|
34
34
|
cmd 'show sshfingerprint' do |cfg|
|
35
35
|
comment cfg
|
36
36
|
end
|
37
|
-
|
37
|
+
|
38
38
|
cmd 'show fru' do |cfg|
|
39
39
|
comment cfg
|
40
40
|
end
|
41
|
-
|
41
|
+
|
42
42
|
cmd 'show network' do |cfg|
|
43
|
+
cfg.gsub! /Last Update:.*$/i, ''
|
43
44
|
comment cfg
|
44
45
|
end
|
45
46
|
|
@@ -54,15 +55,15 @@ class HPEBladeSystem < Oxidized::Model
|
|
54
55
|
cmd 'show server list' do |cfg|
|
55
56
|
comment cfg
|
56
57
|
end
|
57
|
-
|
58
|
+
|
58
59
|
cmd 'show server names' do |cfg|
|
59
60
|
comment cfg
|
60
61
|
end
|
61
|
-
|
62
|
+
|
62
63
|
cmd 'show server port map all' do |cfg|
|
63
64
|
comment cfg
|
64
65
|
end
|
65
|
-
|
66
|
+
|
66
67
|
cmd 'show server info all' do |cfg|
|
67
68
|
comment cfg
|
68
69
|
end
|
@@ -71,13 +72,14 @@ class HPEBladeSystem < Oxidized::Model
|
|
71
72
|
cfg.gsub! /^#(Generated on:) .*$/, '\\1 <removed>'
|
72
73
|
cfg.gsub /^\s+/, ''
|
73
74
|
end
|
74
|
-
|
75
|
+
|
75
76
|
cfg :telnet do
|
76
77
|
username /\slogin:/
|
77
78
|
password /^Password: /
|
78
79
|
end
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
80
|
+
|
81
|
+
cfg :telnet, :ssh do
|
82
|
+
post_login "set script mode on"
|
83
|
+
pre_logout "exit"
|
84
|
+
end
|
83
85
|
end
|
data/lib/oxidized/model/ios.rb
CHANGED
@@ -1,24 +1,23 @@
|
|
1
1
|
class IOS < Oxidized::Model
|
2
|
-
|
3
2
|
prompt /^([\w.@()-]+[#>]\s?)$/
|
4
3
|
comment '! '
|
5
4
|
|
6
5
|
# example how to handle pager
|
7
|
-
#expect /^\s--More--\s+.*$/ do |data, re|
|
6
|
+
# expect /^\s--More--\s+.*$/ do |data, re|
|
8
7
|
# send ' '
|
9
8
|
# data.sub re, ''
|
10
|
-
#end
|
9
|
+
# end
|
11
10
|
|
12
11
|
# non-preferred way to handle additional PW prompt
|
13
|
-
#expect /^[\w.]+>$/ do |data|
|
12
|
+
# expect /^[\w.]+>$/ do |data|
|
14
13
|
# send "enable\n"
|
15
14
|
# send vars(:enable) + "\n"
|
16
15
|
# data
|
17
|
-
#end
|
16
|
+
# end
|
18
17
|
|
19
18
|
cmd :all do |cfg|
|
20
|
-
#cfg.gsub! /\cH+\s{8}/, '' # example how to handle pager
|
21
|
-
#cfg.gsub! /\cH+/, '' # example how to handle pager
|
19
|
+
# cfg.gsub! /\cH+\s{8}/, '' # example how to handle pager
|
20
|
+
# cfg.gsub! /\cH+/, '' # example how to handle pager
|
22
21
|
# get rid of errors for commands that don't work on some devices
|
23
22
|
cfg.gsub! /^% Invalid input detected at '\^' marker\.$|^\s+\^$/, ''
|
24
23
|
cfg.each_line.to_a[1..-2].join
|
@@ -26,6 +25,7 @@ class IOS < Oxidized::Model
|
|
26
25
|
|
27
26
|
cmd :secret do |cfg|
|
28
27
|
cfg.gsub! /^(snmp-server community).*/, '\\1 <configuration removed>'
|
28
|
+
cfg.gsub! /^(snmp-server host \S+( vrf \S+)?( version (1|2c|3))?)\s+\S+((\s+\S*)*)\s*/, '\\1 <secret hidden> \\5'
|
29
29
|
cfg.gsub! /^(username \S+ privilege \d+) (\S+).*/, '\\1 <secret hidden>'
|
30
30
|
cfg.gsub! /^(username \S+ password \d) (\S+)/, '\\1 <secret hidden>'
|
31
31
|
cfg.gsub! /^(username \S+ secret \d) (\S+)/, '\\1 <secret hidden>'
|
@@ -42,64 +42,64 @@ class IOS < Oxidized::Model
|
|
42
42
|
comments = []
|
43
43
|
comments << cfg.lines.first
|
44
44
|
lines = cfg.lines
|
45
|
-
lines.each_with_index do |line,i|
|
46
|
-
|
47
|
-
|
45
|
+
lines.each_with_index do |line, i|
|
46
|
+
slave = ''
|
47
|
+
slaveslot = ''
|
48
48
|
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
49
|
+
if line.match /^Slave in slot (\d+) is running/
|
50
|
+
slave = " Slave:";
|
51
|
+
slaveslot = ", slot #{$1}";
|
52
|
+
end
|
53
53
|
|
54
|
-
|
55
|
-
|
56
|
-
|
54
|
+
if line.match /^Compiled (.*)$/
|
55
|
+
comments << "Image:#{slave} Compiled: #{$1}"
|
56
|
+
end
|
57
57
|
|
58
|
-
|
59
|
-
|
60
|
-
|
58
|
+
if line.match /^(?:Cisco )?IOS .* Software,? \(([A-Za-z0-9_-]*)\), .*Version\s+(.*)$/
|
59
|
+
comments << "Image:#{slave} Software: #{$1}, #{$2}"
|
60
|
+
end
|
61
61
|
|
62
|
-
|
63
|
-
|
64
|
-
|
62
|
+
if line.match /^ROM: (IOS \S+ )?(System )?Bootstrap.*(Version.*)$/
|
63
|
+
comments << "ROM Bootstrap: #{$3}"
|
64
|
+
end
|
65
65
|
|
66
|
-
|
67
|
-
|
68
|
-
|
66
|
+
if line.match /^BOOTFLASH: .*(Version.*)$/
|
67
|
+
comments << "BOOTFLASH: #{$1}"
|
68
|
+
end
|
69
69
|
|
70
|
-
|
71
|
-
|
72
|
-
|
70
|
+
if line.match /^(\d+[kK]) bytes of (non-volatile|NVRAM)/
|
71
|
+
comments << "Memory: nvram #{$1}"
|
72
|
+
end
|
73
73
|
|
74
|
-
|
75
|
-
|
76
|
-
|
74
|
+
if line.match /^(\d+[kK]) bytes of (flash memory|flash internal|processor board System flash|ATA CompactFlash)/i
|
75
|
+
comments << "Memory: flash #{$1}"
|
76
|
+
end
|
77
77
|
|
78
|
-
|
79
|
-
|
80
|
-
|
78
|
+
if line.match (/^(\d+[kK]) bytes of (Flash|ATA)?.*PCMCIA .*(slot|disk) ?(\d)/i)
|
79
|
+
comments << "Memory: pcmcia #{$2} #{$3}#{$4} #{$1}";
|
80
|
+
end
|
81
81
|
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
end
|
93
|
-
if cfg.lines[i+2].match /(cpu at |processor: |#{cpu} processor,)/i
|
94
|
-
# change implementation to impl and prepend comma
|
95
|
-
cpuxtra = cfg.lines[i+2].gsub(/implementation/,'impl').gsub(/^/,', ').chomp;
|
96
|
-
end
|
97
|
-
comments << "CPU:#{slave} #{cpu}#{cpuxtra}#{slaveslot}";
|
82
|
+
if line.match /(\S+(?:\sseries)?)\s+(?:\((\S+)\)\s+processor|\(revision[^)]+\)).*\s+with (\S+k) bytes/i
|
83
|
+
sproc = $1
|
84
|
+
cpu = $2
|
85
|
+
mem = $3
|
86
|
+
cpuxtra = ''
|
87
|
+
comments << "Chassis type:#{slave} #{sproc}";
|
88
|
+
comments << "Memory:#{slave} main #{mem}";
|
89
|
+
# check the next two lines for more CPU info
|
90
|
+
if cfg.lines[i + 1].match /processor board id (\S+)/i
|
91
|
+
comments << "Processor ID: #{$1}";
|
98
92
|
end
|
99
|
-
|
100
|
-
|
101
|
-
|
93
|
+
if cfg.lines[i + 2].match /(cpu at |processor: |#{cpu} processor,)/i
|
94
|
+
# change implementation to impl and prepend comma
|
95
|
+
cpuxtra = cfg.lines[i + 2].gsub(/implementation/, 'impl').gsub(/^/, ', ').chomp;
|
102
96
|
end
|
97
|
+
comments << "CPU:#{slave} #{cpu}#{cpuxtra}#{slaveslot}";
|
98
|
+
end
|
99
|
+
|
100
|
+
if line.match /^System image file is "([^\"]*)"$/
|
101
|
+
comments << "Image: #{$1}"
|
102
|
+
end
|
103
103
|
end
|
104
104
|
comments << "\n"
|
105
105
|
comment comments.join "\n"
|
@@ -142,5 +142,4 @@ class IOS < Oxidized::Model
|
|
142
142
|
post_login 'terminal width 0'
|
143
143
|
pre_logout 'exit'
|
144
144
|
end
|
145
|
-
|
146
145
|
end
|
data/lib/oxidized/model/iosxr.rb
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
class IOSXR < Oxidized::Model
|
2
|
-
|
3
2
|
# IOS XR model #
|
4
3
|
|
5
4
|
prompt /^(\r?[\w.@:\/-]+[#>]\s?)$/
|
@@ -9,7 +8,7 @@ class IOSXR < Oxidized::Model
|
|
9
8
|
cfg.each_line.to_a[2..-2].join
|
10
9
|
end
|
11
10
|
|
12
|
-
cmd :secret do |cfg|
|
11
|
+
cmd :secret do |cfg|
|
13
12
|
cfg.gsub! /^(snmp-server community).*/, '\\1 <configuration removed>'
|
14
13
|
cfg.gsub! /secret (\d+) (\S+).*/, '<secret hidden>'
|
15
14
|
cfg
|
@@ -45,5 +44,4 @@ class IOSXR < Oxidized::Model
|
|
45
44
|
end
|
46
45
|
pre_logout 'exit'
|
47
46
|
end
|
48
|
-
|
49
47
|
end
|
data/lib/oxidized/model/ipos.rb
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
class IPOS < Oxidized::Model
|
2
|
-
|
3
2
|
# Ericsson SSR (IPOS)
|
4
3
|
# Redback SE (SEOS)
|
5
4
|
|
@@ -54,7 +53,7 @@ class IPOS < Oxidized::Model
|
|
54
53
|
post_login 'terminal length 0'
|
55
54
|
if vars :enable
|
56
55
|
post_login do
|
57
|
-
cmd "enable"
|
56
|
+
cmd "enable"
|
58
57
|
cmd vars(:enable)
|
59
58
|
end
|
60
59
|
end
|
@@ -63,5 +62,4 @@ class IPOS < Oxidized::Model
|
|
63
62
|
send "n\n"
|
64
63
|
end
|
65
64
|
end
|
66
|
-
|
67
65
|
end
|