Network Automation NAPALM
This blog introduces NAPALM, which is a Python library for network automation. NAPLAM stands for Network Automation and Programmability Abstraction Layer with Multivendor Support.
The NAPALM library can comes in handy for performing daily tasks such as getting device configuration, device uptime, protocol details and many more. It can also be used to configure a device. NAPALM has support for multiple network drivers such as Cisco IOS, Cisco Nexus-OS, Juniper Junos, and Arista EOS. These are core drivers, which means they are installed when we install the NAPALM library. Additionally, community drivers are also created by their specific vendors, such as Aruba using AOS CX and Checkpoint using napalm-gaia.
It is also known as the unified API. Using a single API, we can connect to network devices with different operating systems.

We can perform operations such as connecting to a device, managing and modifying the configuration of a device. It can also be used to compare configurations.
Below is the list of core NAPALM drivers.
- Arista EOS
- Cisco IOS
- Cisco IOS-XR
- Cisco NX-OS
- Juniper JunOS
Besides core drivers, NAPALM also supports community drivers.
Before we start using the library, we have to install it. To install the library, use the command pip install napalm.
pip install napalam
We have created a simple program that connects to a Cisco router and displays the ARP table. We must know the operating system of the device to which an attempt is made to connect. When attempting to connect a device with a different operating system, the connection will fail, such as the connection to a Nexus device will fail if we use “ios” instead of “nxos”.
The first step is to import a network driver from the NAPALM library. This determines the kind of network device to which we are trying to make a connection. Additionally, import the JSON library. JSON is the data formatting library.
from napalm import get_network_driver
import json
I am running a Cisco IOS router and will try to connect it using the below code.
driver = get_network_driver('ios')
device = driver('131.226.217.143','developer','C1sco12345')
device.open()
print(json.dumps(device.get_arp_table(), indent=2))
device.close()
When the program is executed, we get the below result.
[
{
"interface": "GigabitEthernet1",
"mac": "00:50:56:BF:49:0F",
"ip": "10.10.20.28",
"age": 2.0
},
{
"interface": "GigabitEthernet1",
"mac": "00:50:56:BF:78:AC",
"ip": "10.10.20.48",
"age": -1.0
},
{
"interface": "GigabitEthernet1",
"mac": "00:50:56:BF:D6:36",
"ip": "10.10.20.254",
"age": 194.0
},
{
"interface": "GigabitEthernet2",
"mac": "00:50:56:BF:4E:A3",
"ip": "10.255.255.2",
"age": -1.0
}
]
Complete Code
from napalm import get_network_driver
import json
driver = get_network_driver('ios')
device = driver('131.226.217.143','developer','C1sco12345')
device.open()
print(json.dumps(device.get_arp_table(), indent=2))
device.close()