Palo Alto NGFW lab 22 of 30
Automating PAN-OS with the XML and REST APIs
Manage the firewall from code: get an API key, run operational commands, read and write configuration by XPath, commit and poll the job, use the REST API with JSON, and bulk-load depot devices from a CSV file with a Python script, learning the XML of any CLI command with debug cli on.
Run this lab
It needs Lite: its 2 nodes are set to 3 vCPU and 6,656 MB in total. That fits the free demo too.
In your workspace: Shared, then Palo Alto NGFW PAN-OS 11 guided labs, then 22 - Automating PAN-OS with the XML and REST APIs
- Level
- Advanced
- Time
- About 50 minutes
- Nodes need
- 3 vCPU, 6,656 MB
- Smallest plan
- Lite
The scenario
Calder is rolling out new handheld scanners to every depot, and each one needs an address object. Doing that by hand on dozens of firewalls is slow and error-prone. You'll learn the firewall's two APIs from Client-PC (which has curl and Python 3), then load the handhelds from a CSV file.
Before you start. Start all the nodes. The firewall takes 6-8 minutes to boot and comes up with this lab's starting configuration already loaded. Wait until the FW1 console shows
FW1 login:, then log in asadmin/Lab-Access-1. Until the management plane is ready it answers Login incorrect, even with the right password. The Linux hosts are ready within seconds.
What you’ll practise
- Generate an API key and pass it safely in a header
- Run operational commands and learn their XML with debug cli on
- Read and write configuration with XPath through the XML API
- Commit through the API and poll the job to completion
- Use the REST API with JSON and automate a bulk change with Python
The tasks
- Get an API key
- Operational commands, and how to find their XML
- Read configuration by XPath
- Write configuration and commit through the API
- The REST API
- Bulk load from a CSV with Python
- Export the configuration
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
- FW1
mgmtto Inside (network) - FW1
ethernet1/2to Inside (network) - Client-PC
eth0to Inside (network)
| Node | Device | Image in Add Node | Set to |
|---|---|---|---|
| FW1 | Palo Alto Networks VM-Series (PAN-OS) | paloalto-11.2.5 | 2 vCPU, 5,632 MB |
| Client-PC | EVE-NG GUI server (Docker) | eve-gui-server:latest | 1 vCPU, 1,024 MB |
How to open this lab
Sign in to your workspace at
lab.cloudlabbox.com.In File Manager, open Shared, then the folder
Palo Alto NGFW PAN-OS 11 guided labs.Open
22 - Automating PAN-OS with the XML and REST APIsand 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 Palo Alto NGFW labs
Related labs in other courses
CloudLabBox is independent of Palo Alto Networks and Cisco. The lab follows exam topics and isn’t vendor training material; vendor names identify the exams and the images in the workspace.