Jump to content


1

Getting started with Cisco onePK


3 replies to this topic

#1 ccie4lab

ccie4lab

    Advanced Member

  • Members
  • PipPipPip
  • 57 posts
  • 14412 thanks

Posted 08 May 2014 - 11:54 AM

Following on from the previous post on Software-Defined Networks (SDN), we are going to have a quick look at Cisco's onePK.
onePK and the Software Defined Network

onePK stands for One Platform Kit, its what gets us started with programming for the Cisco Open Network Environment. It is basically a set of APIs for programming your network devices (IOS, IOS-XE, IOS-XR and NX-OS) in C (well C64 to be more exact), Java and Python.

From Cisco's website (you'll need a CCO login for this) you can download the onePK all-in-one image for Ubuntu, which can run very nicely in VirtualBox. It is a 2.61Gb image that contains everything you'll need to get started, including 3 IOSv routers and the Eclipse IDE.

I downloaded the all-in-one VM and fired it up, but learned that before you do this you need to make sure that the second adapter is set to a host-only adapter. If you get an error that one cannot be found then go to preferences (of VirtualBox - not of the VM), select Network, click on Host-only Networks, and click add to create one:

Posted Image



The VM settings should look a bit like this now, the first adapter is set to bridged (so that I have ssh access to the VM):



Posted Image


Once it's installed into VirtualBox login in as "cisco" with a password of "cisco123" and change the password when prompted. Set the Network Simulator Credentials (I used 802101 for both), which is the username and password needed to communicate with the virtual routers.



Posted Image


Double click on Start 3node - if you get an error here then its probably due to lack of a host-only network - so make sure it's there and connected.



Posted Image


Once it's done you get a confirmation:



Posted Image


After you have clicked OK to the above message your routers start up:



Posted Image


After a short time we are launched into IOSv (VIOS-ADVENTERPRISEK9-M) Version 15.4(1.24)T0.9.



Posted Image


At this point it should be pointed out that the onePK vm gets a little funny about switching back and forth in order to take screenshots. I stopped the VM, added a DVD drive and installed the Guest Additions. Once done I needed to use the Stop 3node icon and then use Start 3node to get my routers back again.

With the Guest Additions making life much easier we can have a quick look at the config of our router, nothing hugely out of the ordinary here, we have a bunch of interfaces:



Posted Image


The only real thing of note is the onep settings:



Posted Image


Enabling a supported device for onep is as simple as entering "onep" at the configuration prompt, then from the sub-prompt enabling the tls transport:

router(config)#onep
router(config-onep)#transport tls

Let's try and actually do something now though.

From the desktop doubleclick on the CreateCA icon. This generates the certificate needed for communication between the nodes and the controller. At the moment I am following the instructions from the Cisco website, which follow the rule that any introduction to anything even vaguely programming orientated starts with a "Hello" example, so from the Terminal prompt on the desktop change directory (cd) to /home/cisco/onePK-sdk-1.2.0.173/c/sample-apps/HelloNetwork and run the "make" command. Once thats run through run the following:

[email protected]:~/onePK-sdk-1.2.0.173/c/sample-apps/HelloNetwork$ ./bin/HelloNetwork -a router1.3node.example.com -R ~/ca.pem
Enter username: 802101
Enter password:
Connecting with onep transport type TLS.

Router1 says: Hello Network!

[email protected]:~/onePK-sdk-1.2.0.173/c/sample-apps/HelloNetwork$

I can tell you are impressed!

To prove that the application is actually doing something we can see the router's log for the connection:



Posted Image


We can change the routers name:



Posted Image


And we can run the command again and see the reflected change:

[email protected]:~/onePK-sdk-1.2.0.173/c/sample-apps/HelloNetwork$ ./bin/HelloNetwork -a router1.3node.example.com -R ~/ca.pem
Enter username: 802101
Enter password:
Connecting with onep transport type TLS.

MyFirstRouter says: Hello Network!

[email protected]:~/onePK-sdk-1.2.0.173/c/sample-apps/HelloNetwork$

