step two – learn to code (network automation != Python)

I bet many of you were waiting for this post. I completely understand why. Whenever I have a chat with a Network Engineer about network automation, the first word I hear in almost every case is Python!

Have you ever wondered why Python comes to your mind? Are you 100% sure that Python is the best you can choose? Read further and you’ll get my answers for these questions.

Let me tell you the most important message of this post:

network automation != Python

To get the full picture, please read STEP ZERO and STEP ONE first. You may think reading those would be a waste of time, but please re-consider as I believe you need to put things into perspective first. It will not take too long.

Let me bust one more thing here in the beginning:

programming != Python

So what’s Python then?

Let’s just turn it around a little bit. You are a NETWORK engineer. You have expert knowledge of network concepts such as routing, switching and protocols. When it comes to practicality you’ll configure specific devices, which may be Cisco, Juniper, HP, Arista and the list goes on. I didn’t say anything new and groundbreaking so far.

Which was harder? Understanding the fundamentals and truly grasp how OSPF or BGP works or learning the commands to configure device? For me the process looked like: large effort to understand concepts, then quickly pick up the commands even for multiple vendors.

Look at the table below and you can see how the frequently heard terms (such as programming and networking) relate to each other if we put them next to each other:

Purpose Interconnecting hosts Solving people’s problems with the help of computers *
Concept Networking Programming
Implementation Configuring… Cisco, Juniper, Arista, etc. Writing code in… Python, Javascript, C, ruby, etc.

* I was trying to find a great definition for “the purpose of programming” and surprisingly most of the sites just say “teach the computer what to do”, but that does not grasp it fully. I came up with my own, but if you find a better one please share with me in a comment or in the Contact page.

So now you see what Python really is: one of the tools to be able to solve problems.

Your most important task is to learn the basic concepts of programming. I am not saying that you must learn only theory in the beginning, not at all. But you need to learn the theory and then practice with your selected programming language. Once you mastered and truly embraced the concepts, picking up new languages will be a piece of cake, just like start working with a new vendor.

IMG_20161018_161629

how to choose your first programming language?

Finally! After you understood how networking, programming relates to each other let’s talk for real now.

To learn the basic concepts, in my opinion, it does not matter which programming languages you learn first.

badum

I bet you say: “Great. But I still need to pick one.

So ask the following question: What problems do I want to solve with programming? We’re talking about network automation here. We need to examine what resources and tools are out there in 2017 for network automation.

  1. Plenty of libraries and frameworks have been written in Python. You can also add modules to most in Python, if you’d like to extend their capabilities.
  2. When we look at vendor APIs, you can call them easily from Python.
  3. There are plenty of Python based open source projects with large communities and frequent updates with  bug fixes and new features.
  4. Python is well documented, more and more articles are published for network automation, so it’s likely you’ll find the answered for your questions as you learn.

Tweet: Network Automation only works if everyone is on board. Please click to share and help to create a Movement!

A few examples:

Is Python the best language? No. Will you be able to solve all the problems and implement all your ideas with Python? No.

As a conclusion, I say Python is a good choice to start to learn for network automation in 2017. You might say: “This is what I was saying in the beginning!”. Yes, you’re right, however, now you understand ***why*** Python is a good choice. You are now confident, that’s one of the best languages to can get started with.

Is learning a programming language enough?

As you will start solving real world problems, soon you’ll find that you need a few more tools. You have to store data somewhere. You can save them to a file in JSON or YAML format. You may need to store some information in a relational database, so SQL comes handy. If you generate configurations, you could simplify your life using a template engine such as Jinja2 or Mako. If you’re using an API, you may need to send and receive data in JSON. Need a web interface? Look at HTML, CSS, JavaScript and related libraries.

what shall I do now?

You’ll find plenty of resources about learning a programming language on the Internet and I’ll give you a few links below.

My aim in this blog post was not to teach you how to code. I wanted to put coding into perspective for you and give pointers what to consider when before open up that text editor or IDE. I hope this was useful.

Read the STEP THREE about learning git and managing your code.


Don’t miss out and stay motivated by subscribing to email alerts on the right hand side. (desktop browser).

Till next time…

 

Advertisements

8 thoughts on “step two – learn to code (network automation != Python)

  1. Nice post. The sheer number of tools and languages can indeed be overwhelming. I personally find python easy to learn and most valuable as of now. Codeacademy’s course is very good too. I highly recommend it.

    Like

  2. Interesting post. I didn’t know any coding at all and decided to learn python. It took me 2-3 months before I started writing some tools that a team of people were using at work. After 6 months I wrote some blogs and developed proper python modules. I now cringe at the original tools I wrote, but I think they are still using them (I’m a consultant so left years ago).

    Python is good for creating a set of tools, but to develop a full automation / orchestration system its easier if you have a framework to help you out. I previously looked at git/Jenkins, but I’m not sure if I should invest time learning ansible or saltstack or what would you recommend?

    Like

    1. Next week I am going to cover this exact topic in step 6 🙂
      The good think about frameworks, that you can understand and start using them under a fairly short time.
      The first step is to figure out what do you want from a framework. My personal understanding at present time is that Ansible is great for configuration management, but limited if you want to work on event based automation. For the latter I recommend looking at Salt, as it covers that too. I am running a free coaching for Ansible, feel free to apply – you can find the page in the top menu.
      By the way why don’t you look at both. Understand the basics then get a deep dive in the one that you can see better value.

      Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s