eos_designs_to_containerlab is a role to build a containerlab topology from Arista AVD project
- General requirements are located here: avd-requirements
- containerlab must be installed or a host with docker installed must be available in case containeriezed deployment will be used. See the following link for deployment models of containerlab: https://containerlab.dev/install/
- containerlab in version
>=0.25.0
- The cEOS-lab image which should be used has to be available in the docker images of the host running containerlab..
- The structured configs and device configs must be generated by eos_designs and eos_cli_config_gen first.
- In case you want to split the AVD nodes to run on different containerlab hosts, the containerlab hosts must be able to reach each other (IP connectivity).
- NOTE: If you are running a cEOS-lab < 4.28.0F set "containerlab_custom_interface_mapping: false".
- NOTE: Currently you should only run one AVD lab on the containerlab host / containerlab hosts
Clone this project and move the folder to the AVD roles in collections/ansible_collections/arista/avd/roles/. This is the same folder where the other AVD roles like eos_designs are.
The following default variables are defined, and can be modified as desired:
containerlab_dir_name
: Location for the containerlabs generated files. (default: 'containerlab' which will be in{{ output_dir }}
)containerlab_mapping_dir_name
: Location for custom interface mappings. (default: 'mappings' which will be in{{ output_dir }}/{{ containerlab_dir_name }}
)containerlab_config_dir_name
: Location for needed config files. (default: 'configs' which will be in{{ output_dir }}/{{ containerlab_dir_name }}
)containerlab_configuration
: Filename which will be used for the containerlab topology. (default: containerlab.yml)containerlab_labname
: Name of the containerlab topology. (default: AVD)containerlab_prefix
: Prefix which will be used for the node containers, see https://containerlab.dev/manual/topo-def-file/#prefix. (default: __lab-name)containerlab_mgmt_network_name
: Name of the management network bridge. (default: MGMT)containerlab_mgmt_network
: Address range for the management network. Currently containerlab supports one management network. (if not set it will be tried to find the network range based on the first node which is processed.)containerlab_ceos_version
: Name of the cEOS-lab docker image to be used. (default: ceos:latest)containerlab_enforce_startup_config
: Enforce to reset the startup-config for every run, see: https://containerlab.dev/manual/nodes/#enforce-startup-config . (default: true)containerlab_custom_interface_mapping
: Should a custom interface mapping be created based on the AVD defined interfaces, this option also changes the management interface to what is defined for the nodes in eos_designs. Supported in cEOS-lab 4.28.0F and later. Should be set to true if Management 1 is used as management interface. (default: false)containerlab_include_intfs_to_non_avd_nodes
: Include dummy interfaces for connections to non AVD defined notes. (default: false)containerlab_debug
: Turn on debug output for the containerlab deploy command. (default: false)containerlab_mode
: Deploy the topology using an installed or containerized containerlab. (default: installed ; options: installed | container)containerlab_timeout
: The timeout of API requests that containerlab send toward external resources (i.e. docker). (default: 120s)containerlab_skip_post_deploy
: Skip containerlab post deploy actions. Supported in containerlab version 0.24 and later. (default: false)containerlab_max_workers
: Limit the amout of concurrent workers that create containers or wire virtual links. (default: equals the number of nodes/links to create)containerlab_vxlan_base
: Base VXLAN VNI for the communication between containers on different containerlab hosts. (default: 100)containerlab_onboard_to_cvp_token:
Optional parameter to provide a CVP token to devices for registering with CVP automatically.containerlab_deploy_on_hosts:
Copy the topology file and other needed files to the containerlab hosts and run the lab. If set to false the topology files and other needed files will only be created in the intended/ folder. (default: true)containerlab_deploy_startup_batches:
Depending on your containerlab host resources you might want to limit the amount of containers started in parallel. This option uses the containerlab option startup-delay and the delay is set to 300 seconds between the batches. (default: 20)
The above mentioned variables can be defined in the inventory file as shown below in the example playbook section.
There is a possibility to define specific variables supported by containerlab, see https://containerlab.dev/manual/nodes/, per AVD node. Therefore you can use the structured_config option provided by eos_designs and eos_cli_config_gen.
The following example shows this possibility. In this case Spine_1 should start 30 seconds after the the other nodes. For this the containerlab option startup-delay (https://containerlab.dev/manual/nodes/#startup-delay) can be used.
# Spine Switches
spine:
defaults:
...
node_groups:
dc1_spines:
...
nodes:
Spine_1:
id: 1
mgmt_ip: 11.11.11.11/24
...
structured_config:
containerlab:
startup-delay: 30
Spine_2:
...
Here is a playbook example to use arista.avd.eos_designs_to_containerlab
:
---
- name: Create avd nodes specific files
hosts: DC1
gather_facts: false
tasks:
- name: 'Create avd nodes specific files'
import_role:
name: arista.avd.eos_designs_to_containerlab
tasks_from: create_avd_node_files
- name: Create and deploy containerlab topology
hosts: CONTAINERLAB
gather_facts: false
tasks:
- name: 'Create and deploy containerlab topology'
import_role:
name: arista.avd.eos_designs_to_containerlab
tasks_from: deploy
Here is an example how to define two containerlab hosts in the inventory file (the name "CONTAINERLAB" must not be changed)
---
all:
children:
CONTAINERLAB:
hosts:
CL_1:
ansible_host: 1.1.1.1
CL_2:
ansible_host: 1.1.1.2
vars:
ansible_user: user
ansible_password: password
ansible_become_password: password
ansible_connection: ssh
ansible_become: true
ansible_become_method: sudo
containerlab_ceos_version: ceos:4.28.0F
containerlab_configuration: custom_topology.yml
containerlab_vxlan_base: 200
containerlab_labname: MyLabName
containerlab_mgmt_network: 11.11.11.0/24
containerlab_custom_interface_mapping: false # should be set to false if you are running a cEOS-lab < 4.28.0F
containerlab_prefix: '""'
containerlab_onboard_to_cvp_token: "eyJhbGciOiJSU..." # you can provide a onboarding token from the CVP defined in the AVD eos_designs so that your virtual devices can directly onboard to this CVP
Project is published under Apache 2.0 License