cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Announcements
configure & troubleshoot anyconnect

** Deprecated - Cisco UCS Python SDK - Deprecated**

31993
Views
20
Helpful
46
Comments

This version of the UCS Manager Python SDK has been deprecated please use the UCS Manager Python SDK  located here, Cisco UCS Python SDK - ucsmsdk


The following Python SDKs are available for download from Cisco:

Cisco UCS Manager Python SDK v0.8.3:

Downloads:

Documentation Links:

----------------------------------------------------------------------------------------------------

Cisco IMC Python SDK v0.7.2:

Downloads:



Cisco IMC Python SDK v0.7.1:

Downloads:

Documentation Links:

Note: Due to the changes in the naming convention of the APIs in the SDK release 0.7.1, scripts written using SDK release 0.6.x need to be modified to make it work with SDK release 0.7.1. Also this version is not compatible with IMC Plugin 0.9.1 for Nagios.



Cisco IMC Python SDK v0.6.2:

Downloads:

Documentation Links:

For any queries/feedback on the Python SDK, please add a discussion to the Cisco Developed Integrations sub-space on Cisco UCS Communities.


Internal (Cisco) developers/users can contact the team at ucs-python@cisco.com

Comments
Cisco Employee

Jesper,

Incase of java version > 1.7.45, you have to add below line in jnlp file before launching the UCSM.

<property name="jnlp.ucsm.log.show.encrypted" value="true"/>.

Previously for java version <= 1.7.45 we used to add below line.

<property name="log.show.encrypted" value="true"/>

These entry in jnlp file used to populate the UCSM logfile with desired logs which later we use to generate python scripts using ConvertToPython utility.

Hope this will help.

Thanks

Enthusiast

Rahul

- Thanks, this sounds the correct solution, which I will test

BR

Jesper

Fra: Rahul Gupta

Sendt: 28. august 2014 08:00

Til: Jesper Munk

Emne: Re: - Cisco UCS Python SDK

Cisco Communities <https://communities.cisco.com/>

Cisco UCS Python SDK

new comment by Rahul Gupta<https://communities.cisco.com/people/ragupta4>

View all comments on this document<https://communities.cisco.com/docs/DOC-37174#comment-16400>

Beginner

Can any kind person help with the Cisco UCS Python SDK install

Server is Redhat 5.8

Python 2.4.3

On doing the following I get error's , which I assume are not correct

python setup.py  build

/usr/lib64/python2.4/distutils/dist.py:236: UserWarning: Unknown distribution option: 'zip_safe'

  warnings.warn(msg)

/usr/lib64/python2.4/distutils/dist.py:236: UserWarning: Unknown distribution option: 'include_package_data'

  warnings.warn(msg)

/usr/lib64/python2.4/distutils/dist.py:236: UserWarning: Unknown distribution option: 'namespace_packages'

  warnings.warn(msg)

running build

running build_py

=========================

python setup.py install

/usr/lib64/python2.4/distutils/dist.py:236: UserWarning: Unknown distribution option: 'zip_safe'

  warnings.warn(msg)

/usr/lib64/python2.4/distutils/dist.py:236: UserWarning: Unknown distribution option: 'include_package_data'

  warnings.warn(msg)

/usr/lib64/python2.4/distutils/dist.py:236: UserWarning: Unknown distribution option: 'namespace_packages'

  warnings.warn(msg)

running install

running build

running build_py

running install_lib

Cisco Employee

Earlier to python version 2.6 we used to install using distutils and these warnings are specific to distutils.

However these warning wont have any impact on installation of package UcsSdk and using its functionality.

You can also suppress these warnings as below:

python -W ignore::UserWarning:distutils.dist setup.py <any-other-args>


Thanks

Rahul

Cisco Employee

Hi Drew,

Can you please tell which operating system or platform you are working on?

Also where in your system UCSM logs are generated.

As per our understanding UCSM logs created at “Darwin” platform are stored at ,

$HOME/Library/Caches/Java/log/.ucsm.

Do let us know if the logs are created at different location in your system?

If yes, where ?

Thanks & Regards

Rahul Gupta

Beginner

You have a bug in the fullstate backup in the UcsHandle module (lines 1118 - 1121)

        if type=="fullstate" and not pathPattern.endswith('.tar.gz'):

            raise UcsValidationException('pathPattern should end with .tar.gz')

        elif not pathPattern.endswith('.xml'):

            raise UcsValidationException('pathPattern should end with .xml')

       

Basically I think you need to revise the elif line to be

