Skip to content
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

Draft
wants to merge 41 commits into
base: devel
Choose a base branch
from

Conversation

carl-baillargeon
Copy link
Contributor

@carl-baillargeon carl-baillargeon commented Jul 9, 2024

Change Summary

  • anta_workflow Ansible action plugin
  • get_device_anta_catalog function in PyAVD to generate the ANTA catalogs
  • get_fabric_data function in PyAVD to generate the fabric mappings used to generate the catalogs
  • ANTA test index with their input factories in PyAVD

Requirements

NEEDS ANTA v1.3.0

On ANTA:

On AVD:

Component(s) name

PyAVD

Proposed changes

Example playbook for anta_runner role:

---
- name: Validate AVD
  hosts: GLOBAL
  check_mode: yes
  tasks:
    - name: Run ANTA on EOS devices
      import_role:
        name: arista.avd.anta_runner

Example playbook for anta_workflow plugin:

---
- name: ANTA Workflow
  arista.avd.anta_workflow:
    device_list: "{{ ansible_play_hosts }}"
    anta_catalog:
      output_dir: "/my_avd_project/anta/catalogs"
      structured_config_dir: "/my_avd_project/intended/structured_configs"
      structured_config_suffix: ".yml"
      scope:
        boundary: "fabric"
        allow_bgp_external: true
        allow_bgp_vrfs: true
      filters:
        skip_tests:
          - VerifyNTP
    custom_catalog:
      input_dir: "/my_avd_project/anta/my_catalogs"
    anta_logging:
      log_dir: "/my_avd_project/anta/logs"
    report:
      fabric_data_output: "/my_avd_project/anta/reports/fabric_data.json"
      csv_output: "/my_avd_project/anta/reports/anta_results.csv"
      md_output: "/my_avd_project/anta/reports/anta_results.md"
      json_output: "/my_avd_project/anta/reports/anta_results.json"
      filters:
        hide_statuses:
          - success
  register: anta
  delegate_to: localhost
  run_once: true

To-do list

  • Add reporting using anta.reporter.csv_reporter and anta.reporter.md_reporter. We should also be able to filter statuses (from plugin arguments) using ResultManager.filter()
  • Input factory for VerifyAVTRole 4e20dbf
  • Input factory for VerifyMlagStatus
  • Input factory for VerifyRoutingProtocolModel 4e20dbf
  • Input factory for VerifyAPIHttpsSSL
  • Input factory for VerifySpecificIPSecConn 4e20dbf
  • Input factory for VerifyStunClient 4e20dbf
  • Input factory for VerifyNTP 4e20dbf
  • Input factory for VerifyReloadCause 4e20dbf
  • VerifyLLDP factory: Add support for validate_state: false configuration 4e20dbf
  • VerifyReachability factory: Add WAN VTEPs support - DPS to DPS reachability 4e20dbf
  • VerifyEnvironmentPower factory: accepted_pwr_supply_states is not yet implemented in the AVD structured config schema
  • VerifyEnvrionmentCooling factory: accepted_fan_states is not yet implemented in the AVD structured config schema
  • VerifyTransceiversManufacturers: accepted_xcvr_manufacturers is not yet implemented in the AVD structured config schema
  • Update FabricData to add DPS mappings 4e20dbf
  • Add the ability to skip specific inputs from a test for granular testing - Boundary
  • Create the Ansible role (anta_runner) that will run the action plugin anta_workflows - Similar to cv_deploy & cv_workflows 18d98be
  • Complete anta_workflow plugin documentation under plugins.modules
  • Complete README.md for anta_runner role
  • Add support for BGP VRFs (see Feat(eos_validate_state): Add validation for BGP IPv4 peers in VRFs #4538)
  • Molecule tests - Need to add more runs when Feat(eos_designs): Added rack, pod, dc, fabric information in the structured_config metadata #4827 is merged
  • Unit tests in PyAVD - Need to add FabricData boundary testing when Feat(eos_designs): Added rack, pod, dc, fabric information in the structured_config metadata #4827 is merged

Some tests don't require any inputs, in that case we just update PYAVD_TEST_INDEX

Phase 2: Add all ANTA tests 🥇

Copy link

github-actions bot commented Jul 9, 2024

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

@gmuloc gmuloc added this to the v5.0.0 milestone Jul 25, 2024
@carl-baillargeon carl-baillargeon force-pushed the feat/move_anta_to_pyavd branch 2 times, most recently from 8853a02 to da57595 Compare August 13, 2024 18:18
@carl-baillargeon carl-baillargeon changed the title Feat: ANTA Integration to PyAVD Feat: New anta_workflow plugin and anta_runner role to Ansible AVD collection using PyAVD Aug 13, 2024
@carl-baillargeon carl-baillargeon force-pushed the feat/move_anta_to_pyavd branch from da57595 to 7b8c139 Compare August 17, 2024 14:59
Copy link

@ClausHolbechArista ClausHolbechArista removed this from the v5.0.0 milestone Sep 20, 2024
@carl-baillargeon carl-baillargeon changed the title Feat: New anta_workflow plugin and anta_runner role to Ansible AVD collection using PyAVD Feat: New anta_workflow plugin using PyAVD Oct 31, 2024
@github-actions github-actions bot added the state: CI Updated CI scenario have been updated in the PR label Nov 25, 2024
@github-actions github-actions bot added role: build_output_folders issue related to build_output_folders role state: Documentation role Updated labels Dec 30, 2024
@github-actions github-actions bot added the type: documentation Improvements or additions to documentation label Dec 31, 2024
@github-actions github-actions bot added the state: conflict PR with conflict label Jan 2, 2025
Copy link

github-actions bot commented Jan 2, 2025

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

Copy link

github-actions bot commented Jan 3, 2025

Conflicts have been resolved. A maintainer will review the pull request shortly.

@github-actions github-actions bot removed the state: conflict PR with conflict label Jan 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
role: build_output_folders issue related to build_output_folders role state: CI Updated CI scenario have been updated in the PR state: Documentation role Updated type: documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants