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
data/lib/oxidized/model/siklu.rb
CHANGED
@@ -0,0 +1,59 @@
|
|
1
|
+
class SLXOS < Oxidized::Model
|
2
|
+
prompt /^.*[>#]\s?$/i
|
3
|
+
comment '! '
|
4
|
+
|
5
|
+
cmd 'show version' do |cfg|
|
6
|
+
cfg.gsub! /(^((.*)[Ss]ystem [Uu]ptime(.*))$)/, '' # remove unwanted line system uptime
|
7
|
+
cfg.gsub! /[Uu]p\s?[Tt]ime is .*/, ''
|
8
|
+
|
9
|
+
comment cfg
|
10
|
+
end
|
11
|
+
|
12
|
+
cmd 'show chassis' do |cfg|
|
13
|
+
cfg.encode!("UTF-8", :invalid => :replace, :undef => :replace) # sometimes ironware returns broken encoding
|
14
|
+
cfg.gsub! /.*Power Usage.*/, '' # remove unwanted lines power usage
|
15
|
+
cfg.gsub! /Time A(live|wake).*/, '' # remove unwanted lines time alive/awake
|
16
|
+
cfg.gsub! /([\[]*)1([\]]*)<->([\[]*)2([\]]*)(<->([\[]*)3([\]]*))*/, ''
|
17
|
+
|
18
|
+
comment cfg
|
19
|
+
end
|
20
|
+
|
21
|
+
cmd 'show system' do |cfg|
|
22
|
+
cfg.gsub! /Up Time.*/, '' # removes uptime line
|
23
|
+
cfg.gsub! /Current Time.*/, '' # remove current time line
|
24
|
+
cfg.gsub! /.*speed is.*/, '' # removes fan speed lines
|
25
|
+
|
26
|
+
comment cfg
|
27
|
+
end
|
28
|
+
|
29
|
+
cmd 'show slots' do |cfg|
|
30
|
+
cfg.gsub! /^-*^$/, '' # some slx devices are fixed config
|
31
|
+
cfg.gsub! /syntax error: element does not exist/, '' # same as above
|
32
|
+
|
33
|
+
comment cfg
|
34
|
+
end
|
35
|
+
|
36
|
+
cmd 'show running-config' do |cfg|
|
37
|
+
arr = cfg.each_line.to_a
|
38
|
+
arr[2..-1].join unless arr.length < 2
|
39
|
+
end
|
40
|
+
|
41
|
+
cfg :telnet do
|
42
|
+
# match expected prompts
|
43
|
+
username /^(Please Enter Login Name|Username):/
|
44
|
+
password /^(Please Enter Password ?|Password):/
|
45
|
+
end
|
46
|
+
|
47
|
+
# handle pager with enable
|
48
|
+
cfg :telnet, :ssh do
|
49
|
+
if vars :enable
|
50
|
+
post_login do
|
51
|
+
send "enable\n"
|
52
|
+
cmd vars(:enable)
|
53
|
+
end
|
54
|
+
end
|
55
|
+
post_login ''
|
56
|
+
post_login 'terminal length 0'
|
57
|
+
pre_logout 'exit'
|
58
|
+
end
|
59
|
+
end
|
@@ -0,0 +1,117 @@
|
|
1
|
+
class SROS < Oxidized::Model
|
2
|
+
#
|
3
|
+
# Nokia SR OS (TiMOS) (formerly TiMetra, Alcatel, Alcatel-Lucent).
|
4
|
+
# Used in 7705 SAR, 7210 SAS, 7450 ESS, 7750 SR, 7950 XRS, and NSP.
|
5
|
+
#
|
6
|
+
|
7
|
+
comment '# '
|
8
|
+
|
9
|
+
prompt /^([-\w\.:>\*]+\s?[#>]\s?)$/
|
10
|
+
|
11
|
+
cmd :all do |cfg, cmdstring|
|
12
|
+
new_cfg = comment "COMMAND: #{cmdstring}\n"
|
13
|
+
new_cfg << cfg.each_line.to_a[1..-2].join
|
14
|
+
end
|
15
|
+
|
16
|
+
#
|
17
|
+
# Show the boot options file.
|
18
|
+
#
|
19
|
+
cmd 'show bof' do |cfg|
|
20
|
+
cfg.gsub! /# Finished .*/, ''
|
21
|
+
cfg.gsub! /# Generated .*/, ''
|
22
|
+
comment cfg
|
23
|
+
end
|
24
|
+
|
25
|
+
#
|
26
|
+
# Show the system information.
|
27
|
+
#
|
28
|
+
cmd 'show system information' do |cfg|
|
29
|
+
#
|
30
|
+
# Strip uptime.
|
31
|
+
#
|
32
|
+
cfg.sub! /^System Up Time.*\n/, ''
|
33
|
+
cfg.gsub! /# Finished .*/, ''
|
34
|
+
cfg.gsub! /# Generated .*/, ''
|
35
|
+
comment cfg
|
36
|
+
end
|
37
|
+
|
38
|
+
#
|
39
|
+
# Show the card state.
|
40
|
+
#
|
41
|
+
cmd 'show card state' do |cfg|
|
42
|
+
cfg.gsub! /# Finished .*/, ''
|
43
|
+
cfg.gsub! /# Generated .*/, ''
|
44
|
+
comment cfg
|
45
|
+
end
|
46
|
+
|
47
|
+
#
|
48
|
+
# Show the boot log.
|
49
|
+
#
|
50
|
+
cmd 'file type bootlog.txt' do |cfg|
|
51
|
+
#
|
52
|
+
# Strip carriage returns and backspaces.
|
53
|
+
#
|
54
|
+
cfg.gsub! /\r/, ''
|
55
|
+
cfg.gsub! /[\b][\b][\b]/, "\n"
|
56
|
+
cfg.gsub! /# Finished .*/, ''
|
57
|
+
cfg.gsub! /# Generated .*/, ''
|
58
|
+
comment cfg
|
59
|
+
end
|
60
|
+
|
61
|
+
#
|
62
|
+
# Show the running debug configuration.
|
63
|
+
#
|
64
|
+
cmd 'show debug' do |cfg|
|
65
|
+
cfg.gsub! /# Finished .*/, ''
|
66
|
+
cfg.gsub! /# Generated .*/, ''
|
67
|
+
comment cfg
|
68
|
+
end
|
69
|
+
|
70
|
+
#
|
71
|
+
# Show the saved debug configuration (admin debug-save).
|
72
|
+
#
|
73
|
+
cmd 'file type config.dbg' do |cfg|
|
74
|
+
#
|
75
|
+
# Strip carriage returns.
|
76
|
+
#
|
77
|
+
cfg.gsub! /\r/, ''
|
78
|
+
cfg.gsub! /# Finished .*/, ''
|
79
|
+
cfg.gsub! /# Generated .*/, ''
|
80
|
+
comment cfg
|
81
|
+
end
|
82
|
+
|
83
|
+
#
|
84
|
+
# Show the running persistent indices.
|
85
|
+
#
|
86
|
+
cmd 'admin display-config index' do |cfg|
|
87
|
+
#
|
88
|
+
# Strip carriage returns.
|
89
|
+
#
|
90
|
+
cfg.gsub! /\r/, ''
|
91
|
+
cfg.gsub! /# Finished .*/, ''
|
92
|
+
cfg.gsub! /# Generated .*/, ''
|
93
|
+
comment cfg
|
94
|
+
end
|
95
|
+
|
96
|
+
#
|
97
|
+
# Show the running configuration.
|
98
|
+
#
|
99
|
+
cmd 'admin display-config' do |cfg|
|
100
|
+
#
|
101
|
+
# Strip carriage returns.
|
102
|
+
#
|
103
|
+
cfg.gsub! /\r/, ''
|
104
|
+
cfg.gsub! /# Finished .*/, ''
|
105
|
+
cfg.gsub! /# Generated .*/, ''
|
106
|
+
end
|
107
|
+
|
108
|
+
cfg :telnet do
|
109
|
+
username /^Login: /
|
110
|
+
password /^Password: /
|
111
|
+
end
|
112
|
+
|
113
|
+
cfg :telnet, :ssh do
|
114
|
+
post_login 'environment no more'
|
115
|
+
pre_logout 'logout'
|
116
|
+
end
|
117
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
class StoneOS < Oxidized::Model
|
2
|
+
# Hillstone Networks StoneOS software
|
3
|
+
|
4
|
+
prompt /^\r?[\w.()-]+[#>](\s)?$/
|
5
|
+
comment '# '
|
6
|
+
|
7
|
+
expect /^\s.*--More--.*$/ do |data, re|
|
8
|
+
send ' '
|
9
|
+
data.sub re, ''
|
10
|
+
end
|
11
|
+
|
12
|
+
cmd :all do |cfg|
|
13
|
+
cfg.each_line.to_a[1..-2].join
|
14
|
+
end
|
15
|
+
|
16
|
+
cmd 'show configuration running'
|
17
|
+
|
18
|
+
cmd 'show version' do |cfg|
|
19
|
+
comment cfg
|
20
|
+
end
|
21
|
+
|
22
|
+
cfg :telnet do
|
23
|
+
username(/^login:/)
|
24
|
+
password(/^Password:/)
|
25
|
+
end
|
26
|
+
|
27
|
+
cfg :telnet, :ssh do
|
28
|
+
post_login 'terminal length 256'
|
29
|
+
post_login 'terminal width 512'
|
30
|
+
pre_logout 'exit'
|
31
|
+
end
|
32
|
+
end
|
@@ -1,45 +1,10 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
# Backward compatibility shim for deprecated model `supermicro`.
|
2
|
+
# Migrate your source from `supermicro` to `edgecos`.
|
3
3
|
|
4
|
-
|
5
|
-
cfg.gsub!(/password \d+ (\S+).*/, '<secret removed>')
|
6
|
-
cfg.gsub!(/community (\S+)/, 'community <hidden>')
|
7
|
-
cfg
|
8
|
-
end
|
4
|
+
require_relative 'edgecos.rb'
|
9
5
|
|
10
|
-
|
11
|
-
cfg.each_line.to_a[2..-2].join
|
12
|
-
end
|
6
|
+
Supermicro = EdgeCOS
|
13
7
|
|
14
|
-
|
8
|
+
Oxidized.logger.warn "Using deprecated model supermicro, use edgecos instead."
|
15
9
|
|
16
|
-
|
17
|
-
comment cfg
|
18
|
-
end
|
19
|
-
|
20
|
-
cmd 'show memory' do |cfg|
|
21
|
-
comment cfg
|
22
|
-
end
|
23
|
-
|
24
|
-
cmd 'show system' do |cfg|
|
25
|
-
comment cfg
|
26
|
-
end
|
27
|
-
|
28
|
-
cmd 'show version' do |cfg|
|
29
|
-
comment cfg
|
30
|
-
end
|
31
|
-
|
32
|
-
cmd 'show watchdog' do |cfg|
|
33
|
-
comment cfg
|
34
|
-
end
|
35
|
-
|
36
|
-
cfg :telnet do
|
37
|
-
username /^Username:/
|
38
|
-
password /^Password:/
|
39
|
-
end
|
40
|
-
|
41
|
-
cfg :telnet, :ssh do
|
42
|
-
post_login 'terminal length 0'
|
43
|
-
pre_logout 'exit'
|
44
|
-
end
|
45
|
-
end
|
10
|
+
# Deprecated
|
data/lib/oxidized/model/timos.rb
CHANGED
@@ -1,118 +1,10 @@
|
|
1
|
-
|
1
|
+
# Backward compatibility shim for deprecated model `timos`.
|
2
|
+
# Migrate your source from `timos` to `sros`.
|
2
3
|
|
3
|
-
|
4
|
-
# Nokia SR OS (TiMOS) (formerly TiMetra, Alcatel, Alcatel-Lucent).
|
5
|
-
# Used in 7705 SAR, 7210 SAS, 7450 ESS, 7750 SR, 7950 XRS, and NSP.
|
6
|
-
#
|
4
|
+
require_relative 'sros.rb'
|
7
5
|
|
8
|
-
|
6
|
+
TiMOS = SROS
|
9
7
|
|
10
|
-
|
8
|
+
Oxidized.logger.warn "Using deprecated model timos, use sros instead."
|
11
9
|
|
12
|
-
|
13
|
-
new_cfg = comment "COMMAND: #{cmdstring}\n"
|
14
|
-
new_cfg << cfg.each_line.to_a[1..-2].join
|
15
|
-
end
|
16
|
-
|
17
|
-
#
|
18
|
-
# Show the boot options file.
|
19
|
-
#
|
20
|
-
cmd 'show bof' do |cfg|
|
21
|
-
cfg.gsub! /# Finished .*/, ''
|
22
|
-
cfg.gsub! /# Generated .*/, ''
|
23
|
-
comment cfg
|
24
|
-
end
|
25
|
-
|
26
|
-
#
|
27
|
-
# Show the system information.
|
28
|
-
#
|
29
|
-
cmd 'show system information' do |cfg|
|
30
|
-
#
|
31
|
-
# Strip uptime.
|
32
|
-
#
|
33
|
-
cfg.sub! /^System Up Time.*\n/, ''
|
34
|
-
cfg.gsub! /# Finished .*/, ''
|
35
|
-
cfg.gsub! /# Generated .*/, ''
|
36
|
-
comment cfg
|
37
|
-
end
|
38
|
-
|
39
|
-
#
|
40
|
-
# Show the card state.
|
41
|
-
#
|
42
|
-
cmd 'show card state' do |cfg|
|
43
|
-
cfg.gsub! /# Finished .*/, ''
|
44
|
-
cfg.gsub! /# Generated .*/, ''
|
45
|
-
comment cfg
|
46
|
-
end
|
47
|
-
|
48
|
-
#
|
49
|
-
# Show the boot log.
|
50
|
-
#
|
51
|
-
cmd 'file type bootlog.txt' do |cfg|
|
52
|
-
#
|
53
|
-
# Strip carriage returns and backspaces.
|
54
|
-
#
|
55
|
-
cfg.gsub! /\r/, ''
|
56
|
-
cfg.gsub! /[\b][\b][\b]/, "\n"
|
57
|
-
cfg.gsub! /# Finished .*/, ''
|
58
|
-
cfg.gsub! /# Generated .*/, ''
|
59
|
-
comment cfg
|
60
|
-
end
|
61
|
-
|
62
|
-
#
|
63
|
-
# Show the running debug configuration.
|
64
|
-
#
|
65
|
-
cmd 'show debug' do |cfg|
|
66
|
-
cfg.gsub! /# Finished .*/, ''
|
67
|
-
cfg.gsub! /# Generated .*/, ''
|
68
|
-
comment cfg
|
69
|
-
end
|
70
|
-
|
71
|
-
#
|
72
|
-
# Show the saved debug configuration (admin debug-save).
|
73
|
-
#
|
74
|
-
cmd 'file type config.dbg' do |cfg|
|
75
|
-
#
|
76
|
-
# Strip carriage returns.
|
77
|
-
#
|
78
|
-
cfg.gsub! /\r/, ''
|
79
|
-
cfg.gsub! /# Finished .*/, ''
|
80
|
-
cfg.gsub! /# Generated .*/, ''
|
81
|
-
comment cfg
|
82
|
-
end
|
83
|
-
|
84
|
-
#
|
85
|
-
# Show the running persistent indices.
|
86
|
-
#
|
87
|
-
cmd 'admin display-config index' do |cfg|
|
88
|
-
#
|
89
|
-
# Strip carriage returns.
|
90
|
-
#
|
91
|
-
cfg.gsub! /\r/, ''
|
92
|
-
cfg.gsub! /# Finished .*/, ''
|
93
|
-
cfg.gsub! /# Generated .*/, ''
|
94
|
-
comment cfg
|
95
|
-
end
|
96
|
-
|
97
|
-
#
|
98
|
-
# Show the running configuration.
|
99
|
-
#
|
100
|
-
cmd 'admin display-config' do |cfg|
|
101
|
-
#
|
102
|
-
# Strip carriage returns.
|
103
|
-
#
|
104
|
-
cfg.gsub! /\r/, ''
|
105
|
-
cfg.gsub! /# Finished .*/, ''
|
106
|
-
cfg.gsub! /# Generated .*/, ''
|
107
|
-
end
|
108
|
-
|
109
|
-
cfg :telnet do
|
110
|
-
username /^Login: /
|
111
|
-
password /^Password: /
|
112
|
-
end
|
113
|
-
|
114
|
-
cfg :telnet, :ssh do
|
115
|
-
post_login 'environment no more'
|
116
|
-
pre_logout 'logout'
|
117
|
-
end
|
118
|
-
end
|
10
|
+
# Deprecated
|
data/lib/oxidized/model/tmos.rb
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
class TMOS < Oxidized::Model
|
2
|
-
|
3
2
|
comment '# '
|
4
3
|
|
5
4
|
cmd :secret do |cfg|
|
@@ -46,7 +45,6 @@ class TMOS < Oxidized::Model
|
|
46
45
|
cmd('cat /config/partitions/*/bigip.conf') { |cfg| comment cfg }
|
47
46
|
|
48
47
|
cfg :ssh do
|
49
|
-
exec true
|
48
|
+
exec true # don't run shell, run each command in exec channel
|
50
49
|
end
|
51
|
-
|
52
50
|
end
|
@@ -1,26 +1,25 @@
|
|
1
1
|
class TPLink < Oxidized::Model
|
2
|
-
|
3
2
|
# tp-link prompt
|
4
3
|
prompt /^\r?([\w.@()-]+[#>]\s?)$/
|
5
|
-
comment
|
4
|
+
comment '! '
|
6
5
|
|
7
6
|
# handle paging
|
8
7
|
# workaround for sometimes missing whitespaces with "\s?"
|
9
8
|
expect /Press\s?any\s?key\s?to\s?continue\s?\(Q\s?to\s?quit\)/ do |data, re|
|
10
|
-
|
11
|
-
|
9
|
+
send ' '
|
10
|
+
data.sub re, ''
|
12
11
|
end
|
13
12
|
|
14
13
|
# send carriage return because \n with the command is not enough
|
15
14
|
# checks if line ends with prompt >,# or \r,\nm otherwise send \r
|
16
15
|
expect /[^>#\r\n]$/ do |data, re|
|
17
|
-
|
18
|
-
|
16
|
+
send "\r"
|
17
|
+
data.sub re, ''
|
19
18
|
end
|
20
19
|
|
21
20
|
cmd :all do |cfg|
|
22
21
|
# normalize linefeeds
|
23
|
-
cfg.gsub! /(\r|\r\n|\n\r)/,"\n"
|
22
|
+
cfg.gsub! /(\r|\r\n|\n\r)/, "\n"
|
24
23
|
# remove empty lines
|
25
24
|
cfg.each_line.reject { |line| line.match /^[\r\n\s\u0000#]+$/ }.join
|
26
25
|
end
|
@@ -31,7 +30,7 @@ class TPLink < Oxidized::Model
|
|
31
30
|
cfg
|
32
31
|
end
|
33
32
|
|
34
|
-
cmd 'show system-info'
|
33
|
+
cmd 'show system-info' do |cfg|
|
35
34
|
comment cfg.each_line.to_a[3..-3].join
|
36
35
|
end
|
37
36
|
|
@@ -58,8 +57,5 @@ class TPLink < Oxidized::Model
|
|
58
57
|
send "exit\r"
|
59
58
|
send "logout\r"
|
60
59
|
end
|
61
|
-
|
62
60
|
end
|
63
|
-
|
64
61
|
end
|
65
|
-
|