It is my opinion that network engineers are already doing some coding – even if they don’t realize it. Maybe it’s a little bit of a stretch. But, let me make my case. I think you will be positively enthused about your own abilities after you read this blog.
My very first lines of code were written in Basic on a TRS-80 computer in 1979. To be honest, I had no idea what I was doing. I was simply following the instructions to create a game and making sure I typed exactly what they said. It was really an exercise in following instructions far more than it was writing code. I didn’t start understanding coding until about 1981, when I switched majors from business to Math and Computer Science. Ever since then, I have, on and off, learned how to code in various programming languages. And, I would add that I have, over the years at Cisco, had the opportunity to dabble in network device configurations as well. And for me, I always looked at this as “programming the router configuration”. It all looks like programming to me. Let me explain why.
The first thing you learn how to code, when learning a new programming language, seems to be, “Hello World!”. This is where you learn to get the computer to print those two words to the screen of your computer. It makes sense this would be the first thing you learn, because it is about the simplest bit of code, in virtually any language. Below, you can see “Hello World” in a four languages.
What all four languages have in common, at this most basic level, is that the code is “executed” one line at a time. In Basic and Python, there is only one line. When it runs, it puts “Hello World!” on the screen. In ANSI-C and Java, there is a little bit more code. There are some lines of code before the “print statement”, which set things up, and then the print happens. Each line of code is executed, one after the other, starting at the top. This is where we can find something in common with network device programming.
Now, let’s switch perspective. Let’s take a look at some lines of configuration, inside a router. We are not going to look at everything – just a small portion of a configuration file. Below is a fragment of a configuration file.
Above are the first few lines of output from a “show command” on a router. As a network engineer, this should seem insanely basic. I believe this is very much like writing software. When you put the router into configuration mode, you are editing your program. You are typing commands that you want executed. They are stored in the configuration file.
Configuration files are stored on the router, such that, when the router boots, it reads the configuration file and does what it says. For example, you can see the line of code, “enable password cisco123”. That is code for setting the router’s enable password to “cisco123”. In other words, when the router boots up and reads that line, it does precisely what you programmed. With some formatting exceptions, you could say that you are programming the router, to execute the lines of code, starting at the top and working your way down. That’s just like a basic software program – like “hello world”.
I am not going to tell you that you know how to program because you can configure a router. But, you are a long way further down the road than someone that can do neither. In application programming, we have things like “loops” and “conditionals”. But, those can easily be learned. A loop is simply where you tell the computer to execute a certain set of code repeatedly. Conditionals are simply “if/then” logic where you tell the computer something like, “If the user hits “Quit”, end the program.
If all this sounds interesting to you, let’s take it a step further. As network engineers, you already understand the basic concepts of programming and networking. I propose that you take a look at the Learning Labs for Network Engineers on Cisco DevNet. You will have to register to get in. But, that’s free and easy. Don’t forget to subscribe to the Cisco DNA Community of Interest while you register! When you get to the DNA Community, you may want to learn how to do some network configuration automation programming by reading Adam Radford’s blog on how to use PnP to make your job easier right now.
Thanks for reading,