Aruba CX lab 10 of 16
The AOS-CX REST API with curl and Python
Open the AOS-CX REST API safely in the mgmt VRF, then use it from an Ubuntu workstation: log in and read data with curl, explore the API reference in a browser, create a VLAN and update an interface, and run Python scripts that inventory the switch and save its configuration.
Run this lab
It needs Lite: its 2 nodes are set to 3 vCPU and 5,120 MB in total. That fits the free demo too.
In your workspace: Shared, then HPE Aruba Networking CX switching guided labs, then 10 - The AOS-CX REST API with curl and Python
- Level
- Intermediate
- Time
- About 60 minutes
- Nodes need
- 3 vCPU, 5,120 MB
- Smallest plan
- Lite
The scenario
Northwind's network team wants to audit and change switches from scripts instead of the CLI. You'll open the AOS-CX REST API on sw1, but only on the out-of-band network and only for a dedicated account, then prove the workflow from the ops workstation: read data, make a change, save it.
| Device | Address | Notes |
|---|---|---|
| sw1 | mgmt 192.168.100.21/24 (VRF mgmt) | already addressed |
| ops | eth0 192.168.100.100/24 | Ubuntu desktop with curl, Python 3 (requests) and Firefox; scripts in /root/lab |
API account on sw1: apiuser, group administrators, password Api-Lab1 (a teaching value).
What you’ll practise
- Enable the HTTPS server for the Web UI and REST API in the mgmt VRF with a dedicated API user
- Explain REST resources, versions in the URI, sessions and HTTP methods on AOS-CX
- Log in, GET, POST, PATCH and log out with curl, keeping the session cookie
- Use the browser-based API reference to discover resources and attributes
- Automate an inventory and a change with Python requests, and save the running configuration through the API
The tasks
- Enable the API in VRF mgmt
- Log in and read with curl
- Explore the API reference
- Change the switch with curl
- Automate with Python
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
- sw1
mgmtto OOB (network) - ops
eth0to OOB (network)
| Node | Device | Image in Add Node | Set to |
|---|---|---|---|
| sw1 | Aruba AOS-CX virtual switch | arubacx-10.14 | 2 vCPU, 3,072 MB |
| ops | EVE-NG GUI server (Docker) | eve-gui-server:latest | 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
HPE Aruba Networking CX switching guided labs.Open
10 - The AOS-CX REST API 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 Aruba CX labs
Related labs in other courses
CloudLabBox is independent of Hewlett Packard Enterprise. The lab follows exam topics and isn’t vendor training material; vendor names identify the exams and the images in the workspace.