netlab: Building Leaf-and-Spine Fabrics with the Fabric Plugin

netlab release 1.7.0 added the fabric plugin that simplifies building lab topologies with leaf-and-spine fabrics. All you have to do to build a full-blown leaf-and-spine fabric is:

  • Specify the default device type
  • Enable the fabric plugin
  • Specify the number of leaves and spines in the fabric.

For example, the following lab topology builds a fabric with Arista cEOS containers having two spines and four leaves:

defaults.device: eos
provider: clab

plugin: [ fabric ]
fabric.spines: 2
fabric.leafs: 4
Leaf-and-spine lab topology

Leaf-and-spine lab topology

Behind the scenes, the fabric plugin creates:

  • The leaf nodes, using fabric.leaf.name parameter to generate node names. The default value of that parameter is L{count}, resulting in node names L1 through L4.
  • The leafs group that contains all leaf nodes.
  • The spine nodes, using fabric.spine.name parameter to generate node names.
  • The spines group that contains all spine nodes.
  • The links between leaf- and spine nodes.

Renaming the Nodes

Let’s change the node names to be more descriptive and use leaf-1 through leaf-4 instead of L1 through L4:

defaults.device: eos
provider: clab

plugin: [ fabric ]
fabric.spines: 2
fabric.leafs: 4

fabric.leaf.name: leaf-{count}
fabric.spine.name: spine-{count}

This is the resulting lab topology:

Leaf-and-spine lab topology

Leaf-and-spine lab topology

Using hyphens in node names is not a good idea; you cannot use short link descriptions if the node names contain hyphens.

Adding Routing Protocols

Next step: we need routing protocols in our leaf-and-spine fabric. Let’s assume we want to build an EVPN fabric using IBGP to exchange EVPN information between the routers and OSPF as the underlying IGP. We could enable both configuration modules with the following addition to the lab topology:

module: [ ospf, bgp ]
bgp.as: 65000

We can also use the autogenerated leafs and the spines groups to run IBGP only on the leaf nodes:

defaults.device: eos
provider: clab

plugin: [ fabric ]
fabric.spines: 2
fabric.leafs: 4

fabric.leaf.name: leaf-{count}
fabric.spine.name: spine-{count}

groups:
  leafs:
    module: [ ospf, bgp ]
    bgp.as: 65000
  spines:
    module: [ ospf ]

The resulting IBGP topology is a full mesh of IBGP sessions between the leaf nodes. The spine nodes are not running BGP:

IBGP full mesh between leaf nodes

IBGP full mesh between leaf nodes

Attaching Hosts to the Fabric

Once the fabric plugin does its magic, you can use the fabric nodes like any other node in the lab topology. For example, you can add Linux hosts and connect them to the fabric.

nodes:
  host-1:
    device: linux
  host-2:
    device: linux

links:
- host-1:
  leaf-1:
- host-2:
  leaf-2:
Hosts attached to the leaf-and-spine fabric

Hosts attached to the leaf-and-spine fabric

Kicking the Tires

Want to build your own leaf-and-spine fabric lab? Let’s do it:

1 comments:

  1. There is a tool with a demonstration that launches 60 containers in a spider-web-like network automatically and has graphical output of the frr running OSPF.

    http://clownix.net/ Go to chapter: " Test the spider web frr demo from within a podman " And follow the instructions.

Add comment
Sidebar