| technology | programming - Erik Mikac
4 Reasons to Learn Python as a Network Engineer
At first, it may seem a little strange that a network engineer needs to learn Python. After all, when somebody thinks of network engineering, their mind probably goes to load balancers, LAN's, routers, and the like.
While computer programming is not required to be a successful network engineer, the advent of network automation is slowly changing that line of thinking. As our world becomes increasingly automated, it is no surprise that the reliability infrastructure of our networks will become automated as well.
Think of all the time-consuming tasks an engineer is burdened with. Inventorying hardware for instance. Instead of manually checking every piece of hardware, a Python script can be run to execute a task that takes minutes to complete instead of hours.
Additionally, as the world moves to the cloud IaaS, automation will become critical to an organization's success. The first example about inventorying hardware leads us to our first reason to learn Python: your efficiency will skyrocket!
1. Learn Python for Efficient Documenting
It's not an understatement to say network engineers have a lot to document. Anyone who has worked in networking knows there is a lot of equipment to keep track of. Even software configurations need to be documented as well, such as firewall ports.
Often, these configurations will be entered manually into a spreadsheet for concise documentation. Unfortunately, as our world becomes more networked, this requirement does not meet standards of scalability. That's where Python comes into play.
Using Python, an engineer can programmatically write and read to an excel file. This means that instead of typing the data into Excel, a Python script is written to loop over data and enter the data via code. Not only that, but they can use jobs to query the network and automatically write to the spreadsheet. Let's take a look at a quick example.
2. Use Python to Collect MAC Addresses
Whenever a new device is added to a network, a Python script can be triggered to ping that device. When the device is pinged, the MAC address can be extracted and written to a CSV file. That way, all physical hardware with a NIC can be tallied in a central location. This increases efficiency because it no longer has to be written down manually, saving the network engineer tons of time!
3. Learn Python to Speed Up Processes
The best part about programming is that it allows people to perform tasks in minutes that normally would take weeks. Equally important, not only can you implement changes quicker, they can be reversed as well. Let's look at a practical example of this concept.
When a node is put onto a network such as a virtual machine (WM), a network engineer needs to make sure it can communicate with the network and possibly even the internet.
Generally this is all taken care of when the VM is created. Information needs to be entered such as which ports it can talk to, which ports should be closed, and which load balancer is associated with it. These questions and dozens more must be entered correctly or the wheels can fall off the whole network.
By using Python automation, all of this can be accomplished by running a script. Instead of manually inputting these fields and hoping everything’s correct, a designated template can be used to ensure the VM is spun up the right way every time.
But what if the script you wrote is wrong?
Well in that case, a script can be written just as easily to reverse the changes. (Let's just hope that it’s not wrong too…) Better yet, if these scripts are version controlled, you could revert your network to a previous state prior to the breaking change.
4. Python Increases Network Reliability
Networks are becoming more and more complex, and it is a sad fact that networking teams have adopted a posture of fear when it comes to changes. This hesitation to modify the network can lead to security vulnerabilities down the road or ossification of the infrastructure. However, with Python and network automation, this need not be the case.
The best part about automation is that it removes "problem exists between keyboard and chair" errors. In other words, by removing the human element from networking, reliability is increased. This leaves actual people to take on more creative work, such as experimenting on the network.
Let's say you read about a brand new networking technology that you would like to implement at your organization. Maybe it is an SD-WAN, EC2 instances, or even a simple router update. Often, even simple updates are met with great hesitation, because there is the possibility it could break the existing architecture. However with network automation, these changes can be made without any fear. That's because the previous state of the network will be located in GitHub on a script to be executed if things get hairy.
How Python can Benefit Your Career
Another reason to learn Python is it can enhance your career prospects. According to the bureau of labor statistics, the role of software engineer is going to grow a whopping 22% in the next 10 years. This means you will be able to either stay at your job as a more valuable employee, or strike out to a different organization for new opportunities.
If you know Python, then you will certainly have a cut of those software developer jobs. The bottom line is everyone needs folks who know how to code. The best part is that in the grand scheme of things, you really don't have to know that much Python to be a great network automator.
That means you will be getting the best of both worlds. You will be a developer without the headache of having to stare at code. Yet, you will be a network engineer with invaluable coding skills.
In this post we talked about four great reasons to learn Python as a network engineer. The first reason is that your efficiency will greatly increase. Organizations will pay top dollar to an engineer who can do what it would normally take twenty engineers to do.
The next reason is that task speed will greatly increase. Long gone will be the days of tedious documentation, setting up VM's, load balancers, and the like. All of this will be done via script management.
The third reason is that the network's reliability will go through the roof. Now that the infrastructure is definitely reliable, employees will have breathing room to experiment with ways of making the network better. For instance, updating the firmware on all the routers will no longer be a risky endeavor, or migrating data to a share drive will no longer be a total hassle.
Lastly, your career prospects will skyrocket. Nothing sounds better to an employer than a network engineer who understands both sides of the IT coin: they can code and provide networking solutions? Unreal! Learning these skills will certainly command a higher salary and job security for decades to come.