Arista AVD Documentation

repository·devel·Indexed 19 days ago

https://github.com/aristanetworks/avd

Arista AVD is an extensible data model and automation framework that treats Arista's Unified Cloud Network architecture as code. Primarily used via an Ansible collection, it automates the provisioning, validation, and documentation of EOS-based networks. It includes the pyavd Python package and the anta_runner role for validating operational state using the Arista Network Test Automation (ANTA) framework.

Tokens
263.5K
Snippets
788
Records
1K
Agent score
57%

What's inside Arista AVD

  1. Overview of Arista AVD

    devel

    Arista AVD (Architect, Validate, Deploy) is an extensible data model that defines Arista's Unified Cloud Network architecture as code. It provides a framework for automating the full network lifecycle, including:

    • Configuration Generation: Using extensible fabric-wide network models to simplify configuration and ensure consistency.
    • Validation: Automating pre- and post-deployment validation workflows.
    • Self-Documentation: Automatically generating network documentation.
    • Multi-Domain Automation: A consistent framework for automating Data Center, Campus, or Wide Area Networks (WAN) using a consistent EOS software image and management platform.
  2. Overview of the eos_designs Ansible role

    devel

    The eos_designs role provides an abstracted data model to deploy various network designs and use cases. It is designed to enable consistent deployment of Arista Leaf & Spine fabrics with both underlay and overlay network services.

    Key Characteristics

    • Stackable Template Architecture: The role is designed to be easily extended using the eos_designs_custom_templates data model.
    • Offline Configuration Generation: It generates the intended configuration offline without needing to query the current state of the switches.
    • Integration Workflow:
      • Use eos_designs to generate the structured data model.
      • Use eos_cli_config_gen to transform that data into EOS CLI configuration.
      • Deploy the configuration using eos_config_deploy_eapi or cv_deploy (config replace strategy).
      • Validate the configuration post-deployment with anta_runner or pre-deployment with tools like Batfish.
  3. Overview of the anta_runner Ansible role

    devel

    The anta_runner role is used to validate the operational state of Arista EOS devices using the Arista Network Test Automation (ANTA) framework.

    It supports two primary modes of operation:

    1. AVD-generated catalogs: Automatically creates per-device test catalogs based on AVD structured configurations. These tests are tailored to both the specific device configuration and the overall network design.
    2. User-defined catalogs: Executes custom ANTA test catalogs provided by the user, allowing for any tests available in the ANTA framework while leveraging Ansible's inventory management.

    Results can be exported in JSON, CSV, or Markdown formats.

  4. Overview of PyAVD

    devel
    PyAVD is a Python package that serves as the foundational layer for the Arista AVD (Architect, Validate, Deploy) project. It provides the core logic and capabilities used by the broader AVD ecosystem to architect, validate, and deploy network configurations.
  5. Overview of arista.avd.cv_deploy role

    devel

    The arista.avd.cv_deploy Ansible role is used to deploy EOS device configurations and tags to the CloudVision management platform. It leverages the CloudVision API via gRPC over encrypted HTTP/2.

    Supported operations include:

    • Deploying device-specific configurations or full hierarchies of containers and configlets using the Static Configuration Studio.
    • Deploying device and interface Tags.
    • Managing devices in the Inventory & Topology Studio (adding missing devices or updating existing ones).
    • Managing Workspaces (creating, building, and submitting).
    • Managing Change Controls (creating, approving, and starting).
    • Deploying special metadata for the CV Pathfinder solution.

    Devices are identified in the following priority order: serial_number, system_mac_address, or hostname.

  6. PyAVD Core Concepts and Capabilities

    devel

    PyAVD is a Python package that serves as the foundation for the Arista AVD project and the arista.avd Ansible collection. It is co-versioned with the Ansible collection.

    Key Capabilities:

    • Input Validation: Validates inputs against AVD Design data models.
    • Fact Generation: Generates avd_facts and structured config for use in subsequent PyAVD functions.
    • Config Validation: Validates structured config against EOS Config data models.
    • Configuration Generation: Generates device configuration and device documentation.

    Important Constraints:

    • Data Mutation: Input data and structured_configs are updated in-place by various functions. If you need to preserve the original data, perform a deep copy before calling PyAVD functions.
    • Thread Safety: The functions get_device_structured_config(), get_device_config(), and get_device_doc() are not thread-safe. Avoid running these for the same device across multiple threads.
    • Identity: The logic uses the hostname as the unique identifier for each device. Overlapping hostnames are not supported.
    • Fabric Logic: For get_avd_facts(), the fabric_name is not used or verified; all devices in the provided input are treated as a single fabric.
    • Hostname Requirement: hostname must be set in structured_config for each device (though get_structured_config() will set this correctly automatically).
  7. Use the eos_cli_config_gen role to generate EOS configuration and documentation

    devel

    The eos_cli_config_gen role is used to generate intended Arista EOS CLI configurations and device documentation offline. This allows you to evaluate the configuration before deployment without needing to connect to a live switch. The generated configuration can then be validated post-deployment using the anta_runner role.

    Workflow

    1. Load and Validate: The role loads your input variables and validates them against the EOS Config schema.
    2. Generate CLI Config: It produces the EOS configuration in CLI format.
    3. Generate Documentation: It produces device documentation in Markdown format.

    Inputs and Outputs

    • Inputs: EOS Config variables following the supported EOS Config data models.
    • Outputs:
      • EOS configuration in CLI format.
      • Device documentation in Markdown format.
  8. Supported network design topologies in AVD

    devel

    Arista AVD supports several pre-defined network topologies. You can extend AVD to support custom topologies by using node_type_keys to create your own node types.

    Supported designs include:

    • 3-stage Clos (Leaf & Spine): Supports layer 3 leaf and spine deployments, optionally with overlay controllers. Can represent spines, L3 leafs, and L2 leafs (often called a "POD").
    • 5-stage Clos (Super Spine): Supports larger deployments where multiple leaf-spine PODs are interconnected by super-spines. Super-spines can be single or multiple planes.
    • Layer 2 Leaf Spine: Supports L2 leaf and spine deployments where routing may terminate at the spine or an external L3 device.
    • MPLS: Supports arbitrary physical mesh topologies using core_interfaces settings.
      • Underlay protocols: ISIS-SR (default), ISIS + LDP, ISIS-SR + LDP, OSPF + LDP.
      • Overlay protocols: IBGP (default).
      • Note: MPLS does not support MLAG, VXLAN, or Inband Management. EVPN settings use mpls_overlay_role and mpls_route_reflectors instead of standard EVPN keys.
    • WAN (AutoVPN and CV Pathfinder): Uses node types wan_rr and wan_router. Default underlay is none, but eBGP is supported. Overlay is IBGP (default).
  9. Configure WAN Route Servers

    devel

    The wan_route_servers key allows WAN routers to establish connectivity to AutoVPN RRs or CV Pathfinder nodes. This is useful when WAN routers and route servers reside in different inventories.

    • wan_router: A router configured with wan_route_servers will establish BGP peering to all listed servers if they share a common path-group.
    • wan_rr: A route server configured with wan_route_servers will establish BGP peerings to every other server in the list if they share a common path-group.

    Best Practices:

    • Always use at least 2 WAN route servers for redundancy.
    • Ensure at least one WAN route server exists in each path group.
    • If route servers are in a different inventory, you must provide full configuration details under the wan_route_servers key, as AVD cannot derive them automatically. This configuration takes precedence over derived data.

    BGP Peer Group Note: When configuring passwords for wan_overlay_peers, you may also need to set a password for wan_rr_overlay_peers if Pathfinders use the same VTEP IP range as edge routers. Failure to do so may prevent static BGP peerings between Pathfinders from coming up.

    wan_route_servers:
      - hostname: pf1
      - hostname: pf2
  10. Organize variables using group_vars and host_vars

    devel

    AVD uses variables to generate EOS configuration files. While variables can be placed in the main inventory.yml, it is best practice to use dedicated folders for organization:

    1. group_vars/: Contains YAML files named after the groups defined in your inventory. For example, group_vars/DC1.yml will apply variables to all hosts in the DC1 group. This allows you to set broad network settings (like mgmt_gateway) at a high level and specific settings (like bgp_as) at a lower level.
    2. host_vars/: Contains YAML files named after specific hosts to override group-level settings.

    Variable Precedence

    When a conflict occurs, the order of precedence (from lowest to highest) is:

    1. all group
    2. Parent group
    3. Child group
    4. Host

    Example Group Variable Configuration

    In group_vars/DC1.yml, you can define both group-wide defaults and specific node configurations:

    ---
    # Default gateway for management
    mgmt_gateway: 172.16.1.1
    
    # Spine switch group configuration
    spine:
      defaults:
        platform: vEOS-lab
        loopback_ipv4_pool: 10.255.1.0/27
        bgp_as: 65100
        bgp_defaults:
          - distance bgp 20 200 200
    
      nodes:
        dc1-spine1:
          id: 1
          mgmt_ip: 172.16.1.11/24
        dc1-spine2:
          id: 2
          mgmt_ip: 172.16.1.12/24
  11. Understand anta_runner inputs and outputs

    devel

    Inputs

    • AVD Structured Configurations: The role parses only the structured configuration files generated by eos_designs to render test catalogs.
      • Note: Variables from the Ansible inventory and raw_eos_cli configurations are not considered for test generation.
    • User-defined custom tests: Custom ANTA test definitions can be provided.

    Outputs

    • Test reports: Available in CSV, Markdown, or JSON formats.
    • Per-device tests: Optionally saves a copy of the AVD-generated tests for each device.
  12. Understand Node Type inheritance and structure

    devel

    In AVD eos_designs, node settings are organized by node type (e.g., spine:, l3leaf:, l2leaf:). All node types follow a hierarchical inheritance structure. You can define common settings at a higher level to reduce repetition and errors.

    Variables defined in a parent section are inherited by child sections in the following order: defaults $\rightarrow$ node_group $\rightarrow$ node_group.node $\rightarrow$ node.

    To mark a node as offline without removing it from the inventory, use is_deployed: false.

    # Example of the inheritance hierarchy concept
    node_type_keys:
      l3leaf:
        defaults:
          # Common settings for all L3 Leafs
        node_group:
          # Settings for a specific group of L3 Leafs
          node:
            # Settings for a specific node within a group
            node:
              # Specific node settings