elif not type=="fullstate" and not pathPattern.endswith('.xml'):

Cisco Employee

Thanks Kyle for pointing it out. We will fix it in the next release.

Cisco Employee

Thanks for the feedback. We will fix the bug in next release.

Meanwhile the correction to the code will be:

backup_types = ["config-all", "config-logical", "config-system", "full-state"]

if type not in backup_types:

                raise UcsValidationException('Valid type values are %s' %(', '.join(backup_types)))

if type=="full-state" and not pathPattern.endswith('.tar.gz'):

                raise UcsValidationException('pathPattern should end with .tar.gz')

elif type != "full-state" and not pathPattern.endswith('.xml'):

                raise UcsValidationException('pathPattern should end with .xml')

- Rahul

Community Member

Do you plan to release a new version of UcsSdk with support for M-series and UCS mini?

Cisco Employee

HI Neel,

It’s in the roadmap. Let us know your requirement/business case for M-series and UCS mini support which can help in prioritizing this ask and also see if we can suggest any workaround. You can contact us on ucs-python@cisco.com<mailto:ucs-python@cisco.com>

Thanks,

Ravikumar

Beginner

It would be nice to be able to re-attach to a session by means of the cookie. Script 1 creates the UCSHandle and returns the Cookie. Any following scripts would use that cookie to re-attach to the session and do their work. A final script would close the session. This would prevent a lot of logins a use case I am thinking about.

Beginner

I changed the Login method myself to have this feature. I simply added a cookie parameter to the Login Method. If a cookie is specified the cookie self._cookie will be set and the entire AaaLogin method will be skipped. The only drawback is is is that the lastUpdateTime/domains/priv/refreshPeriod/sessionId and version dont't get a value assigned. I don't believe these vars are used in any other method. Will see when I do any additional testing.

I also found a minor bug when the logout is done there is no check if the cookie is already expired. No use to do it when the FI already expired the cookie.

Cisco Employee

Need to understand the impact and usability if only using cookie to attach to an existing session via Login API without sending AaaLogin method. You need refreshPeriod for autoRefresh functionality. Currently priv is not checked before sending ConfigConf requests so should be fine for a while.

What if cookie is expired then how do you handle the relogin in the second script?

Regarding Logout API, we have added a check to ignore the exception thrown by UCSM if cookie already expired i.e. does not exist in UCS active sessions. This will be available in upcoming UcsSdk version 0.8.4.

- Rahul

Beginner

I am writing a number of modules for Ansible.
The first Ansible module logs in to the UCS and gathers some basis facts including a cookie and maybe the priv. These facts are stored internally by Ansible so they can be used in further Ansible plays.
Subsequent modules would use the previously generated cookie to do their magic
If each module would create a session this would generate a huge load on the authentication system. It could be that each module is executed multiple times. All the modules will be executed after each other and the cookie will never reach its expiration time before the Ansible playbook finishes.
Of course a final module would terminate the session again.

Community Member

Hi,

I just got started using Python UCS SDK and I'm getting this annoying exception when I'm trying to login to a UCS :

Traceback (most recent call last):

  File "<stdin>", line 1, in <module>

  File "C:\Python27\lib\site-packages\UcsSdk\UcsHandle.py", line 362, in Login

    response = self.AaaLogin(username, password, dumpXml)

  File "C:\Python27\lib\site-packages\UcsSdk\UcsHandle.py", line 2373, in AaaLogin

    response = self.XmlQuery(method, WriteXmlOption.Dirty, dumpXml)

  File "C:\Python27\lib\site-packages\UcsSdk\UcsHandle.py", line 214, in XmlQuery

    f = opener.open(req)

  File "C:\Python27\lib\urllib2.py", line 431, in open

    response = self._open(req, data)

  File "C:\Python27\lib\urllib2.py", line 449, in _open

    '_open', req)

  File "C:\Python27\lib\urllib2.py", line 409, in _call_chain

    result = func(*args)

  File "C:\Python27\lib\urllib2.py", line 1240, in https_open

    context=self._context)

  File "C:\Python27\lib\urllib2.py", line 1197, in do_open

    raise URLError(err)

urllib2.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:590)>


I'm using Python 2.7.10, UCS SDK python 0.8.3, and the UCS Emulator 3.0.1.cPE1.


I have been searching  around a way to correct it, but no answer.


Is there a way to bypass the cerficate verification or is it mandatory for the UCS to have one ?

Help !

Thanks,

Kind regards



CreatePlease to create content
Content for Community-Ad
June's Community Spotlight Awards