Jason Edelman's Blog
  • Home
  • About
  • Contact

Application Routes with onePK and the Need for Better Libraries

10/16/2014

3 Comments

 
It’s been some time since I wrote about Cisco’s onePK.  In this post, I’ll look at some of the good and the bad of onePK and also show an example of how to add a route to a device running onePK to help make a few points along the way.
The Bad

I’ve never heard anyone speak positively about onePK and I’m not sure I 100% agree, but I’ll save the positivity for the next section.  onePK is a thick Software Development Kit (SDK).  If you are a network engineer looking to learn to program from the ground up, it may NOT be the BEST place to start.  That said, if you are looking to learn about object oriented programming, listener APIs, etc., and can spare some time, it’s a great place to start.  If you’re already a developer, it probably won’t be much different compared to learning any other SDK.

Another thing to be weary of is that onePK was not intended to be a configuration API.  I voiced my opinion on this already and I do think things are headed in the right direction, but it always helps knowing the history.  Initially, it was about dynamic configurations.  This means that if the onePK app disconnected from a device, all configs that the app provisioned would be de-commissioned.  Not cool.

Lastly, if you are going to use onePK don’t forget to cross check SDK support with platform support.  There is not 100% uniformity, but hey, you may not need it anyway given what you are trying to accomplish.

Adding a Route the onePK Way

You can easily see the complexity here.  Look at all of the modules required for what “should” be a simple task.
Picture
The following picture shows the process to create and send the route to a device.  The screen shot shows it in a function that I created to simplify the process and you’ll see that more in the next section, but you get the idea.  15 commands to add a route seems like it’s a few too many.  What do you think?
Picture
The Good

Cisco DevNet offers an all-in-one onePK virtual machine.  You can download a virtual machine that has a 3 node virtual router topology that has Java/C/Python onePK libraries pre-installed.  Each router, of course, supports onePK.  The VM also has all of the onePK documentation bookmarked in a FireFox browser.  This is real.  It exists today.  It is one of the best learning VMs I’ve seen for network programming.  So, to those who want to wait for VIRL to start programming, keep waiting.  I do think it’s the better option, but at the end of the day, if you are just looking to understand the basics of working with an API, it does not matter and this is a real solid choice.  For this reason, I think onePK is just fine.  While challenging, you’ll learn quite a bit and then be able to recognize when you work with more consumable APIs like Cisco NX-API or Arista eAPI.

Adding a route my way

After abstracting out the creation and deployment of a route into its own function, all you need to do is create a single variable (Python dictionary) and store the data about the route you want to add.  Then call the addRoute() function by sending it two arguments: (1) the device object which should be of type NetworkElement and (2) the route in the form of a Python dictionary.

Picture
This isn’t showing the details of the Device module, but that’s something I also created to simplify setting up devices in onePK.

Consumable Libraries

As you can see, we need more “widgets” like addRoute() and Device().  These are just two quick examples, but if consumable libraries were out there, it would increase the rate of adoption and learning.  The best example of a comprehensive consumable library is from Juniper.  The Juniper PyEZ library abstracts away having to know anything about the Juniper underlying Netconf/XML interface. 

There is no reason libraries can’t be created to ease consumption of the “off the shelf” APIs and libraries from every vendor.  In the meantime, we can all keep creating small modules (“widgets”) like this to make our lives easier. 

FYI to the vendors: This is not just a onePK thing.  We need more consumable libraries all around.  As new vendors emerge and incumbents come out with APIs, please think through who your target audience is and how you will help them consume your API.

Thanks,
Jason

Twitter: @jedelman8


3 Comments
Uros
10/16/2014 08:45:37 pm

Hello

First of all, I love to read you blog, always full of valuable information.

Since I am also doing on some small scripts, widgets etc... for configuring network devices, I have a question. Do you have any inside information if onePK will eventually become configuration API? I believe this would make API much more usable.

BR

Reply
Jason Edelman link
10/21/2014 01:12:04 pm

No inside information here, but it seems like some configs are persistent. At the very least you can always configure using the VTY service set (with CLI commands) to use it as a config API.

Reply
Solomon Yang
11/7/2014 11:37:05 am

I think Cisco has cut the whole onePK team. So you probably will not see any update from them.

Reply



Leave a Reply.

    Author

    Jason Edelman, Founder & CTO of Network to Code. 


    Enter your email address:

    Delivered by FeedBurner


    RSS Feed


    Categories

    All
    1cloudroad
    2011
    2960
    40gbe
    7000
    Arista
    Aruba
    Big Switch
    Brocade
    Capwap
    Christmas
    Cisco
    Controller
    Data Center
    Dell Force10
    Embrane
    Extreme
    Fex
    Hadoop
    Hp
    Ibm
    Isr G2
    Juniper
    Limited Lifetime Warranty
    Meraki
    Multicast
    N7k
    Nexus
    Nicira
    Ons
    Opendaylight
    Openflow
    Openstack
    Presidio
    Qsfp
    Quick Facts
    Routeflow
    Sdn
    Sdn Ecosystem
    Security
    Ucs


    Archives

    May 2015
    April 2015
    February 2015
    January 2015
    December 2014
    November 2014
    October 2014
    September 2014
    August 2014
    June 2014
    May 2014
    March 2014
    February 2014
    January 2014
    December 2013
    November 2013
    October 2013
    September 2013
    August 2013
    July 2013
    June 2013
    May 2013
    April 2013
    March 2013
    February 2013
    January 2013
    December 2012
    November 2012
    October 2012
    June 2012
    May 2012
    April 2012
    March 2012
    February 2012
    January 2012
    December 2011
    November 2011


    View my profile on LinkedIn
Photo used under Creative Commons from NASA Goddard Photo and Video