Python

Recently, the Python Language has become one of the most popular Programming Language. Today almost all network engineers irrespective of their technologies will be required to learn Python or some other form of automation skills using programming language. Recently I got a use-case on network automation & delivering that manually was a nightmare and almost impossible. Therefore, I started leaning Python. Hence in our next few blogs – we shall be decoding the individual beans which are must required for a Network Automation.

This is exactly the same methodology which i followed :-

At the first place – we will start this with leaning different modules in Python. You may ask – why so many? (or probably so less for python experts :P?) Answer is “Simple” – There are tons of articles available on Learning Python. Hence, we will not cover any of the topics such as Data types, looping in Python. Our methodology will be different like “delivering python code as per the usecase”. This objective is simple & “get practical”. I won’t talk about programming in abstract terms and make us wait before one can start automating networks. I will demonstrate how we can quickly and easily start network programming by using GNS3, Cisco IOS and Python. Because a network engineer would spend 90% of their Python time to work in one of these mentioned module. Hence, It would a good idea to understand each one of them at once.

Python module – “getpass”

Python module – “argparse:

Python module – “netmiko”

Python module – “telnetlib”

Python module – “ipaddress”

Python module – “paramiko”

Python module – “jinja”

Python module – “os”

Python module – “sys”

Python module – “ConfigParser”

Python module – “logging”

Python module – “queue”

Python module – “threading”

Python module – “collection”

Python module – “re”

Once, we got a sufficient understanding of above module’s our 50% of the Job is already completed.

The next step would be connecting the dots. To accomplish this we will demonstrate a real world use-case – with a production level Python code & we will see how each module fits and connect with other’s.

Trust me, In one python code – we will be using all of these module and get things going to deliver our defined objectives.

Disclaimer: – I am not an expert in Python. I have been spending some good time to understand it primarily focused on Network Automation use-cases. This arcticle was written by me (Gaurav Agrawal) in my personal capacity. The opinions expressed in this article are solely my own and do not reflect the view of my employer or my preference towards any of the OEMs.