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
- 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.
| Switch | Platform | Mgmt address | Link |
|---|---|---|---|
| cx1 | AOS-CX 10.14 (virtual) | 10.10.20.51 | 1/1/1 to cx2 |
| cx2 | AOS-CX 10.14 (virtual) | 10.10.20.52 | 1/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
- Open the API
- Versions and sessions with cURL
- Reading data, and a client that logs out
- How the switch says no, and what PUT really does
- Make the switches match a file
- Prove it with traffic
- 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.
Every link, as text
- devbox
eth0to Mgmt (network) - cx1
mgmtto Mgmt (network) - cx2
mgmtto Mgmt (network) - cx1
1/1/1to cx21/1/1
| Node | Device | Image in Add Node | Set to |
|---|---|---|---|
| devbox | EVE-NG GUI server (Docker) | eve-gui-server:latest | 1 vCPU, 1,024 MB |
| cx1 | Aruba AOS-CX virtual switch | arubacx-10.14 | 2 vCPU, 3,072 MB |
| cx2 | Aruba AOS-CX virtual switch | arubacx-10.14 | 2 vCPU, 3,072 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
25 - HPE Aruba AOS-CX REST API v10-14 with cURL and Pythonand 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.