Search This Blog

Sunday, April 14, 2013

Cisco Nexus NX-OS operating systems has a build in Python shell

The world is changing and Cisco doesn't want to stay behind. In its new NX-OS os that is targeting data centre and service provider customer they build in a python shell: Python API

More info about the Cisco Nexus can be found here:
http://www.cisco.com/en/US/products/ps9494/Products_Sub_Category_Home.html

Example:
 
switch# show clock                                           
23:54:55.872 UTC Wed May 16 2012

switch# python                          !-- Enter Python interpreter
switch# >>> cli("conf term ; interface loopback 1")          
switch(config-if)# >>> cli("ip address 1.1.1.1/24")          
switch(config-if)# >>> cli("exit")      !-- Exit the CLI interface mode
switch(config)# >>> cli("exit")                              
switch# >>> i=0                                              
switch# >>> while i<8:                                       
switch# ...   i=i+1                     !-- Composite command; prompt indicates more input
switch# ...   cmd = "show module %i" % i                     
switch# ...   r=clid(cmd)                                    
switch# ...   if "TABLE_modinfo/model" in r.keys():          
switch# ...     if r["TABLE_modinfo/model"] == "Nurburgring":
switch# ...       print "got a racer in slot %d" % i         
switch# ...                             !-- Empty input indicates end of loop
got a racer in slot 3                                        
switch# >>> exit                        ! -- Exit Python interpreter          
switch#

No comments:

Post a Comment