Skip to content

Refactor(eos_designs): Use VRF ID instead of VRF VNI as offset for evpn underlay l3 multicast group #14948

Refactor(eos_designs): Use VRF ID instead of VRF VNI as offset for evpn underlay l3 multicast group

Refactor(eos_designs): Use VRF ID instead of VRF VNI as offset for evpn underlay l3 multicast group #14948

---
name: "Collection code testing"
on: pull_request
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref }}
cancel-in-progress: true
env:
# Set -vvv is ACTIONS_STEP_DEBUG is set
# Apparently it is set in secrets when running with debug
ANSIBLE_VERBOSITY: ${{ secrets.ACTIONS_STEP_DEBUG && 3 || 0 }}
jobs:
file-changes:
runs-on: ubuntu-latest
outputs:
eos_design: ${{ steps.filter.outputs.eos_design }}
config_gen: ${{ steps.filter.outputs.config_gen }}
cloudvision: ${{ steps.filter.outputs.cloudvision }}
dhcp: ${{ steps.filter.outputs.dhcp }}
plugins: ${{ steps.filter.outputs.plugins }}
requirements: ${{ steps.filter.outputs.requirements }}
docs: ${{ steps.filter.outputs.docs }}
steps:
- uses: actions/checkout@v4
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
eos_design:
- 'ansible_collections/arista/avd/roles/eos_designs/*'
- 'ansible_collections/arista/avd/roles/eos_designs/**/*'
- '.github/workflows/pull-request-management.yml'
- 'ansible_collections/arista/avd/molecule/*'
- 'ansible_collections/arista/avd/molecule/**/*'
- 'python-avd/pyavd/_eos_designs/*'
- 'python-avd/pyavd/_eos_designs/**/*'
- '!ansible_collections/arista/avd/roles/eos_config_deploy_cvp/*'
- '!ansible_collections/arista/avd/roles/eos_config_deploy_cvp/**/*'
- '!ansible_collections/arista/avd/molecule/cvp_configlet_upload/*'
- '!ansible_collections/arista/avd/molecule/cvp_configlet_upload/**/*'
config_gen:
- 'ansible_collections/arista/avd/roles/eos_cli_config_gen/*'
- 'ansible_collections/arista/avd/roles/eos_cli_config_gen/**/*'
- '.github/workflows/pull-request-management.yml'
- 'ansible_collections/arista/avd/molecule/eos_cli_config_gen*/*'
- 'ansible_collections/arista/avd/molecule/eos_cli_config_gen*/**/*'
- 'python-avd/pyavd/_eos_cli_config_gen/*'
- 'python-avd/pyavd/_eos_cli_config_gen/**/*'
validate_state:
- 'ansible_collections/arista/avd/roles/eos_validate_state/*'
- 'ansible_collections/arista/avd/roles/eos_validate_state/**/*'
cloudvision:
- 'ansible_collections/arista/avd/roles/eos_config_deploy_cvp/*'
- 'ansible_collections/arista/avd/roles/eos_config_deploy_cvp/**/*'
- 'ansible_collections/arista/avd/molecule/cvp_configlet_upload/*'
- 'ansible_collections/arista/avd/molecule/cvp_configlet_upload/**/*'
- '.github/workflows/pull-request-management.yml'
dhcp:
- 'ansible_collections/arista/avd/roles/dhcp_provisioner/*'
- 'ansible_collections/arista/avd/roles/dhcp_provisioner/**/*'
- '.github/workflows/pull-request-management.yml'
plugins:
- 'ansible_collections/arista/avd/plugins/filter/**'
- 'ansible_collections/arista/avd/plugins/test/**'
requirements:
- 'ansible_collections/arista/avd/requirements.txt'
- 'ansible_collections/arista/avd/requirements-dev.txt'
- 'ansible_collections/arista/avd/meta/runtime.yml'
- '.github/requirements-ci.txt'
- '.github/workflows/pull-request-management.yml'
docs:
- '.github/workflows/pull-request-management.yml'
- 'mkdocs.yml'
- 'ansible_collections/arista/avd/docs/**'
- 'ansible_collections/arista/avd/roles/**/*.md'
- 'ansible_collections/arista/avd/**/*.md'
- 'ansible_collections/arista/avd/README.md'
- 'ansible_collections/arista/avd/**/*.schema.yml'
pyavd:
- 'python_avd/*'
- 'python_avd/**/*'
# ----------------------------------- #
# Test Requirements
# ----------------------------------- #
python_requirements:
name: Test Python requirements installation
runs-on: ubuntu-latest
needs: [ file-changes ]
if: needs.file-changes.outputs.requirements == 'true'
strategy:
fail-fast: true
matrix:
python_version:
- "3.10"
- "3.11"
- "3.12"
steps:
- name: 'Set environment variables'
run: |
echo "PY_COLORS=1" >> $GITHUB_ENV
echo "ANSIBLE_FORCE_COLOR=1" >> $GITHUB_ENV
- uses: actions/checkout@v4
- name: Set up Python 3
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python_version }}
- name: 'Install Python requirements'
run: |
pip install -r ansible_collections/arista/avd/requirements-dev.txt -r ansible_collections/arista/avd/requirements.txt --upgrade
# ----------------------------------- #
# EOS CLI CONFIG GEN MOLECULE
# ----------------------------------- #
molecule_eos_cli_config_gen:
name: Validate eos_cli_config_gen
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
avd_scenario:
- 'eos_cli_config_gen'
- 'eos_cli_config_gen_deprecated_vars'
- 'eos_cli_config_gen_negative_unit_tests'
ansible_version:
- 'ansible-core<2.18.0 --upgrade'
# Also test minimum ansible version for one scenario.
include:
- avd_scenario: 'eos_cli_config_gen'
ansible_version: 'ansible-core==2.15.0'
needs: [ file-changes ]
if: needs.file-changes.outputs.config_gen == 'true'
steps:
- name: 'Set environment variables'
run: |
echo "PY_COLORS=1" >> $GITHUB_ENV
echo "ANSIBLE_FORCE_COLOR=1" >> $GITHUB_ENV
- uses: actions/checkout@v4
- name: Run molecule action
uses: arista-netdevops-community/action-molecule-avd@v1.8.1
with:
molecule_parentdir: 'ansible_collections/arista/avd'
molecule_command: 'test'
molecule_args: '--scenario-name ${{ matrix.avd_scenario }}'
pip_file: .github/requirements-ci.txt
galaxy_file: "ansible_collections/arista/avd/collections.yml"
ansible: ${{ matrix.ansible_version }}
check_git: true
check_git_enforced: true
# - uses: actions/upload-artifact@v4
# with:
# name: molecule-${{ matrix.avd_scenario }}-artifacts
# path: ${PWD}/ansible_collections/arista/avd/molecule/${{ matrix.avd_scenario }}
# ----------------------------------- #
# DHCP PROVISIONNER MOLECULE
# ----------------------------------- #
molecule_dhcp_provisionner:
name: Validate DHCP configuration
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
avd_scenario: ['dhcp_configuration', 'dhcp_provisioning']
ansible_version: ['ansible-core<2.18.0 --upgrade']
needs: [ file-changes ]
if: needs.file-changes.outputs.dhcp == 'true'
steps:
- name: 'Set environment variables'
run: |
echo "PY_COLORS=1" >> $GITHUB_ENV
echo "ANSIBLE_FORCE_COLOR=1" >> $GITHUB_ENV
- uses: actions/checkout@v4
- name: Run molecule action
uses: arista-netdevops-community/action-molecule-avd@v1.8.1
with:
molecule_parentdir: 'ansible_collections/arista/avd'
molecule_command: 'test'
molecule_args: '--scenario-name ${{ matrix.avd_scenario }}'
pip_file: .github/requirements-ci.txt
galaxy_file: "ansible_collections/arista/avd/collections.yml"
ansible: ${{ matrix.ansible_version }}
check_git: true
check_git_enforced: true
# - uses: actions/upload-artifact@v4
# with:
# name: molecule-${{ matrix.avd_scenario }}-artifacts
# path: ${PWD}/ansible_collections/arista/avd/molecule/${{ matrix.avd_scenario }}
# ----------------------------------- #
# EOS Design MOLECULE
# ----------------------------------- #
molecule_eos_designs:
name: Validate eos_designs
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
avd_scenario:
- 'eos_designs_deprecated_vars'
- 'eos_designs-l2ls'
- 'eos_designs-mpls-isis-sr-ldp'
- 'eos_designs_negative_unit_tests'
- 'eos_designs-twodc-5stage-clos'
- 'eos_designs_unit_tests'
- 'evpn_underlay_ebgp_overlay_ebgp'
- 'evpn_underlay_isis_overlay_ibgp'
- 'evpn_underlay_ospf_overlay_ebgp'
- 'evpn_underlay_rfc5549_overlay_ebgp'
- 'example-campus-fabric'
- 'example-dual-dc-l3ls'
- 'example-isis-ldp-ipvpn'
- 'example-l2ls-fabric'
- 'example-single-dc-l3ls'
ansible_version:
# Testing all scenario with 2.16.x, due to bug with in 2.17.0 with and the way we test eos_designs_negative_unit_tests https://github.com/ansible/ansible/issues/83292
- 'ansible-core>=2.16.0,<2.17.0 --upgrade'
pip_requirements:
- '.github/requirements-ci.txt'
# Also test minimum ansible version for one scenario.
include:
- avd_scenario: 'eos_designs_unit_tests'
ansible_version: 'ansible-core==2.15.0'
pip_requirements: 'tmp-requirements-minimum.txt'
- avd_scenario: 'eos_designs_unit_tests'
ansible_version: 'ansible-core>=2.15.0,<2.16.0 --upgrade'
pip_requirements: '.github/requirements-ci.txt'
- avd_scenario: 'eos_designs_unit_tests'
ansible_version: 'ansible-core<2.18.0 --upgrade'
pip_requirements: '.github/requirements-ci.txt'
needs: [ file-changes ]
if: needs.file-changes.outputs.eos_design == 'true' || needs.file-changes.outputs.config_gen == 'true'
steps:
- name: 'Set environment variables'
run: |
echo "PY_COLORS=1" >> $GITHUB_ENV
echo "ANSIBLE_FORCE_COLOR=1" >> $GITHUB_ENV
- uses: actions/checkout@v4
- name: Build minimum requirements
run: |
pip install uv
uv pip compile .github/requirements-ci.txt --resolution=lowest-direct > ${{ matrix.pip_requirements }}
cat ${{ matrix.pip_requirements }}
if: matrix.pip_requirements == 'tmp-requirements-minimum.txt'
- name: Run molecule action
uses: arista-netdevops-community/action-molecule-avd@v1.8.1
with:
molecule_parentdir: 'ansible_collections/arista/avd'
molecule_command: 'test'
molecule_args: '--scenario-name ${{ matrix.avd_scenario }}'
pip_file: ${{ matrix.pip_requirements }}
galaxy_file: "ansible_collections/arista/avd/collections.yml"
ansible: ${{ matrix.ansible_version }}
check_git: true
check_git_enforced: true
# - uses: actions/upload-artifact@v4
# with:
# name: molecule-${{ matrix.avd_scenario }}-artifacts
# path: ${PWD}/ansible_collections/arista/avd/molecule/${{ matrix.avd_scenario }}
# ----------------------------------- #
# Cloudvision MOLECULE
# ----------------------------------- #
molecule_cloudvision:
name: Validate cvp_collection
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
avd_scenario:
- 'eos_config_deploy_cvp'
ansible_version:
- 'ansible-core<2.18.0 --upgrade'
include:
- avd_scenario: 'eos_config_deploy_cvp'
ansible_version: 'ansible-core==2.15.0'
needs: [ file-changes ]
if: needs.file-changes.outputs.cloudvision == 'true'
steps:
- name: 'Set environment variables'
run: |
echo "PY_COLORS=1" >> $GITHUB_ENV
echo "ANSIBLE_FORCE_COLOR=1" >> $GITHUB_ENV
- uses: actions/checkout@v4
- name: Run molecule action
uses: arista-netdevops-community/action-molecule-avd@v1.8.1
with:
molecule_parentdir: 'ansible_collections/arista/avd'
molecule_command: 'test'
molecule_args: '--scenario-name ${{ matrix.avd_scenario }}'
pip_file: .github/requirements-ci.txt
galaxy_file: "ansible_collections/arista/avd/collections.yml"
ansible: ${{ matrix.ansible_version }}
check_git: true
check_git_enforced: true
# - uses: actions/upload-artifact@v4
# with:
# name: molecule-${{ matrix.avd_scenario }}-artifacts
# path: ${PWD}/ansible_collections/arista/avd/molecule/${{ matrix.avd_scenario }}
#
# ----------------------------------- #
# EOS Validate State MOLECULE
# ----------------------------------- #
molecule_eos_validate_state:
name: Validate eos_validate_state
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
avd_scenario:
- 'eos_validate_state'
ansible_version:
- 'ansible-core<2.18.0 --upgrade'
include:
- avd_scenario: 'eos_validate_state'
ansible_version: 'ansible-core==2.15.0'
needs: [ file-changes ]
if: needs.file-changes.outputs.eos_design == 'true' || needs.file-changes.outputs.validate_state == 'true'
steps:
- name: 'Set environment variables'
run: |
echo "PY_COLORS=1" >> $GITHUB_ENV
echo "ANSIBLE_FORCE_COLOR=1" >> $GITHUB_ENV
- uses: actions/checkout@v4
- name: Run molecule action
uses: arista-netdevops-community/action-molecule-avd@v1.8.1
with:
molecule_parentdir: 'ansible_collections/arista/avd'
molecule_command: 'test'
molecule_args: '--scenario-name ${{ matrix.avd_scenario }}'
pip_file: .github/requirements-ci.txt
galaxy_file: "ansible_collections/arista/avd/collections.yml"
ansible: ${{ matrix.ansible_version }}
check_git: true
check_git_enforced: true
# ----------------------------------- #
# Ansible tests
# ----------------------------------- #
ansible_test_sanity:
name: Run ansible-test sanity validation
runs-on: ubuntu-latest
needs: [ file-changes ]
# needs: [ molecule_eos_designs, molecule_cloudvision ]
# if: needs.cloudvision.status != 'failed' && needs.molecule_eos_designs.status != 'failed' && needs.file-changes.outputs.plugins == 'true'
steps:
- name: 'Set environment variables'
run: |
echo "PY_COLORS=1" >> $GITHUB_ENV
- uses: actions/checkout@v4
- name: Set up Python 3
uses: actions/setup-python@v5
with:
python-version: |
3.10
3.11
3.12
- name: 'Install Python requirements'
run: |
pip install "ansible-core<2.18.0" -r .github/requirements-ci.txt --upgrade
- name: 'Run ansible-test sanity'
run: |
cd ansible_collections/arista/avd/
ansible-test sanity --color yes -v
ansible_test_units:
name: Run ansible-test units test cases
runs-on: ubuntu-latest
needs: [ file-changes ]
steps:
- name: 'Set environment variables'
run: |
echo "PY_COLORS=1" >> $GITHUB_ENV
- uses: actions/checkout@v4
- name: Set up Python 3
uses: actions/setup-python@v5
with:
python-version: |
3.10
- name: 'Install Python requirements'
run: |
pip install mock pytest pytest-mock pytest-xdist pyyaml "ansible-core<2.18.0" -r .github/requirements-ci.txt --upgrade
- name: 'Run ansible-test units test cases'
run: |
cd ansible_collections/arista/avd/
ansible-test units -vv
ansible_test_integration:
name: Run ansible-test integration test cases
runs-on: ubuntu-latest
needs: [ file-changes ]
steps:
- name: 'Set environment variables'
run: |
echo "PY_COLORS=1" >> $GITHUB_ENV
- uses: actions/checkout@v4
- name: Set up Python 3
uses: actions/setup-python@v5
with:
python-version: |
3.12
- name: 'Install Python requirements'
run: |
pip install "ansible-core<2.18.0" -r .github/requirements-ci.txt --upgrade
- name: 'Run ansible-test integration test cases'
run: |
cd ansible_collections/arista/avd/
ansible-test integration -vv
ansible_lint:
name: Run ansible-lint test case
runs-on: ubuntu-latest
needs: [ file-changes ]
steps:
- name: 'Set environment variables'
run: |
echo "PY_COLORS=1" >> $GITHUB_ENV
- uses: actions/checkout@v4
- name: Set up Python 3
uses: actions/setup-python@v5
with:
python-version: |
3.10
3.11
3.12
- name: 'Install Python & Ansible requirements'
run: |
pip install -r ansible_collections/arista/avd/requirements-dev.txt -r ansible_collections/arista/avd/requirements.txt --upgrade
ansible-galaxy collection install -r ansible_collections/arista/avd/collections.yml
- name: 'Run ansible-test integration test cases'
run: |
cd ansible_collections/arista/avd/
ansible-lint --force-color --strict -v
# ----------------------------------- #
# Galaxy Importer
# ----------------------------------- #
galaxy_importer:
name: Test galaxy-importer
runs-on: ubuntu-20.04 # Older version to be compatible with old python
env:
PY_COLORS: 1 # allows molecule colors to be passed to GitHub Actions
ANSIBLE_FORCE_COLOR: 1 # allows ansible colors to be passed to GitHub Actions
GALAXY_IMPORTER_CONFIG: galaxy-importer/galaxy-importer.cfg
steps:
- uses: actions/setup-python@v5
with:
python-version: |
3.10
- uses: actions/checkout@v4
- name: 'Install Python & Ansible requirements'
run: |
pip install pydantic>=2.3.0 "ansible-core<2.18.0" -r .github/requirements-ci.txt --upgrade
ansible-galaxy collection install -r ansible_collections/arista/avd/collections.yml
- name: Install galaxy-importer
# Install the specific version of galaxy-importer used on galaxy.ansible.com
# The version conflicts with our requirements,
# so we let the galaxy-importer version resolve remaining requirements.
run: |
pip install "galaxy-importer==0.4.22"
- name: 'Build ansible package'
run: make collection-build
- name: 'Run galaxy-importer checks'
run: python -m galaxy_importer.main *.tar.gz
- uses: actions/upload-artifact@v4
with:
name: importer-logs
path: ./importer_result.json
# ----------------------------------- #
# Test of pyavd
# ----------------------------------- #
pyavd:
name: Test pyavd
runs-on: ubuntu-latest
needs: [file-changes]
if: |
needs.file-changes.outputs.eos_design == 'true' ||
needs.file-changes.outputs.config_gen == 'true' ||
needs.file-changes.outputs.pyavd == 'true'
strategy:
matrix:
python: ["3.10", "3.11", "3.12"]
steps:
- name: 'Set environment variables'
run: |
echo "PY_COLORS=1" >> $GITHUB_ENV
- uses: actions/checkout@v4
- name: Set up Python 3
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
- name: 'Install tox'
run: |
pip install tox tox-gh-actions --upgrade
- name: "Run pytest via tox for ${{ matrix.python }}"
working-directory: python-avd
run: |
tox