Skip to content
Snippets Groups Projects
Select Git revision
  • 6f7a88f0515827a66fa71958e866a59cf4ec6069
  • main default protected
2 results

template-vxlan-lab-rafael

Forked from NetAut / Exercise Sources / template_vxlan_lab
6 commits ahead of the upstream repository.

VxLAN Service Deployment Lab

This lab is designed to give you hands-on experience with network automation, focusing on service provisioning using both Ansible and Nornir within a leaf-spine fabric using VxLAN.

Theory

Before starting the lab, we recommend reviewing the theoretical concepts here: EVPN Designs in VxLAN Leaf-Spine Fabrics

Lab Objectives

You will complete the following tasks:

  1. Start the network topology using Containerlab.
  2. Provision and deprovision VxLAN services based on services.yaml.
    • Implement this using both Ansible and Nornir.
  3. Use the inventory auto-generated by Containerlab for automation.
  4. Test the network with NUTS
  5. Setup Infrahub (comming soon)
  6. Optionally, validate services.yaml using a JSON schema.
  7. Submit a short video presentation and your code repository.

Lab Setup

graph TD

%% Spines
S1(S1)
S2(S2)

%% Leafs
L1(L1)
L2(L2)
L3(L3)
L4(L4)

%% Hosts
H1[🐧
H1]
H2[🐧
H2]
H3[🐧
H3]
H4[🐧
H4]
H5[🐧
H5]
H6[🐧
H6]
H7[🐧
H7]
H8[🐧
H8]

%% Connections
S1 --- L1
S1 --- L2
S1 --- L3
S1 --- L4
S2 --- L1
S2 --- L2
S2 --- L3
S2 --- L4

L1 -- L1:eth3 ---- H1
L2 -- L2:eth3 ---- H2
L3 -- L3:eth3 ---- H3
L4 -- L4:eth3 ---- H4
L1 -- L1:eth4 ---- H5
L2 -- L2:eth4 ---- H6
L3 -- L3:eth4 ---- H7
L4 -- L4:eth4 ---- H8

Prerequisites

  • Docker & Containerlab installed
  • Python environment for Nornir and YAML processing
  • Ansible installed
  • task CLI tool installed (Install Task)

Folder Structure

.
├── README.md
├── Taskfile.yml
├── clab
│   └── vxlan_lab.clab.yml
├── infrahub
├── network_tests
├── service_deployment
│   ├── ansilbe_implementation
│   │   └── playbooks
│   │       └── service_deployment.yaml
│   └── nornir_implementation
│       └── main.py
├── services.yaml
└── utils

Running the Lab

Start the Lab Topology

task lab_start

Stop the Lab Topology

task lab_stop

Service Provisioning

Ansible

Write a playbook to read from services.yaml and configure devices accordingly.

Run your playbook with:

task ansible_deploy

(Dry run: task ansible_dryrun)

Nornir

Replicate the Ansible logic using Nornir (Python).

Run the Nornir script with:

task nornir_deploy

(Dry run: task nornir_dryrun)

Network Testing with NUTS

Leverage NUTS (Network Unit Testing System) to validate your fabric and service configurations.

  • Write test cases tailored to your VxLAN fabric setup.
  • These tests can be hardcoded for this lab’s topology.
  • Include a README.md inside the network_tests directory that:
    • Describes the expected topology layout.
    • Lists any dependencies or assumptions.

Infrahub

Infrahub will be used as a source of truth for the network fabric and services, replacing the need for services.yaml.

Your tasks:

  • Define a schema to represent:
    • The physical and logical structure of the fabric.
    • The VxLAN service parameters currently defined in services.yaml.
  • Import the schema into Infrahub to enable data modeling and management.
  • Complete the script at infrahub/populate_infrahub.py, which should:
    • Parse the existing services.yaml and topology files.
    • Populate Infrahub with this data using its SDK.

Note: You are not required to modify your Ansible or Nornir automation to pull data from Infrahub at this stage — but think about how it could be done in a future iteration.

Validation (Optional)

You can validate services.yaml with a JSON Schema.

Reference:
YAML Validation Guide

Submission Requirements

To complete the lab, submit the following:

  • 🎥 A 15-minute video demonstrating:
    • Your lab setup and deployment
    • A walkthrough of your Ansible and Nornir logic
    • How could Infrahub steamlit the process?
    • Your personal reflection on both tools (what worked, what didn’t)
  • 💾 A Git repository containing:
    • All playbooks, scripts, and supporting files
    • services.yaml, Taskfile.yml, and your topology definition