New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Map tags to inventory devices and test catalog #44
Labels
framework-enhancement
New feature or request
Comments
We are going to start tag implementation with the following approach:
anta_inventory:
hosts:
- host: 192.168.0.10
tags: []
- host: 192.168.0.11
tags: []
networks:
- network: 192.168.110.0/24
tags: []
ranges:
- start: 10.0.0.9
end: 10.0.0.11
tags: []
check-devices.py --inventory my_inventory.yml --catalog my_catalog.yml --tags tag1,tag2 --table So it will run all tests in the catalog for devices with tags |
ksator
pushed a commit
that referenced
this issue
Sep 8, 2022
* feat(inventory): Add initial support for tags Add support for tags in inventory module as per issue #44 ```yaml anta_inventory: hosts: - host: 192.168.0.10 tags: [] - host: 192.168.0.11 tags: [] networks: - network: 192.168.110.0/24 tags: [] ranges: - start: 10.0.0.9 end: 10.0.0.11 tags: [] ``` * doc: Fix typo in docstring * feat(inventory): Add method to filter inventory per tags - Update inventory module to support tag filtering in get_inventory - Update check-devices.py to support tags Inventory example: ```yaml anta_inventory: hosts: - host: 192.168.0.10 tags: ['test'] - host: 192.168.0.11 tags: ['dc1'] - host: 192.168.0.12 tags: ['dc1'] - host: 192.168.0.13 tags: ['dc2'] - host: 192.168.0.14 - host: 192.168.0.15 - host: 10.73.252.11 tags: ['dc1'] ranges: - start: 10.73.252.12 end: 10.73.252.50 tags: ['clab'] ``` Code execution ```bash python scripts/check-devices.py -i .personal/avd-lab.yml -c .personal/ceos-catalog.yml --table --tags dc1 [08:07:43] INFO Inventory .personal/avd-lab.yml loaded check-devices.py INFO starting running test on inventory ... check-devices.p [08:07:44] INFO testing done ! All tests results ┏━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓ ┃ Device IP ┃ Test Name ┃ Test Status ┃ Message(s) ┃ ┡━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┩ │ 10.73.252.11 │ verify_eos_version │ failure │ device is running version 4.27.2F-26069621.4272F (engineering build) not in expected versions: ['4.25.4M', '4.26.1F'] │ │ 10.73.252.11 │ verify_field_notice_44_resolution │ skipped │ verify_field_notice_44_resolution test is not supported on cEOSLab. │ │ 10.73.252.11 │ verify_uptime │ success │ │ │ 10.73.252.11 │ verify_zerotouch │ success │ │ │ 10.73.252.11 │ verify_running_config_diffs │ success │ │ │ 10.73.252.11 │ verify_mlag_status │ success │ │ │ 10.73.252.11 │ verify_mlag_interfaces │ success │ │ │ 10.73.252.11 │ verify_mlag_config_sanity │ success │ │ │ 10.73.252.11 │ verify_routing_protocol_model │ success │ │ └──────────────┴───────────────────────────────────┴─────────────┴───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ ``` * doc: Update rwith tag support
Closing this issue since the current tags implementation fits the use case:
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Increase flexibility by using tags on inventory devices and the test catalog, so that catalog tests can run on relevant devices only. For instance, in s typical EVPN scenario there.might be some tests that should run only in spines and some other tests only on leaf switches, having also some tests that run on all devices. Using tags or filters on tests and inventory devices could achieve this easily and add flexibility to the way tests execute. For inventory networks/ranges, tags would apply to the whole range/network...
The text was updated successfully, but these errors were encountered: