-
Notifications
You must be signed in to change notification settings - Fork 244
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: New anta_workflow plugin using PyAVD #4196
Feat: New anta_workflow plugin using PyAVD #4196
Conversation
Review docs on Read the Docs To test this pull request: # Create virtual environment for this testing below the current directory
python -m venv test-avd-pr-4196
# Activate the virtual environment
source test-avd-pr-4196/bin/activate
# Install all requirements including PyAVD
pip install "pyavd[ansible] @ git+https://github.com/carl-baillargeon/avd.git@feat/move_anta_to_pyavd#subdirectory=python-avd" --force
# Install Ansible collection
ansible-galaxy collection install git+https://github.com/carl-baillargeon/avd.git#/ansible_collections/arista/avd/,feat/move_anta_to_pyavd --force
# Optional: Install AVD examples
cd test-avd-pr-4196
ansible-playbook arista.avd.install_examples |
8853a02
to
da57595
Compare
da57595
to
7b8c139
Compare
|
7b8c139
to
3e78cff
Compare
for more information, see https://pre-commit.ci
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.
I've tested the PR on the following inventory and AVD dev image.
In arista.avd.eos_validate_state
we used to have save_catalog
. I never used it, but I find it a bit confusing that anta_runner combines that under avd_catalogs_enabled
togerther with activating/deactivating default tests. That could be a good thing, but when combined with re-writing the whole anta/ directory content. After playing with avd_catalogs_enabled
and avd_catalogs_dir
a bit it’s easy to create quite confusing setup, that will never be auto-cleaned. I’d propose following:
- Overwrite everything, except
user_catalogs_dir
on every run. Also clean any old dirs and files. - Dump avd catalog only when
avd_catalogs_enabled: true
(already the case) - Introduce a knob to dump the combined catalog in some different location for debugging.
AVD catalogs are JSON by default. Do we have an option to dump them as YAML?
avd_catalogs_filters
- I was able to make them work for hostnames, but not for groups. I'd consider at least adding some documentation. Ideally I'd convert device_list
to a list, not a string, that accepts hostnames, group names and fails if host or group is not known.
anta_report_filter_statuses: [success]
has no effect.
Conflicts have been resolved. A maintainer will review the pull request shortly. |
Thanks for the review Petr! As discussed, we will implement the following feature in future PRs: |
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
we can ignore coverage here - we are not having coverage on the ansible plugins right now but are looking at it - so we will take the hit. |
|
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.
I have not reviewed the code thoroughly but this is preview so we will need another round of review.
Lets expose this to testers in the field to get feedback
Change Summary
anta_workflow
Ansible action pluginanta_runner
Ansible roleget_device_anta_catalog
function in PyAVD to generate the ANTA catalogsRequirements
NEEDS ANTA v1.3.0
On ANTA:
On AVD:
Component(s) name
PyAVD
Proposed changes
Example playbook for anta_runner role:
How to test
1- Follow the
To test this pull request
snippet from github-actions to install the requirements2- By default, you can simply run the following playbook:
3- Test different variables/behaviors following the example playbook in
Proposed changes
To-do list
anta.reporter.csv_reporter
andanta.reporter.md_reporter
. We should also be able to filter statuses (from plugin arguments) usingResultManager.filter()
VerifyAVTRole
4e20dbfVerifyMlagStatus
VerifyRoutingProtocolModel
4e20dbfVerifyAPIHttpsSSL
VerifySpecificIPSecConn
4e20dbfVerifyStunClient
4e20dbfVerifyNTP
4e20dbfVerifyReloadCause
4e20dbfvalidate_state: false
configuration 4e20dbfanta_runner
) that will run the action pluginanta_workflows
- Similar tocv_deploy
&cv_workflows
18d98beanta_workflow
plugin documentation underplugins.modules
anta_runner
roleSome tests don't require any inputs, in that case we just update AVD_TEST_INDEX
Phase 2: