oxidized 0.28.0 → 0.29.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/dependabot.yml +31 -0
- data/.github/workflows/codeql.yml +76 -0
- data/.github/workflows/publishdocker.yml +11 -2
- data/.github/workflows/ruby.yml +42 -0
- data/.github/workflows/stale.yml +16 -0
- data/.rubocop.yml +30 -10
- data/.rubocop_todo.yml +97 -43
- data/CHANGELOG.md +149 -2
- data/Dockerfile +15 -9
- data/README.md +63 -32
- data/Rakefile +2 -0
- data/docs/Configuration.md +49 -7
- data/docs/Creating-Models.md +24 -19
- data/docs/Hooks.md +35 -6
- data/docs/Model-Notes/ADVA.md +12 -0
- data/docs/Model-Notes/Cumulus.md +7 -1
- data/docs/Model-Notes/IOS.md +36 -0
- data/docs/Model-Notes/JunOS.md +3 -3
- data/docs/Model-Notes/LenovoNOS.md +29 -0
- data/docs/Model-Notes/LinksysSRW.md +15 -0
- data/docs/Model-Notes/Nokia.md +3 -0
- data/docs/Model-Notes/OS10.md +33 -0
- data/docs/Model-Notes/PanOS_API.md +28 -0
- data/docs/Model-Notes/README.md +2 -0
- data/docs/Ruby-API.md +12 -8
- data/docs/Sources.md +18 -0
- data/docs/Supported-OS-Types.md +51 -6
- data/docs/Troubleshooting.md +1 -1
- data/extra/gitdiff-msteams.sh +91 -0
- data/extra/nagios_check_failing_nodes.rb +6 -9
- data/extra/oxidized-report-git-commits +71 -14
- data/extra/oxidized.init +2 -5
- data/extra/oxidized.logrotate +1 -0
- data/extra/oxidized.runit +4 -1
- data/extra/oxidized.service +5 -8
- data/extra/rest_client.rb +1 -1
- data/extra/syslog.rb +2 -2
- data/lib/oxidized/cli.rb +1 -1
- data/lib/oxidized/config/vars.rb +5 -2
- data/lib/oxidized/config.rb +6 -3
- data/lib/oxidized/core.rb +1 -1
- data/lib/oxidized/hook/exec.rb +6 -6
- data/lib/oxidized/hook/githubrepo.rb +42 -11
- data/lib/oxidized/hook/slackdiff.rb +2 -2
- data/lib/oxidized/hook/xmppdiff.rb +45 -25
- data/lib/oxidized/hook.rb +4 -8
- data/lib/oxidized/input/exec.rb +1 -1
- data/lib/oxidized/input/input.rb +1 -0
- data/lib/oxidized/input/ssh.rb +23 -20
- data/lib/oxidized/input/telnet.rb +52 -44
- data/lib/oxidized/job.rb +1 -0
- data/lib/oxidized/jobs.rb +11 -6
- data/lib/oxidized/manager.rb +1 -0
- data/lib/oxidized/model/acmepacket.rb +40 -0
- data/lib/oxidized/model/acos.rb +3 -1
- data/lib/oxidized/model/acsw.rb +2 -0
- data/lib/oxidized/model/adtran.rb +7 -3
- data/lib/oxidized/model/adva.rb +68 -0
- data/lib/oxidized/model/aen.rb +2 -0
- data/lib/oxidized/model/aireos.rb +2 -0
- data/lib/oxidized/model/airfiber.rb +3 -1
- data/lib/oxidized/model/airos.rb +2 -0
- data/lib/oxidized/model/alteonos.rb +2 -0
- data/lib/oxidized/model/alvarion.rb +2 -0
- data/lib/oxidized/model/aos.rb +2 -0
- data/lib/oxidized/model/aos7.rb +2 -0
- data/lib/oxidized/model/aoscx.rb +98 -0
- data/lib/oxidized/model/aosw.rb +4 -2
- data/lib/oxidized/model/apc_aos.rb +2 -0
- data/lib/oxidized/model/arbos.rb +2 -0
- data/lib/oxidized/model/aricentiss.rb +2 -0
- data/lib/oxidized/model/asa.rb +4 -0
- data/lib/oxidized/model/asyncos.rb +2 -0
- data/lib/oxidized/model/audiocodes.rb +2 -0
- data/lib/oxidized/model/audiocodesmp.rb +2 -0
- data/lib/oxidized/model/awplus.rb +3 -1
- data/lib/oxidized/model/axos.rb +2 -0
- data/lib/oxidized/model/bdcom.rb +51 -0
- data/lib/oxidized/model/boss.rb +3 -1
- data/lib/oxidized/model/br6910.rb +2 -0
- data/lib/oxidized/model/c4cmts.rb +2 -0
- data/lib/oxidized/model/cambium.rb +2 -0
- data/lib/oxidized/model/cambiumepmp.rb +19 -0
- data/lib/oxidized/model/casa.rb +6 -1
- data/lib/oxidized/model/catos.rb +2 -0
- data/lib/oxidized/model/ciscoce.rb +14 -0
- data/lib/oxidized/model/cisconga.rb +2 -0
- data/lib/oxidized/model/ciscosma.rb +2 -0
- data/lib/oxidized/model/ciscosmb.rb +4 -0
- data/lib/oxidized/model/ciscovpn3k.rb +2 -0
- data/lib/oxidized/model/cnos.rb +2 -0
- data/lib/oxidized/model/comnetms.rb +2 -0
- data/lib/oxidized/model/comtrol.rb +2 -0
- data/lib/oxidized/model/comware.rb +17 -1
- data/lib/oxidized/model/coriant8600.rb +2 -0
- data/lib/oxidized/model/coriantgroove.rb +2 -0
- data/lib/oxidized/model/corianttmos.rb +2 -0
- data/lib/oxidized/model/cumulus.rb +60 -44
- data/lib/oxidized/model/datacom.rb +2 -0
- data/lib/oxidized/model/dcnos.rb +2 -0
- data/lib/oxidized/model/dellx.rb +3 -3
- data/lib/oxidized/model/dlink.rb +4 -1
- data/lib/oxidized/model/dnos.rb +2 -0
- data/lib/oxidized/model/eciapollo.rb +2 -0
- data/lib/oxidized/model/edgecos.rb +24 -2
- data/lib/oxidized/model/edgeos.rb +2 -0
- data/lib/oxidized/model/edgeswitch.rb +6 -4
- data/lib/oxidized/model/eltex.rb +50 -0
- data/lib/oxidized/model/enterasys.rb +20 -3
- data/lib/oxidized/model/enterasys800.rb +31 -0
- data/lib/oxidized/model/eos.rb +4 -1
- data/lib/oxidized/model/fabricos.rb +3 -1
- data/lib/oxidized/model/fastiron.rb +5 -2
- data/lib/oxidized/model/fiberdriver.rb +2 -0
- data/lib/oxidized/model/firebrick.rb +2 -0
- data/lib/oxidized/model/firelinuxos.rb +2 -0
- data/lib/oxidized/model/firewareos.rb +2 -0
- data/lib/oxidized/model/fortios.rb +26 -11
- data/lib/oxidized/model/fortiwlc.rb +26 -0
- data/lib/oxidized/model/ftos.rb +2 -0
- data/lib/oxidized/model/fujitsupy.rb +2 -0
- data/lib/oxidized/model/gaiaos.rb +42 -3
- data/lib/oxidized/model/gcombnps.rb +2 -0
- data/lib/oxidized/model/grandstream.rb +2 -0
- data/lib/oxidized/model/h3c.rb +42 -0
- data/lib/oxidized/model/hatteras.rb +4 -2
- data/lib/oxidized/model/hios.rb +40 -0
- data/lib/oxidized/model/hirschmann.rb +2 -0
- data/lib/oxidized/model/hpebladesystem.rb +3 -1
- data/lib/oxidized/model/hpemsa.rb +2 -0
- data/lib/oxidized/model/hpmsm.rb +2 -0
- data/lib/oxidized/model/ibos.rb +2 -0
- data/lib/oxidized/model/icotera.rb +2 -0
- data/lib/oxidized/model/ios.rb +15 -10
- data/lib/oxidized/model/iosxe.rb +1 -1
- data/lib/oxidized/model/iosxr.rb +2 -0
- data/lib/oxidized/model/ipos.rb +2 -0
- data/lib/oxidized/model/ironware.rb +10 -4
- data/lib/oxidized/model/isam.rb +2 -0
- data/lib/oxidized/model/junos.rb +7 -1
- data/lib/oxidized/model/lancom.rb +25 -0
- data/lib/oxidized/model/lenovonos.rb +84 -0
- data/lib/oxidized/model/linksyssrw.rb +73 -0
- data/lib/oxidized/model/linuxgeneric.rb +2 -0
- data/lib/oxidized/model/masteros.rb +2 -0
- data/lib/oxidized/model/mlnxos.rb +4 -0
- data/lib/oxidized/model/model.rb +35 -8
- data/lib/oxidized/model/mtrlrfs.rb +2 -0
- data/lib/oxidized/model/ndms.rb +3 -1
- data/lib/oxidized/model/necix.rb +32 -0
- data/lib/oxidized/model/netgear.rb +7 -2
- data/lib/oxidized/model/netonix.rb +2 -0
- data/lib/oxidized/model/netscaler.rb +40 -1
- data/lib/oxidized/model/nodegrid.rb +25 -0
- data/lib/oxidized/model/nos.rb +2 -0
- data/lib/oxidized/model/nsxconfig.rb +2 -0
- data/lib/oxidized/model/nsxfirewall.rb +2 -0
- data/lib/oxidized/model/nxos.rb +5 -2
- data/lib/oxidized/model/oneos.rb +2 -0
- data/lib/oxidized/model/openbsd.rb +11 -0
- data/lib/oxidized/model/opengear.rb +3 -1
- data/lib/oxidized/model/openwrt.rb +2 -0
- data/lib/oxidized/model/opnsense.rb +14 -4
- data/lib/oxidized/model/os10.rb +2 -0
- data/lib/oxidized/model/outputs.rb +2 -0
- data/lib/oxidized/model/panos.rb +2 -0
- data/lib/oxidized/model/panos_api.rb +73 -0
- data/lib/oxidized/model/pfsense.rb +14 -7
- data/lib/oxidized/model/planet.rb +2 -0
- data/lib/oxidized/model/powerconnect.rb +3 -3
- data/lib/oxidized/model/procurve.rb +4 -2
- data/lib/oxidized/model/purityos.rb +10 -1
- data/lib/oxidized/model/qtech.rb +2 -0
- data/lib/oxidized/model/quantaos.rb +3 -5
- data/lib/oxidized/model/raisecom.rb +2 -0
- data/lib/oxidized/model/routeros.rb +17 -2
- data/lib/oxidized/model/saos.rb +2 -0
- data/lib/oxidized/model/screenos.rb +2 -0
- data/lib/oxidized/model/sgos.rb +2 -0
- data/lib/oxidized/model/siklu.rb +2 -0
- data/lib/oxidized/model/slxos.rb +3 -0
- data/lib/oxidized/model/smartax.rb +2 -0
- data/lib/oxidized/model/smartcs.rb +42 -0
- data/lib/oxidized/model/sonicos.rb +11 -1
- data/lib/oxidized/model/speedtouch.rb +2 -0
- data/lib/oxidized/model/sros.rb +3 -1
- data/lib/oxidized/model/srosmd.rb +99 -0
- data/lib/oxidized/model/stoneos.rb +8 -2
- data/lib/oxidized/model/supermicro.rb +1 -1
- data/lib/oxidized/model/swos.rb +11 -0
- data/lib/oxidized/model/tdre.rb +2 -0
- data/lib/oxidized/model/telco.rb +2 -0
- data/lib/oxidized/model/timos.rb +1 -1
- data/lib/oxidized/model/tmos.rb +5 -2
- data/lib/oxidized/model/tplink.rb +4 -0
- data/lib/oxidized/model/trango.rb +13 -11
- data/lib/oxidized/model/truenas.rb +22 -0
- data/lib/oxidized/model/ucs.rb +2 -0
- data/lib/oxidized/model/viptela.rb +2 -0
- data/lib/oxidized/model/voltaire.rb +2 -0
- data/lib/oxidized/model/voss.rb +2 -0
- data/lib/oxidized/model/vrp.rb +3 -1
- data/lib/oxidized/model/vyatta.rb +2 -0
- data/lib/oxidized/model/weos.rb +2 -0
- data/lib/oxidized/model/xos.rb +6 -3
- data/lib/oxidized/model/yamaha.rb +59 -0
- data/lib/oxidized/model/zhoneolt.rb +2 -0
- data/lib/oxidized/model/zteolt.rb +54 -0
- data/lib/oxidized/model/zy1308.rb +13 -0
- data/lib/oxidized/model/zynos.rb +2 -0
- data/lib/oxidized/model/zynoscli.rb +2 -0
- data/lib/oxidized/model/zynosgs.rb +2 -0
- data/lib/oxidized/node/stats.rb +1 -0
- data/lib/oxidized/node.rb +16 -11
- data/lib/oxidized/nodes.rb +7 -6
- data/lib/oxidized/output/file.rb +2 -1
- data/lib/oxidized/output/git.rb +5 -3
- data/lib/oxidized/output/gitcrypt.rb +5 -8
- data/lib/oxidized/output/http.rb +2 -0
- data/lib/oxidized/source/csv.rb +1 -0
- data/lib/oxidized/source/http.rb +4 -0
- data/lib/oxidized/source/source.rb +7 -2
- data/lib/oxidized/source/sql.rb +15 -5
- data/lib/oxidized/version.rb +2 -2
- data/lib/oxidized/worker.rb +5 -5
- data/lib/oxidized.rb +1 -1
- data/lib/refinements.rb +43 -0
- data/oxidized.gemspec +22 -16
- metadata +120 -31
- data/.github/no-response.yml +0 -13
- data/.travis.yml +0 -10
- data/lib/oxidized/string.rb +0 -36
@@ -1,4 +1,6 @@
|
|
1
1
|
class GaiaOS < Oxidized::Model
|
2
|
+
using Refinements
|
3
|
+
|
2
4
|
# CheckPoint - Gaia OS Model
|
3
5
|
|
4
6
|
# Gaia Prompt
|
@@ -21,6 +23,12 @@ class GaiaOS < Oxidized::Model
|
|
21
23
|
cfg
|
22
24
|
end
|
23
25
|
|
26
|
+
# check for vsx / multiple context
|
27
|
+
cmd 'show vsx' do |cfg|
|
28
|
+
@is_vsx = cfg.include? 'VSX Enabled'
|
29
|
+
Oxidized.logger.debug cfg
|
30
|
+
end
|
31
|
+
|
24
32
|
cmd 'show asset all' do |cfg|
|
25
33
|
comment cfg
|
26
34
|
end
|
@@ -29,9 +37,40 @@ class GaiaOS < Oxidized::Model
|
|
29
37
|
comment cfg
|
30
38
|
end
|
31
39
|
|
32
|
-
|
33
|
-
|
34
|
-
|
40
|
+
post do
|
41
|
+
if @is_vsx
|
42
|
+
multiple_context
|
43
|
+
else
|
44
|
+
single_context
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
def single_context
|
49
|
+
Oxidized.logger.debug 'Single context tasks'
|
50
|
+
cmd 'show configuration' do |cfg|
|
51
|
+
cfg.gsub! /^# Exported by \S+ on .*/, '# '
|
52
|
+
cfg
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
def multiple_context
|
57
|
+
Oxidized.logger.debug 'Multi context tasks'
|
58
|
+
cmd 'show virtual-system all' do |systems|
|
59
|
+
vs_items = systems.scan(/^(?<VSID>\d+)\s+(?<VSNAME>.*[^\s])/)
|
60
|
+
allcfg = ''
|
61
|
+
vs_items.each do |item|
|
62
|
+
allcfg += "\n\n\n#--------======== [ VS #{item[0]} - #{item[1]} ] ========--------\n\n"
|
63
|
+
allcfg += "set virtual-system #{item[0]}\n\n"
|
64
|
+
cmd "set virtual-system #{item[0]}" do |vs|
|
65
|
+
Oxidized.logger.debug vs
|
66
|
+
cmd 'show configuration' do |vscfg|
|
67
|
+
vscfg.gsub! /^# Exported by \S+ on .*/, '# '
|
68
|
+
allcfg += vscfg
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
allcfg
|
73
|
+
end
|
35
74
|
end
|
36
75
|
|
37
76
|
cfg :ssh do
|
@@ -0,0 +1,42 @@
|
|
1
|
+
class H3C < Oxidized::Model
|
2
|
+
using Refinements
|
3
|
+
|
4
|
+
# H3C
|
5
|
+
|
6
|
+
prompt /^.*(<[\w.-]+>)$/
|
7
|
+
comment '# '
|
8
|
+
|
9
|
+
cmd :secret do |cfg|
|
10
|
+
cfg.gsub! /(pin verify (?:auto|)).*/, '\\1 <PIN hidden>'
|
11
|
+
cfg.gsub! /(%\^%#.*%\^%#)/, '<secret hidden>'
|
12
|
+
cfg
|
13
|
+
end
|
14
|
+
|
15
|
+
cmd :all do |cfg|
|
16
|
+
cfg.cut_both
|
17
|
+
end
|
18
|
+
|
19
|
+
cfg :telnet do
|
20
|
+
username /^Username:$/
|
21
|
+
password /^Password:$/
|
22
|
+
end
|
23
|
+
|
24
|
+
cfg :telnet, :ssh do
|
25
|
+
post_login 'screen-length disable'
|
26
|
+
pre_logout 'quit'
|
27
|
+
end
|
28
|
+
|
29
|
+
cmd 'display version' do |cfg|
|
30
|
+
cfg = cfg.each_line.reject { |l| l.match /uptime/ }.join
|
31
|
+
cfg = cfg.each_line.reject { |l| l.match /Uptime is/ }.join
|
32
|
+
comment cfg
|
33
|
+
end
|
34
|
+
|
35
|
+
cmd 'display device' do |cfg|
|
36
|
+
comment cfg
|
37
|
+
end
|
38
|
+
|
39
|
+
cmd 'display current-configuration' do |cfg|
|
40
|
+
cfg
|
41
|
+
end
|
42
|
+
end
|
@@ -1,4 +1,6 @@
|
|
1
1
|
class Hatteras < Oxidized::Model
|
2
|
+
using Refinements
|
3
|
+
|
2
4
|
# Hatteras Networks
|
3
5
|
|
4
6
|
prompt /^(\r?[\w.@()-]+[#>]\s?)$/
|
@@ -24,7 +26,7 @@ class Hatteras < Oxidized::Model
|
|
24
26
|
cfg = cfg.each_line.reject do |line|
|
25
27
|
line.match(/Switch uptime|Switch temperature|Last reset reason/) ||
|
26
28
|
line.match(/TermCpuUtil|^\s+\^$|ERROR: Bad command/)
|
27
|
-
end
|
29
|
+
end.join
|
28
30
|
comment cfg
|
29
31
|
end
|
30
32
|
|
@@ -32,7 +34,7 @@ class Hatteras < Oxidized::Model
|
|
32
34
|
cfg = cfg.each_line.reject do |line|
|
33
35
|
line.match(/Card uptime|Card temperature|Last reset reason/) ||
|
34
36
|
line.match(/TermCpuUtil|^\s+\^$|ERROR: Bad command/)
|
35
|
-
end
|
37
|
+
end.join
|
36
38
|
comment cfg
|
37
39
|
end
|
38
40
|
|
@@ -0,0 +1,40 @@
|
|
1
|
+
class Hios < Oxidized::Model
|
2
|
+
using Refinements
|
3
|
+
|
4
|
+
## Docker location: /var/lib/gems/2.7.0/gems/oxidized-0.28.0/lib/oxidized/model/hios.rb
|
5
|
+
prompt /^\[[\w\s\W]+\][>|#]+?$/
|
6
|
+
|
7
|
+
comment '## '
|
8
|
+
|
9
|
+
# Handle pager
|
10
|
+
expect /^--More--.*$/ do |data, re|
|
11
|
+
send 'n'
|
12
|
+
data.sub re, ''
|
13
|
+
end
|
14
|
+
|
15
|
+
cmd :all do |cfg|
|
16
|
+
cfg.cut_both
|
17
|
+
end
|
18
|
+
|
19
|
+
cmd 'show system info' do |cfg|
|
20
|
+
cfg.gsub! /^System uptime.*\n/, ""
|
21
|
+
cfg.gsub! /^Operating hours.*\n/, ""
|
22
|
+
cfg.gsub! /^System date.*\n/, ""
|
23
|
+
cfg.gsub! /^Current temperature.*\n/, ""
|
24
|
+
comment cfg
|
25
|
+
end
|
26
|
+
|
27
|
+
cmd 'show running-config script' do |cfg|
|
28
|
+
cfg
|
29
|
+
end
|
30
|
+
|
31
|
+
cfg :telnet do
|
32
|
+
username /^User:/
|
33
|
+
password /^Password:/
|
34
|
+
end
|
35
|
+
|
36
|
+
cfg :telnet, :ssh do
|
37
|
+
post_login 'enable'
|
38
|
+
pre_logout "logout\nY\r\n"
|
39
|
+
end
|
40
|
+
end
|
@@ -1,4 +1,6 @@
|
|
1
1
|
class HPEBladeSystem < Oxidized::Model
|
2
|
+
using Refinements
|
3
|
+
|
2
4
|
# HPE Onboard Administrator
|
3
5
|
|
4
6
|
prompt /.*> /
|
@@ -69,7 +71,7 @@ class HPEBladeSystem < Oxidized::Model
|
|
69
71
|
end
|
70
72
|
|
71
73
|
cmd 'show config' do |cfg|
|
72
|
-
cfg.gsub!
|
74
|
+
cfg.gsub! /^(#Generated on:) .*$/, '\\1 <removed>'
|
73
75
|
cfg.gsub /^\s+/, ''
|
74
76
|
end
|
75
77
|
|
data/lib/oxidized/model/hpmsm.rb
CHANGED
data/lib/oxidized/model/ibos.rb
CHANGED
data/lib/oxidized/model/ios.rb
CHANGED
@@ -1,4 +1,6 @@
|
|
1
1
|
class IOS < Oxidized::Model
|
2
|
+
using Refinements
|
3
|
+
|
2
4
|
prompt /^([\w.@()-]+[#>]\s?)$/
|
3
5
|
comment '! '
|
4
6
|
|
@@ -105,16 +107,19 @@ class IOS < Oxidized::Model
|
|
105
107
|
comment cfg
|
106
108
|
end
|
107
109
|
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
110
|
+
post do
|
111
|
+
cmd_line = 'show running-config'
|
112
|
+
cmd_line += ' view full' if vars(:ios_rbac)
|
113
|
+
cmd cmd_line do |cfg|
|
114
|
+
cfg = cfg.each_line.to_a[3..-1]
|
115
|
+
cfg = cfg.reject { |line| line.match /^ntp clock-period / }.join
|
116
|
+
cfg = cfg.each_line.reject { |line| line.match /^! (Last|No) configuration change (at|since).*/ unless line =~ /\d+\sby\s\S+$/ }.join
|
117
|
+
cfg.gsub! /^Current configuration : [^\n]*\n/, ''
|
118
|
+
cfg.gsub! /^ tunnel mpls traffic-eng bandwidth[^\n]*\n*(
|
119
|
+
(?: [^\n]*\n*)*
|
120
|
+
tunnel mpls traffic-eng auto-bw)/mx, '\1'
|
121
|
+
cfg
|
122
|
+
end
|
118
123
|
end
|
119
124
|
|
120
125
|
cfg :telnet do
|
data/lib/oxidized/model/iosxe.rb
CHANGED
data/lib/oxidized/model/iosxr.rb
CHANGED
data/lib/oxidized/model/ipos.rb
CHANGED
@@ -1,4 +1,6 @@
|
|
1
1
|
class IronWare < Oxidized::Model
|
2
|
+
using Refinements
|
3
|
+
|
2
4
|
prompt /^.*(telnet|ssh)@.+[>#]\s?$/i
|
3
5
|
comment '! '
|
4
6
|
|
@@ -31,7 +33,7 @@ class IronWare < Oxidized::Model
|
|
31
33
|
cfg.encode!("UTF-8", invalid: :replace, undef: :replace) # sometimes ironware returns broken encoding
|
32
34
|
cfg.gsub! /(^((.*)Current temp(.*))$)/, '' # remove unwanted lines current temperature
|
33
35
|
cfg.gsub! /Speed = [A-Z-]{2,6} \(\d{2,3}%\)/, '' # remove unwanted lines Speed Fans
|
34
|
-
cfg.gsub! /current speed is [A-Z]{2,6} \(\d{2,3}%\)/, ''
|
36
|
+
cfg.gsub! /current speed is [A-Z-]{2,6} \(\d{2,3}%\)/, ''
|
35
37
|
cfg.gsub! /Fan \d* - STATUS: OK \D*\d*./, '' # Fix for ADX Fan speed reporting
|
36
38
|
cfg.gsub! /\d* deg C/, '' # Fix for ADX temperature reporting
|
37
39
|
cfg.gsub! /([\[]*)1([\]]*)<->([\[]*)2([\]]*)(<->([\[]*)3([\]]*))*/, ''
|
@@ -75,9 +77,13 @@ class IronWare < Oxidized::Model
|
|
75
77
|
# handle pager with enable
|
76
78
|
cfg :telnet, :ssh do
|
77
79
|
if vars :enable
|
78
|
-
|
79
|
-
|
80
|
-
|
80
|
+
if vars(:enable).is_a? TrueClass
|
81
|
+
post_login 'enable'
|
82
|
+
else
|
83
|
+
post_login do
|
84
|
+
send "enable\r\n"
|
85
|
+
cmd vars(:enable)
|
86
|
+
end
|
81
87
|
end
|
82
88
|
end
|
83
89
|
post_login ''
|
data/lib/oxidized/model/isam.rb
CHANGED
data/lib/oxidized/model/junos.rb
CHANGED
@@ -1,4 +1,6 @@
|
|
1
1
|
class JunOS < Oxidized::Model
|
2
|
+
using Refinements
|
3
|
+
|
2
4
|
comment '# '
|
3
5
|
|
4
6
|
def telnet
|
@@ -34,7 +36,11 @@ class JunOS < Oxidized::Model
|
|
34
36
|
end
|
35
37
|
|
36
38
|
cmd('show chassis hardware') { |cfg| comment cfg }
|
37
|
-
cmd('show system license')
|
39
|
+
cmd('show system license') do |cfg|
|
40
|
+
cfg.gsub!(/ fib-scale\s+(\d+)/, ' fib-scale <count>')
|
41
|
+
cfg.gsub!(/ rib-scale\s+(\d+)/, ' rib-scale <count>')
|
42
|
+
comment cfg
|
43
|
+
end
|
38
44
|
cmd('show system license keys') { |cfg| comment cfg }
|
39
45
|
|
40
46
|
cmd 'show configuration | display omit'
|
@@ -0,0 +1,25 @@
|
|
1
|
+
class LANCOM < Oxidized::Model
|
2
|
+
using Refinements
|
3
|
+
|
4
|
+
# LANCOM Systems GmbH
|
5
|
+
# tested on LANCOM 1781EF+ router using Lancom OS 10.32.0176RU9 / 21.04.2020
|
6
|
+
comment '# '
|
7
|
+
|
8
|
+
prompt />\s?$/
|
9
|
+
|
10
|
+
cmd "sysinfo\r" do |cfg|
|
11
|
+
cfg.gsub! /^TIME:.*\n/, ''
|
12
|
+
comment cfg
|
13
|
+
end
|
14
|
+
|
15
|
+
cmd "readscript\r"
|
16
|
+
|
17
|
+
cfg :telnet do
|
18
|
+
username /login:\s/
|
19
|
+
password /^Password:\s/
|
20
|
+
end
|
21
|
+
|
22
|
+
cfg :telnet, :ssh do
|
23
|
+
pre_logout "exit\r"
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,84 @@
|
|
1
|
+
class LenovoNOS < Oxidized::Model
|
2
|
+
using Refinements
|
3
|
+
|
4
|
+
prompt /^([\w.@()-]+[#>]\s?)$/
|
5
|
+
comment '! '
|
6
|
+
|
7
|
+
def comment_ext(header, output)
|
8
|
+
data = ''
|
9
|
+
data << header
|
10
|
+
data << "\n"
|
11
|
+
data << output
|
12
|
+
data << "\n"
|
13
|
+
comment data
|
14
|
+
end
|
15
|
+
|
16
|
+
cmd :all do |cfg|
|
17
|
+
cfg.gsub! /^% Invalid input detected at '\^' marker\.$|^\s+\^$/, ''
|
18
|
+
cfg.cut_both
|
19
|
+
end
|
20
|
+
|
21
|
+
cmd :secret do |cfg|
|
22
|
+
cfg.gsub! /^(enable password) \S+(.*)/, '\\1 <secret hidden>\\2'
|
23
|
+
cfg.gsub! /^(access user \S+ password) \S+(.*)/, '\\1 <secret hidden>\\2'
|
24
|
+
cfg.gsub! /^(snmp-server \S+-community) \S+(.*)/, '\\1 <secret hidden>\\2'
|
25
|
+
cfg.gsub! /^(tacacs-server \S+ \S+ ekey) \S+(.*)/, '\\1 <secret hidden>\\2'
|
26
|
+
cfg.gsub! /^(ntp message-digest-key \S+ md5-ekey) \S+(.*)/, '\\1 <secret hidden>\\2'
|
27
|
+
cfg.gsub! /(.* password )"[0-9a-f]+"(.*)/, '\\1<secret hidden>\\2'
|
28
|
+
cfg.gsub! /(.*ekey )"[0-9a-f]+"(.*)/, '\\1<secret hidden>\\2'
|
29
|
+
cfg
|
30
|
+
end
|
31
|
+
|
32
|
+
expect /^Select Command Line Interface mode.*iscli.*:/ do |data, re|
|
33
|
+
send "iscli\n"
|
34
|
+
data.sub re, ''
|
35
|
+
end
|
36
|
+
|
37
|
+
cmd 'show version' do |cfg|
|
38
|
+
cfg = cfg.each_line.to_a
|
39
|
+
|
40
|
+
cfg = cfg.reject { |line| line.match /^System Information at/ }
|
41
|
+
cfg = cfg.reject { |line| line.match /^Switch has been up for/ }
|
42
|
+
cfg = cfg.reject { |line| line.match /^Last boot:/ }
|
43
|
+
cfg = cfg.reject { |line| line.match /^Temperature / }
|
44
|
+
cfg = cfg.reject { |line| line.match /^Power Consumption/ }
|
45
|
+
|
46
|
+
cfg = cfg.join
|
47
|
+
comment_ext("=== show version ===", cfg)
|
48
|
+
end
|
49
|
+
|
50
|
+
cmd 'show boot' do |cfg|
|
51
|
+
comment_ext("=== show boot ===", cfg)
|
52
|
+
end
|
53
|
+
|
54
|
+
cmd 'show transceiver' do |cfg|
|
55
|
+
comment_ext("=== show transceiver ===", cfg)
|
56
|
+
end
|
57
|
+
|
58
|
+
cmd 'show software-key' do |cfg|
|
59
|
+
comment_ext("=== show software-key ===", cfg)
|
60
|
+
end
|
61
|
+
|
62
|
+
cmd 'show running-config' do |cfg|
|
63
|
+
cfg.gsub! /^Current configuration:[^\n]*\n/, ''
|
64
|
+
if vars(:remove_unstable_lines) == true
|
65
|
+
cfg.gsub! /(.* password )"[0-9a-f]+"(.*)/, '\\1<unstable line hidden>\\2'
|
66
|
+
cfg.gsub! /(.*ekey )"[0-9a-f]+"(.*)/, '\\1<unstable line hidden>\\2'
|
67
|
+
end
|
68
|
+
cfg
|
69
|
+
end
|
70
|
+
|
71
|
+
cfg :ssh do
|
72
|
+
# preferred way to handle additional passwords
|
73
|
+
post_login do
|
74
|
+
if vars(:enable) == true
|
75
|
+
cmd "enable"
|
76
|
+
elsif vars(:enable)
|
77
|
+
cmd "enable", /^[pP]assword:/
|
78
|
+
cmd vars(:enable)
|
79
|
+
end
|
80
|
+
end
|
81
|
+
post_login 'terminal-length 0'
|
82
|
+
pre_logout 'exit'
|
83
|
+
end
|
84
|
+
end
|
@@ -0,0 +1,73 @@
|
|
1
|
+
class LinksysSRW < Oxidized::Model
|
2
|
+
using Refinements
|
3
|
+
|
4
|
+
comment '! '
|
5
|
+
|
6
|
+
prompt /^([\r\w.@-]+[#>]\s?)$/
|
7
|
+
|
8
|
+
# Graphical login screen
|
9
|
+
# Just login to get to Main Menu
|
10
|
+
expect /Login Screen/ do
|
11
|
+
Oxidized.logger.send(:debug, "#{self.class.name}: Login Screen")
|
12
|
+
# This is to ensure the whole thing have rendered before we send stuff
|
13
|
+
sleep 0.2
|
14
|
+
send 0x18.chr # CAN Cancel
|
15
|
+
send @node.auth[:username]
|
16
|
+
send "\t"
|
17
|
+
send @node.auth[:password]
|
18
|
+
send "\r"
|
19
|
+
''
|
20
|
+
end
|
21
|
+
|
22
|
+
# Main menu, escape into Pre-cli-shell
|
23
|
+
expect /Switch Main Menu/ do
|
24
|
+
Oxidized.logger.send(:debug, "#{self.class.name}: Switch menu")
|
25
|
+
send 0x1a.chr # SUB Substitite ^z
|
26
|
+
''
|
27
|
+
end
|
28
|
+
|
29
|
+
# Pre-cli-shell, start lcli which is ios-ish
|
30
|
+
expect />/ do
|
31
|
+
Oxidized.logger.send(:debug, "#{self.class.name}: >")
|
32
|
+
send "lcli\r"
|
33
|
+
''
|
34
|
+
end
|
35
|
+
|
36
|
+
cmd :all do |cfg|
|
37
|
+
# Remove \r from first response row
|
38
|
+
cfg.gsub! /^\r/, ''
|
39
|
+
cfg.cut_tail + "\n"
|
40
|
+
end
|
41
|
+
|
42
|
+
cmd :secret do |cfg|
|
43
|
+
cfg.gsub! /^(snmp-server community).*/, '\\1 <configuration removed>'
|
44
|
+
cfg.gsub! /^(enable (password|secret)( level \d+)? \d) .+/, '\\1 <secret hidden>'
|
45
|
+
end
|
46
|
+
|
47
|
+
cmd 'show startup-config' do |cfg|
|
48
|
+
# Repair some linewraps which terminal datadump doesn't take care of
|
49
|
+
# and there's no terminal width either.
|
50
|
+
cfg.gsub! /(lldpPortConfigT)\n(LVsTxEnable)/, '\\1\\2'
|
51
|
+
cfg.gsub! /(lldpPortConfigTL)\n(VsTxEnable)/, '\\1\\2'
|
52
|
+
# And comment out the echo of the command
|
53
|
+
"#{comment cfg.lines.first}#{cfg.cut_head}"
|
54
|
+
end
|
55
|
+
|
56
|
+
cmd 'show version' do |cfg|
|
57
|
+
comment cfg
|
58
|
+
end
|
59
|
+
|
60
|
+
cmd 'show system' do |cfg|
|
61
|
+
cfg.gsub! /(System Up Time \(days,hour:min:sec\):\s+).*/, '\\1 <uptime removed>'
|
62
|
+
comment cfg
|
63
|
+
end
|
64
|
+
|
65
|
+
cfg :telnet, :ssh do
|
66
|
+
# Some pre-cli-shell just expects a username, who its going to log in.
|
67
|
+
username /^User Name:/
|
68
|
+
password /Password:/
|
69
|
+
post_login 'terminal datadump'
|
70
|
+
pre_logout 'exit'
|
71
|
+
pre_logout 'logout'
|
72
|
+
end
|
73
|
+
end
|
@@ -1,4 +1,6 @@
|
|
1
1
|
class MLNXOS < Oxidized::Model
|
2
|
+
using Refinements
|
3
|
+
|
2
4
|
prompt /([\w.@()-\[:\s\]]+[#>]\s)$/
|
3
5
|
comment '## '
|
4
6
|
|
@@ -10,7 +12,9 @@ class MLNXOS < Oxidized::Model
|
|
10
12
|
|
11
13
|
cmd :all do |cfg|
|
12
14
|
cfg.gsub! /\[\?1h=\r/, '' # Pager Handling
|
15
|
+
cfg.gsub! /\[24;1H/, '' # Pager Handling
|
13
16
|
cfg.gsub! /\r\[K/, '' # Pager Handling
|
17
|
+
cfg.gsub! /\[K/, '' # Pager Handling
|
14
18
|
cfg.gsub! /\s/, '' # Linebreak Handling
|
15
19
|
cfg.gsub! /^CPU load averages:\s.+/, '' # Omit constantly changing CPU info
|
16
20
|
cfg.gsub! /^System memory:\s.+/, '' # Omit constantly changing memory info
|