Welcome Message

Hello my dear reader,

Welcome to my blog, which is dedicated to Cisco technologies. On its pages we will talk about the limitless world of telephony and networking.

We will focus mostly on Cisco collaboration solutions and technologies. These are IP PBX based on Cisco Unified Communications Manager and Cisco Unified Communications Manager Express, Cisco contact centers, Cisco Voice Gateways, etc. Also, I will introduce you the education news: Cisco authorized courses, my own developed training programs, our upcoming events, online learning.

If you have any questions regarding my posts, job or activities, please feel free to ask your questions. I will try to answer them when I have time.

If you are satisfied with the content of my blog, isn’t that worth a beer or coffee? Donations help me to continue supporting the blog and creating new posts here — things for which I spend hours of my free time! Thank you very much!

Sincerely, Dmytro Benda

Tuesday, August 9, 2022

Python for Network Programming

The era in which a network engineer only had to manage or configure one device at a time is quickly disappearing. With the growth of network devices, the adoption of cloud, and the desire of companies to be more flexible for a competitive edge in their market, the old ways of performing network management do not work anymore.

If you examine the way devices have been managed for 20 years, you can see that there has been no good way to manage machine-to-machine communication with the network. Usually, device configuration by network engineers generally looked like the process below:

  • Connect to a single device through the console port, by Telnet, or by SSH.
  • Configure the device.
  • Copy the configuration to Notepad.
  • Search the configuration for all the parameters that need to be changed on each device.
  • Edit the parameters for a particular device
  • Connect to the device and copy the edited configuration back to the device.
  • Repeat these steps for the next N devices. 

While this method has been used for many years, it is absolutely clear that it is not optimal for larger networks. Configuring one device at a time via the CLI is extremely slow because the speed is based on human interaction as you copy and modify configurations for multiple devices. Moreover, it is not possible to avoid errors in this process and it can’t be repeatable because it involves copying and manipulating configurations for multiple devices.

Consider a network engineer who manages a small network. The engineer can manage the network devices through the CLI without too much trouble. But what happens as the network grows and more services are added? When managing so many things such as routing protocols, Spanning Tree, security policies, segmentation, and quality of service (QoS), the engineer face the issues described above. 

To manage large network efficiently another approach was required. First, the engineers started to use scripts along with the CLI, later on new ideas appeared and complex network configurations were done with programming/scripting languages. Network Programmability and Automation can help engineers to solve administration problems when their network growth significantly. The common solution across the industry seems to be revolving around providing application programming interfaces (APIs), sample code, and reliable software development kits (SDKs).

Network programmability and automation sounds to be an ideal job for computers. To interact with the computers, we need a programming/scripting languages and the most favorite of them is Python.

If you are tired of logging in and typing a bunch of commands to configure your network, Python is for you. If you need to be certain that the network configuration is solid and repeatable, Python is for you. If you need to monitor, in real-time, what is happening on the network, well, Python is also for you.

Python was developed by Guido van Rossum and released in 1991 with the philosophy that code should be fun and easy to write and read. This is a modern language that brings coding into the range of being useful to network engineers. It makes it easy to build simple scripts to automate daily network tasks. Python supports both procedural and object-oriented programing.  The name Python comes from the surreal British comedy group Monty Python, not from the snake.

Why is Python the perfect language to learn and use in your network programmability:

  • Python is an interpretive language. Interpretive means that the code executes line by line, making it easier to test and debug because you don't have to compile the code.
  • Python is flexible. Python scripts can run on a computer (Windows, macOS, or Linux), on a server, in a VM, in a container, in the cloud, and on some Cisco IOS devices. You can use Python to create scripts that can run in various places to fit the needs of your use case.
  • Python is a full-featured object-oriented programming language with a standard library that includes everything needed to rapidly build powerful network applications. In addition, it has a multitude of third-party libraries and packages that extend Python to every sphere of network programming.
  • Python is developed under an OSI-approved open-source license. This licensing makes it freely usable and distributed for commercial use, making it popular with developers. You can also download the source code to inspect, modify, and enhance it.

I think that after all these explanations, you have no doubts how to answer a simple question like:

Should network engineers learn Python?

Yes, definitely! Python enables you to build scripts to automate network configuration. It is the most commonly used programming language for network automation, and is a critical skill for network engineers today.

Python is a great language to automate complex network configurations. Cisco has adopted Python as their language of choice to automate network devices. Moreover, Cisco provides you an authorized course to get started with Python:

Knowledge Club Slovakia also offers some courses where you can study Python and significantly improve your skills in Python programming: 

If you are ready to start you Python Networking trip, please do not hesitate to contact me or our training center via info@knowledgeclub.net

We will be happy to share our Python experience and practical knowledge with you! 

No comments:

Post a Comment