Network automation lab 22 of 27
NAPALM: one Python API for IOS, EOS and Junos
Run the same Python against Cisco IOS, Arista EOS and Juniper Junos with NAPALM: normalised facts, addresses, LLDP links and BGP health, a compliance report from YAML, and one load, diff, commit and rollback workflow on all three.
Run this lab
It needs Lite: its 4 nodes are set to 5 vCPU and 7,680 MB in total. That fits the free demo too.
In your workspace: Shared, then Network Automation - CCNA and CCNP Automation guided labs, then 22 - NAPALM - one Python API for IOS EOS and Junos
- Level
- Intermediate
- Time
- About 75 minutes
- Nodes need
- 5 vCPU, 7,680 MB
- Smallest plan
- Lite
The scenario
Kestrel Freight has bought Northern Haulage, and its network came with the deal: an Arista switch in Manchester and a Juniper SRX at the Hull depot, joined to your Cisco router in Leeds by eBGP. The operations manager wants one morning report across all three and one way to push a change. Three scripts with three sets of parsers would be three things to maintain, so you'll try NAPALM, a Python library that gives every vendor the same API.
| Device | Platform | Mgmt address | Loopback0 | AS | NAPALM driver | How NAPALM reaches it |
|---|---|---|---|---|---|---|
| r1 | Cisco IOS 15.9 (IOSv) | 10.10.20.11 | 10.255.0.1 | 65001 | ios | SSH, with Netmiko |
| eos1 | Arista EOS 4.33 (vEOS) | 10.10.20.31 | 10.255.0.2 | 65002 | eos | eAPI over HTTPS, with pyeapi |
| srx1 | Juniper Junos 24.4 (vSRX) | 10.10.20.41 | 10.255.0.3 | 65003 | junos | NETCONF over SSH, with PyEZ |
The links are r1 Gi0/1 to eos1 Ethernet1 (10.1.12.0/30), eos1 Ethernet2 to srx1 ge-0/0/0 (10.1.23.0/30) and srx1 ge-0/0/1 to r1 Gi0/2 (10.1.13.0/30). The login is netops / NetOps-Lab1 on all three, exported as $NET_USER and $NET_PASS. NAPALM 4.1 is installed on devbox, and your files are in ~/lab.
What you’ll practise
- Explain what a NAPALM driver does and how each vendor is reached (SSH, eAPI, NETCONF)
- Use getters to build one inventory, address table, link map and BGP report across three vendors
- Validate live state against a YAML description with compliance_report
- Find where normalisation stops: vendor names, numeric LLDP ports and getters a virtual platform can't answer
- Merge, diff, commit and roll back configuration with one workflow on all three platforms
The tasks
- Meet the three drivers
- One inventory:
get_facts() - Addresses in one shape:
get_interfaces_ip() - The cabling from LLDP:
get_lldp_neighbors() - BGP health:
get_bgp_neighbors() - Check the network against a description:
compliance_report() - Where the abstraction stops
- One workflow for 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
- devbox
eth0to Mgmt (network) - r1
Gi0/0to Mgmt (network) - eos1
Management1to Mgmt (network) - srx1
fxp0to Mgmt (network) - r1
Gi0/1to eos1Ethernet1 - eos1
Ethernet2to srx1ge-0/0/0 - srx1
ge-0/0/1to r1Gi0/2
| Node | Device | Image in Add Node | Set to |
|---|---|---|---|
| devbox | EVE-NG GUI server (Docker) | eve-gui-server:latest | 1 vCPU, 1,024 MB |
| r1 | Cisco IOSv | vios-adventerprisek9-m.spa.159-3.m9 | 1 vCPU, 512 MB |
| eos1 | Arista vEOS | veos-4.33.1.1F | 1 vCPU, 2,048 MB |
| srx1 | Juniper vSRX NextGen template | vsrxng-24.4R1.9 | 2 vCPU, 4,096 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
22 - NAPALM - one Python API for IOS EOS and Junosand 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.