oxidized 0.31.0 → 0.32.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +2 -9
- data/.rubocop.yml +8 -7
- data/.rubocop_todo.yml +6 -6
- data/CHANGELOG.md +40 -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/Release.md +18 -2
- 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/powerconnect.rb +1 -1
- 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 +21 -11
- metadata +47 -71
- 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
@@ -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
|