a developing networker

Python and onePK Offer the Power of SDN Today

13 Nov 2014 » Coding, Networking
This entry is part 1 of 5 in the series Getting started with Cisco OnePK

Cisco announced their entry into the Software Defined Networking (SDN) arena with OnePK in early 2013. If you haven’t heard of Cisco’s OnePK yet, please read their introductions before continuing (only because they do a better job of explaining it than I do):

It took Cisco a while to deliver something tangible after the initial announcement, but it was certainly worth the wait. Cisco has a large amount of resources for onePK that range from videos, tutorials, code examples, SDKs in 3 languages (Java, C, python), and full API docs. I’ve been digging through these resources and there is plenty of good info to get people started with SDN.

I have obviously taken interest in their python SDK to see what sort of things I can automate and plan to write a series of posts as I learn. There’s a lot of potential as to what can be done with OnePK, so I will just be touching on the tip of the iceberg I’m sure. Just thinking off the top of my head, I’m imaging starting off with some scripts/apps with the following functionality:

  • Polling basic router/switch status information about interfaces, routes, CPU, memory, etc.
  • Interface statistics reports with QoS policy rules.
  • Web app that offers basic interface and ACL management for basic provisioning.
  • Monitoring tool that uses OnePK event listeners with configured actions, such as changing routes or creating alerts.

Just while I was thinking of these few ideas I quickly realized that so much more can be done. I’m happy starting with these basic ideas and I’m sure apps will get more complex as I get more familiar with OnePK and python alike. As I write scripts I will be making new posts to explain them and also keeping them in one handy GitHub repo here. As I start to create bigger apps (like the web app provisioning tool) I will probably create stand-alone repos just for those, so keep an eye out for that.

Getting Started

Here are the steps to get started developing with python and OnePK

Documentation Woes

I’d like to give you a warning that Cisco’s main onep API docs can be a pain to sift through. I don’t think the python SDK was written by someone who works with python everyday (but I could be way off-base and if so, I apologize). There are complex classes and enumerations used where much simpler methods could be used. You’ll see in examples later how many objects have to be created just to get an interface list or RIB information. I usually start off finding what I want with the examples included in the SDK and then make use of python’s dir() and help() functions to figure out what is going on with each returned object.

If you’re interested in harnessing the power of python to control your network elements, please follow my blog and learn with me as I dive into the world of SDN and Cisco’s OnePK.