on
12-21-2015
08:06 PM
- edited on
02-28-2019
12:37 AM
by
tamathur
Installation:
pip install ucsmsdk
Install pip (skip if pip is already available):
wget https://bootstrap.pypa.io/get-pip.py
python get-pip.py
git clone https://github.com/CiscoUcs/ucsmsdk.git
cd ucsmsdk
make install
Uninstall:
pip uninstall ucsmsdk
Documentation:
https://CiscoUcs.github.io/ucsmsdk_docs/
Samples:
GitHub - CiscoUcs/ucsmsdk_samples
Features 0.9.3.1 (2017-01-25)
Features v0.9.3.0:
handle.estimate_impact
convert_to_ucs_python
easier. bin/watch_ucs.py in the github repo.get_inventory
API
Features v0.9.2.0:
convert_from_backup
get_ucs_tech_support
in favour of get_tech_support
. The newer
Features v0.9.1.1:
wait_for_event
method. UcsEventHandler
internals are hidden from user.tag
parameter in add_mo
, set_mo
, remove_mo
, commit_mo
convert_to_ucs_python
exception in some scenariosconvert_to_ucs_python
not displaying python script for Java6u45
Features v0.9.1.0:
compare_ucs_mo
sync_ucs_mo
filter_str
in query_children
methodget_meta_info
UcsEventHandler
Login
methodnot
filter not generating filter requestremove_from_ucs=True
gui_log=True
Features v0.9.0.0:
Github:
https://github.com/CiscoUcs/ucsmsdk/
PyPi:
https://pypi.python.org/pypi/ucsmsdk/0.9.1.1
A slide-deck in markdown describing some of the changes:
stash/slides.md at master · CiscoUcs/stash · GitHub
Community:
We are also on Slack - slack requires registration, but the ucspython team is open invitation to anyone to register here
Quick reference for PythonSDK commands is available for download.Please find it attached below as
LE-45204-PythonSDKPoster.pdf
Note:
0.9.1.0 is not backward compatible with any of the earlier SDKs. It is re-written to be more pythonic and moves away from the earlier JAVA like syntax.
Rahul,
Thanks for the reply. I tried exporting "export PYTHONHTTPSVERIFY=0" and ran the auto discovery. that was able to do the job.
~Aravind
Most of the time handle.login() is hanging forever.
I am creating handle as below
handle = UcsHandle("IP/host", "username", "pwd")
handle.login()
Some time i see this first time or while firmware activation. On server reboot boot UcsHandle is not able to establish the connection.
i tried with force=True option too.
Thank you in advance..
Parisa
Root cause for this issue.
in ucssession.py
self._tx_lock_acquire_conditional(elem)
if self._is_stale_cookie(elem):
elem.attrib['cookie'] = self.cookie
self.dump_xml_request(elem)
xml_str = xc.to_xml_str(elem)
response_str = self.post_xml(xml_str)
self.dump_xml_response(response_str)
self._tx_lock_acquire_conditional(elem) is not released in case of exception at response_str = self.post_xml(xml_str)
And when login attempt is made during server is rebooting we get an exception and this lock will not be released unless we restart the program.
self._tx_lock_release_conditional(elem) needs to be added in except block.
Hi
I am getting AttributeError , will you help me.
[root@ansible ucsmsdk]# java -version
openjdk version "1.8.0_102"
OpenJDK Runtime Environment (build 1.8.0_102-b14)
OpenJDK 64-Bit Server VM (build 25.102-b14, mixed mode)
[root@ansible ucsmsdk]# python
Python 2.7.5 (default, Aug 2 2016, 04:20:16)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from ucsmsdk.utils.ucsguilaunch import ucs_gui_launch
>>> from ucsmsdk.ucshandle import UcsHandle
>>> handle = UcsHandle("192.168.224.148", "ucspe", "ucspe")
>>> handle.login()
True
>>> ucs_gui_launch(handle)
2017-05-26 07:24:11,925 - ucs - DEBUG - AuthToken: <17591998066782747766531>
2017-05-26 07:24:11,925 - ucs - DEBUG - UCSM URL: <https://192.168.224.148:443/ucsm/ucsm.jnlp?ucsmToken=17591998066782747766531>
2017-05-26 07:24:11,926 - ucs - DEBUG - javaws path: </bin/javaws>
2017-05-26 07:24:12,006 - ucs - DEBUG - Temp Directory: </tmp>
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "ucsmsdk/utils/ucsguilaunch.py", line 119, in ucs_gui_launch
raise e
AttributeError: 'NoneType' object has no attribute 'groups'
>>>
[3]+ Stopped python
[root@ansible ucsmsdk]# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 7.3 (Maipo)
Ashish
While debugging more I have observed that ucsguilaunch.py is not able to create a file in tmp named temp.jnlp.
So I download ucsm.jnlp manually at /tmp and renamed it as temp.jnlp. But when I execute ucs_gui_launch again, it is deleting manually created file temp.jnlp.
Commenting below line in ucsguilaunch.py is not helping as well.
79 if os.path.exists(jnlp_file):
80 os.remove(jnlp_file)
So it looks like it is not able to recreate temp.jnlp again. Am I missing anything.
Ashish
i have an issue. i have a multi-threaded program for python it collects multiple component info not just cisco on multiple threads.. so i kick off some code (a thread for cisco stuff) to get ucsm logs and chassis logs from a ucs system... so each get_tech_support call for logs (ucsm and chassis logs) are each their own thread as well, even for multiple chassis each chassis would be on a thread, getting all logs at the same time. i do delay starting of the threads each by 20 secs just in case.. so i have several labs that this works perfect on but those labs only have 2 chassis in them nothing more.
now when i run this on a customer's system that has like say 8 chassis! there seems to be issues, the exception msg that comes back is "TechSupport creation timed out" ... now it has happened on 2 different customer sites where they had 8 chassis. it would always get (from what i could tell) ucsm logs and chassis 1 logs, but would fail on either getting chassis 2 through 8 or 3 through 8.
again it's multi-threaded so i'm getting the ucsm logs and all the chassis logs at the same time from the same UCS system. i NEVER have issues on a 2 chassis only ucs system.
if this is known issue or limitation?? i can provide my code if needed
**************************************
UPDATE
turns out the limitation is within ucs, you can't even get multiple chassis at the same time via the ucsm gui .
Hello, i want to create on my cisco servers raid 1 with automation, i tried to do that with redfish api but It doesn't allow me to do that.
What can i do? what tool i can use to do it(create physical raid with the raid controller), i think the "cisco ucs python sdk" can't help me...
Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: