netclab

Your AVD fabric, live in Kubernetes

Keep the AVD model you have and the containerlab you run. Change the model in Kubernetes, and the twin follows.

VS Code: a VLAN added to the AVD model with kubectl edit, beside the containerlab twin in TopoViewer and the Fabric's objects in the Kubernetes tree
A VLAN added to the model, in the cluster, beside its containerlab twin.
Crossview: the Fabric in the middle and a Device per switch around it, all healthy
The fabric in Kubernetes: one Fabric, a Device per switch.
show vlan on dc1-leaf1a listing the new VLAN 3403, beside the trace of the Fabric's objects, all ready
Half a minute later, the VLAN is on the switch.

What you get

Quick start

AVD's own single-dc-l3ls example: 8 cEOS switches and 2 servers in containerlab, the model in a kind cluster. Run with netadopt 0.9.0, function-avd v0.2.4, Crossplane v2.4.2, containerlab 0.79.0 and cEOS 4.36.1F.

It needs Docker, kind, kubectl, helm, uv and containerlab. cEOS cannot be pulled: download it from Arista and import it once.

docker import cEOS64-lab-4.36.1F.tar.xz ceos:4.36.1F

1. The repository

git clone --depth 1 --branch v6.4.0 --filter=blob:none --sparse https://github.com/aristanetworks/avd
git -C avd sparse-checkout set ansible_collections/arista/avd/examples/single-dc-l3ls
cp -r avd/ansible_collections/arista/avd/examples/single-dc-l3ls .

2. What is in it

uvx "netadopt[avd]" avd report single-dc-l3ls --playbook build.yml

It carries: a Fabric, and a FabricInput per group.

3. The twin

uvx "netadopt[avd]" avd lab single-dc-l3ls --playbook build.yml --for containerlab \
  --ceos-image ceos:4.36.1F --extra-vars-out lab-vars.yml > single-dc-l3ls.clab.yml
sudo containerlab deploy -t single-dc-l3ls.clab.yml

lab-vars.yml points each switch of the model at its node in the twin. cEOS takes a few minutes to boot. In VS Code with vscode-containerlab, one setting logs into the nodes as the twin's user:

"containerlab.node.sshUserMapping": { "arista_ceos": "arista" }

4. The cluster

curl -LO https://raw.githubusercontent.com/netclab/function-avd/v0.2.4/example/runtime.yaml
curl -LO https://raw.githubusercontent.com/netclab/function-avd/v0.2.4/example/providerconfig.yaml
uvx netclab up --crossplane v2.4.2 \
  --configuration xpkg.upbound.io/netclab/configuration-avd:v0.2.4 \
  --manifest runtime.yaml --manifest providerconfig.yaml

A kind cluster with Crossplane and function-avd, in about a minute and a half.

5. The model in the cluster

uvx "netadopt[avd]" avd emit single-dc-l3ls --playbook build.yml -e @lab-vars.yml \
  | kubectl apply --server-side -f -
kubectl get fabric,device

The Fabric and its 8 Devices are ready in under a minute, and every switch in the twin carries its AVD configuration.

6. A change

KUBE_EDITOR="code --wait" kubectl edit fabricinput single-dc-l3ls-network-services

Under l2vlans, add:

- id: 3403
  name: NEW_VLAN

Save and close. Half a minute later the VLAN is on the six leaves, and not on the spines:

docker exec clab-single-dc-l3ls-dc1-leaf1a Cli -p 15 -c "show vlan"

7. Production

uvx "netadopt[avd]" avd emit single-dc-l3ls --playbook build.yml > production.yaml
uvx "netadopt[avd]" avd emit single-dc-l3ls --playbook build.yml -e @lab-vars.yml > twin.yaml
diff production.yaml twin.yaml

Only spec.extraVars differs. Applied without it, the Fabric configures the switches at the addresses in your inventory: read Before applying a Fabric first.

Clean up

sudo containerlab destroy -t single-dc-l3ls.clab.yml
uvx netclab down

What makes it possible