oxidized 0.35.0 → 0.36.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/.coderabbit.yaml +21 -0
- data/.github/workflows/publishdocker.yml +11 -9
- data/.github/workflows/ruby.yml +1 -3
- data/.rubocop.yml +13 -2
- data/.rubocop_todo.yml +21 -2
- data/CHANGELOG.md +50 -3
- data/README.md +2 -3
- data/docs/Configuration.md +30 -1
- data/docs/Creating-Models.md +128 -13
- data/docs/Docker.md +2 -1
- data/docs/Inputs.md +29 -0
- data/docs/Model-Notes/APC.md +72 -0
- data/docs/Model-Notes/ExaLink.md +43 -0
- data/docs/Model-Notes/Fortinet.md +75 -0
- data/docs/Model-Notes/IvantiConnectSecure.md +59 -0
- data/docs/Model-Notes/TrueNAS.md +19 -0
- data/docs/ModelUnitTests.md +23 -0
- data/docs/Outputs.md +18 -4
- data/docs/Release.md +1 -1
- data/docs/Ruby-API.md +86 -5
- data/docs/Supported-OS-Types.md +20 -9
- data/docs/Troubleshooting.md +1 -1
- data/extra/device2yaml.rb +2 -3
- data/extra/hooks/modelrules.rb +55 -0
- data/extra/hooks/modelrulesadvanced.rb +168 -0
- data/extra/hooks/srcipmap.rb +54 -0
- data/lib/oxidized/hook/githubrepo.rb +2 -1
- data/lib/oxidized/hook.rb +56 -8
- data/lib/oxidized/input/exec.rb +0 -4
- data/lib/oxidized/input/ftp.rb +0 -13
- data/lib/oxidized/input/http.rb +38 -13
- data/lib/oxidized/input/input.rb +33 -13
- data/lib/oxidized/input/scp.rb +10 -64
- data/lib/oxidized/input/ssh.rb +10 -60
- data/lib/oxidized/input/sshbase.rb +107 -0
- data/lib/oxidized/input/telnet.rb +0 -4
- data/lib/oxidized/input/tftp.rb +7 -3
- data/lib/oxidized/model/aoscx.rb +5 -3
- data/lib/oxidized/model/aosw.rb +10 -11
- data/lib/oxidized/model/apc_aos.rb +4 -0
- data/lib/oxidized/model/apcaos.rb +39 -0
- data/lib/oxidized/model/arubainstant.rb +11 -20
- data/lib/oxidized/model/asa.rb +7 -7
- data/lib/oxidized/model/comware.rb +3 -1
- data/lib/oxidized/model/defacto.rb +26 -0
- data/lib/oxidized/model/dslcommands.rb +93 -0
- data/lib/oxidized/model/dslsetup.rb +102 -0
- data/lib/oxidized/model/efos.rb +5 -5
- data/lib/oxidized/model/exalink.rb +36 -0
- data/lib/oxidized/model/fastiron.rb +2 -2
- data/lib/oxidized/model/firelinuxos.rb +1 -3
- data/lib/oxidized/model/fortigate.rb +160 -0
- data/lib/oxidized/model/fortios.rb +28 -69
- data/lib/oxidized/model/fsos.rb +1 -3
- data/lib/oxidized/model/h3c.rb +1 -1
- data/lib/oxidized/model/ios.rb +21 -15
- data/lib/oxidized/model/ironware.rb +5 -3
- data/lib/oxidized/model/ivanti.rb +54 -0
- data/lib/oxidized/model/macros.rb +60 -0
- data/lib/oxidized/model/mlnxos.rb +11 -7
- data/lib/oxidized/model/model.rb +28 -126
- data/lib/oxidized/model/ndms.rb +6 -0
- data/lib/oxidized/model/netgear.rb +5 -3
- data/lib/oxidized/model/nxos.rb +2 -2
- data/lib/oxidized/model/outputs.rb +5 -0
- data/lib/oxidized/model/perle.rb +14 -8
- data/lib/oxidized/model/smartbyte.rb +48 -0
- data/lib/oxidized/model/truenas.rb +10 -1
- data/lib/oxidized/model/voss.rb +3 -0
- data/lib/oxidized/model/vyos.rb +3 -1
- data/lib/oxidized/node.rb +25 -23
- data/lib/oxidized/nodes.rb +2 -0
- data/lib/oxidized/output/file.rb +7 -1
- data/lib/oxidized/output/git.rb +11 -1
- data/lib/oxidized/output/gitcrypt.rb +1 -1
- data/lib/oxidized/output/http.rb +12 -3
- data/lib/oxidized/source/csv.rb +5 -0
- data/lib/oxidized/source/jsonfile.rb +5 -0
- data/lib/oxidized/source/sql.rb +5 -0
- data/lib/oxidized/version.rb +2 -2
- data/lib/oxidized/worker.rb +36 -15
- data/lib/refinements.rb +18 -0
- data/oxidized.gemspec +28 -24
- metadata +98 -55
- data/docs/Model-Notes/APC_AOS.md +0 -65
- data/docs/Model-Notes/FortiOS.md +0 -44
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f594c7328a0f47ff8623d8a025df44224af1e7addc71c57bd0c37ab2285c4f8f
|
|
4
|
+
data.tar.gz: 837bb841353c080c93235ca4a46095d42335fa8e05623f3e6f7ef5fc9cc67a44
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ce194d0b6353b929bdb14514d835a1500d846c50491d30782d89c1c3ccc2a6e0f0cdc34aa0b9385c8ca2ce82f0c759a917f252076fc8675169d5eb40694bc3dc
|
|
7
|
+
data.tar.gz: 21c716e53c0e391bfefa617e0a3bc68a23a14a04dce3d508ca82c127f993ea909a27799901d6ad3c3e0bb1625d749bae73882f2c8e2fcb8f0b400aca036df5ab
|
data/.coderabbit.yaml
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
reviews:
|
|
2
|
+
auto_review:
|
|
3
|
+
enabled: false
|
|
4
|
+
auto_incremental_review: false
|
|
5
|
+
|
|
6
|
+
commit_status: false
|
|
7
|
+
review_status: false
|
|
8
|
+
high_level_summary: false
|
|
9
|
+
suggested_labels: false
|
|
10
|
+
suggested_reviewers: false
|
|
11
|
+
changed_files_summary: false
|
|
12
|
+
poem: false
|
|
13
|
+
sequence_diagrams: false
|
|
14
|
+
estimate_code_review_effort: false
|
|
15
|
+
assess_linked_issues: false
|
|
16
|
+
related_issues: false
|
|
17
|
+
in_progress_fortune: false
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
chat:
|
|
21
|
+
auto_reply: false
|
|
@@ -27,27 +27,28 @@ jobs:
|
|
|
27
27
|
|
|
28
28
|
- name: Docker meta
|
|
29
29
|
id: meta
|
|
30
|
-
uses: docker/metadata-action@
|
|
30
|
+
uses: docker/metadata-action@v6
|
|
31
31
|
with:
|
|
32
32
|
images: ${{ env.REGISTRY_IMAGE }}
|
|
33
33
|
tags: |
|
|
34
34
|
type=semver,pattern={{version}}
|
|
35
|
+
type=semver,pattern={{major}}
|
|
35
36
|
type=sha,prefix=master-
|
|
36
37
|
flavor: |
|
|
37
38
|
latest=true
|
|
38
39
|
|
|
39
40
|
- name: Login to Docker Hub
|
|
40
|
-
uses: docker/login-action@
|
|
41
|
+
uses: docker/login-action@v4
|
|
41
42
|
with:
|
|
42
43
|
username: ${{ secrets.DOCKER_USERNAME }}
|
|
43
44
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
|
44
45
|
|
|
45
46
|
- name: Set up Docker Buildx
|
|
46
|
-
uses: docker/setup-buildx-action@
|
|
47
|
+
uses: docker/setup-buildx-action@v4
|
|
47
48
|
|
|
48
49
|
- name: Build and push by digest
|
|
49
50
|
id: build
|
|
50
|
-
uses: docker/build-push-action@
|
|
51
|
+
uses: docker/build-push-action@v7
|
|
51
52
|
with:
|
|
52
53
|
platforms: ${{ matrix.platform }}
|
|
53
54
|
tags: ${{ env.REGISTRY_IMAGE }}
|
|
@@ -65,7 +66,7 @@ jobs:
|
|
|
65
66
|
touch "${{ runner.temp }}/digests/${digest#sha256:}"
|
|
66
67
|
|
|
67
68
|
- name: Upload digest
|
|
68
|
-
uses: actions/upload-artifact@
|
|
69
|
+
uses: actions/upload-artifact@v7
|
|
69
70
|
with:
|
|
70
71
|
name: digests-${{ env.PLATFORM_PAIR }}
|
|
71
72
|
path: ${{ runner.temp }}/digests/*
|
|
@@ -78,28 +79,29 @@ jobs:
|
|
|
78
79
|
- build
|
|
79
80
|
steps:
|
|
80
81
|
- name: Download digests
|
|
81
|
-
uses: actions/download-artifact@
|
|
82
|
+
uses: actions/download-artifact@v8
|
|
82
83
|
with:
|
|
83
84
|
path: ${{ runner.temp }}/digests
|
|
84
85
|
pattern: digests-*
|
|
85
86
|
merge-multiple: true
|
|
86
87
|
|
|
87
88
|
- name: Login to Docker Hub
|
|
88
|
-
uses: docker/login-action@
|
|
89
|
+
uses: docker/login-action@v4
|
|
89
90
|
with:
|
|
90
91
|
username: ${{ secrets.DOCKER_USERNAME }}
|
|
91
92
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
|
92
93
|
|
|
93
94
|
- name: Set up Docker Buildx
|
|
94
|
-
uses: docker/setup-buildx-action@
|
|
95
|
+
uses: docker/setup-buildx-action@v4
|
|
95
96
|
|
|
96
97
|
- name: Docker meta
|
|
97
98
|
id: meta
|
|
98
|
-
uses: docker/metadata-action@
|
|
99
|
+
uses: docker/metadata-action@v6
|
|
99
100
|
with:
|
|
100
101
|
images: ${{ env.REGISTRY_IMAGE }}
|
|
101
102
|
tags: |
|
|
102
103
|
type=semver,pattern={{version}}
|
|
104
|
+
type=semver,pattern={{major}}
|
|
103
105
|
type=sha,prefix=master-
|
|
104
106
|
flavor: |
|
|
105
107
|
latest=true
|
data/.github/workflows/ruby.yml
CHANGED
|
@@ -19,14 +19,12 @@ jobs:
|
|
|
19
19
|
runs-on: ubuntu-latest
|
|
20
20
|
strategy:
|
|
21
21
|
matrix:
|
|
22
|
-
ruby-version: ['3.1', '3.2', '3.3', '3.4', 'ruby-head']
|
|
22
|
+
ruby-version: ['3.0', '3.1', '3.2', '3.3', '3.4', 'ruby-head']
|
|
23
23
|
continue-on-error: ${{ matrix.ruby-version == 'ruby-head' }}
|
|
24
24
|
|
|
25
25
|
steps:
|
|
26
26
|
- uses: actions/checkout@v6
|
|
27
27
|
- name: Set up Ruby
|
|
28
|
-
# To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
|
|
29
|
-
# change this to (see https://github.com/ruby/setup-ruby#versioning):
|
|
30
28
|
uses: ruby/setup-ruby@v1
|
|
31
29
|
with:
|
|
32
30
|
ruby-version: ${{ matrix.ruby-version }}
|
data/.rubocop.yml
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
inherit_from: .rubocop_todo.yml
|
|
2
2
|
|
|
3
|
+
inherit_mode:
|
|
4
|
+
merge:
|
|
5
|
+
- Exclude
|
|
6
|
+
|
|
3
7
|
plugins:
|
|
4
8
|
- rubocop-rake
|
|
5
9
|
- rubocop-minitest
|
|
@@ -24,7 +28,6 @@ Style/FrozenStringLiteralComment:
|
|
|
24
28
|
|
|
25
29
|
Layout/LineLength:
|
|
26
30
|
Enabled: true
|
|
27
|
-
IgnoreCopDirectives: false
|
|
28
31
|
Max: 120
|
|
29
32
|
# Too much models have long lines, which is unsafe to reduce without
|
|
30
33
|
# having an existing model unit test.
|
|
@@ -66,6 +69,10 @@ Style/ConditionalAssignment:
|
|
|
66
69
|
Style/FormatString:
|
|
67
70
|
EnforcedStyle: percent
|
|
68
71
|
|
|
72
|
+
Style/FileOpen:
|
|
73
|
+
Exclude:
|
|
74
|
+
- lib/oxidized/input/*.rb
|
|
75
|
+
|
|
69
76
|
Style/FormatStringToken:
|
|
70
77
|
EnforcedStyle: unannotated
|
|
71
78
|
AllowedMethods: ['metadata']
|
|
@@ -82,6 +89,10 @@ Style/HashTransformKeys:
|
|
|
82
89
|
Style/HashTransformValues:
|
|
83
90
|
Enabled: true
|
|
84
91
|
|
|
92
|
+
Style/OneClassPerFile:
|
|
93
|
+
Exclude:
|
|
94
|
+
- spec/**/*.rb
|
|
95
|
+
|
|
85
96
|
Style/RegexpLiteral:
|
|
86
97
|
EnforcedStyle: slashes
|
|
87
98
|
AllowInnerSlashes: true
|
|
@@ -107,7 +118,7 @@ Metrics/AbcSize:
|
|
|
107
118
|
Enabled: false
|
|
108
119
|
|
|
109
120
|
Metrics/ClassLength:
|
|
110
|
-
|
|
121
|
+
Max: 200
|
|
111
122
|
|
|
112
123
|
Metrics/PerceivedComplexity:
|
|
113
124
|
Enabled: false
|
data/.rubocop_todo.yml
CHANGED
|
@@ -1,11 +1,18 @@
|
|
|
1
1
|
# This configuration was generated by
|
|
2
2
|
# `rubocop --auto-gen-config`
|
|
3
|
-
# on
|
|
3
|
+
# on 2026-03-31 11:49:52 UTC using RuboCop version 1.86.0.
|
|
4
4
|
# The point is for the user to remove these configuration records
|
|
5
5
|
# one by one as the offenses are removed from the code base.
|
|
6
6
|
# Note that changes in the inspected code, or installation of new
|
|
7
7
|
# versions of RuboCop, may require this file to be generated again.
|
|
8
8
|
|
|
9
|
+
# Offense count: 2
|
|
10
|
+
# Configuration parameters: CountComments, Max, CountAsOne.
|
|
11
|
+
Metrics/ClassLength:
|
|
12
|
+
Exclude:
|
|
13
|
+
- 'lib/oxidized/node.rb'
|
|
14
|
+
- 'lib/oxidized/output/git.rb'
|
|
15
|
+
|
|
9
16
|
# Offense count: 1
|
|
10
17
|
Style/ClassVars:
|
|
11
18
|
Exclude:
|
|
@@ -19,7 +26,19 @@ Style/DoubleNegation:
|
|
|
19
26
|
Exclude:
|
|
20
27
|
- 'lib/oxidized/hook/exec.rb'
|
|
21
28
|
|
|
22
|
-
# Offense count:
|
|
29
|
+
# Offense count: 1
|
|
30
|
+
Style/FileOpen:
|
|
31
|
+
Exclude:
|
|
32
|
+
- 'extra/syslog.rb'
|
|
33
|
+
|
|
34
|
+
# Offense count: 2
|
|
35
|
+
# Configuration parameters: AllowedClasses.
|
|
36
|
+
Style/OneClassPerFile:
|
|
37
|
+
Exclude:
|
|
38
|
+
- 'lib/oxidized/input/telnet.rb'
|
|
39
|
+
- 'lib/oxidized/signals.rb'
|
|
40
|
+
|
|
41
|
+
# Offense count: 32
|
|
23
42
|
# This cop supports unsafe autocorrection (--autocorrect-all).
|
|
24
43
|
Style/SlicingWithRange:
|
|
25
44
|
Enabled: false
|
data/CHANGELOG.md
CHANGED
|
@@ -4,13 +4,60 @@ All notable changes to this project will be documented in this file.
|
|
|
4
4
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
|
|
6
6
|
|
|
7
|
+
## [0.36.0 - 2026-03-31]
|
|
8
|
+
### Release Notes
|
|
9
|
+
The fortios model has been split into fortigate and fortios. You need the new fortigate model for FortiGate firewalls. Be sure to check the [Fortinet model notes](docs/Model-Notes/Fortinet.md) before upgrading.
|
|
10
|
+
|
|
11
|
+
The SCP gem is now an optional dependency as it will rarely be used - you must install it if you need it. It is still included in the docker image.
|
|
12
|
+
|
|
13
|
+
We may rework models in the future to clean up duplicated code (by using the macros or by inheriting from the Defacto model). To make sure your favorite model doesn’t break, please share [simulation files](/docs/DeviceSimulation.md) via issues or, preferably, pull requests, so we can detect when a change breaks a model.
|
|
14
|
+
|
|
15
|
+
### Added
|
|
16
|
+
- Support https mode, headers, and ssl verify for HTTP output (@bahirul)
|
|
17
|
+
- String refinements: introduce `keep_lines` and `reject_lines` methods (@robertcheramy)
|
|
18
|
+
- Support for storing configurations only on significant changes (@robertcheramy)
|
|
19
|
+
- Add support for Ivanti Secure Connect ISA models (@candleflip)
|
|
20
|
+
- smartbyte: new model for SmartByte switches (@freddy36)
|
|
21
|
+
- Support multiple input (@robertcheramy)
|
|
22
|
+
- apcaos model with SSH + SCP capabilities, deprecates apc_aos (@robertcheramy)
|
|
23
|
+
- exalink model for specific Cisco ExaLink Fusion (formerly Exablaze) switches (@obol89)
|
|
24
|
+
- source_node_transform hook, allows user to manipulate node data when loading from source (@ytti)
|
|
25
|
+
- docker image: publish major version tag (e.g. `0`) in addition to full semver tag on releases (@infabo)
|
|
26
|
+
- introduce the defacto model and macros for models (@ytti)
|
|
27
|
+
|
|
28
|
+
### Changed
|
|
29
|
+
- Refactored models: Use `keep_lines` and `reject_lines` in aosw, arubainstant, asa, efos, firelinuxos, fsos, ironware, mlnxos and perle (@robertcheramy)
|
|
30
|
+
- Refactor SSH and SCP into a common class SSHBase. Fixes #3597 (@robertcheramy)
|
|
31
|
+
- Modified models to support store mode on significant changes: ios, fortios, perle, ndms (@robertcheramy, @furriest)
|
|
32
|
+
- fortios: model rewrite and split into fortios and fortigate. Fixes #3680 (@robertcheramy)
|
|
33
|
+
- fortigate: Add PSU & SFP inventory (@robertcheramy)
|
|
34
|
+
- fortigate: move var fortios_autoupdate (deprecated) to fortigate_autoupdate (@robertcheramy)
|
|
35
|
+
- netgear: extended login and pager detection to add support for GS728TPv2 and GS752TPv2 (@weberc)
|
|
36
|
+
- comware: Hide snmp secrets for Comware (@iriseden)
|
|
37
|
+
- Aruba-CX : Hide secrets for Aruba-CX (@iriseden)
|
|
38
|
+
|
|
39
|
+
### Fixed
|
|
40
|
+
- VyOS: Only remove SNMP community, not route-maps. Fixes #3735 (@systeembeheerder)
|
|
41
|
+
- apc_aos: set comment to "; " to match comments in config.ini (@robertcheramy)
|
|
42
|
+
- h3c: fix overly permissive prompt regexp causing false matches. Fixes #3673 (@robertcheramy)
|
|
43
|
+
- extra/device2yaml.rb: fix \r being removed at end of line (@robertcheramy)
|
|
44
|
+
- perle: remove trailing \r (the device sends \r\r\n) (@robertcheramy)
|
|
45
|
+
- Reintroduce support for Ruby 3.0. Fixes #3688 (@robertcheramy)
|
|
46
|
+
- githubrepo: fix authentication with ssh-agent not working. Fixes #3420 (@robertcheramy)
|
|
47
|
+
- fastiron: adjust prompt to account for stacks, remove time from stack output. Fixes #3106 (@ManoftheSea)
|
|
48
|
+
- interval: fix fetching device configuration at oxidized start when interval is 0. Fixes #3746 (@tgr229)
|
|
49
|
+
- voss: more cleanup of constantly changing values (fan & temp) for at least Extreme Networks 7520-48Y-8C-FabricEngine (8.10.5.0) (@irrwitzer42)
|
|
50
|
+
- truenas: Added retry logic to use sudo for reading/dumping the configuration database if needed. Fixes #3767 (@neilschelly)
|
|
51
|
+
- aoscx: update regex to include 'N/A' in FAN speed parsing (@solrac200, @robertcheramy)
|
|
52
|
+
- nxos: show inventory for older models. Fixes #3779 (@scamp)
|
|
53
|
+
|
|
7
54
|
## [0.35.0 - 2025-12-04]
|
|
8
55
|
### Release Notes
|
|
9
|
-
- VyOS now has it's own
|
|
56
|
+
- VyOS now has it's own model and should be used for supported VyOS versions instead of the Vyatta model.
|
|
10
57
|
- AosCX has been reworked and may break old OS versions. Submit an issue along with a YAML Simulation File if you encounter problems.
|
|
11
58
|
- TiMOS (deprecated model) has been removed. Use SROS.
|
|
12
|
-
- FortiOs will be reworked in
|
|
13
|
-
- Support for Ruby 3.1 will be discontinued in
|
|
59
|
+
- FortiOs will be reworked in release 0.36 (Issue #3680). Subscribe to the issue if you want to be informed and test the model before the release.
|
|
60
|
+
- ~~Support for Ruby 3.1 will be discontinued in release 0.36 (Issue #3688) if no one objects.~~
|
|
14
61
|
|
|
15
62
|
### Added
|
|
16
63
|
- Allow setting timeout on per node basis. Closes #3612 (@ytti)
|
data/README.md
CHANGED
|
@@ -73,8 +73,7 @@ Check out the [Oxidized TREX 2014 presentation](http://youtu.be/kBQ_CTUuqeU?t=3h
|
|
|
73
73
|
## Installation
|
|
74
74
|
|
|
75
75
|
### Debian and Ubuntu
|
|
76
|
-
|
|
77
|
-
Debian "buster" or newer and Ubuntu 17.10 (artful) or newer are recommended. On Ubuntu, begin by enabling the `universe`
|
|
76
|
+
Debian 12 "bookworm" or newer and Ubuntu 22.04 (Jammy Jellyfish) or newer are recommended. On Ubuntu, begin by enabling the `universe`
|
|
78
77
|
repository (required for libssh2-1-dev):
|
|
79
78
|
|
|
80
79
|
```shell
|
|
@@ -129,7 +128,7 @@ gem install oxidized-script # Script-based input/output extensions
|
|
|
129
128
|
```
|
|
130
129
|
|
|
131
130
|
### FreeBSD
|
|
132
|
-
These installation instructions have been tested on FreeBSD 14.2, but
|
|
131
|
+
> :warning: These installation instructions have been tested on FreeBSD 14.2, but
|
|
133
132
|
oxidized itself has not been tested on it.
|
|
134
133
|
|
|
135
134
|
First install ruby and rubyXX-gems (Find out the name of the package with `pkg search gems`):
|
data/docs/Configuration.md
CHANGED
|
@@ -82,7 +82,7 @@ a regular expression.
|
|
|
82
82
|
username: oxidized
|
|
83
83
|
password: S3cr3tx
|
|
84
84
|
model: junos
|
|
85
|
-
interval: 3600 #interval in seconds
|
|
85
|
+
interval: 3600 #interval in seconds, when 0 is configured no fetch config is done at initial start and after
|
|
86
86
|
log: ~/.config/oxidized/log
|
|
87
87
|
debug: false
|
|
88
88
|
threads: 30 # maximum number of threads
|
|
@@ -548,3 +548,32 @@ end
|
|
|
548
548
|
```
|
|
549
549
|
|
|
550
550
|
Remove a previous metadata by setting it to `nil`.
|
|
551
|
+
|
|
552
|
+
## Store configuration only on significant changes
|
|
553
|
+
Some devices produce configuration changes even though nothing relevant
|
|
554
|
+
changed. For example, Cisco IOS produces a `Last configuration change at` as
|
|
555
|
+
soon as you exit config mode, and FortiOS encrypts its passwords with a
|
|
556
|
+
different salt on every run.
|
|
557
|
+
|
|
558
|
+
By setting the [variable](#options-credentials-vars-etc-precedence)
|
|
559
|
+
`output_store_mode` to `on_significant`, you can tell Oxidized only to
|
|
560
|
+
store the configuration when significant changes occurred. The default is to
|
|
561
|
+
always store the configuration.
|
|
562
|
+
```yaml
|
|
563
|
+
vars:
|
|
564
|
+
output_store_mode: on_significant
|
|
565
|
+
```
|
|
566
|
+
|
|
567
|
+
For this to work, the model must implement `cmd :significant_changes`:
|
|
568
|
+
```ruby
|
|
569
|
+
cmd :significant_changes do |cfg|
|
|
570
|
+
cfg.reject_lines [
|
|
571
|
+
'Last configuration change at',
|
|
572
|
+
'NVRAM config last updated at'
|
|
573
|
+
]
|
|
574
|
+
end
|
|
575
|
+
```
|
|
576
|
+
|
|
577
|
+
Note that store on significant change only applies to the main configuration,
|
|
578
|
+
and will not affect
|
|
579
|
+
[output types](Creating-Models.md#advanced-feature-output-type)
|
data/docs/Creating-Models.md
CHANGED
|
@@ -1,10 +1,19 @@
|
|
|
1
1
|
# Creating and Extending Models
|
|
2
2
|
|
|
3
|
-
Oxidized supports a growing list of
|
|
3
|
+
Oxidized supports a growing list of
|
|
4
|
+
[operating system types](Supported-OS-Types.md). Out of the box, most model
|
|
5
|
+
implementations collect configuration data. Some implementations also include a
|
|
6
|
+
conservative set of additional commands that collect basic device information
|
|
7
|
+
(device make and model, software version, licensing information, ...) which are
|
|
8
|
+
appended to the configuration as comments.
|
|
4
9
|
|
|
5
|
-
A user may wish to extend an existing model to collect the output of additional
|
|
10
|
+
A user may wish to extend an existing model to collect the output of additional
|
|
11
|
+
commands. Oxidized offers smart loading of models in order to facilitate this
|
|
12
|
+
with ease, without the need to introduce changes to the upstream source code.
|
|
6
13
|
|
|
7
|
-
This methodology allows local site changes to be preserved during Oxidized
|
|
14
|
+
This methodology allows local site changes to be preserved during Oxidized
|
|
15
|
+
version updates / gem updates. It also enables convenient local development
|
|
16
|
+
of new models.
|
|
8
17
|
|
|
9
18
|
## Index
|
|
10
19
|
- [Creating a new model](#creating-a-new-model)
|
|
@@ -19,14 +28,50 @@ This methodology allows local site changes to be preserved during Oxidized versi
|
|
|
19
28
|
- [Help](#help)
|
|
20
29
|
|
|
21
30
|
## Creating a new model
|
|
31
|
+
### Use the defacto model
|
|
32
|
+
Before you create a new model, check the
|
|
33
|
+
[defacto model](/lib/oxidized/model/defacto.rb). It aims to work with a lot of
|
|
34
|
+
devices copying the defacto standard set by the cisco CLI:
|
|
35
|
+
- login per ssh or telnet
|
|
36
|
+
- disable pager
|
|
37
|
+
- execute `show running-config`
|
|
38
|
+
- run both `exit` and `logout`
|
|
39
|
+
|
|
40
|
+
If you want to extend the defacto model, you can define your own model file,
|
|
41
|
+
and inherit from `Defacto`:
|
|
42
|
+
```ruby
|
|
43
|
+
require 'oxidized/model/defacto'
|
|
44
|
+
|
|
45
|
+
class OxiWare < Defacto
|
|
46
|
+
# Redefine how to process show running-config
|
|
47
|
+
def process_config(cfg)
|
|
48
|
+
cfg.gsub(/.*service timestamps.*/, '')
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
# run more commands. They will be run before 'show running-config'
|
|
52
|
+
cmd "show cdp neighbors" do |cfg|
|
|
53
|
+
comment cfg
|
|
54
|
+
end
|
|
22
55
|
|
|
56
|
+
# Send "enable" password if defined in vars("enable")
|
|
57
|
+
macro :enable
|
|
58
|
+
end
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
If your model doesn't support "show running-config", or if you prefer to avoid
|
|
62
|
+
the dependency of the defacto model, you will need to write a model "from
|
|
63
|
+
scratch" as explained in the next section.
|
|
64
|
+
|
|
65
|
+
### Create a new model from scratch
|
|
23
66
|
An Oxidized model, at minimum, requires just three elements:
|
|
24
67
|
|
|
25
68
|
* A model file, this file should be placed in the ~/.config/oxidized/model directory and named after the target OS type.
|
|
26
69
|
* A class defined within this file with the same name as the file itself that inherits from `Oxidized::Model`, the base model class.
|
|
27
70
|
* At least one command that will be executed and the output of which will be collected by Oxidized.
|
|
28
71
|
|
|
29
|
-
A bare-bone example for a fictional model running the OS type `rootware` could
|
|
72
|
+
A bare-bone example for a fictional model running the OS type `rootware` could
|
|
73
|
+
be introduced by creating the file `~/.config/oxidized/model/rootware.rb`, with
|
|
74
|
+
the following content:
|
|
30
75
|
|
|
31
76
|
```ruby
|
|
32
77
|
class RootWare < Oxidized::Model
|
|
@@ -60,14 +105,84 @@ A more fleshed out example can be found in the `IOS` and `JunOS` models.
|
|
|
60
105
|
|
|
61
106
|
## Typical Tasks and Solutions
|
|
62
107
|
|
|
108
|
+
### Keep or Remove Lines Returned from a Command
|
|
109
|
+
To make command output cleaner, you can remove unwanted lines or keep only
|
|
110
|
+
specific ones.
|
|
111
|
+
|
|
112
|
+
Most devices echo the executed command on the first line and display a
|
|
113
|
+
prompt on the last line. To remove these for all commands, use
|
|
114
|
+
[cut_both](Ruby-API.md#cut_both):
|
|
115
|
+
```ruby
|
|
116
|
+
cmd :all do |cfg|
|
|
117
|
+
cfg.cut_both
|
|
118
|
+
end
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
You can also use the macro `clean :cut`, which does the same:
|
|
122
|
+
```ruby
|
|
123
|
+
clean :cut
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
If you want to keep only relevant lines, use
|
|
127
|
+
[keep_lines](Ruby-API.md#keep_lines):
|
|
128
|
+
```ruby
|
|
129
|
+
cmd 'show interfaces transceiver' do |cfg|
|
|
130
|
+
cfg = cfg.keep_lines [
|
|
131
|
+
'SFP Information',
|
|
132
|
+
/Vendor (Name|Serial Number)/
|
|
133
|
+
]
|
|
134
|
+
comment cfg + "\n"
|
|
135
|
+
end
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
If you want to suppress specific lines,
|
|
139
|
+
use [reject_lines](Ruby-API.md#reject_lines):
|
|
140
|
+
```ruby
|
|
141
|
+
cmd 'show running-config' do |cfg|
|
|
142
|
+
cfg.reject_lines [
|
|
143
|
+
'System Up Time',
|
|
144
|
+
/Current .* Time:/
|
|
145
|
+
]
|
|
146
|
+
end
|
|
147
|
+
```
|
|
148
|
+
|
|
63
149
|
### Handling 'enable' mode
|
|
64
|
-
|
|
65
|
-
|
|
150
|
+
Some devices need to send an 'enable' command and an enable password.
|
|
151
|
+
|
|
152
|
+
You can use the `macro :enable` command to implement this:
|
|
153
|
+
```ruby
|
|
154
|
+
class IOS < Oxidized::Model
|
|
155
|
+
using Refinements
|
|
156
|
+
# ... Code ...
|
|
157
|
+
macro :enable
|
|
158
|
+
end
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
`macro :enable` takes options:
|
|
162
|
+
- `regex`; the regex to match the password prompt (default: `/password/i`)
|
|
163
|
+
- `inputs`: a symbol or a list of symbols for which inputs enable should be activated (default: %i[telnet ssh])
|
|
164
|
+
- `command`: the command needed to access privileged mode (default: `enable`)
|
|
165
|
+
|
|
166
|
+
If one would want to access a german linux box as root, a minimal model would be:
|
|
167
|
+
```ruby
|
|
168
|
+
class GermanLinux < Oxidized::Model
|
|
169
|
+
using Refinements
|
|
170
|
+
|
|
171
|
+
prompt /^(\w.*|\W.*)[:#$] /
|
|
172
|
+
comment '# '
|
|
66
173
|
|
|
67
|
-
|
|
68
|
-
need to enable privileged mode, either without providing a password (by setting
|
|
69
|
-
`enable: true` in the configuration) or with a password.
|
|
174
|
+
cmd "id"
|
|
70
175
|
|
|
176
|
+
cfg :ssh do
|
|
177
|
+
pre_logout 'exit'
|
|
178
|
+
pre_logout 'exit'
|
|
179
|
+
end
|
|
180
|
+
|
|
181
|
+
macro :enable, inputs: :ssh, command: "su -", regex: /Passwort: /
|
|
182
|
+
end
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
The macro (with defaults) implements following code:
|
|
71
186
|
```ruby
|
|
72
187
|
cfg :telnet, :ssh do
|
|
73
188
|
post_login do
|
|
@@ -80,7 +195,7 @@ need to enable privileged mode, either without providing a password (by setting
|
|
|
80
195
|
end
|
|
81
196
|
end
|
|
82
197
|
```
|
|
83
|
-
|
|
198
|
+
|
|
84
199
|
|
|
85
200
|
### Remove ANSI Escape Codes
|
|
86
201
|
Some devices produce [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code#Control_Sequence_Introducer_commands)
|
|
@@ -110,8 +225,8 @@ You can nest `cmd` inside [`cmd` blocks](Ruby-API.md#cmd), the following example
|
|
|
110
225
|
is taken from [nxos.rb](/lib/oxidized/model/nxos.rb):
|
|
111
226
|
```ruby
|
|
112
227
|
cmd 'show inventory all' do |cfg|
|
|
113
|
-
if cfg.
|
|
114
|
-
# 'show inventory all' isn't supported on older versions (See
|
|
228
|
+
if cfg.match? /^% Invalid .* at '\^' marker\./
|
|
229
|
+
# 'show inventory all' isn't supported on older versions (See Issues #3657, #3779)
|
|
115
230
|
cfg = cmd 'show inventory'
|
|
116
231
|
end
|
|
117
232
|
comment cfg
|
|
@@ -209,7 +324,7 @@ A good (and optional) practice for submissions is to provide a
|
|
|
209
324
|
further developments could break it, and facilitates debugging issues without
|
|
210
325
|
having access to a physical network device for the model.
|
|
211
326
|
|
|
212
|
-
## Advanced
|
|
327
|
+
## Advanced feature: output type
|
|
213
328
|
|
|
214
329
|
The loosely-coupled architecture of Oxidized allows for easy extensibility in more advanced use cases as well.
|
|
215
330
|
|
data/docs/Docker.md
CHANGED
|
@@ -8,7 +8,8 @@ as [oxidized/oxidized](https://hub.docker.com/r/oxidized/oxidized/) with a
|
|
|
8
8
|
There are three different types of tags:
|
|
9
9
|
- Each commit to the master branch will be published with the tag
|
|
10
10
|
`master-(git sha oid)`
|
|
11
|
-
- Each release will be published with the version as a tag
|
|
11
|
+
- Each release will be published with the full version as a tag (e.g. `0.35.0`)
|
|
12
|
+
- Each release will also be published with the major version as a tag (e.g. `0`)
|
|
12
13
|
- Latest is the latest release, either from a commit or a release tag
|
|
13
14
|
|
|
14
15
|
Currently, Docker Hub automatically builds the master branch for linux/amd64 and
|
data/docs/Inputs.md
CHANGED
|
@@ -177,6 +177,35 @@ input:
|
|
|
177
177
|
passive: false
|
|
178
178
|
```
|
|
179
179
|
|
|
180
|
+
## HTTP
|
|
181
|
+
### Supported HTTP Methods
|
|
182
|
+
|
|
183
|
+
The HTTP input supports the following HTTP methods:
|
|
184
|
+
- `:get` - for GET requests
|
|
185
|
+
- `:post` - for POST requests
|
|
186
|
+
|
|
187
|
+
These methods are used internally by models that require HTTP-based
|
|
188
|
+
configuration retrieval. Models can use `get_http()` and `post_http()` methods
|
|
189
|
+
provided by the HTTP input.
|
|
190
|
+
|
|
191
|
+
Example usage in a model:
|
|
192
|
+
|
|
193
|
+
```ruby
|
|
194
|
+
cfg :http do
|
|
195
|
+
post_response = post_http('/some/path', payload, 'Some-Extra-Header' => 'value')
|
|
196
|
+
get_response = get_http('/some/path')
|
|
197
|
+
end
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
HTTP input can be enabled by adding this block to the configuration file:
|
|
201
|
+
|
|
202
|
+
```yaml
|
|
203
|
+
input:
|
|
204
|
+
http:
|
|
205
|
+
scheme: https
|
|
206
|
+
ssl_verify: true
|
|
207
|
+
timeout: 30
|
|
208
|
+
```
|
|
180
209
|
|
|
181
210
|
## Debugging
|
|
182
211
|
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
# APC Configuration
|
|
2
|
+
The configuration of APC Network Management Cards can be downloaded using FTP
|
|
3
|
+
and SCP. You can retrieve serial numbers and OS version information through
|
|
4
|
+
an SSH connection.
|
|
5
|
+
|
|
6
|
+
APC OS does not have the ability to display the config.ini within an SSH shell.
|
|
7
|
+
A ticket was opened with APC support to enable "cat config.ini"
|
|
8
|
+
within an SSH shell, but APC declined to implement this feature.
|
|
9
|
+
|
|
10
|
+
To overcome this limitation, a capability to run against multiple inputs (SSH + SCP)
|
|
11
|
+
has been implemented in Oxidized and in the [model ApcAos](/lib/oxidized/model/apcaos.rb).
|
|
12
|
+
|
|
13
|
+
The old model apc_aos (SCP/FTP only) is deprecated and will be removed in a
|
|
14
|
+
future release. Migrate to ApcAos.
|
|
15
|
+
|
|
16
|
+
## How do I activate FTP/SCP input?
|
|
17
|
+
To download the configuration with FTP or SCP, you must activate it
|
|
18
|
+
as an input in the Oxidized configuration. If you don't activate the input,
|
|
19
|
+
Oxidized will fail for the node with an error.
|
|
20
|
+
|
|
21
|
+
You probably also need to increase the default timeout to something about 60
|
|
22
|
+
seconds, as the APC are really slow, and need about 30 seconds to complete.
|
|
23
|
+
|
|
24
|
+
The configuration can be done either globally or only for the ApcAos model.
|
|
25
|
+
|
|
26
|
+
### Global Configuration
|
|
27
|
+
The global configuration would look like this. Note that Oxidized will try every
|
|
28
|
+
input type in the given order until it succeeds, or it will report a failure.
|
|
29
|
+
```yaml
|
|
30
|
+
timeout: 60
|
|
31
|
+
input:
|
|
32
|
+
default: ssh, ftp, scp
|
|
33
|
+
```
|
|
34
|
+
The order in the configuration is relevant. With this configuration, the ApcAos
|
|
35
|
+
model will run SSH first, then it will try FTP, and if FTP fails SCP.
|
|
36
|
+
|
|
37
|
+
### Model-Specific Configuration
|
|
38
|
+
|
|
39
|
+
Configuration for activating only the SCP input for ApcAos only:
|
|
40
|
+
```yaml
|
|
41
|
+
input:
|
|
42
|
+
default: ssh
|
|
43
|
+
models:
|
|
44
|
+
apcaos:
|
|
45
|
+
input: ssh, scp
|
|
46
|
+
timeout: 60
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### Setting Specific Credentials
|
|
50
|
+
You can also set a specific username and password for ApcAos only:
|
|
51
|
+
```yaml
|
|
52
|
+
username: default-user
|
|
53
|
+
password: default-password
|
|
54
|
+
input:
|
|
55
|
+
default: ssh
|
|
56
|
+
models:
|
|
57
|
+
ApcAos:
|
|
58
|
+
username: apc-user
|
|
59
|
+
password: apc-password
|
|
60
|
+
input: ssh, scp
|
|
61
|
+
timeout: 60
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## Why do I partially get CR + LF?
|
|
65
|
+
The config.ini file has a DOS-Format (CR + LF), and is saved without
|
|
66
|
+
modifications, so that it can be uploaded to the device.
|
|
67
|
+
|
|
68
|
+
Outputs from ssh are stored without CR, so the first part of the file is
|
|
69
|
+
without CR and config.ini with CR + LF.
|
|
70
|
+
|
|
71
|
+
This is expected behavior and should not affect the functionality of the backup
|
|
72
|
+
or restore process.
|