Network automation lab 24 of 27
Arista EOS automation: eAPI, pyeapi and configuration sessions
Program two Arista switches from a Linux workstation: JSON-RPC calls to eAPI with cURL and Python, structured data with no screen scraping, pyeapi's connection profiles and API modules, a desired-state VLAN push, and configuration sessions with a commit timer that undoes a change nobody confirms.
Run this lab
It needs Lite: its 3 nodes are set to 3 vCPU and 5,120 MB in total. That fits the free demo too.
In your workspace: Shared, then Network Automation - CCNA and CCNP Automation guided labs, then 24 - Arista EOS automation - eAPI pyeapi and configuration sessions
- Level
- Intermediate
- Time
- About 70 minutes
- Nodes need
- 3 vCPU, 5,120 MB
- Smallest plan
- Lite
The scenario
Northern Haulage's Manchester data centre runs Arista switches, and the team wants to manage them with code, not screen scraping. EOS offers eAPI: send CLI commands over HTTPS, and get back structured JSON. You'll start with bare JSON-RPC to see what's really on the wire, move to Arista's pyeapi library, and finish with the safest way to change a switch you can't afford to lose.
| Switch | Platform | Mgmt address | Link |
|---|---|---|---|
| eos1 | Arista EOS 4.33 (vEOS) | 10.10.20.31 | Ethernet1 trunk to eos2 |
| eos2 | Arista EOS 4.33 (vEOS) | 10.10.20.32 | Ethernet1 trunk to eos1 |
What you’ll practise
- Enable eAPI and read its status
- Build runCmds JSON-RPC requests with cURL and Python, in JSON and text formats
- Tell a transport failure from a command failure in an eAPI reply
- Use pyeapi connection profiles, node methods and API modules
- Push a desired VLAN state to two switches so that a second run changes nothing
- Make a safe change with a configuration session, a diff and a commit timer
The tasks
- Turn on eAPI
- JSON-RPC by hand
- Two kinds of failure
- An inventory from JSON
- pyeapi: profiles and nodes
- Desired state for VLANs
- A change that undoes itself
The Lab Tasks pane has the scenario, these tasks, the checks to run, hints and the full solution.
Topology and devices
The network as it opens in EVE-NG, drawn from the lab’s own canvas, and the image each node runs.
Every link, as text
- devbox
eth0to Mgmt (network) - eos1
Management1to Mgmt (network) - eos2
Management1to Mgmt (network) - eos1
Ethernet1to eos2Ethernet1
| Node | Device | Image in Add Node | Set to |
|---|---|---|---|
| devbox | EVE-NG GUI server (Docker) | eve-gui-server:latest | 1 vCPU, 1,024 MB |
| eos1 | Arista vEOS | veos-4.33.1.1F | 1 vCPU, 2,048 MB |
| eos2 | Arista vEOS | veos-4.33.1.1F | 1 vCPU, 2,048 MB |
How to open this lab
Sign in to your workspace at
lab.cloudlabbox.com.In File Manager, open Shared, then the folder
Network Automation - CCNA and CCNP Automation guided labs.Open
24 - Arista EOS automation - eAPI pyeapi and configuration sessionsand start its nodes, then open Lab Tasks for the scenario and the steps.
The lab is read-only. You can start the nodes and configure the devices, but changes to the topology can’t be saved. To change it, rebuild it in your own folder.
More Network automation labs
Related labs in other courses
CloudLabBox is independent of Cisco. The lab follows exam topics and isn’t vendor training material; vendor names identify the exams and the images in the workspace.