cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
25118
Views
13
Helpful
22
Comments
Vijay Balyan
Cisco Employee
Cisco Employee

Installation:

  •      Using pip:

     pip install ucsmsdk

 

  •      Using Github:

     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.8 (2019-01-22)

  • Support for UCSM release 4.0(2a)

 

Features 0.9.6 (2018-12-11)

  • Support for UCSM release 4.0(1b)

 

Features 0.9.5 (2018-10-10)

  • Updated requirements to include setuptools

 

Features 0.9.4 (2018-08-13)

  • Fixes for Python 3 compatibility

 

Features 0.9.3.2 (2018-04-25)

  • Support for UCSM release 3.2(3a)
  • Support for accepting array arguments in query_classids, query_dns
  • Support for setting response timeout for the UCSM operations (query/config)
  • Handling auto_refresh flag in unfreeze
  • Fixing issue with None value check of property by removing None check from validation of property/check_prop_match
  • Fixing issue where error happens with commit when threading is enabled and commit buffer is empty
  • Fixing issue where ssl with "Only TLS 1.2" does not work

 

 

 

Features 0.9.3.1 (2017-01-25)

  • Removed jsonpickle dependency

 

Features v0.9.3.0:

  • Support for estimating impact of a transaction - handle.estimate_impact
  • Support for TLS 1.1, 1.2 Newer UCSM releases support TLS1.2. HTTPS connection to the servers with newer releases might fail in absence of TLS1.1/1.2 support.
  • Added command line script to make running convert_to_ucs_python easier. bin/watch_ucs.py in the github repo.
  • Special characters like <,>,& in XML values are deemed invalid and cause failure in parsing XML. Added a recovery logic if these exist in the XML value fields.
  • Support for serialization, deserialization of UcsHandle
  • Support for UCSM inventory via get_inventory API

 

Features v0.9.2.0:

  • Support for UCSM 3.1(2b)
  • Adds Support for Generating python APIs from a Ucs backup xml -
    convert_from_backup
  • Adds Infra to facilitate and notify users of API deprecation
  • Allows the ucsmsdk/apis layer APIs to pass in None values to indicate that no
    change is requested to those specific params
  • Adds a method to check if the handle.cookie is still valid
  • Fix in eventhandlers, where some events were not getting processed
  • Fix in eventhandlers, where timeout was not getting triggered until new
    events
  • Fix in get_ucs_tech_support, where techsupport for rack server was failing
  • Fix in logout, where a Ctrl+C was causing stale connections on the server
  • Deprecated get_ucs_tech_support in favour of get_tech_support. The newer
    API simplifies the API

 

Features v0.9.1.1:

  • Support for UCSM 2.2.7
  • Simplified event handlers to a single wait_for_event method. UcsEventHandler internals are hidden from user.
  • Support for showing progress for upload/download operations
  • Support for multi-threading in SDK. An application can run multiple threads that can use SDK methods in parallel.
  • Support for multiple parallel transactions via the tag parameter in add_mo, set_mo, remove_mo, commit_mo
  • Fix for convert_to_ucs_python exception in some scenarios
  • Fix for convert_to_ucs_python not displaying python script for Java6u45
  • Fix for event handlers not trigerring for some events
  • Added more unit and system tests
  • Better Documentation

 

Features v0.9.1.0:

  • Support for UCSM 3.1.1
  • Support for Python 3.x
  • Support for Comparing and Syncing Objects across Ucs Domains - compare_ucs_mo sync_ucs_mo
  • Support for filter_str in query_children method
  • Support to drill down into Managed Object Meta and Property Meta details - get_meta_info
  • Support to monitor any/all change(s) in a ManagedObject with UcsEventHandler
  • Fix for Unable to make unsecured connection when redirection was enabled on the server
  • Fix for issues with the usage of force parameter in Login method
  • Fix for not filter not generating filter request
  • Fix for TechSupport not getting removed from server even when remove_from_ucs=True
  • Fix for convert_to_ucs_python not redirecting output to a file
  • Fix for convert_to_ucs_python not working correctly when gui_log=True
  • More PEP8 compliance related fixes

 

Features v0.9.0.0:

  • Python SDK for UCS server management and related automation
  • Supports every Managed Object exposed by Cisco UCSM
  • APIs for CRUD operations simplified for usability
  • convert_to_ucs_python - API to generate Python script based on operations done on the UCSM UI
  • Support for server side filters made simpler
  • Support for eventhandlers
  • Parameter validation on the client-end
  • Runtime memory usage is reduced
  • logging support
  • Nosetests for unit testing
  • Samples directory for more real world use cases
  • Integrating the sphinx framework for documentation
  • PEP8 Compliance

 

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.

Comments
aranatar
Cisco Employee
Cisco Employee

Rahul,

Thanks for the reply. I tried exporting "export PYTHONHTTPSVERIFY=0" and ran the auto discovery. that was able to do the job.

~Aravind

parterda
Level 1
Level 1

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

parterda
Level 1
Level 1

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.

ashish-pimple
Community Member

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

ben.crook
Level 1
Level 1

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 .

kfudge1980
Level 1
Level 1
Is the SDK going to be updated with any kind of HTML GUI launch and python conversion function?
halperin amit
Level 1
Level 1

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...

Getting Started

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:

Quick Links