Skip to content

Latest commit

 

History

History
 
 

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

AVD Unit test

This section provides a list of AVD scenario executed during Continuous Integration to validate AVD integration.

Ansible molecule

Molecule provides support for testing with multiple instances, operating systems and distributions, virtualization providers, test frameworks and testing scenarios. Molecule encourages an approach that results in consistently developed roles that are well-written, easily understood and maintained.

Scenario

Current molecule implementation provides following scenario:

How to use scenario

Molecule scenario are used to validate role execution and coverage of data-model. When you update a role or data-model, scenario must be updated to reflect your changes and validate it is not breaking other supported scenario.

# Go to test folder
$ cd ansible_collections/arista/avd

# Edit molecule scenario
$ vim molecule/<scenario-name>/<molecule-file>

# Run testing
$ molecule test --scenario-name <scenario-name>

# Cleanup your environment
$ molecule cleanup --scenario-name <scenario-name>

Which file to update

If you are updating eos_cli_config_gen

Testing for eos_cli_config_gen is part of scenario eos_cli_config_gen. It is based on a in flat inventory with 1 host covering a specific section of templates like:

When you update a template in eos_cli_config_gen, you should report a test case in molecule scenario ansible_collections/arista/avd/molecule/eos_cli_config_gen.

  1. Create or update a file related to updated section under inventory/host_vars
  2. If the section is new, update the inventory file (hosts.ini) to add a new host. The host SHALL be the name of your section and also the <filename>.yml in your host_vars
  3. Run molecule scenario to generate artifacts:
# Move to AVD collection
$ cd ansible_collections/arista/avd/

# Run molecule
$ molecule test --scenario-name eos_cli_config_gen
  1. Commit artifacts. They will be used by CI to validate their is no change in the future.
$ git commit -m 'Upload artefact for issue #...' molecule/eos_cli_config_gen

If you have pre-commit enabled, use --no-verify trigger to avoid any content change in your commit

If you are updating eos_designs

Update related to underlay or overlay protocol

In such case, copy an existing scenario to create a new one:

# Move to AVD collection
$ cd ansible_collections/arista/avd/

# Run Molecule scenario
$ molecule test --scenario-name eos_cli_config_gen
General eos_designs update

If your update is not related to underlay or overlay protocol, edit scenario evpn_underlay_ebgp_overlay_ebgp and edit group_vars accordingly. Then run molecule to validate it is working as expected

  1. Create your scenario
# Move to AVD collection
$ cd ansible_collections/arista/avd/

# Copy existing molecule scenario
$ cp -r molecule/evpn_underlay_isis_overlay_ebgp molecule/evpn_underlay_<underlay-protocol>_overlay_<overlay-protocol>
  1. Edit files from your scenario's inventory
$ cd molecule/evpn_underlay_<underlay-protocol>_overlay_<overlay-protocol>/inventory

# Edit group_vars
$ vim group_vars/DC1_FABRIC.yml
  1. Run your molecule scenario for validation
# Move to AVD collection
$ cd ../../../

# Run Molecule scenario
$ molecule test --scenario-name evpn_underlay_<underlay-protocol>_overlay_<overlay-protocol>
  1. Edit CI file to include your scenario
#.github/workflows/molecule-eos-designs.yml
jobs:
  molecule:
    name: Run CI test for eos_designs
    runs-on: ubuntu-latest
    strategy:
      fail-fast: true
      matrix:
        avd_scenario:
          - 'evpn_underlay_ebgp_overlay_ebgp'
          - 'evpn_underlay_ospf_overlay_ebgp'
          - 'evpn_underlay_isis_overlay_ebgp'
          - 'evpn_underlay_<underlay-protocol>_overlay_<overlay-protocol>'
          - 'upgrade_v1.0_to_v1.1'

Once you are ready, commit your change and push to Github.