oxidized 0.31.0 → 0.32.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +2 -3
- data/.rubocop.yml +1 -2
- data/.rubocop_todo.yml +6 -6
- data/CHANGELOG.md +32 -0
- data/Dockerfile +5 -2
- data/Rakefile +28 -0
- data/docs/Configuration.md +14 -2
- data/docs/Creating-Models.md +52 -22
- data/docs/DeviceSimulation.md +184 -0
- data/docs/Hooks.md +5 -5
- data/docs/Issues.md +15 -9
- data/docs/Model-Notes/APC_AOS.md +29 -16
- data/docs/Model-Notes/FSOS.md +1 -0
- data/docs/ModelUnitTests.md +186 -0
- data/docs/Supported-OS-Types.md +3 -2
- data/examples/podman-compose/Makefile +1 -2
- data/{examples/device-simulation → extra}/device2yaml.rb +32 -12
- data/extra/gitdiff-msteams.sh +32 -5
- data/extra/nagios_check_failing_nodes.rb +1 -1
- data/extra/rest_client.rb +1 -1
- data/lib/oxidized/config.rb +1 -1
- data/lib/oxidized/input/ssh.rb +13 -5
- data/lib/oxidized/model/aos7.rb +2 -0
- data/lib/oxidized/model/aosw.rb +1 -1
- data/lib/oxidized/model/apc_aos.rb +1 -1
- data/lib/oxidized/model/arubainstant.rb +1 -1
- data/lib/oxidized/model/asa.rb +2 -1
- data/lib/oxidized/model/asyncos.rb +1 -1
- data/lib/oxidized/model/cumulus.rb +16 -2
- data/lib/oxidized/model/enterprise_sonic.rb +46 -0
- data/lib/oxidized/model/fsos.rb +5 -1
- data/lib/oxidized/model/garderos.rb +4 -4
- data/lib/oxidized/model/junos.rb +1 -1
- data/lib/oxidized/model/kornfeldos.rb +33 -0
- data/lib/oxidized/model/model.rb +2 -2
- data/lib/oxidized/model/sonicos.rb +8 -2
- data/lib/oxidized/model/tplink.rb +1 -0
- data/lib/oxidized/model/xos.rb +1 -1
- data/lib/oxidized/source/source.rb +32 -2
- data/lib/oxidized/version.rb +2 -2
- data/oxidized.gemspec +7 -6
- metadata +33 -35
- data/examples/device-simulation/README.md +0 -173
- data/examples/device-simulation/cmdsets/aoscx +0 -9
- data/examples/device-simulation/cmdsets/arubainstant +0 -5
- data/examples/device-simulation/cmdsets/asa +0 -7
- data/examples/device-simulation/cmdsets/ios +0 -7
- data/examples/device-simulation/cmdsets/nxos +0 -5
- data/examples/device-simulation/cmdsets/routeros +0 -5
- data/examples/device-simulation/cmdsets/srosmd +0 -11
- data/examples/device-simulation/yaml/aoscx_R0X25A-6410_FL.10.10.1100.yaml +0 -2281
- data/examples/device-simulation/yaml/aoscx_R8N85A-C6000-48G-CL4_PL.10.08.1010.yaml +0 -451
- data/examples/device-simulation/yaml/arubainstant_IAP515_8.10.0.6_VWLC.yaml +0 -213
- data/examples/device-simulation/yaml/asa_5512_9.12-4-67_single-context.yaml +0 -531
- data/examples/device-simulation/yaml/asr920_16.8.1b.yaml +0 -1122
- data/examples/device-simulation/yaml/garderos_R7709_003_006_068.yaml +0 -101
- data/examples/device-simulation/yaml/iosxe_C9200L-24P-4G_17.09.04a.yaml +0 -514
- data/examples/device-simulation/yaml/iosxe_C9800-L-F-K9_17.06.05.yaml +0 -417
- data/examples/device-simulation/yaml/riverbed_915.yaml +0 -123
- data/examples/device-simulation/yaml/routeros_CHR_7.10.1.yaml +0 -145
- data/examples/device-simulation/yaml/routeros_CHR_7.16.yaml +0 -79
- data/examples/device-simulation/yaml/routeros_L009UiGS_7.15.2.yaml +0 -353
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
class KornfeldOS < Oxidized::Model
|
|
2
|
+
using Refinements
|
|
3
|
+
|
|
4
|
+
# For switches running Kornfeld OS
|
|
5
|
+
#
|
|
6
|
+
# Tested with : Kornfeld D1156 and Kornfeld D2132
|
|
7
|
+
|
|
8
|
+
comment '# '
|
|
9
|
+
|
|
10
|
+
cmd :all do |cfg|
|
|
11
|
+
cfg.gsub! /^% Invalid input detected at '\^' marker\.$|^\s+\^$/, ''
|
|
12
|
+
cfg.each_line.to_a[2..-2].join
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
cmd 'show version | except REPOSITORY | except docker | except Uptime' do |cfg|
|
|
16
|
+
comment cfg
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
cmd 'show platform firmware' do |cfg|
|
|
20
|
+
comment cfg
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
cmd 'show running-configuration' do |cfg|
|
|
24
|
+
cfg.each_line.to_a[0..-1].join
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
cfg :ssh do
|
|
28
|
+
username /^Login:/
|
|
29
|
+
password /^Password:/
|
|
30
|
+
post_login 'terminal length 0'
|
|
31
|
+
pre_logout 'exit'
|
|
32
|
+
end
|
|
33
|
+
end
|
data/lib/oxidized/model/model.rb
CHANGED
|
@@ -184,7 +184,7 @@ module Oxidized
|
|
|
184
184
|
end
|
|
185
185
|
|
|
186
186
|
def comment(str)
|
|
187
|
-
data = ''
|
|
187
|
+
data = String.new('')
|
|
188
188
|
str.each_line do |line|
|
|
189
189
|
data << self.class.comment << line
|
|
190
190
|
end
|
|
@@ -202,7 +202,7 @@ module Oxidized
|
|
|
202
202
|
# Also, XML Comments must not contain --. So we put a space between
|
|
203
203
|
# any double hyphens, by replacing any - that is followed by another -
|
|
204
204
|
# with '- '
|
|
205
|
-
data = ''
|
|
205
|
+
data = String.new('')
|
|
206
206
|
str.each_line do |_line|
|
|
207
207
|
data << '<!-- ' << str.gsub(/-(?=-)/, '- ').chomp << " -->\n"
|
|
208
208
|
end
|
|
@@ -3,8 +3,14 @@ class SonicOS < Oxidized::Model
|
|
|
3
3
|
|
|
4
4
|
# Applies to Sonicwall NSA series firewalls
|
|
5
5
|
|
|
6
|
-
prompt /^\w
|
|
7
|
-
comment
|
|
6
|
+
prompt /^\w+@[\w\-]+[>]\(?.+\)?\s?/
|
|
7
|
+
comment '! '
|
|
8
|
+
|
|
9
|
+
# Accept policiy message (see Issue #3339). Tested on 6.5 and 7.1
|
|
10
|
+
expect /Accept The Policy Banner \(yes\)\?\r\nyes: $/ do |data, re|
|
|
11
|
+
send "yes\n"
|
|
12
|
+
data.sub re, ''
|
|
13
|
+
end
|
|
8
14
|
|
|
9
15
|
cmd :all do |cfg|
|
|
10
16
|
cfg.each_line.to_a[1..-2].join
|
data/lib/oxidized/model/xos.rb
CHANGED
|
@@ -13,7 +13,7 @@ class XOS < Oxidized::Model
|
|
|
13
13
|
end
|
|
14
14
|
|
|
15
15
|
cmd :secret do |cfg|
|
|
16
|
-
cfg.gsub! /^(configure radius (netlogin|mgmt-access) (primary|secondary) shared-secret encrypted).+/, '\\1 <secret hidden>'
|
|
16
|
+
cfg.gsub! /^(configure (radius|radius-accounting) (netlogin|mgmt-access) (primary|secondary) shared-secret encrypted).+/, '\\1 <secret hidden>'
|
|
17
17
|
cfg.gsub! /^(configure account admin encrypted).+/, '\\1 <secret hidden>'
|
|
18
18
|
cfg.gsub! /^(create account (admin|user) (.+) encrypted).+/, '\\1 <secret hidden>'
|
|
19
19
|
cfg
|
|
@@ -8,12 +8,42 @@ module Oxidized
|
|
|
8
8
|
@group_map = Oxidized.config.group_map || {}
|
|
9
9
|
end
|
|
10
10
|
|
|
11
|
+
# common code of #map_model and #map_group
|
|
12
|
+
def map_value(map_hash, original_value)
|
|
13
|
+
map_hash.each do |key, new_value|
|
|
14
|
+
mthd = key.instance_of?(Regexp) ? :match : :eql?
|
|
15
|
+
return new_value if original_value.send(mthd, key)
|
|
16
|
+
end
|
|
17
|
+
original_value
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
# search a match for model in the configuration and returns it.
|
|
21
|
+
# If no match is found, return model
|
|
22
|
+
#
|
|
23
|
+
# model can be matched against a string or a regexp:
|
|
24
|
+
#
|
|
25
|
+
# model_map:
|
|
26
|
+
# cisco: ios
|
|
27
|
+
# juniper: junos
|
|
28
|
+
# !ruby/regexp /procurve/: procurve
|
|
11
29
|
def map_model(model)
|
|
12
|
-
|
|
30
|
+
map_value(@model_map, model)
|
|
13
31
|
end
|
|
14
32
|
|
|
33
|
+
# search a match for group in the configuration and returns it.
|
|
34
|
+
# If no match is found, return group
|
|
35
|
+
#
|
|
36
|
+
# group can be matched against a string or a regexp:
|
|
37
|
+
#
|
|
38
|
+
# group_map:
|
|
39
|
+
# alias1: groupA
|
|
40
|
+
# alias2: groupA
|
|
41
|
+
# alias3: groupB
|
|
42
|
+
# alias4: groupB
|
|
43
|
+
# !ruby/regexp /specialgroup/: groupS
|
|
44
|
+
# aliasN: groupZ
|
|
15
45
|
def map_group(group)
|
|
16
|
-
|
|
46
|
+
map_value(@group_map, group)
|
|
17
47
|
end
|
|
18
48
|
|
|
19
49
|
def node_var_interpolate(var)
|
data/lib/oxidized/version.rb
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
module Oxidized
|
|
2
|
-
VERSION = '0.
|
|
3
|
-
VERSION_FULL = '0.
|
|
2
|
+
VERSION = '0.32.0'.freeze
|
|
3
|
+
VERSION_FULL = '0.32.0'.freeze
|
|
4
4
|
def self.version_set
|
|
5
5
|
version_full = %x(git describe --tags).chop rescue ""
|
|
6
6
|
version = %x(git describe --tags --abbrev=0).chop rescue ""
|
data/oxidized.gemspec
CHANGED
|
@@ -26,20 +26,21 @@ Gem::Specification.new do |s|
|
|
|
26
26
|
s.add_dependency 'ed25519', '~> 1.2'
|
|
27
27
|
s.add_dependency 'net-ftp', '~> 0.2'
|
|
28
28
|
s.add_dependency 'net-http-digest_auth', '~> 1.4'
|
|
29
|
-
s.add_dependency 'net-scp', '~> 4.
|
|
29
|
+
s.add_dependency 'net-scp', '~> 4.1'
|
|
30
30
|
s.add_dependency 'net-ssh', '~> 7.3'
|
|
31
31
|
s.add_dependency 'net-telnet', '~> 0.2'
|
|
32
|
+
s.add_dependency 'ostruct', '~> 0.6'
|
|
32
33
|
s.add_dependency 'psych', '~> 5.0'
|
|
33
34
|
s.add_dependency 'rugged', '~> 1.6'
|
|
34
35
|
s.add_dependency 'slop', '~> 4.6'
|
|
35
36
|
|
|
36
37
|
s.add_development_dependency 'bundler', '~> 2.2'
|
|
37
38
|
s.add_development_dependency 'git', '~> 2'
|
|
38
|
-
s.add_development_dependency 'minitest', '~> 5.
|
|
39
|
+
s.add_development_dependency 'minitest', '~> 5.25.4'
|
|
39
40
|
s.add_development_dependency 'mocha', '~> 2.1'
|
|
40
|
-
s.add_development_dependency 'pry', '~> 0.
|
|
41
|
+
s.add_development_dependency 'pry', '~> 0.15.0'
|
|
41
42
|
s.add_development_dependency 'rake', '~> 13.0'
|
|
42
|
-
s.add_development_dependency 'rubocop', '~> 1.
|
|
43
|
+
s.add_development_dependency 'rubocop', '~> 1.72.0'
|
|
43
44
|
s.add_development_dependency 'rubocop-minitest', '~> 0.36.0'
|
|
44
45
|
s.add_development_dependency 'rubocop-rake', '~> 0.6.0'
|
|
45
46
|
s.add_development_dependency 'rubocop-sequel', '~> 0.3.3'
|
|
@@ -48,6 +49,6 @@ Gem::Specification.new do |s|
|
|
|
48
49
|
s.add_development_dependency 'simplecov-html', '~> 0.13.1'
|
|
49
50
|
|
|
50
51
|
# Dependencies on optional libraries, used for unit tests & development
|
|
51
|
-
s.add_development_dependency 'oxidized-web', '>= 0.
|
|
52
|
-
s.add_development_dependency 'sequel', '~> 5.
|
|
52
|
+
s.add_development_dependency 'oxidized-web', '>= 0.15.0'
|
|
53
|
+
s.add_development_dependency 'sequel', '~> 5.88.0'
|
|
53
54
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: oxidized
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.32.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Saku Ytti
|
|
@@ -10,7 +10,7 @@ authors:
|
|
|
10
10
|
autorequire:
|
|
11
11
|
bindir: bin
|
|
12
12
|
cert_chain: []
|
|
13
|
-
date:
|
|
13
|
+
date: 2025-02-17 00:00:00.000000000 Z
|
|
14
14
|
dependencies:
|
|
15
15
|
- !ruby/object:Gem::Dependency
|
|
16
16
|
name: asetus
|
|
@@ -88,14 +88,14 @@ dependencies:
|
|
|
88
88
|
requirements:
|
|
89
89
|
- - "~>"
|
|
90
90
|
- !ruby/object:Gem::Version
|
|
91
|
-
version: '4.
|
|
91
|
+
version: '4.1'
|
|
92
92
|
type: :runtime
|
|
93
93
|
prerelease: false
|
|
94
94
|
version_requirements: !ruby/object:Gem::Requirement
|
|
95
95
|
requirements:
|
|
96
96
|
- - "~>"
|
|
97
97
|
- !ruby/object:Gem::Version
|
|
98
|
-
version: '4.
|
|
98
|
+
version: '4.1'
|
|
99
99
|
- !ruby/object:Gem::Dependency
|
|
100
100
|
name: net-ssh
|
|
101
101
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -124,6 +124,20 @@ dependencies:
|
|
|
124
124
|
- - "~>"
|
|
125
125
|
- !ruby/object:Gem::Version
|
|
126
126
|
version: '0.2'
|
|
127
|
+
- !ruby/object:Gem::Dependency
|
|
128
|
+
name: ostruct
|
|
129
|
+
requirement: !ruby/object:Gem::Requirement
|
|
130
|
+
requirements:
|
|
131
|
+
- - "~>"
|
|
132
|
+
- !ruby/object:Gem::Version
|
|
133
|
+
version: '0.6'
|
|
134
|
+
type: :runtime
|
|
135
|
+
prerelease: false
|
|
136
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
137
|
+
requirements:
|
|
138
|
+
- - "~>"
|
|
139
|
+
- !ruby/object:Gem::Version
|
|
140
|
+
version: '0.6'
|
|
127
141
|
- !ruby/object:Gem::Dependency
|
|
128
142
|
name: psych
|
|
129
143
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -200,14 +214,14 @@ dependencies:
|
|
|
200
214
|
requirements:
|
|
201
215
|
- - "~>"
|
|
202
216
|
- !ruby/object:Gem::Version
|
|
203
|
-
version:
|
|
217
|
+
version: 5.25.4
|
|
204
218
|
type: :development
|
|
205
219
|
prerelease: false
|
|
206
220
|
version_requirements: !ruby/object:Gem::Requirement
|
|
207
221
|
requirements:
|
|
208
222
|
- - "~>"
|
|
209
223
|
- !ruby/object:Gem::Version
|
|
210
|
-
version:
|
|
224
|
+
version: 5.25.4
|
|
211
225
|
- !ruby/object:Gem::Dependency
|
|
212
226
|
name: mocha
|
|
213
227
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -228,14 +242,14 @@ dependencies:
|
|
|
228
242
|
requirements:
|
|
229
243
|
- - "~>"
|
|
230
244
|
- !ruby/object:Gem::Version
|
|
231
|
-
version: 0.
|
|
245
|
+
version: 0.15.0
|
|
232
246
|
type: :development
|
|
233
247
|
prerelease: false
|
|
234
248
|
version_requirements: !ruby/object:Gem::Requirement
|
|
235
249
|
requirements:
|
|
236
250
|
- - "~>"
|
|
237
251
|
- !ruby/object:Gem::Version
|
|
238
|
-
version: 0.
|
|
252
|
+
version: 0.15.0
|
|
239
253
|
- !ruby/object:Gem::Dependency
|
|
240
254
|
name: rake
|
|
241
255
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -256,14 +270,14 @@ dependencies:
|
|
|
256
270
|
requirements:
|
|
257
271
|
- - "~>"
|
|
258
272
|
- !ruby/object:Gem::Version
|
|
259
|
-
version: 1.
|
|
273
|
+
version: 1.72.0
|
|
260
274
|
type: :development
|
|
261
275
|
prerelease: false
|
|
262
276
|
version_requirements: !ruby/object:Gem::Requirement
|
|
263
277
|
requirements:
|
|
264
278
|
- - "~>"
|
|
265
279
|
- !ruby/object:Gem::Version
|
|
266
|
-
version: 1.
|
|
280
|
+
version: 1.72.0
|
|
267
281
|
- !ruby/object:Gem::Dependency
|
|
268
282
|
name: rubocop-minitest
|
|
269
283
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -354,28 +368,28 @@ dependencies:
|
|
|
354
368
|
requirements:
|
|
355
369
|
- - ">="
|
|
356
370
|
- !ruby/object:Gem::Version
|
|
357
|
-
version: 0.
|
|
371
|
+
version: 0.15.0
|
|
358
372
|
type: :development
|
|
359
373
|
prerelease: false
|
|
360
374
|
version_requirements: !ruby/object:Gem::Requirement
|
|
361
375
|
requirements:
|
|
362
376
|
- - ">="
|
|
363
377
|
- !ruby/object:Gem::Version
|
|
364
|
-
version: 0.
|
|
378
|
+
version: 0.15.0
|
|
365
379
|
- !ruby/object:Gem::Dependency
|
|
366
380
|
name: sequel
|
|
367
381
|
requirement: !ruby/object:Gem::Requirement
|
|
368
382
|
requirements:
|
|
369
383
|
- - "~>"
|
|
370
384
|
- !ruby/object:Gem::Version
|
|
371
|
-
version:
|
|
385
|
+
version: 5.88.0
|
|
372
386
|
type: :development
|
|
373
387
|
prerelease: false
|
|
374
388
|
version_requirements: !ruby/object:Gem::Requirement
|
|
375
389
|
requirements:
|
|
376
390
|
- - "~>"
|
|
377
391
|
- !ruby/object:Gem::Version
|
|
378
|
-
version:
|
|
392
|
+
version: 5.88.0
|
|
379
393
|
description: software to fetch configuration from network devices and store them
|
|
380
394
|
email:
|
|
381
395
|
- saku@ytti.fi
|
|
@@ -408,6 +422,7 @@ files:
|
|
|
408
422
|
- bin/oxidized
|
|
409
423
|
- docs/Configuration.md
|
|
410
424
|
- docs/Creating-Models.md
|
|
425
|
+
- docs/DeviceSimulation.md
|
|
411
426
|
- docs/Hooks.md
|
|
412
427
|
- docs/Issues.md
|
|
413
428
|
- docs/Model-Notes/ADVA.md
|
|
@@ -437,33 +452,13 @@ files:
|
|
|
437
452
|
- docs/Model-Notes/VRP-Huawei.md
|
|
438
453
|
- docs/Model-Notes/Viptela.md
|
|
439
454
|
- docs/Model-Notes/XGS4600-Zyxel.md
|
|
455
|
+
- docs/ModelUnitTests.md
|
|
440
456
|
- docs/Outputs.md
|
|
441
457
|
- docs/Release.md
|
|
442
458
|
- docs/Ruby-API.md
|
|
443
459
|
- docs/Sources.md
|
|
444
460
|
- docs/Supported-OS-Types.md
|
|
445
461
|
- docs/Troubleshooting.md
|
|
446
|
-
- examples/device-simulation/README.md
|
|
447
|
-
- examples/device-simulation/cmdsets/aoscx
|
|
448
|
-
- examples/device-simulation/cmdsets/arubainstant
|
|
449
|
-
- examples/device-simulation/cmdsets/asa
|
|
450
|
-
- examples/device-simulation/cmdsets/ios
|
|
451
|
-
- examples/device-simulation/cmdsets/nxos
|
|
452
|
-
- examples/device-simulation/cmdsets/routeros
|
|
453
|
-
- examples/device-simulation/cmdsets/srosmd
|
|
454
|
-
- examples/device-simulation/device2yaml.rb
|
|
455
|
-
- examples/device-simulation/yaml/aoscx_R0X25A-6410_FL.10.10.1100.yaml
|
|
456
|
-
- examples/device-simulation/yaml/aoscx_R8N85A-C6000-48G-CL4_PL.10.08.1010.yaml
|
|
457
|
-
- examples/device-simulation/yaml/arubainstant_IAP515_8.10.0.6_VWLC.yaml
|
|
458
|
-
- examples/device-simulation/yaml/asa_5512_9.12-4-67_single-context.yaml
|
|
459
|
-
- examples/device-simulation/yaml/asr920_16.8.1b.yaml
|
|
460
|
-
- examples/device-simulation/yaml/garderos_R7709_003_006_068.yaml
|
|
461
|
-
- examples/device-simulation/yaml/iosxe_C9200L-24P-4G_17.09.04a.yaml
|
|
462
|
-
- examples/device-simulation/yaml/iosxe_C9800-L-F-K9_17.06.05.yaml
|
|
463
|
-
- examples/device-simulation/yaml/riverbed_915.yaml
|
|
464
|
-
- examples/device-simulation/yaml/routeros_CHR_7.10.1.yaml
|
|
465
|
-
- examples/device-simulation/yaml/routeros_CHR_7.16.yaml
|
|
466
|
-
- examples/device-simulation/yaml/routeros_L009UiGS_7.15.2.yaml
|
|
467
462
|
- examples/podman-compose/Makefile
|
|
468
463
|
- examples/podman-compose/README.md
|
|
469
464
|
- examples/podman-compose/docker-compose.yml
|
|
@@ -479,6 +474,7 @@ files:
|
|
|
479
474
|
- examples/podman-compose/oxidized-ssh/.gitignore
|
|
480
475
|
- examples/podman-compose/oxidized-ssh/README.md
|
|
481
476
|
- extra/auto-reload-config.runit
|
|
477
|
+
- extra/device2yaml.rb
|
|
482
478
|
- extra/gitdiff-msteams.sh
|
|
483
479
|
- extra/nagios_check_failing_nodes.rb
|
|
484
480
|
- extra/oxidized-report-git-commits
|
|
@@ -582,6 +578,7 @@ files:
|
|
|
582
578
|
- lib/oxidized/model/eltex.rb
|
|
583
579
|
- lib/oxidized/model/enterasys.rb
|
|
584
580
|
- lib/oxidized/model/enterasys800.rb
|
|
581
|
+
- lib/oxidized/model/enterprise_sonic.rb
|
|
585
582
|
- lib/oxidized/model/eos.rb
|
|
586
583
|
- lib/oxidized/model/f5os.rb
|
|
587
584
|
- lib/oxidized/model/fabricos.rb
|
|
@@ -615,6 +612,7 @@ files:
|
|
|
615
612
|
- lib/oxidized/model/ironware.rb
|
|
616
613
|
- lib/oxidized/model/isam.rb
|
|
617
614
|
- lib/oxidized/model/junos.rb
|
|
615
|
+
- lib/oxidized/model/kornfeldos.rb
|
|
618
616
|
- lib/oxidized/model/lancom.rb
|
|
619
617
|
- lib/oxidized/model/lenovonos.rb
|
|
620
618
|
- lib/oxidized/model/linksyssrw.rb
|
|
@@ -1,173 +0,0 @@
|
|
|
1
|
-
# Device simulation
|
|
2
|
-
Oxidized supports [150+ devices](/docs/Supported-OS-Types.md).
|
|
3
|
-
No developer has access to all of these devices, which makes the task of
|
|
4
|
-
maintaining Oxidized difficult:
|
|
5
|
-
|
|
6
|
-
- issues can't be resolved because the developer has no access to the device.
|
|
7
|
-
- further developments can produce regressions.
|
|
8
|
-
|
|
9
|
-
In order to address this, we can simulate the devices. An example for a
|
|
10
|
-
simulation are the [model unit tests](/spec/model) but one could also simulate
|
|
11
|
-
a device within a ssh server.
|
|
12
|
-
|
|
13
|
-
The simulation of devices is currently focused on ssh-based devices. This may
|
|
14
|
-
be extended to other inputs like telnet or ftp in the future.
|
|
15
|
-
|
|
16
|
-
## YAML Simulation Data
|
|
17
|
-
The underlying data for the simulation is a [YAML](https://yaml.org/) file in
|
|
18
|
-
which we store all relevant information about the device. The most important
|
|
19
|
-
information is the responses to the commands used in the oxidized models.
|
|
20
|
-
|
|
21
|
-
The YAML simulation files are stored under
|
|
22
|
-
[/examples/device-simulation/yaml/](/examples/device-simulation/yaml/).
|
|
23
|
-
|
|
24
|
-
### Creating a YAML file with device2yaml.rb
|
|
25
|
-
A device does not only output the ASCII text we can see in the console.
|
|
26
|
-
It adds ANSI-escape code for nice colors, bold and underline, \r and so on.
|
|
27
|
-
These are key factors in prompt issues so they must be represented in the YAML
|
|
28
|
-
file. We use the ruby string format with interpolations like \r \e and so on.
|
|
29
|
-
Another important point is trailing spaces at the end of lines. Some text
|
|
30
|
-
editors automatically remove trailing spaces, so we code them with \x20.
|
|
31
|
-
|
|
32
|
-
Although a YAML file could be written by hand, this is quite a tedious task to
|
|
33
|
-
catch all the extra codes and code them into YAML. This can be
|
|
34
|
-
automated with the ruby script
|
|
35
|
-
[device2yaml.rb](/examples/device-simulation/device2yaml.rb).
|
|
36
|
-
|
|
37
|
-
`device2yaml.rb` needs ruby and the gem
|
|
38
|
-
[net-ssh](https://rubygems.org/gems/net-ssh/) to run. On debian, you can install
|
|
39
|
-
them with `sudo apt install ruby-net-ssh`
|
|
40
|
-
|
|
41
|
-
Run `device2yaml.rb` in the directory `/examples/device-simulation/`, the
|
|
42
|
-
online help tells you the options.
|
|
43
|
-
```
|
|
44
|
-
device-simulation$ ./device2yaml.rb
|
|
45
|
-
Missing a host to connect to...
|
|
46
|
-
|
|
47
|
-
Usage: device2yaml.rb [user@]host [options]
|
|
48
|
-
-c, --cmdset file Mandatory: specify the commands to be run
|
|
49
|
-
-o, --output file Specify an output YAML-file
|
|
50
|
-
-t, --timeout value Specify the idle timeout beween commands (default: 5 seconds)
|
|
51
|
-
-e, --exec-mode Run ssh in exec mode (without tty)
|
|
52
|
-
-h, --help Print this help
|
|
53
|
-
```
|
|
54
|
-
|
|
55
|
-
- `[user@]host` specifies the user and host to connect to the device. The
|
|
56
|
-
password will be prompted interactively by the script. If you do not specify a
|
|
57
|
-
user, it will use the user executing the script.
|
|
58
|
-
- You must list the commands you want to run on the device in a file. Just
|
|
59
|
-
enter one command per line. It is important that you enter exactly the commands
|
|
60
|
-
used by the oxidized model, and no abbreviation like `sh run`. Do not forget
|
|
61
|
-
to insert the `post_login` commands at the beginning if the model has some and
|
|
62
|
-
also the `pre_logout`commands at the end.
|
|
63
|
-
Predefined command sets for some models are stored in
|
|
64
|
-
`/examples/device-simulation/cmdsets`.
|
|
65
|
-
- `device2yaml.rb` waits an idle timeout after the last received data before
|
|
66
|
-
sending the next command. The default is 5 seconds. If your device makes a
|
|
67
|
-
longer pause than 5 seconds before or within a command, you will see that the
|
|
68
|
-
output of the command is shortened or slips into the next command in the yaml
|
|
69
|
-
file. You will have to change the idle timeout to a greater value to address
|
|
70
|
-
this.
|
|
71
|
-
- When run without the output argument, `device2yaml.rb` will only print the ssh
|
|
72
|
-
output to the standard output. You must use `-o <model_HW_SW.yaml>` to store the
|
|
73
|
-
collected data in a YAML file.
|
|
74
|
-
- If your oxidized model uses ssh exec mode (look for `exec true` in the model),
|
|
75
|
-
you will have to use the option `-e` to run device2yaml in ssh exec mode.
|
|
76
|
-
|
|
77
|
-
Note that `device2yaml.rb` takes some time to run because of the idle
|
|
78
|
-
timeout of (default) 5 seconds between each command. You can press the "Escape"
|
|
79
|
-
key if you know there is no more data to come for the current command (when you
|
|
80
|
-
see the prompt for the next command), and the script will stop waiting and
|
|
81
|
-
directly process the next command.
|
|
82
|
-
|
|
83
|
-
Here are two examples of how to run the script:
|
|
84
|
-
```shell
|
|
85
|
-
./device2yaml.rb OX-SW123.sample.domain -c cmdsets/aoscx -o yaml/aoscx_R8N85A-C6000-48G-CL4_PL.10.08.1010.yaml
|
|
86
|
-
./device2yaml.rb admin@r7 -c cmdsets/routeros -e -o yaml/routeros_CHR_7.10.1.yaml
|
|
87
|
-
```
|
|
88
|
-
|
|
89
|
-
### Publishing the YAML simulation file to oxidized
|
|
90
|
-
Publishing the YAML simulation file of your device helps maintain oxidized.
|
|
91
|
-
This task may take some time, and we are very grateful that you take this time
|
|
92
|
-
for the community!
|
|
93
|
-
|
|
94
|
-
You should pay attention to removing or replacing anything you don't want to
|
|
95
|
-
share with the rest of the world, for example:
|
|
96
|
-
|
|
97
|
-
- Passwords
|
|
98
|
-
- IP Adresses
|
|
99
|
-
- Serial numbers
|
|
100
|
-
|
|
101
|
-
You can also shorten the configuration if you want - we don't need 48 times the
|
|
102
|
-
same config for each interface, but it doesn't hurt either.
|
|
103
|
-
|
|
104
|
-
Take your time, this is an important task: after you have
|
|
105
|
-
uploaded your file on github, it may be impossible to remove it. You can use
|
|
106
|
-
search/replace to make consistent and faster changes (change the hostname).
|
|
107
|
-
|
|
108
|
-
You can leave the section `oxidized_output` unchanged, it is only used for
|
|
109
|
-
[model unit tests](/spec/model). You will find an explanation of how to produce
|
|
110
|
-
the `oxidized_output`-section in the README.md there.
|
|
111
|
-
|
|
112
|
-
The YAML simulation file should be stored under
|
|
113
|
-
[/examples/device-simulation/yaml/](/examples/device-simulation/yaml/. It
|
|
114
|
-
should be named so that it can be easily recognized: model, hardware type,
|
|
115
|
-
software version and optionally a description if you need to differentiate two
|
|
116
|
-
YAML files:
|
|
117
|
-
|
|
118
|
-
- #model_#hardware_#software.yaml
|
|
119
|
-
- #model_#hardware_#software_#description.yaml
|
|
120
|
-
|
|
121
|
-
Examples:
|
|
122
|
-
|
|
123
|
-
- garderos_R7709_003_006_068.yaml
|
|
124
|
-
- iosxe_C9200L-24P-4G_17.09.04a.yaml
|
|
125
|
-
- asa_5512_9.12-4-67_single-context.yaml
|
|
126
|
-
|
|
127
|
-
### Interactive mode
|
|
128
|
-
The `device2yaml.rb` script is a little dumb and needs some help, especially
|
|
129
|
-
when having a device sending its output page by page and requiring you to press
|
|
130
|
-
space for the next page. `device2yaml.rb` does not know how to handle this.
|
|
131
|
-
|
|
132
|
-
While `device2yaml.rb` is running, you can type anything to the keyboard, it
|
|
133
|
-
will be send to the remote device. So you can press space or 'n' to get the
|
|
134
|
-
next page.
|
|
135
|
-
|
|
136
|
-
You can also use this to enter an enable password.
|
|
137
|
-
|
|
138
|
-
If you press the "Esc" key, `device2yaml.rb` will not wait for the idle timeout
|
|
139
|
-
and will process the next command right away.
|
|
140
|
-
|
|
141
|
-
### YAML Format
|
|
142
|
-
The yaml file has three sections:
|
|
143
|
-
- init_prompt: describing the lines send by the device before we can send a
|
|
144
|
-
command. It usually includes MOTD banners, and must include the first prompt.
|
|
145
|
-
- commands: the commands the oxidized model sends to the network device and the
|
|
146
|
-
expected output.
|
|
147
|
-
- oxidized_output: the expected output of oxidized, so that you can compare it
|
|
148
|
-
to the output generated by the unit test. This is optional and only used for
|
|
149
|
-
unit tests.
|
|
150
|
-
|
|
151
|
-
The outputs are multiline and use YAML block scalars (`|`), with the trailing \n
|
|
152
|
-
removed (`-` after `|`). The outputs include the echo of the given command and
|
|
153
|
-
the next prompt. Escape characters are coded in Ruby style (\n, \r...).
|
|
154
|
-
|
|
155
|
-
Here is a shortened example of a YAML file:
|
|
156
|
-
```yaml
|
|
157
|
-
---
|
|
158
|
-
init_prompt: |-
|
|
159
|
-
\e[4m\rLAB-R1234_Garderos#\e[m\x20
|
|
160
|
-
commands:
|
|
161
|
-
show system version: |-
|
|
162
|
-
show system version
|
|
163
|
-
grs-gwuz-armel/003_005_068 (Garderos; 2021-04-30 16:19:35)
|
|
164
|
-
\e[4m\rLAB-R1234_Garderos#\e[m\x20
|
|
165
|
-
# ...
|
|
166
|
-
exit: ""
|
|
167
|
-
oxidized_output: |
|
|
168
|
-
# grs-gwuz-armel/003_005_068 (Garderos; 2021-04-30 16:19:35)
|
|
169
|
-
#\x20
|
|
170
|
-
# ...
|
|
171
|
-
```
|
|
172
|
-
|
|
173
|
-
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
environment more false
|
|
2
|
-
show system information
|
|
3
|
-
show card state
|
|
4
|
-
show chassis
|
|
5
|
-
file show bootlog.txt
|
|
6
|
-
admin show configuration debug full-context
|
|
7
|
-
file show config.dbg
|
|
8
|
-
admin show configuration configure | match persistent-indices post-lines 10000
|
|
9
|
-
admin show configuration bof full-context
|
|
10
|
-
admin show configuration configure full-context
|
|
11
|
-
logout
|