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

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

DevicePlatformMgmt addressLoopback0ASNAPALM driverHow NAPALM reaches it
r1Cisco IOS 15.9 (IOSv)10.10.20.1110.255.0.165001iosSSH, with Netmiko
eos1Arista EOS 4.33 (vEOS)10.10.20.3110.255.0.265002eoseAPI over HTTPS, with pyeapi
srx1Juniper Junos 24.4 (vSRX)10.10.20.4110.255.0.365003junosNETCONF 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

  1. Meet the three drivers
  2. One inventory: get_facts()
  3. Addresses in one shape: get_interfaces_ip()
  4. The cabling from LLDP: get_lldp_neighbors()
  5. BGP health: get_bgp_neighbors()
  6. Check the network against a description: compliance_report()
  7. Where the abstraction stops
  8. 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.

Topology of NAPALM - one Python API for IOS EOS and Junos4 nodes and 1 network, 7 links. Every link is listed as text below the diagram.devboxr1eos1srx1Mgmteth0Gi0/0Management1Ethernet2ge-0/0/0ge-0/0/1Gi0/2Gi0/1Ethernet1fxp0
4 nodes and 1 network, with the interface names each link uses. On a narrow screen, scroll the diagram sideways.
Nodes in NAPALM: one Python API for IOS, EOS and Junos, with the image each runs and the vCPU and RAM it’s set to
NodeDeviceImage in Add NodeSet to
devboxEVE-NG GUI server (Docker)eve-gui-server:latest1 vCPU, 1,024 MB
r1Cisco IOSvvios-adventerprisek9-m.spa.159-3.m91 vCPU, 512 MB
eos1Arista vEOSveos-4.33.1.1F1 vCPU, 2,048 MB
srx1Juniper vSRX NextGen templatevsrxng-24.4R1.92 vCPU, 4,096 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 Network Automation - CCNA and CCNP Automation guided labs.

  3. Open 22 - NAPALM - one Python API for IOS EOS and Junos 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 Network automation labs

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