I havn't touched C programming since my university days, but onePK also supports Java and Python, so it should suit most developers in one language or another. Running a python script follows the same syntax, here is one that will get the contents of the RIB:

[email protected]:~/onePK-sdk-1.2.0.173/python/tutorials/routing$ ./RIBTutorial.py -a router1.3node.example.com -R ~/ca.pem
INFO:onep:RIBTutorial:Reading arguments...
Enter Username : 802101
Enter Password :
INFO:onep:RIBTutorial:Connecting to Network Element...
INFO:onep:BaseTutorial:We have a NetworkElement :
NetworkElement [ router1.3node.example.com ]

INFO:onep:BaseTutorial:Successful connection to NetworkElement -
INFO:onep:RIBTutorial:Done
INFO:onep:RIBTutorial:Getting a Routing Instance...
INFO:onep:RIBTutorial:Getting a RIB...
INFO:onep:RIBTutorial:adding RIB listener...
INFO:onep:RIBTutorial:1001
INFO:onep:RIBTutorial:Routes are :
INFO:onep:RIBTutorial:L3UnicastRoute[address:10.10.10.0/24,ownerType:CONNECTED,ownerTag:,adminDistance:0,metric:0,errorCode:0]
INFO:onep:RIBTutorial:L3UnicastRoute[address:10.10.10.110/32,ownerType:LOCAL,ownerTag:,adminDistance:0,metric:0,errorCode:0]
INFO:onep:RIBTutorial:L3UnicastRoute[address:10.10.20.0/24,ownerType:CONNECTED,ownerTag:,adminDistance:0,metric:0,errorCode:0]
INFO:onep:RIBTutorial:L3UnicastRoute[address:10.10.20.110/32,ownerType:LOCAL,ownerTag:,adminDistance:0,metric:0,errorCode:0]
INFO:onep:RIBTutorial:L3UnicastRoute[address:10.10.30.0/24,ownerType:CONNECTED,ownerTag:,adminDistance:0,metric:0,errorCode:0]
INFO:onep:RIBTutorial:L3UnicastRoute[address:10.10.30.110/32,ownerType:LOCAL,ownerTag:,adminDistance:0,metric:0,errorCode:0]
INFO:onep:RIBTutorial:L3UnicastRoute[address:192.168.56.0/24,ownerType:CONNECTED,ownerTag:,adminDistance:0,metric:0,errorCode:0]
INFO:onep:RIBTutorial:L3UnicastRoute[address:192.168.56.111/32,ownerType:LOCAL,ownerTag:,adminDistance:0,metric:0,errorCode:0]
[email protected]:~/onePK-sdk-1.2.0.173/python/tutorials/routing$

Anything that can be done on the router can be done through a script, which is great when making changes to multiple routers. Yes I know you can use cut and paste, but somethings require a certain level of out-of-band management, and onePK is just the ticket.

This has only been a really simple walk through, hopefully when I get some time I'll put together something on how to create a script with the onePK API, for now I encourage you to have a look to get a feel for the possibilities that this opens up.

Thanked by 12 Members:
armenoidxp , fkoc , engi888 , ciscostew , duke806 , m3g9tr0n , tazzmancd , brian6 , p3yman , Rapici , RickCCIE , votive

#2 Vedder2k

Vedder2k

    Member

  • Members
  • PipPip
  • 24 posts
  • 35 thanks

Posted 09 May 2014 - 07:33 PM

Hi ccie4lab, thanks for reposting my blog entries - but please if you are going to do this then just put at the beginning that this post was originally from www.802101.com ?

Thanks

Stuart

Edited by Vedder2k, 09 May 2014 - 07:37 PM.


#3 bluephoenix71

bluephoenix71

    Advanced Member

  • Members
  • PipPipPip
  • 62 posts
  • 1237 thanks

Posted 27 March 2016 - 09:37 PM

Hi, it seems the onepk ova is not anymore available on the site.  Can you upload the ova image in torrent?

#4 lenia

lenia

    Member

  • Members
  • PipPip
  • 10 posts
  • 8 thanks

Posted 02 April 2016 - 10:26 AM

What is cisco one?




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

Organization

Community

Downloads

Test Providers

Site Info


Go to top