Skip to content

Conversation

@carl-baillargeon
Copy link
Contributor

Change Summary

Introduces a small DSL to the run_tests and skip_tests filters for AVD-generated catalogs. This enhancement provides more granular control to run or skip tests for specific fabric peers.

Peer-filtering DSL is only implemented for the VerifyReachability test.

Component(s) name

arista.avd.anta_runner

Proposed changes

Previously, a filter like skip_tests: [ "VerifyReachability" ] would disable all reachability tests. With this change, users can now target specific peers, such as skip_tests: [ "VerifyReachability(DC1-SPINE1)" ], which will only skip the reachability test towards that single device.

The DSL supports a parenthesized comma-separated list of peer device hostnames appended to a test name.

Examples:

  1. Skip reachability tests from devices in the DC1 group to peers DC2-BL1 and DC2-BL2 only. All other reachability tests will still be generated and run.
avd_catalogs_filters:
  - device_list: "{{ groups['DC1'] }}"
    skip_tests: [ "VerifyReachability(DC2-BL1, DC2-BL2)" ]
  1. Only run reachability tests from devices in the DC1 group to peers DC2-BL1 and DC2-BL2. No other reachability tests will be included in the catalog for these devices.
avd_catalogs_filters:
  - device_list: "{{ groups['DC1'] }}"
    run_tests: [ "VerifyReachability(DC2-BL1, DC2-BL2)" ]
  1. Like before, filters can be combined. Here, VerifyNTP test is skipped, but only the reachability test towards DC1-SPINE1 is skipped.
avd_catalogs_filters:
  - device_list: "{{ groups['DC1-LEAFS'] }}"
    skip_tests:
      - "VerifyNTP"
      - "VerifyReachability(DC1-SPINE1)"

How to test

---
- name: Run ANTA
  hosts: GLOBAL
  connection: local
  gather_facts: false
  tasks:
    - name: Run ANTA on EOS devices
      import_role:
        name: arista.avd.anta_runner
      # vars:
      #   avd_catalogs_filters:
      #     - device_list: "{{ groups['DC1'] }}"
      #       skip_tests: [ "VerifyReachability(DC1-LEAF1A)"]
  1. Run the anta_runner role normally to establish a baseline and confirm all reachability tests are generated in the catalog.

  2. Uncomment and adapt the avd_catalogs_filters variable in your playbook as shown above to apply a peer-specific filter.

  3. Run the role again and check the generated ANTA catalog for a device in the DC1 group.

  4. Confirm that the reachability test towards the specified peer (e.g., DC1-LEAF1A) has been removed from the catalog, while other reachability tests remain.

Checklist

User Checklist

  • Add logic to also skip BGP neighbor reachability tests.
  • Update documentation with examples.

Repository Checklist

  • My code has been rebased from devel before I start
  • I have read the CONTRIBUTING document.
  • My change requires a change to the documentation and documentation have been updated accordingly.
  • I have updated molecule CI testing accordingly. (check the box if not applicable)

@github-actions
Copy link

github-actions bot commented Oct 8, 2025

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-5991
# Activate the virtual environment
source test-avd-pr-5991/bin/activate
# Install all requirements including PyAVD
pip install "pyavd[ansible] @ git+https://github.com/carl-baillargeon/avd.git@feat/anta_runner/granular_filters#subdirectory=python-avd" --force
# Point Ansible collections path to the Python virtual environment
export ANSIBLE_COLLECTIONS_PATH=$VIRTUAL_ENV/ansible_collections
# Install Ansible collection
ansible-galaxy collection install git+https://github.com/carl-baillargeon/avd.git#/ansible_collections/arista/avd/,feat/anta_runner/granular_filters --force
# Optional: Install AVD examples
cd test-avd-pr-5991
ansible-playbook arista.avd.install_examples

@github-actions github-actions bot added the state: CI Updated CI scenario have been updated in the PR label Oct 8, 2025
@github-actions github-actions bot added the state: conflict PR with conflict label Oct 14, 2025
@github-actions
Copy link

This pull request has conflicts, please resolve those before we can evaluate the pull request.

@carl-baillargeon
Copy link
Contributor Author

Closing this. We will implement knobs in eos_designs instead to exlcude targeted peers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

state: CI Updated CI scenario have been updated in the PR state: conflict PR with conflict

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant