We have seen how to achieve parallel task execution in python using multi-threading as in the below-linked post. Let’s see how we can leverage Python Scrapli AsyncIO to achieve similar results. Part1 of scrapli can be found here What is AsyncIO? asyncio is a library to write concurrent code using the async/await syntax. asyncio is used as a foundation…
Category: Python Libraries
[Practical] Multithreading vs Multiprocessing vs Asynchronous
We have already seen in theory how all of the above differ and where each of them is applicable and useful. In this post, I will try to demonstrate the same concept using practical examples. I could have spun up tens of devices in GNS3/Eve-ng but I figured just using manual delays to simulate the…
[Theory] Multithreading vs Multiprocessing vs AsyncIO
I have been using a multi-threaded version of the synchronous codes that we usually see to interact with devices and for over a year now and I have a network of nearly 28k devices (routers / switches / WLCs / FWs ) that I need to manage. With that multithreaded version, I was able to…
How to use Scrapli for Network Automation
Scrapli stands for scrape cli very cleverly joined together in one word. Althought he source documentation of this network devices interaction library is really wonderful and can be found here, this is my journal on my path to learning various libraries for device interactions and understand how they differ from each other and which one…
What is YANG For Network Engineers
As network engineers are bombarded with more and more terms like NETCONF, RESTCONF, YANG, REST APIs every day, it’s becoming increasingly important to understand the basics of these terms if not in-depth for all network engineers. To begin this series of uncovering the meaning and relevance of these terms for network engineers, let’s start by…
How to Parse data with TextFSM
TextFsm is available as a plugin to various device interaction libraries like Netmiko but what if we need to use TEXTFSM as a standalone python package, it is also available. Conditions where you don’t have access to the devices but have outputs from the device in a text file. We have already seen how to…
Python Jinja2 For Network Engineers
Jinja2 is a templating framework that is extremely versatile and its usage is not limited to any particular field like networking or web development. In this post, we will see the power of Jinja2 for network engineers. This flow chart gives the overall concept of jinja2 Let’s take an example to make this more clear….
Python NAPALM For Network Automation
We have seen how we can leverage python’s Netmiko module to interact with devices programmatically. In this blog post, we will see how we can achieve similar results with the NAPALM library for network automation. The main advantage of using NAPALM over netmiko is that there is a lot of stuff and heavy lifting that…
Multithreading with Python for Network Engineers
Up until now, we have been establishing connections to devices sequentially, i.e If you have 10 devices from which you want to pull show version data, the script will connect to device1, extract show version, goto device2, extra show version, connect to the device and extract show version and so on until all devices are…
How to Automate Network Devices using Python Netmiko Part 2
In Part 1 of this series, we saw how to establish a connection with network devices using python netmiko and fetch command outputs. In this post, we will see how to enter into enable mode and also configure cisco devices using python netmiko programmatically. If you are new to netmiko, please read Part1 here For…