01-30-2014 04:52 PM - edited 03-07-2019 05:55 PM
Hi,
May I ask where I can download the Cisco python libraries and API's required to run scripts on an external server rather than on the Nexus 7K itself?
Regards,
Aleks
01-31-2014 02:17 AM
01-31-2014 03:50 AM
Hi,
Thanks I have checked previously however cannot find the actual cisco.py module(s), I can only find third party extensions built for ssh/cisco cli commands...
Does this mean I need to download the OnePK suite to access the proper cisco modules to import?
Regards,
Aleks
01-31-2014 04:10 AM
Aleks
See what you mean now.
Haven't come across OnePK so can't say for sure whether it will be in there unless you know different.
So as i understand it the module you are after is built into NX-OS.
Just for my reference would you get the same functionality if you ran it on a server within your own scripts ie.do you lose any functionality by not running it direct on the actual device.
Sorry i can't be more help.
Jon
01-31-2014 04:28 AM
I have no experience with Nexus outside of managing it once for a friend of mine when he ran into an issue, so I don't claim to be an expert in the OS That being said, Jon is correct that it seems like you have that functionality in the OS already, but if you're wanting to run scripts from a server, have you looked at the telnetlib and sshlib for python? You can still configure commands using these modules as if you were sitting at the terminal.
HTH,
John
*** Please rate all useful posts ***
01-31-2014 05:18 AM
Thanks for the replies, what I am trying to do is somewhat different. Python scripts can be run from the switch directly, however the other option is to compile the scripts from a central location and using API's run them on the nexus7k's remotely as it would not be practical to run seperate scripts on say 20+ 7000 switches all the time.
So the actual script still runs on the switch however complied remotely, from what i found this needs to be done via Cisco OnePK which has the relevant API's and python libraries which can be imported into python eg; import cisco.py (within the code)...
I attended a Cisco python scripting for Nexus7k recently and this was demonstrated however I assumed locating the relevant modules would be easy so did not bother to ask anyway the Cisco devnet looks to be unaccessable at the moment so will wait until Monday to have a go.
Also the sshlib and telnetlib are good however just run commands remotely, with the built in modules we can create trigger events for thresholds such as "run sh ip route | inc 00:00" when the cpu spikes due to BGP / ARP which will give us the routes that are flapping at that point in time without anyone needing to monitor the switch manually for this.
Thanks again, I will update this post when I get it working.
01-31-2014 05:35 AM
Aleks
So the actual script still runs on the switch however complied remotely, from what i found this needs to be done via Cisco OnePK which has the relevant API's and python libraries which can be imported into python eg; import cisco.py (within the code)..
.
thanks for clarifying that. I was thinking that if you ran them remotely on a server you would actually lose access to some of the APIs built into NX-OS but from the sounds of it you don't.
Jon
01-31-2014 05:53 AM
Is this it?
Onepk
https://developer.cisco.com/web/onePK
Sent from Cisco Technical Support iPhone App
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide