• Diniz Martins

Napalm | Network Automation

Napalm is a vendor neutral, cross-platform open source project that provides a unified API to network devices, is written in Python and already works with the most popular automation frameworks.

You don't have to use an existing automation framework to automate with Napalm. Since it's an open source library you could just integrate it with your own Python application.

NAPALM supports several methods to connect to the devices, to manipulate configurations or to retrieve data:

  • Arista EOS;

  • Cisco IOS;

  • Cisco IOS-XR;

  • Cisco NX-OS;

  • Juniper JunOS.

You can select the driver you need by doing the following:

>>> from napalm import get_network_driver
>>> get_network_driver('eos')
<class napalm.eos.eos.EOSDriver at 0x10ebad6d0>
>>> get_network_driver('iosxr')
<class napalm.iosxr.iosxr.IOSXRDriver at 0x10ec90050>
>>> get_network_driver('junos')
<class napalm.junos.junos.JunOSDriver at 0x10f8f61f0>
>>> get_network_driver('nxos')
<class napalm.nxos.nxos.NXOSDriver at 0x10f9304c8>
>>> get_network_driver('ios')
<class napalm.ios.ios.IOSDriver at 0x10f9b0738>


pip install napalm 

Open the python on your machine:

root@DRM:/home/STENGE# python3
Python 3.8.5 (default, Jul 28 2020, 12:59:40)
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.

Start by importing the NAPALM module into Python:

from napalm import get_network_driver

You can select the driver you need by doing the following:

driver = get_network_driver("ios")

Create the python code using the IOS-XE always on sandbox information:

device = driver ('ip-address', 'your-loggin', 'your-password')

Next, we open a connection the device and pass the 'get_interfaces' command:


The output will come all messed up - we can make the output more readable, by importing 'json' and printing this in 'json format':

import json
print(json.dumps(device.get_interfaces(), sort_keys=True, indent=4))

Finally, we close the connection. It is advised to issue use the 'close' to disconnect our session from the device:

17 views0 comments

Recent Posts

See All

Installing Cisco ISE

The Cisco Identity Services Engine (ISE) is a next-generation identity and access control policy platform that provides a single policy plane across the entire organization combining multiple services

Disable weak cipher and TLS on CISCO FMC

Transport Layer Security, or TLS, is a widely adopted security protocol designed to facilitate privacy and data security for communications over the Internet. A primary use case of TLS is encrypting t

IOS-XR | CVE-2020-26070

A high-severity flaw in Cisco’s IOS XR software could allow unauthenticated, remote attackers to cripple Cisco Aggregation Services Routers (ASR). The flaw stems from Cisco IOS XR, a train of Cisco Sy