Arista VXLAN 2 – Automating Spine and Leaf Configuration

This is going to follow on from the previous post to get a basic three switch topology up and running with VXLAN. This time however, instead of doing more VXLAN I will concentrate on a way to automate the adding of spine and leaf switches to the fabric.
The purpose of this automation piece is to turn on all the switches in a new topology or add additional spine or leaf switches, and they will configure themselves with a working VXLAN config using one VRF and two VLANs.

The scripts used for this post can be found here on my GitHub.

The automation piece will be using previous posts that cover DHCP Options, ZTP and AEM.
The phases of what will happen are;

1 DHCP Options

DHCP options direct a new and unconfigured switch to retrieve the file config-ztp-fix.cfg
I have discussed how I managed to do this in this post on a Checkpoint firewall. This file is giving IP connectivity on the management interface and adding an AEM event that will download, run a python script to understand if it is a spine or leaf switch and then reload itself to boot into the new config.
The config file will also download another python script that will be used later for the VXLAN configuration.

2 AEM Runs ZTP1 Python Script

This has been previously described in this post.
The AEM event will run the previously downloaded python script that determines if the switch is a spine or leaf based off the number of connections that are active. If there are four or more interfaces active, then it is a spine, if not it is a leaf. There may be some issues with this approach as the topology grows, but that is to be seen. For the lab topology of six switches, it is fine.
Now the script has determined the switch type, it will determine the number off LLDP connected port numbers and then create a management IP address of the switch type and number.

Hostnames & Management IPs
Spine 1: 172.17.3.101/24
Spine 2: 172.17.3.102/24
Leaf 1: 172.17.3.1/24
Leaf 2: 172.17.3.2/24
Leaf 1: 172.17.3.3/24
Leaf 2: 172.17.3.4/24

The python script will perform two more tasks, which are to remove the AEM config that started this process and to configure another AEM event that will run the VXLAN on reload. Now that the Python script has run, the switch is reloaded to boot into its new configuration.

There is a 60-second sleep timer on this script to allow all the devices to run the show lldp neoghbor command to be able to see each other. If the switch doesn’t see all f the switches that will be in the spine leaf topology, the hostname and IP will be different, causing a misconfiguration for the next stage.

3 AEM Runs AEM_VXLAN_DeviceReady Python Script

I have previously written an AEM script that follows the same steps above, and then configures the XMPP feature using the hostname as the foundation for the XMPP username the switch will configure for itself. That can be found in this post.

This script will configure the spine and leaf switches with all the configuration to get VXLAN working. I have also added a VRF and 2 VLANs for a CUSTOMER1. This is used as a test tenant. All that is needed to be added is the VLANs on ports and some test PCs configuring to confirm network connectivity.

There is an important point to this script about the timing. The devices for a fresh topology must be booted around the same time. I have included a 60-second sleep timer in the script to allow all switches to boot and the show lldp neighbor command to run while they are all up. If this command runs when switches aren’t all in a fully operational mode, the configuration will not be correct.

Testing

Test 1 – Three Switch Topology

For the first test, I have used the other half of my spine/leaf topology. This will be for three switches only. Spine2, Leaf3 and Leaf4 will be automatically configured from nothing. All configuration and scripts will be removed from them, and they will be booted up at the same time.

Below is a video of the process of the three switches booting up for the first time. There are a couple of reboots but once configured the only configuration left is to add the VLANs to the switchports and cable the Ubuntu PCs up.

Test 2 – Six Switch Topology Adding ECMP

I repeated the test buy this time used all six switches in the topology. The results were the same. Each spine and leaf got the correct hostname and IP. With this, they were able to configure all the elements correctly of my VXLAN topology, and I was then able to add in some PCs to ping between the leaf switches in the same network or different.

The next steps to this was to manually implement ECMP. This is only a single line in each switch’s BGP configuration. After testing, I can add it to the script.

ECMP allows for more than one route to be added to the routing table. This is useful for the VTEPs as they can use both spine switches, so have two links to utilise.

The below output is taken from leaf1. This shows that BGP has two routes to the VTEPS via spine 1 and 2.

Next is the BGP routing table. This shows the VTEPs have the two routes installed into the routing table.

Running a ping from 192.168.20.101 on leaf 1 to 192.168.30.101 on leaf 3 yields the following EVPN BGP output.

Leave a Comment

Your email address will not be published. Required fields are marked *