Network automation lab 25 of 27

HPE Aruba AOS-CX REST API v10.14 with cURL and Python

Manage two AOS-CX switches through their REST API: session cookies and limits, attributes, depth and selectors, what POST, PATCH, PUT and DELETE really do, a desired-state VLAN and port script, and checkpoints with rollback, all with cURL and plain Python requests.

Run this lab

It needs Lite: its 3 nodes are set to 5 vCPU and 7,168 MB in total. That fits the free demo too.

In your workspace: Shared, then Network Automation - CCNA and CCNP Automation guided labs, then 25 - HPE Aruba AOS-CX REST API v10-14 with cURL and Python

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 75 minutes
Nodes need
5 vCPU, 7,168 MB
Smallest plan
Lite

The scenario

The new Hull depot is getting two HPE Aruba CX access switches. There's no Ansible collection or vendor Python library for them on this workstation, so you'll work the way those tools do underneath: plain HTTPS calls to the switch's REST API, first with cURL to see each step, then with a small Python client of your own.

SwitchPlatformMgmt addressLink
cx1AOS-CX 10.14 (virtual)10.10.20.511/1/1 to cx2
cx2AOS-CX 10.14 (virtual)10.10.20.521/1/1 to cx1

What you’ll practise

  • Enable the REST API on the management VRF and log in with a session cookie
  • Read data efficiently with attributes, depth, selector and filter parameters
  • Encode interface names in URLs and follow references between resources
  • Explain POST, PATCH, PUT and DELETE on AOS-CX, and read its error replies
  • Write a script that makes two switches match a YAML file and changes nothing on a second run
  • Take a checkpoint, roll back to it and save the configuration over REST

The tasks

  1. Open the API
  2. Versions and sessions with cURL
  3. Reading data, and a client that logs out
  4. How the switch says no, and what PUT really does
  5. Make the switches match a file
  6. Prove it with traffic
  7. Checkpoints, rollback and saving

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 HPE Aruba AOS-CX REST API v10-14 with cURL and Python3 nodes and 1 network, 4 links. Every link is listed as text below the diagram.devboxcx1cx2Mgmteth01/1/11/1/1mgmtmgmt
3 nodes and 1 network, with the interface names each link uses. On a narrow screen, scroll the diagram sideways.
Nodes in HPE Aruba AOS-CX REST API v10.14 with cURL and Python, 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
cx1Aruba AOS-CX virtual switcharubacx-10.142 vCPU, 3,072 MB
cx2Aruba AOS-CX virtual switcharubacx-10.142 vCPU, 3,072 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 25 - HPE Aruba AOS-CX REST API v10-14 with cURL and Python 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.