Computer NetworksNETWORKS

Useful Python Libraries for Network Engineers | Network Programmability | Insoft Academy

Useful Python Libraries for Network Engineers | Insoft Academy

As the Internet has grown, so too has Python’s role as an Internet tool. Python has proven to be well-suited to Internet scripting for some of the very same reasons that make it ideal in other domains. Its modular design and rapid turnaround auger well with the intense demands of network development.

The first useful library is Asyncio – a Python standard library. This module provides an infrastructure for writing single-threaded concurrent code using coroutines, multiplexing I/O access over sockets and other resources, running network clients and servers, and other related primitives.

The second is Netmiko – a multi-vendor Python library that simplifies SSH connections to network devices. It can be used to push out configs to a network device, add VLANs, etc. Among the platforms that Netmiko currently supports are Cisco IOS, Arista EOS, and Juniper Junos.

The third is NAPALM – a vendor-agnostic open-source python library that provides a unified API to network devices. NAPALM is an abbreviation for Network Automation and Programmability Abstraction Layer with Multivendor support. By design, it works with popular automation tools such as Ansible, SaltStack, and StackStorm. Besides, you don’t have to use an existing automation framework to automate with NAPALM. Since it’s an open-source project you could just integrate it with your own Python script.

The fourth is pyATS – an infrastructure agnostic, highly pluggable test automation framework that is very scalable. Genie can help network engineers to test, maintain, and diagnose the desired operational state of their network. You could, for instance, use it to ensure that for every “up interface”, there are no CRC errors. Such a use case can greatly help reduce packet drops on a link. Moreover, through plugins and a large pool of Pythonic libraries, you can develop integrations with 3rd party products and execute even more complex DevOps tasks.

The fifth is Nornir – An automation framework written in python to be used with python. Just imagine Nornir as the Flask of automation. Nornir will take care of dealing with the inventory where you have your host information, it will take care of dispatching the tasks to your devices and will provide a common framework to write “plugins”.

Please note that these are just but a few popular ones, the Python programming language has a large number of networking libraries, each has its own strengths. Always do your homework on the right library to use for specific purposes.

source

cisco academie