arista-netdevops-community / eos_designs_to_containerlab

Deploy and run AVD eos_designs in containerlab
Apache License 2.0
8 stars 3 forks source link

eos_designs to containerlab

eos_designs_to_containerlab is a role to build a containerlab topology from Arista AVD project

Requirements

Installation

Clone this project to your directory where your AVD playbooks are.

Role Variables

The following default variables are defined, and can be modified as desired:

    sim_external_nodes_map:
          server:
            kind:'linux'
            image:'alpine:latest'
          others: 
            kind: 'ceos'
            image: 'ceos:4.31.1F'

The above mentioned variables can be defined in the inventory file as shown below in the example playbook section.

Additional containerlab variables for nodes

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:
        ...

Playbook

Here is a playbook example to use arista.avd.eos_designs_to_containerlab:

---
- name: Create avd nodes specific files
  hosts: FABRIC
  gather_facts: false
  tasks:
    - name: 'Create avd nodes specific files'
      import_role:
        name: eos_designs_to_containerlab
        tasks_from: create_avd_node_files

- name: Deploy containerlab topology
  hosts: SIMULATION
  gather_facts: false
  tasks:
    - name: 'Create and deploy containerlab topology'
      import_role:
        name: eos_designs_to_containerlab
        tasks_from: deploy

Inventory

Here is an example how to define two simulation hosts in the inventory file (the name "SIMULATION" must not be changed)

NOTE: The group SIMULATION and the mandatory fields have to be defined.

---
all:
  children:
    SIMULATION:
      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
          sim_env: clab
          sim_ceos_version: ceos:4.28.0F
          sim_topology_file_name: 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

License

Project is published under Apache 2.0 License