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

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

DeviceAddressNotes
sw1mgmt 192.168.100.21/24 (VRF mgmt)already addressed
opseth0 192.168.100.100/24Ubuntu 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

  1. Enable the API in VRF mgmt
  2. Log in and read with curl
  3. Explore the API reference
  4. Change the switch with curl
  5. 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.

Topology of The AOS-CX REST API with curl and Python2 nodes and 1 network, 2 links. Every link is listed as text below the diagram.sw1opsOOBmgmteth0
2 nodes and 1 network, with the interface names each link uses.
Nodes in The AOS-CX REST API with curl and Python, with the image each runs and the vCPU and RAM it’s set to
NodeDeviceImage in Add NodeSet to
sw1Aruba AOS-CX virtual switcharubacx-10.142 vCPU, 3,072 MB
opsEVE-NG GUI server (Docker)eve-gui-server:latest1 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 HPE Aruba Networking CX switching guided labs.

  3. Open 10 - The AOS-CX REST API 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 Aruba CX labs

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