-
Notifications
You must be signed in to change notification settings - Fork 230
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
Feat(eos_validate_state): ANTA Provide custom ANTA catalog files to validate state #3655
Feat(eos_validate_state): ANTA Provide custom ANTA catalog files to validate state #3655
Conversation
ansible_collections/arista/avd/plugins/action/eos_validate_state_runner.py
Show resolved
Hide resolved
...ble_collections/arista/avd/plugins/plugin_utils/eos_validate_state_utils/get_anta_results.py
Outdated
Show resolved
Hide resolved
ansible_collections/arista/avd/roles/eos_validate_state/python_modules/tests/avdtestmlag.py
Show resolved
Hide resolved
ansible_collections/arista/avd/roles/eos_validate_state/ANTA-Preview.md
Outdated
Show resolved
Hide resolved
@@ -168,7 +193,7 @@ def get_skipped_tests_from_tags(run_tags: tuple, skip_tags: tuple) -> list[dict] | |||
return result | |||
|
|||
|
|||
def generate_tests(device_name: str, hostvars: Mapping, skipped_tests: list[dict]) -> RawCatalogInput: | |||
def generate_tests(device_name: str, hostvars: Mapping, skipped_tests: list[dict], custom_catalog: dict | None = None) -> RawCatalogInput: | |||
"""Create the test catalog in a dictionnary format generated from the AVD test classes. | |||
|
|||
Test definitions are generated from the AVD structured_config for each AVD test classes and are merged together to create the final catalog. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add here something about custom_catalog
Test definitions are generated from the AVD structured_config for each AVD test classes and are merged together to create the final catalog. | |
Test definitions are generated from the AVD structured_config for each AVD test classes and are merged together with an optional custom_catalog to create the final catalog. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in c490e18.
...ble_collections/arista/avd/plugins/plugin_utils/eos_validate_state_utils/get_anta_results.py
Show resolved
Hide resolved
with file.open("r", encoding="UTF-8") as fd: | ||
catalog = load(fd, Loader=CSafeLoader) | ||
catalog_list.append(catalog) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
exception handling - what if the file opening is causing issue. e.g. permission denied or malformated yaml?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in 1461c6d
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM - thanks for adding this! Let's merge when CI finihes
…alidate state (aristanetworks#3655) Co-authored-by: Guillaume Mulocher <[email protected]>
Change Summary
Feature to provide custom ANTA catalog files to validate state.
Related Issue(s)
Fixes #3384
Component(s) name
arista.avd.eos_validate_state
ANTA ModeProposed changes
custom_anta_catalogs_dir
added<hostname>.yml
or<hostname>.yaml
files representing a custom ANTA catalog and will merge that catalog on top of the auto-generated AVD tests.<group>.yml
or<group>.yaml
can also be provided,group
being an Ansible inventory group. The custom catalog will be merged on top of the auto-generated AVD tests for all devices part of that group.How to test
intended/custom_anta_catalogs
folder:. ├── intended │ ├── custom_anta_catalogs │ │ ├── DC1_L3_LEAVES.yml │ │ └── DC1-LEAF1A.yml
In this example, the
DC1_L3_LEAVES.yml
catalog will be applied to all devices under that group andDC1-LEAF1A.yml
catalog will be applied to this host only. You can also useall.yml
to target all devices in your Ansible inventory.Follow the ANTA documentation to provide custom tests. Here are some examples: https://github.com/arista-netdevops-community/anta/blob/main/examples/tests.yaml
You can then run validate state in ANTA mode -->
ansible-playbook playbooks/fabric-validate.yaml -e use_anta=true
Checklist
User Checklist
Repository Checklist