oxidized 0.33.0 → 0.34.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/ISSUE_TEMPLATE/bug_report.md +4 -1
- data/.github/ISSUE_TEMPLATE/support-request.md +4 -1
- data/.github/workflows/ruby.yml +4 -2
- data/.gitignore +1 -0
- data/.rubocop.yml +29 -6
- data/.rubocop_todo.yml +2 -35
- data/CHANGELOG.md +49 -0
- data/CONTRIBUTING.md +10 -3
- data/Dockerfile +4 -4
- data/README.md +52 -55
- data/Rakefile +2 -3
- data/docs/Configuration.md +97 -0
- data/docs/DeviceSimulation.md +19 -7
- data/docs/Docker.md +9 -4
- data/docs/Issues.md +11 -2
- data/docs/ModelUnitTests.md +35 -25
- data/docs/Outputs.md +83 -2
- data/docs/Release.md +30 -22
- data/docs/Supported-OS-Types.md +4 -0
- data/docs/Troubleshooting.md +4 -18
- data/extra/device2yaml.rb +24 -9
- data/extra/rest_client.rb +2 -1
- data/extra/syslog.rb +8 -3
- data/lib/oxidized/cli.rb +7 -3
- data/lib/oxidized/config/vars.rb +7 -3
- data/lib/oxidized/config.rb +0 -1
- data/lib/oxidized/core.rb +5 -4
- data/lib/oxidized/hook/ciscosparkdiff.rb +11 -9
- data/lib/oxidized/hook/exec.rb +5 -4
- data/lib/oxidized/hook/githubrepo.rb +23 -17
- data/lib/oxidized/hook/noophook.rb +2 -2
- data/lib/oxidized/hook/slackdiff.rb +9 -8
- data/lib/oxidized/hook/xmppdiff.rb +9 -9
- data/lib/oxidized/hook.rb +10 -8
- data/lib/oxidized/input/cli.rb +8 -3
- data/lib/oxidized/input/exec.rb +1 -1
- data/lib/oxidized/input/ftp.rb +2 -2
- data/lib/oxidized/input/http.rb +5 -5
- data/lib/oxidized/input/input.rb +1 -0
- data/lib/oxidized/input/scp.rb +2 -2
- data/lib/oxidized/input/ssh.rb +21 -14
- data/lib/oxidized/input/telnet.rb +3 -3
- data/lib/oxidized/input/tftp.rb +1 -1
- data/lib/oxidized/job.rb +7 -4
- data/lib/oxidized/logger.rb +51 -0
- data/lib/oxidized/model/acos.rb +1 -0
- data/lib/oxidized/model/aos7.rb +6 -0
- data/lib/oxidized/model/aoscx.rb +2 -0
- data/lib/oxidized/model/aosw.rb +22 -17
- data/lib/oxidized/model/aricentiss.rb +2 -2
- data/lib/oxidized/model/asa.rb +3 -3
- data/lib/oxidized/model/awplus.rb +13 -10
- data/lib/oxidized/model/edgecos.rb +2 -1
- data/lib/oxidized/model/edgeos.rb +7 -6
- data/lib/oxidized/model/edgeswitch.rb +3 -1
- data/lib/oxidized/model/efos.rb +41 -0
- data/lib/oxidized/model/eltex.rb +1 -1
- data/lib/oxidized/model/fabricos.rb +1 -1
- data/lib/oxidized/model/fastiron.rb +3 -1
- data/lib/oxidized/model/firelinuxos.rb +12 -3
- data/lib/oxidized/model/fortios.rb +2 -1
- data/lib/oxidized/model/gaiaos.rb +4 -4
- data/lib/oxidized/model/ios.rb +15 -5
- data/lib/oxidized/model/ironware.rb +1 -1
- data/lib/oxidized/model/junos.rb +4 -0
- data/lib/oxidized/model/linksyssrw.rb +3 -3
- data/lib/oxidized/model/mlnxos.rb +14 -7
- data/lib/oxidized/model/model.rb +4 -3
- data/lib/oxidized/model/netgear.rb +2 -0
- data/lib/oxidized/model/nsxdfw.rb +2 -1
- data/lib/oxidized/model/nsxfirewall.rb +2 -1
- data/lib/oxidized/model/nxos.rb +2 -2
- data/lib/oxidized/model/openwrt.rb +6 -6
- data/lib/oxidized/model/procurve.rb +3 -1
- data/lib/oxidized/model/qtech.rb +3 -1
- data/lib/oxidized/model/quantaos.rb +8 -6
- data/lib/oxidized/model/routeros.rb +3 -2
- data/lib/oxidized/model/saos10.rb +38 -0
- data/lib/oxidized/model/sixwind.rb +28 -0
- data/lib/oxidized/model/sonicos.rb +1 -1
- data/lib/oxidized/model/supermicro.rb +1 -1
- data/lib/oxidized/model/timos.rb +1 -1
- data/lib/oxidized/model/tmos.rb +1 -0
- data/lib/oxidized/model/tnsr.rb +53 -0
- data/lib/oxidized/model/trango.rb +3 -1
- data/lib/oxidized/model/unifiap.rb +7 -5
- data/lib/oxidized/model/vrp.rb +3 -1
- data/lib/oxidized/model/xos.rb +3 -1
- data/lib/oxidized/model/zhoneolt.rb +3 -1
- data/lib/oxidized/model/zynos.rb +3 -3
- data/lib/oxidized/node.rb +44 -27
- data/lib/oxidized/nodes.rb +8 -4
- data/lib/oxidized/output/file.rb +28 -0
- data/lib/oxidized/output/git.rb +66 -9
- data/lib/oxidized/output/gitcrypt.rb +15 -13
- data/lib/oxidized/output/http.rb +5 -4
- data/lib/oxidized/output/output.rb +14 -0
- data/lib/oxidized/source/http.rb +4 -2
- data/lib/oxidized/version.rb +2 -2
- data/lib/oxidized/worker.rb +11 -8
- data/lib/oxidized.rb +3 -24
- data/oxidized.gemspec +8 -5
- metadata +54 -21
data/docs/DeviceSimulation.md
CHANGED
@@ -21,7 +21,7 @@ information is the responses to the commands used in the Oxidized models.
|
|
21
21
|
|
22
22
|
The YAML simulation files are stored under
|
23
23
|
[/spec/model/data/](/spec/model/data/), with the naming convention
|
24
|
-
`<model
|
24
|
+
`<model>#<description>#simulation.yaml`, where `<model>` is the lowercase name
|
25
25
|
of the Oxidized model and `<description>` is the name of the test case.
|
26
26
|
`<description>` is generally formatted as `<hardware>_<software>` or
|
27
27
|
`<hardware>_<software>_<information>`.
|
@@ -61,6 +61,7 @@ Usages:
|
|
61
61
|
-o, --output file Specify an output YAML-file
|
62
62
|
-t, --timeout value Specify the idle timeout beween commands (default: 5 seconds)
|
63
63
|
-e, --exec-mode Run ssh in exec mode (without tty)
|
64
|
+
-u, --unordered The YAML simulation should not enforce an order of the commands
|
64
65
|
-h, --help Print this help
|
65
66
|
```
|
66
67
|
|
@@ -80,10 +81,16 @@ output of the command is shortened or slips into the next command in the YAML
|
|
80
81
|
file. You will have to change the idle timeout to a greater value to address
|
81
82
|
this.
|
82
83
|
- When run without the output argument, `device2yaml.rb` will only print the SSH
|
83
|
-
output to the standard output. You must use `-o <model
|
84
|
+
output to the standard output. You must use `-o <model#HW_SW#simulation.yaml>`
|
84
85
|
to store the collected data in a YAML file.
|
85
86
|
- If your Oxidized model uses SSH exec mode (look for `exec true` in the model),
|
86
87
|
you will have to use the option `-e` to run `device2yaml.rb` in SSH exec mode.
|
88
|
+
- The default behavior is to create a YAML file in which the commands must
|
89
|
+
appear in the order used in the Oxidized model. This is useful for simulating
|
90
|
+
devices that paginate output. To allow any order or include more commands than
|
91
|
+
the model uses, use the option `-u`. Note that the `unordered` mode may not
|
92
|
+
produce a useful YAML file when combined with user input (see
|
93
|
+
[Interactive Mode](#interactive-mode) below).
|
87
94
|
|
88
95
|
Note that `device2yaml.rb` takes some time to run because of the idle timeout of
|
89
96
|
(default) 5 seconds between each command. You can press the "Escape" key if you
|
@@ -100,7 +107,7 @@ show version
|
|
100
107
|
show vtp status
|
101
108
|
show inventory
|
102
109
|
show running-config
|
103
|
-
exit" -o spec/model/data/ios
|
110
|
+
exit" -o spec/model/data/ios#C8200L_16.12.1#simulation.yaml
|
104
111
|
```
|
105
112
|
### Publishing the YAML Simulation File to Oxidized
|
106
113
|
Publishing the YAML simulation file of your device helps maintain Oxidized. This
|
@@ -124,7 +131,7 @@ change the hostname everywhere.
|
|
124
131
|
|
125
132
|
The YAML simulation files are stored under
|
126
133
|
[/spec/model/data/](/spec/model/data/), with the naming convention
|
127
|
-
`<model
|
134
|
+
`<model>#<description>#simulation.yaml`, where `<model>` is the lowercase name
|
128
135
|
of the Oxidized model and `<description>` is the name of the test case.
|
129
136
|
`<description>` is generally formatted as `<hardware>_<software>` or
|
130
137
|
`<hardware>_<software>_<information>`.
|
@@ -134,9 +141,9 @@ automatic model unit tests.
|
|
134
141
|
|
135
142
|
Examples:
|
136
143
|
|
137
|
-
- spec/model/data/aoscx
|
138
|
-
- spec/model/data/asa
|
139
|
-
- spec/model/data/ios
|
144
|
+
- spec/model/data/aoscx#R0X25A-6410_FL.10.10.1100#simulation.yaml
|
145
|
+
- spec/model/data/asa#5512_9.12-4-67_single-context#simulation.yaml
|
146
|
+
- spec/model/data/ios#C9200L-24P-4G_17.09.04a#simulation.yaml
|
140
147
|
|
141
148
|
When you are finished, commit and push to your forked repository on GitHub, and
|
142
149
|
submit a Pull Request. Thank you for your help!
|
@@ -153,6 +160,11 @@ page.
|
|
153
160
|
|
154
161
|
You can also use this to enter an enable password.
|
155
162
|
|
163
|
+
Every key press will be recorded in the YAML file, so that it can be used
|
164
|
+
in the simulation afterwards, especialy for devices that paginate output. You
|
165
|
+
may need to clean the YAML file manually if you don't want some input (such
|
166
|
+
as passwords) to be included.
|
167
|
+
|
156
168
|
If you press the "Esc" key, `device2yaml.rb` will not wait for the idle timeout
|
157
169
|
and will process the next command right away.
|
158
170
|
|
data/docs/Docker.md
CHANGED
@@ -222,7 +222,9 @@ If not, a quick way to solve it is to delete `~/.local/share/containers/`.
|
|
222
222
|
Beware - this will delete **all** your containers!
|
223
223
|
|
224
224
|
### Store the ssh keys a remote git repository
|
225
|
-
When you
|
225
|
+
When you use the githubrepo hook to upload your configs to a remote git
|
226
|
+
repository, you have to store your ssh-key and the public keys of the remote
|
227
|
+
server. Create a directory `~/oxidized-ssh` and map it to `/home/oxidized/.ssh`.
|
226
228
|
|
227
229
|
|
228
230
|
To generate an ssh-key, run:
|
@@ -230,11 +232,14 @@ To generate an ssh-key, run:
|
|
230
232
|
ssh-keygen -q -t ed25519 -C "Oxidized Push Key@`hostname`" -N "YOURPASSPHRASE" -m PEM -f ~/oxidized-ssh/oxidized-key
|
231
233
|
```
|
232
234
|
|
233
|
-
You also need to store the public keys of the remote git server in known_hosts.
|
234
|
-
oxidized will refuse to push to the remote Git with
|
235
|
+
You also need to store the public keys of the remote git server in known_hosts.
|
236
|
+
If you don't store the keys, oxidized will refuse to push to the remote Git with
|
237
|
+
the error
|
238
|
+
`#<Rugged::SshError: invalid or unknown remote ssh hostkey>`, see Issue #2753.
|
235
239
|
|
236
240
|
```shell
|
237
241
|
ssh-keyscan git-server.example.com > ~/oxidized-ssh/known_hosts
|
238
242
|
```
|
239
243
|
|
240
|
-
Don't forget to set the permission (owner) of the files for the user oxidized
|
244
|
+
Don't forget to set the permission (owner) of the files for the user oxidized
|
245
|
+
inside the container, or this will not work!
|
data/docs/Issues.md
CHANGED
@@ -7,7 +7,8 @@ This guide provides tips on writing your issue to make it easier for the
|
|
7
7
|
community and developers to understand and respond effectively.
|
8
8
|
|
9
9
|
Why write good issues?
|
10
|
-
- A clear and detailed issue improves the chances of getting your problem
|
10
|
+
- A clear and detailed issue improves the chances of getting your problem
|
11
|
+
resolved.
|
11
12
|
- By spending time to write a good issue, you save developers time, contributing
|
12
13
|
to Oxidized’s progress without writing a line of code.
|
13
14
|
|
@@ -21,7 +22,7 @@ following rules:
|
|
21
22
|
questions in the templates), expect your issue to be closed without a comment.
|
22
23
|
- Inactive issues will be marked "stale" automatically after 90 days. Issues
|
23
24
|
are not closed automatically; this is a manual action by a maintainer.
|
24
|
-
- A feature
|
25
|
+
- A feature request may be closed after some time of inactivity, as obviously
|
25
26
|
no one has found the time to implement it. Consider contributing code in a
|
26
27
|
Pull Request instead.
|
27
28
|
- While it is OK to ask for help (using the support request template), don't be
|
@@ -41,6 +42,13 @@ Choose the appropriate GitHub project based on your issue:
|
|
41
42
|
- For issues with Oxidized itself, go to
|
42
43
|
[oxidized](https://github.com/ytti/oxidized).
|
43
44
|
|
45
|
+
## Use the latest version
|
46
|
+
If you are using an old version of oxidized, you may encounter issues that have
|
47
|
+
been solved. No support will be provided for older versions of oxidized.
|
48
|
+
|
49
|
+
If you can, please also test against the latest git version, or at least read
|
50
|
+
[CHANGELOG.md](/CHANGELOG.md) to see if your problem has been solved on master.
|
51
|
+
|
44
52
|
## Format your issue
|
45
53
|
- Use [GitHub Markdown](https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax) to format your issue.
|
46
54
|
- Preview your text before submitting to ensure it renders correctly.
|
@@ -53,6 +61,7 @@ Keep the title brief yet descriptive. Aim to summarize the main issue or request
|
|
53
61
|
Include as many relevant details as possible. At a minimum, specify:
|
54
62
|
|
55
63
|
- Oxidized version and operating system.
|
64
|
+
- Which model (oxidized name AND Manufacturer name) is the issue about.
|
56
65
|
- Relevant parts of your Oxidized configuration and a brief explanation of your setup.
|
57
66
|
- Output of the error, if relevant.
|
58
67
|
- For issues related to specific devices, consider creating a YAML Simulation file (instructions below).
|
data/docs/ModelUnitTests.md
CHANGED
@@ -21,7 +21,7 @@ See the link for instructions on how to produce it.
|
|
21
21
|
|
22
22
|
The YAML simulation files are stored under
|
23
23
|
[/spec/model/data/](/spec/model/data/), with the naming convention
|
24
|
-
`<model
|
24
|
+
`<model>#<description>#simulation.yaml`, where `<model>` is the lowercase name
|
25
25
|
of the Oxidized model and `<description>` is the name of the test case.
|
26
26
|
`<description>` is generally formatted as `<hardware>_<software>` or
|
27
27
|
`<hardware>_<software>_<information>`.
|
@@ -31,17 +31,17 @@ automatic model unit tests.
|
|
31
31
|
|
32
32
|
### Expected Output
|
33
33
|
You need a second file that contains the expected output, which has the same
|
34
|
-
name as the YAML simulation file but ends with
|
35
|
-
|
34
|
+
name as the YAML simulation file but ends with `#output.txt` instead of
|
35
|
+
`#simulation.yaml`.
|
36
36
|
|
37
37
|
You can automatically produce an output file based on the current model for all
|
38
|
-
YAML simulation files missing an
|
38
|
+
YAML simulation files missing an `#output.txt`:
|
39
39
|
```shell
|
40
40
|
bundle exec ruby spec/model/atoms_generate.rb
|
41
41
|
```
|
42
42
|
|
43
43
|
In the following example,
|
44
|
-
`spec/model/data/aoscx
|
44
|
+
`spec/model/data/aoscx#R8N85A-C6000-48G-CL4_PL.10.08.1010#output.txt` (the
|
45
45
|
second file in the list) was missing:
|
46
46
|
|
47
47
|
```shell
|
@@ -50,21 +50,21 @@ Run options: --seed 57811
|
|
50
50
|
|
51
51
|
# Running:
|
52
52
|
|
53
|
-
Generating output file for aoscx
|
54
|
-
Generating output file for aoscx
|
55
|
-
Generating output file for arubainstant
|
56
|
-
Generating output file for asa
|
57
|
-
Generating output file for garderos
|
58
|
-
Generating output file for ios
|
59
|
-
Generating output file for ios
|
60
|
-
Generating output file for ios
|
61
|
-
Generating output file for ios
|
62
|
-
Generating output file for junos
|
63
|
-
Generating output file for opnsense
|
64
|
-
Generating output file for pfsense
|
65
|
-
Generating output file for routeros
|
66
|
-
Generating output file for routeros
|
67
|
-
Generating output file for routeros
|
53
|
+
Generating output file for aoscx#R0X25A-6410_FL.10.10.1100#simulation... SKIP, output already exists
|
54
|
+
Generating output file for aoscx#R8N85A-C6000-48G-CL4_PL.10.08.1010#simulation... OK
|
55
|
+
Generating output file for arubainstant#IAP515_8.10.0.6_VWLC#simulation... SKIP, output already exists
|
56
|
+
Generating output file for asa#5512_9.12-4-67_single-context#simulation... SKIP, output already exists
|
57
|
+
Generating output file for garderos#R7709_003_006_068#simulation... SKIP, output already exists
|
58
|
+
Generating output file for ios#C8200L_16.12.1#simulation... FAIL, no simulation file
|
59
|
+
Generating output file for ios#C9200L-24P-4G_17.09.04a#simulation... SKIP, output already exists
|
60
|
+
Generating output file for ios#C9800-L-F-K9_17.06.05#simulation... SKIP, output already exists
|
61
|
+
Generating output file for ios#asr920_16.8.1b#simulation... SKIP, output already exists
|
62
|
+
Generating output file for junos#srx300_22.4#simulation... SKIP, output already exists
|
63
|
+
Generating output file for opnsense#nano_23.7#simulation... SKIP, output already exists
|
64
|
+
Generating output file for pfsense#CE_2.7.2#simulation... SKIP, output already exists
|
65
|
+
Generating output file for routeros#CHR_7.10.1#simulation... SKIP, output already exists
|
66
|
+
Generating output file for routeros#CHR_7.16#simulation... SKIP, output already exists
|
67
|
+
Generating output file for routeros#L009UiGS_7.15.2#simulation... SKIP, output already exists
|
68
68
|
.
|
69
69
|
|
70
70
|
Finished in 0.904792s, 1.1052 runs/s, 0.0000 assertions/s.
|
@@ -76,7 +76,7 @@ Line Coverage: 58.02% (651 / 1122)
|
|
76
76
|
```
|
77
77
|
|
78
78
|
### Running the Tests
|
79
|
-
You can modify the
|
79
|
+
You can modify the `#output.txt` file to match your expectations and modify the
|
80
80
|
model accordingly. Run `bundle exec rake` to run the tests.
|
81
81
|
|
82
82
|
Here is an example when the output of the VTP command is missing in the expected
|
@@ -94,7 +94,7 @@ Run options: --seed 31447
|
|
94
94
|
Finished in 7.963602s, 14.6918 runs/s, 48.7217 assertions/s.
|
95
95
|
|
96
96
|
1) Failure:
|
97
|
-
ATOMS tests#test_0006_ios
|
97
|
+
ATOMS tests#test_0006_ios#C9200L-24P-4G_17.09.04a#output has expected output [spec/model/model_atoms_spec.rb:12]:
|
98
98
|
--- expected
|
99
99
|
+++ actual
|
100
100
|
@@ -9,6 +9,21 @@
|
@@ -138,9 +138,19 @@ If you want to be sure that your model has been tested, run
|
|
138
138
|
`bundle exec rake test TESTOPTS="--verbose"` and search for your models unter
|
139
139
|
`ATOMS tests`
|
140
140
|
|
141
|
+
### Running only one test
|
142
|
+
If you want to run only one test while debuging your model, you can select it
|
143
|
+
with the option `--name=/regexp/`:
|
144
|
+
```
|
145
|
+
bundle exec rake test TESTOPTS="--verbose --name=/ios#C9800.*output/"
|
146
|
+
```
|
147
|
+
|
148
|
+
You can also set `Oxidized.asetus.cfg.debug = true` in
|
149
|
+
`spec/model/model_helper.rb` to activate debug logs.
|
150
|
+
|
141
151
|
## Device Prompt
|
142
152
|
You can specify device prompts to test in a YAML file named
|
143
|
-
`spec/model/data/<model
|
153
|
+
`spec/model/data/<model>#generic#prompt.yaml`.
|
144
154
|
|
145
155
|
The YAML file has three sections containing a list of prompts to test:
|
146
156
|
- pass: these prompts will pass the prompt regexp.
|
@@ -162,7 +172,7 @@ fail:
|
|
162
172
|
## Secrets
|
163
173
|
You can test if the model effectively removes secrets from your YAML simulation
|
164
174
|
file with a YAML file named like the YAML simulation, but with the suffix
|
165
|
-
|
175
|
+
`#secret.yaml`.
|
166
176
|
|
167
177
|
The YAML file has two sections containing a list of strings to test:
|
168
178
|
- fail: the test will fail if the output contains these strings.
|
@@ -180,7 +190,7 @@ pass:
|
|
180
190
|
## Custom tests
|
181
191
|
When you write custom tests for your models, please do not use the filenames
|
182
192
|
mentioned above, as it will interfere with the standard tests. If you need to
|
183
|
-
store a custom simulation file, use `model
|
193
|
+
store a custom simulation file, use `model#description#custom_simulation.yaml`.
|
184
194
|
|
185
195
|
The [cumulus test](/spec/model/cumulus_spec.rb) is an example of a custom
|
186
196
|
test.
|
data/docs/Outputs.md
CHANGED
@@ -10,9 +10,48 @@ output:
|
|
10
10
|
directory: /var/lib/oxidized/configs
|
11
11
|
```
|
12
12
|
|
13
|
+
### Groups
|
14
|
+
If you use groups, the nodes will be stored in directories named after the
|
15
|
+
groups. The directories are stored one level above the directory for configurations
|
16
|
+
without groups.
|
17
|
+
|
18
|
+
Example:
|
19
|
+
```
|
20
|
+
/var/lib/oxidized/
|
21
|
+
+ configs/ # Configurations of groupless nodes
|
22
|
+
+ group1/ # Configurations of nodes in group1
|
23
|
+
+ group2/ # Configurations of nodes in group2
|
24
|
+
```
|
25
|
+
|
26
|
+
### Clean obsolete nodes
|
27
|
+
The `file` output can automatically remove the configuration of nodes no
|
28
|
+
longer present in the [source](Sources.md).
|
29
|
+
|
30
|
+
> :warning: **Warning:** this might be a dangerous operation: oxidized
|
31
|
+
> will remove **any** file not matching the hostname of the nodes configured
|
32
|
+
> in the source.
|
33
|
+
|
34
|
+
When using groups, it will remove any files not matching the hostnames of the
|
35
|
+
nodes from the groups directories (which are on the same level as the default
|
36
|
+
directory). As a safety measure, oxidized will only clean configuration out of
|
37
|
+
active groups. If the group `example` isn't used anymore, oxidized won't clean
|
38
|
+
the configurations out of the directory `../example/`.
|
39
|
+
|
40
|
+
Configuration:
|
41
|
+
|
42
|
+
```yaml
|
43
|
+
output:
|
44
|
+
default: file
|
45
|
+
clean_obsolete_nodes: true
|
46
|
+
file:
|
47
|
+
directory: "~/.config/oxidized/configs/default"
|
48
|
+
```
|
49
|
+
|
50
|
+
|
13
51
|
## Output: Git
|
14
52
|
|
15
|
-
This uses the rugged/libgit2 interface. So you should remember that normal Git
|
53
|
+
This uses the rugged/libgit2 interface. So you should remember that normal Git
|
54
|
+
hooks will not be executed.
|
16
55
|
|
17
56
|
For a single repository containing all devices:
|
18
57
|
|
@@ -63,7 +102,49 @@ output:
|
|
63
102
|
|
64
103
|
```
|
65
104
|
|
66
|
-
|
105
|
+
### Git performance issues with large device counts
|
106
|
+
When you use git to store your configurations, the size of your repository will
|
107
|
+
grow over time. This growth may lead to performance issues. If you encounter
|
108
|
+
such issues, you should perform a Git garbage collection on your repository.
|
109
|
+
|
110
|
+
Follow these steps to do so:
|
111
|
+
|
112
|
+
1. Stop oxidized (no one should access the git repository while running garbage
|
113
|
+
collection)
|
114
|
+
2. Make a backup of your oxidized data, especially the Git repository
|
115
|
+
3. Change directory your oxidized git repository (as configured in oxidized
|
116
|
+
configuration file)
|
117
|
+
4. Execute the command `git gc` to run the garbage collection
|
118
|
+
5. Restart oxidized - you're done!
|
119
|
+
|
120
|
+
|
121
|
+
### Clean obsolete nodes
|
122
|
+
The `git` output can automatically remove the configuration of nodes no
|
123
|
+
longer present in the [source](Sources.md).
|
124
|
+
|
125
|
+
> :warning: **Limitations**
|
126
|
+
> - this currently only works with `single_repo: true`
|
127
|
+
> - it will ignore configurations saved as [output types](#output-types) in
|
128
|
+
> a separate repository.
|
129
|
+
> - oxidized will refuse to remove old configurations
|
130
|
+
> when saving [output types](#output-types) in a subdirectory of the git
|
131
|
+
> repository (`type_as_directory: true`), or it would remove the output
|
132
|
+
> type directories
|
133
|
+
|
134
|
+
Oxidized will remove **any** file within the git repository not matching the
|
135
|
+
group and hostname of the nodes configured in the source and will then commit
|
136
|
+
the change into git.
|
137
|
+
|
138
|
+
Configuration:
|
139
|
+
|
140
|
+
```yaml
|
141
|
+
output:
|
142
|
+
default: git
|
143
|
+
clean_obsolete_nodes: true
|
144
|
+
git:
|
145
|
+
single_repo: true
|
146
|
+
repo: "~/.config/oxidized/devices.git"
|
147
|
+
```
|
67
148
|
|
68
149
|
## Output: Git-Crypt
|
69
150
|
|
data/docs/Release.md
CHANGED
@@ -1,6 +1,12 @@
|
|
1
1
|
# How to release a new version of Oxidized?
|
2
2
|
This document is targeted at oxidized maintainers. It describes the release process.
|
3
3
|
|
4
|
+
## Version numbering
|
5
|
+
Oxidized versions are nummered like major.minor.patch
|
6
|
+
- currently, the major version is 0.
|
7
|
+
- minor is incremented when releasing new features.
|
8
|
+
- patch is incremented when releasing fixes only.
|
9
|
+
|
4
10
|
## Review changes
|
5
11
|
Run `git diff 0.30.0..master` (where `0.30.0` is to be changed to the last release) and review
|
6
12
|
all the changes that have been done. Have a specific look at changes you don't understand.
|
@@ -23,6 +29,18 @@ If you change some code => Restart the release process at the beginning ;-)
|
|
23
29
|
## Make sure the file permissions are correct
|
24
30
|
Run `bundle exec rake chmod`
|
25
31
|
|
32
|
+
## Create a release branch
|
33
|
+
Name the release branch `release/0.xx.yy`
|
34
|
+
|
35
|
+
Update CHANGELOG.md:
|
36
|
+
- review it
|
37
|
+
- add release notes
|
38
|
+
- set the new version (replace `[Unreleased]` with `[0.xx.yy – 202Y-MM-DD]`)
|
39
|
+
|
40
|
+
Change the version in `lib/oxidized/version.rb`
|
41
|
+
|
42
|
+
Upload the branch to github, make a Pull Request for it.
|
43
|
+
|
26
44
|
## Make sure you pass all GitHub CI
|
27
45
|
They test different ruby versions, the docker build process and codeql.
|
28
46
|
|
@@ -30,38 +48,28 @@ They test different ruby versions, the docker build process and codeql.
|
|
30
48
|
Test the git code and the container against as much device types and
|
31
49
|
environments as you can.
|
32
50
|
|
33
|
-
## Version numbering
|
34
|
-
Oxidized versions are nummered like major.minor.patch
|
35
|
-
- currently, the major version is 0.
|
36
|
-
- minor is incremented when releasing new features.
|
37
|
-
- patch is incremented when releasing fixes only.
|
38
|
-
|
39
51
|
## Prepare the release in your working repository
|
40
|
-
1.
|
41
|
-
2.
|
42
|
-
3.
|
43
|
-
4.
|
44
|
-
5.
|
45
|
-
6.
|
46
|
-
|
47
|
-
|
48
|
-
9. Install an test the gem locally
|
49
|
-
```
|
50
|
-
gem install --user-install pkg/oxidized-0.30.0.gem
|
52
|
+
1. Merge the Pull Request into master
|
53
|
+
2. `git pull` master
|
54
|
+
3. Tag the commit with `git tag -a 0.xx.yy -m "Release 0.xx.yy"`
|
55
|
+
4. Build the gem with ‘rake build’
|
56
|
+
5. Run `git diff` to check if there have been more changes (there shouldn't)
|
57
|
+
6. Install an test the gem locally
|
58
|
+
```shell
|
59
|
+
gem install --user-install pkg/oxidized-0.xx.yy.gem
|
51
60
|
~/.local/share/gem/ruby/3.1.0/bin/oxidized
|
52
61
|
```
|
53
62
|
|
54
63
|
## Release in github
|
55
|
-
Push the
|
64
|
+
Push the tag to github:
|
56
65
|
```
|
57
|
-
git push
|
58
66
|
git push origin 0.xx.yy
|
59
67
|
```
|
60
68
|
|
61
|
-
Make a release from the tag in github
|
62
|
-
-
|
63
|
-
- Only describe major changes, and refer to CHANGELOG.md
|
69
|
+
Make a release from the tag in github.
|
70
|
+
- Take the release notes frm CHANGELOG.md
|
64
71
|
- List new contributors (generated automatically)
|
72
|
+
- Keep the Full Changelog (generated automatically)
|
65
73
|
|
66
74
|
## Release in rubygems
|
67
75
|
Push the gem with ‘rake push’
|
data/docs/Supported-OS-Types.md
CHANGED
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
|Vendor |OS model |oxidized model |model maintainers|comment / model notes|
|
4
4
|
|--------------------|------------------------------|-------------------------------------------------|-----------------|---------------------|
|
5
|
+
|6WIND |VSR |[sixwind](/lib/oxidized/model/sixwind.rb) |@hcaldicott |
|
5
6
|
|A10 Networks |ACOS |[acos](/lib/oxidized/model/acos.rb) | |
|
6
7
|
|Accedian Performance Elements (NIDs)|AEN |[aen](/lib/oxidized/model/aen.rb)
|
7
8
|
|Acme Packet |ACMEPACKET |[acmepacket](/lib/oxidized/model/acmepacket.rb)
|
@@ -30,6 +31,7 @@
|
|
30
31
|
| |BOSS (Baystack Operating System Software)|[boss](/lib/oxidized/model/boss.rb)
|
31
32
|
|BDCOM |S2200PB, S2200-B, S2500-B, S2500-C, S2500PB, S2500-P, S2900 series|[bdcom](/lib/oxidized/model/bdcom.rb)
|
32
33
|
|Brocade |FabricOS |[fabricos](/lib/oxidized/model/fabricos.rb)
|
34
|
+
| |Enhanced Fabric OS |[efos](/lib/oxidized/model/efos.rb)
|
33
35
|
| |FastIron |[fastiron](/lib/oxidized/model/fastiron.rb)
|
34
36
|
| |IronWare |[ironware](/lib/oxidized/model/ironware.rb)
|
35
37
|
| |NOS (Network Operating System)|[nos](/lib/oxidized/model/nos.rb)
|
@@ -43,6 +45,7 @@
|
|
43
45
|
|Centec Networks |CNOS |[cnos](/lib/oxidized/model/cnos.rb)
|
44
46
|
|Check Point |GaiaOS |[gaiaos](/lib/oxidized/model/gaiaos.rb)
|
45
47
|
|Ciena |SAOS |[saos](/lib/oxidized/model/saos.rb)
|
48
|
+
| |SAOS10 |[saos10](/lib/oxidized/model/saos10.rb)
|
46
49
|
|Cisco |ACSW |[acsw](/lib/oxidized/model/acsw.rb)
|
47
50
|
| |AireOS |[aireos](/lib/oxidized/model/aireos.rb) | |[AireOS](Model-Notes/AireOS.md)
|
48
51
|
| |ASA |[asa](/lib/oxidized/model/asa.rb) |@robertcheramy
|
@@ -131,6 +134,7 @@
|
|
131
134
|
|MRV |MasterOS |[masteros](/lib/oxidized/model/masteros.rb)
|
132
135
|
| |FiberDriver |[fiberdriver](/lib/oxidized/model/fiberdriver.rb)
|
133
136
|
|NEC |NEC IX |[necix](/lib/oxidized/model/necix.rb)
|
137
|
+
|Netgate |TNSR |[tnsr](/lib/oxidized/model/tnsr.rb) |@Vantomas
|
134
138
|
|Netgear |Netgear switches |[netgear](/lib/oxidized/model/netgear.rb) | |[Netgear](Model-Notes/Netgear.md)
|
135
139
|
|Netonix |WISP Switch (As Netonix) |[netonix](/lib/oxidized/model/netonix.rb)
|
136
140
|
|Nokia (formerly TiMetra, Alcatel, Alcatel-Lucent)|SR OS (TiMOS)|[sros](/lib/oxidized/model/sros.rb) | |[Nokia ISAM](Model-Notes/Nokia.md)
|
data/docs/Troubleshooting.md
CHANGED
@@ -27,7 +27,10 @@ Welcome to the advanced nuclear launchinator 5A-X20. Proceed with caution.
|
|
27
27
|
SEKRET-5A-X20#
|
28
28
|
```
|
29
29
|
|
30
|
-
Review the relevant device model file and identify the defined prompt. You can
|
30
|
+
Review the relevant device model file and identify the defined prompt. You can
|
31
|
+
find the device models in the `lib/oxidized/model` subdirectory of the
|
32
|
+
repository. For example, the Cisco IOS model, `ios.rb` may use the following
|
33
|
+
prompt:
|
31
34
|
|
32
35
|
```text
|
33
36
|
prompt /^([\w.@()-]+[#>]\s?)$/
|
@@ -85,23 +88,6 @@ If you are running oxidized in a container, you need to map /home/oxidized/.ssh
|
|
85
88
|
container to a local repository and save the known_hosts in the local repository. You can
|
86
89
|
find an example how to do this under [examples/podman-compose](/examples/podman-compose/)
|
87
90
|
|
88
|
-
## Git performance issues with large device counts
|
89
|
-
When you use git to store your configurations, the size of your repository will
|
90
|
-
grow over time. This growth can lead to performance issues. To resolve these
|
91
|
-
issues, you should perform a Git garbage collection on your repository.
|
92
|
-
|
93
|
-
Follow these steps to do so:
|
94
|
-
|
95
|
-
1. Stop oxidized (no one should access the git repository while running garbage collection)
|
96
|
-
2. Make a backup of your oxidized data, especially the Git repository
|
97
|
-
3. Change directory your oxidized git repository (as configured in oxidized configuration file)
|
98
|
-
4. Execute the command `git gc` to run the garbage collection
|
99
|
-
5. Restart oxidized - you're done!
|
100
|
-
|
101
|
-
Note that slow performance in oxidized-web when listing the versions of a device
|
102
|
-
are due to the necessity to go through the whole git log to search the
|
103
|
-
history. See Issue #3121, the fix will come with oxidized version 0.33.0.
|
104
|
-
|
105
91
|
## Oxidized ignores the changes I made to its git repository
|
106
92
|
First of all: you shouldn't manipulate the git repository of oxidized. Don't
|
107
93
|
create it, don't modify it, leave it alone. You can break things. You have
|
data/extra/device2yaml.rb
CHANGED
@@ -6,24 +6,21 @@ require 'optparse'
|
|
6
6
|
require 'etc'
|
7
7
|
require 'timeout'
|
8
8
|
|
9
|
-
# This
|
9
|
+
# This script logs in a network device and outputs a YAML file that can be
|
10
10
|
# used for model unit tests in spec/model/
|
11
11
|
# For more information, see docs/DeviceSimulation.md
|
12
12
|
|
13
|
-
# This script is quick & dirty - it grew with the time an could be a project
|
14
|
-
# for its own. It works, and that should be enough ;-)
|
15
|
-
|
16
13
|
################# Methods
|
17
14
|
# Runs cmd in the ssh session, either im exec mode or with a tty
|
18
15
|
# saves the output to @output
|
19
16
|
def ssh_exec(cmd)
|
20
|
-
puts "\n### Sending #{cmd}..."
|
21
|
-
@output&.puts " #{cmd}: |-"
|
17
|
+
puts "\n### Sending #{cmd.dump}..."
|
18
|
+
@output&.puts " #{@sequence_prepend_command}#{cmd.dump}: |-"
|
22
19
|
|
23
20
|
if @exec_mode
|
24
|
-
@ssh_output = @ssh.exec! cmd
|
21
|
+
@ssh_output = @ssh.exec! cmd
|
25
22
|
else
|
26
|
-
@ses.send_data cmd
|
23
|
+
@ses.send_data cmd
|
27
24
|
shell_wait
|
28
25
|
end
|
29
26
|
yaml_output(' ')
|
@@ -68,7 +65,14 @@ def shell_wait
|
|
68
65
|
puts "\n### ESC pressed, skipping idle timeout"
|
69
66
|
return false
|
70
67
|
else
|
71
|
-
# if not, send the char through ssh
|
68
|
+
# if not, record the char and send the char through ssh
|
69
|
+
puts "\n### #{char.dump} pressed"
|
70
|
+
yaml_output(' ')
|
71
|
+
@output&.puts " #{@sequence_prepend_command}#{char.dump}: |-"
|
72
|
+
@ssh_output = ''
|
73
|
+
start_time = Time.now
|
74
|
+
@ssh_output_length = @ssh_output.length
|
75
|
+
|
72
76
|
@ses.send_data char
|
73
77
|
end
|
74
78
|
end
|
@@ -85,6 +89,8 @@ def yaml_output(prepend = '')
|
|
85
89
|
# Now print the collected output to @output
|
86
90
|
firstline = true
|
87
91
|
|
92
|
+
prepend = @sequence_prepend_output + prepend
|
93
|
+
|
88
94
|
# as we want to prepend 'prepend' to each line, we need each_line and chomp
|
89
95
|
# chomp removes the trainling \n
|
90
96
|
@ssh_output.each_line(chomp: true) do |line|
|
@@ -113,6 +119,9 @@ end
|
|
113
119
|
|
114
120
|
# Define options
|
115
121
|
options = {}
|
122
|
+
@sequence_prepend_command = '- '
|
123
|
+
@sequence_prepend_output = ' '
|
124
|
+
|
116
125
|
optparse = OptionParser.new do |opts|
|
117
126
|
opts.banner = <<~HEREDOC
|
118
127
|
Usages:
|
@@ -140,6 +149,10 @@ optparse = OptionParser.new do |opts|
|
|
140
149
|
options[:timeout] = timeout
|
141
150
|
end
|
142
151
|
opts.on('-e', '--exec-mode', 'Run ssh in exec mode (without tty)') { @exec_mode = true }
|
152
|
+
opts.on('-u', '--unordered', 'The YAML simulation should not enforce an order of the commands') do
|
153
|
+
@sequence_prepend_command = ''
|
154
|
+
@sequence_prepend_output = ''
|
155
|
+
end
|
143
156
|
opts.on '-h', '--help', 'Print this help' do
|
144
157
|
puts opts
|
145
158
|
exit
|
@@ -182,6 +195,8 @@ elsif options[:input]
|
|
182
195
|
end
|
183
196
|
|
184
197
|
puts "Running #{ssh_commands} on #{ssh_user}@#{ssh_host}"
|
198
|
+
# Add \n to each command
|
199
|
+
ssh_commands.map! { |s| s + "\n" }
|
185
200
|
|
186
201
|
# Defaut idle timeout: 5 seconds, as tests showed that 2 seconds is too short
|
187
202
|
@idle_timeout = options[:timeout] || 5
|
data/extra/rest_client.rb
CHANGED
data/extra/syslog.rb
CHANGED
@@ -8,8 +8,10 @@
|
|
8
8
|
# set system syslog host SERVER interactive-commands notice
|
9
9
|
# set system syslog host SERVER match "^mgd\[[0-9]+\]: UI_COMMIT: .*"
|
10
10
|
|
11
|
-
# Ports < 1024 need extra privileges, use a port higher than this by setting the
|
12
|
-
#
|
11
|
+
# Ports < 1024 need extra privileges, use a port higher than this by setting the
|
12
|
+
# port option in your oxidized config file.
|
13
|
+
# To use the default port for syslog (514) you shouldn't pass an argument, but
|
14
|
+
# you will need to allow this with:
|
13
15
|
# sudo setcap 'cap_net_bind_service=+ep' /usr/bin/ruby
|
14
16
|
|
15
17
|
# Config options are:
|
@@ -52,6 +54,7 @@ module Oxidized
|
|
52
54
|
class SyslogMonitor
|
53
55
|
MSG = {
|
54
56
|
ios: /%SYS-(SW[0-9]+-)?5-CONFIG_I:/,
|
57
|
+
iosxr: /%MGBL-SYS-5-CONFIG_I/,
|
55
58
|
junos: 'UI_COMMIT:',
|
56
59
|
eos: /%SYS-5-CONFIG_I:/,
|
57
60
|
nxos: /%VSHD-5-VSHD_SYSLOG_CONFIG_I:/,
|
@@ -89,6 +92,7 @@ module Oxidized
|
|
89
92
|
opts[:from] = log[-1][1..-2]
|
90
93
|
opts
|
91
94
|
end
|
95
|
+
alias iosxr ios
|
92
96
|
alias nxos ios
|
93
97
|
alias eos ios
|
94
98
|
|
@@ -116,7 +120,8 @@ module Oxidized
|
|
116
120
|
def run(io)
|
117
121
|
loop do
|
118
122
|
log = select [io]
|
119
|
-
log
|
123
|
+
log = log.first.first
|
124
|
+
ip = nil
|
120
125
|
if @mode == :udp
|
121
126
|
log, ip = log.recvfrom_nonblock 2000
|
122
127
|
ip = ip.last
|