Programmability in Python: Confessions of a Networking Guy
I am not qualified to discuss it much, but can you guess what this does?
ne = NetworkElement("172.16.66.1", "JasonsApp")
conn = ne.connect("admin", "cisco", sc)
intf1 = ne.get_interface_by_name("FastEthernet0/1")
If you guessed that it logs into a switch at 172.16.66.1 and disables interface F0/1 for 5 seconds and re-enables it, then you guessed right.
Let us talk a little about putting the “ability” in programmability. Did I code in college? Yes. Was I good at it? Not really. Dijksta’s algorithm (the actual coding bit) drove me crazy, however, actually using and operating networks quickly became my cup of tea. I became a network geek. Subnets? Awesome! Cisco CLI? Sweet. Using Enhanced Interior Gateway Routing Protocol (EIGRP)? Yay! AVVID? Even better. But I never wanted to see C++ or another “program” again.
Fast forward to 2014. I’m still a networking guy but now I’m seeing code again. The good news is, maybe like you, I hang out with some really cool people. I challenged a couple of them to help me demonstrate program “ability” to networking people on the show floor at CiscoLive Milan…with me as the test subject!
I love CLI. I don’t need tools. While lucky enough to remember some of this programming stuff, I remained a skeptic. This was the mission that Shelly Cadora and Ralph Schmieder took on. They came back to me with lights. No kidding. PoE lights.
As a first test, Shelly asked me to enable all the lights. I did it successfully. Comfort zone CLI; “interface range”, “shut” and “no shut.” Then Shelly fired up some Python she wrote and began to control the lights. The lights performed an SOS pattern. A cylon pattern. Then some lights turned on when other lights turned off. She asked me how quickly I could do all that. I did not have much to say. Human fingers typing CLI could not compete with the speed and efficiency of a Python algorithm.
That’s when I asked to see the code, all 15 lines of it. And here’s the thing. Even networking people like me can read Python. That’s when I started to have an emotional reaction. Suddenly I saw programmability for what it was – a new way to drive to interact with the same things that I’d worked with my whole career.
I hacked away a while, put a few virtual routers on my machine and learned about this thing called “git” and Voila! I was “programming” again. But I’m directly programming those things I know very well: routers and switches. Sure, I’m a novice again but it feels great. I can see the things that I code translate into other tasks. I am starting to make the routers in my virtual network do all kinds of things.
As I type this, I am at Cisco Live Milan. I am not scheduling meetings. I am not replying to e-mail. I am not creating a presentation. I am not on Tweeting. I am programming .. ROUTERS!
So stop by the Cisco ONE Platform area (under the red banners) in the World of Solutions. What can you make the lights do? More importantly, if you are a Networking person, do you react to this the same way I did?