Dev-ops are cool ! So you wanne be cool. Learn the following nice features with Open NX-OS for the Nexus 9000:
What can you do when you login with a dev-ops role on a Nexus 9000:
N9K-OpenNXOS# sh role name dev-ops
Role: dev-ops
Description: Predefined system role for devops access. This role
cannot be modified.
——————————————————————-
Rule Perm Type Scope Entity
——————————————————————-
6 permit command conf t ; username *
5 permit command attach module *
4 permit command slot *
3 permit command bcm module *
2 permit command run bash *
1 permit command python *
Lets enable the bash-shell and nxapi feature :
N9K-OpenNXOS# conf t
Enter configuration commands, one per line. End with CNTL/Z.
N9K-OpenNXOS(config)# feature bash-shell
N9K-OpenNXOS(config)# feature nxapi
First we’re gonne explore the bash environment :
N9K-OpenNXOS# run ?
bash Linux-bash
guestshell The guest shell Linux-bash
N9K-OpenNXOS# run bash
Now we’re in the bash shell and we can do all kind of things. Here are just a few simple examples:
bash-4.2$ whoami
admin
bash-4.2$ pwd
/bootflash/home/admin
bash-4.2$ cat /proc/version
Linux version 3.4.10 (ssiddha@ins-sw-bld39) (gcc version 4.6.3 (Wind River Linux Sourcery CodeBench 4.6-60) ) #1 SMP Fri Apr 24 16:48:05 PDT 2015
But you can do more. Let’s go program something with python :
N9K-OpenNXOS# python
Python 2.7.5 (default, Oct 8 2013, 23:59:43)
[GCC 4.6.3] on linux2
Type “help”, “copyright”, “credits” or “license” for more information.
>>> print “Hello World!”
Hello World!
>>>
When you save your pythonscript at bootflash:scripts/ of the Nexus, you can run them with the source command. Ofcourse you can start always the pythonscripts with python <filename.py>
Pretty cool stuff huh… But we’re not finished !
There is a sandbox on the Nexus. Just go to http://<ip address>
You can type the command you would like. At the left bottom box you’ll see the format of JSON/XML to post to the Nexus and on the right box you see the outcome.
You don’t know how to program this in python ? Just click the button python :
More to come… When I finish my python course. 😉
More info at the OpenNXOS page of cisco : https://opennxos.cisco.com/
devops online training
Thanks for sharing this- good stuff! Keep up the great work, we look forward to reading more from you in the future!