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

Try it free for 30 minutesRun it on Lite from £3 a day

The free demo needs no card and no email. Every lab plan includes every guided lab.

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.

SwitchPlatformMgmt addressLink
eos1Arista EOS 4.33 (vEOS)10.10.20.31Ethernet1 trunk to eos2
eos2Arista EOS 4.33 (vEOS)10.10.20.32Ethernet1 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

  1. Turn on eAPI
  2. JSON-RPC by hand
  3. Two kinds of failure
  4. An inventory from JSON
  5. pyeapi: profiles and nodes
  6. Desired state for VLANs
  7. 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.

Topology of Arista EOS automation - eAPI pyeapi and configuration sessions3 nodes and 1 network, 4 links. Every link is listed as text below the diagram.devboxeos1eos2Mgmteth0Ethernet1Ethernet1Management1Management1
3 nodes and 1 network, with the interface names each link uses. On a narrow screen, scroll the diagram sideways.
Nodes in Arista EOS automation: eAPI, pyeapi and configuration sessions, with the image each runs and the vCPU and RAM it’s set to
NodeDeviceImage in Add NodeSet to
devboxEVE-NG GUI server (Docker)eve-gui-server:latest1 vCPU, 1,024 MB
eos1Arista vEOSveos-4.33.1.1F1 vCPU, 2,048 MB
eos2Arista vEOSveos-4.33.1.1F1 vCPU, 2,048 MB

How to open this lab

  1. Sign in to your workspace at lab.cloudlabbox.com.

  2. In File Manager, open Shared, then the folder Network Automation - CCNA and CCNP Automation guided labs.

  3. Open 24 - Arista EOS automation - eAPI pyeapi and configuration sessions and 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

All 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.