cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
25088
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
Amir Safayan
Level 1
Level 1

Thank you very much for this.  We need to build more and more support around Python and less around powershell. 

Shin Ito
Level 1
Level 1

Hi,

When I use "convert_to_ucs_python()" and create an VLAN on UCSM, the following error was shown:

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

>>> from ucsmsdk.utils.converttopython import convert_to_ucs_python

>>> convert_to_ucs_python()

### Please review the generated cmdlets before deployment.

ucsm logfile: /Users/shito/Library/Application Support/Oracle/Java/Deployment/log/.ucsm/centrale_51953.log

Traceback (most recent call last):

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

  File "ucsmsdk/utils/converttopython.py", line 1521, in convert_to_ucs_python

  File "ucsmsdk/utils/converttopython.py", line 1316, in _find_xml_requests_in_file

  File "ucsmsdk/utils/converttopython.py", line 1293, in _extract_xml

  File "ucsmsdk/utils/converttopython.py", line 1237, in _generate_cmdlets

  File "ucsmsdk/utils/converttopython.py", line 646, in _generate_config_conf_cmdlets

  File "ucsmsdk/utils/converttopython.py", line 391, in _get_config_conf_cmdlet

  File "ucsmsdk/utils/converttopython.py", line 513, in _form_configconf_cmdlet

  File "ucsmsdk/utils/converttopython.py", line 79, in _get_class_id_for_dn

  File "ucsmsdk/utils/converttopython.py", line 102, in _get_class_id_for_rn

  File "ucsmsdk/ucscoreutils.py", line 231, in get_mo_property_meta

  File "ucsmsdk/ucscoreutils.py", line 139, in load_class

ImportError: No module named TopRoot

>>>

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

How can I address this?

Regards,

Shin

Vijay Balyan
Cisco Employee
Cisco Employee

Shin,

This issue has been fixed and is a part of the latest development code on https://github.com/ciscoucs/ucsmsdk

This will be released as a part of 0.9.1.1 and then available via pip also.

Thanks,

-Vikrant

Shin Ito
Level 1
Level 1

Vikrant,

Thank you for your update on this. Will install 0.9.1.1 later and confirm in my env.

Anyway, when will the GA version of UCS Python SDK be released?

Regards,

Shin

Michael Doherty
Cisco Employee
Cisco Employee

Hi, and thx for your work in this as it should prove very valuable.

I have an issue when I run..

# launch the UCSM GUI

ucs_gui_launch(handle)

I get the following error around having an issue launching Java....but I have the SDK installed as this works doing it manually via Google Chrome....but I dod have issue wit FF though (maybe a clue)....

.............

2016-09-05 15:12:05,492 - ucs - DEBUG - AuthToken: <91981298051670086458591>

2016-09-05 15:12:05,511 - ucs - DEBUG - UCSM URL: <https://10.x.x.x:443/ucsm/ucsm.jnlp?ucsmToken=91981298051670086458591>

2016-09-05 15:12:05,526 - ucs - DEBUG - javaws path: </usr/bin/javaws>

2016-09-05 15:12:05,655 - ucs - DEBUG - Temp Directory: </var/folders/cb/2dd7r4pd4l1c9lp2zswg__240000gp/T>

Traceback (most recent call last):

  File "/Users/micdoher/Documents/Projects/Python Scripts/ucsm.py", line 19, in <module>

    ucs_gui_launch(handle)

  File "/usr/local/lib/python2.7/site-packages/ucsmsdk/utils/ucsguilaunch.py", line 119, in ucs_gui_launch

    raise e

CalledProcessError: Command '[u'java', u'-version']' returned non-zero exit status 1

................

Any thoughts please (btw, using Python 2.7 on a Mac/El Capitan and the latest SDK download)

Cheers

md

................

OK, an update on this .....

I found the following which has helped me move forward as there was an Issue with the Java version….

https://support.apple.com/kb/DL1572?locale=en_GB

After applying the older version of Java,I don’t get any of the Python version errors anymore but it still won’t replicate the code in the Python interpreter (IDLE) and I get the following: -

-----------------------------------------------------]

DEBUG [Comms Worker Pool - 1] 2016-09-06 11:40:04,753 [com.nuova.centrale.core.comms.NuServerCommunicationManager] - Sending requestcom.nuova.centrale.imp.config.ResolveClassMe@7635de1c

DEBUG [Comms Worker Pool - 1] 2016-09-06 11:40:04,765 [latency] - Request-Response Latency (ms):12

DEBUG [Comms Worker Pool - 1] 2016-09-06 11:40:04,766 [com.nuova.centrale.core.comms.NuServerCommunicationManager] -

[---------- Received Response from Server -----------

HTML Headers:

    Response: HTTP/1.1 200 OK

    Date: Sun, 04 Sep 2016 07:19:52 GMT

    Server: Apache/2.4.16 (Unix) CiscoSSL/1.0.1l.4.8-fips

    Content-Length: 352

    Keep-Alive: timeout=5, max=100

    Connection: Keep-Alive

    Content-Type: application/soap+xml

[----------debugBuffer----------------]

<configResolveClass cookie="[hidden]" response="yes" classId="topSystem"> <outConfigs>  <topSystem address="10.55.154.6" currentTime="2016-09-04T07:19:52.847" descr="" dn="sys" ipv6Addr="::" mode="cluster" name="UCSPE-10-55-154-6" owner="" site="" systemUpTime="01:21:04:16"/> </outConfigs> </configResolveClass>

-----------------------------------------------------]

DEBUG [Comms Worker Pool - 1] 2016-09-06 11:41:04,757 [com.nuova.centrale.core.comms.NuServerCommunicationManager] - getting connection for requestcom.nuova.centrale.imp.config.ResolveClassMe@7fc39c69

DEBUG [Comms Worker Pool - 1] 2016-09-06 11:41:04,757 [com.nuova.centrale.core.comms.NuServerCommunicationManager] -

[------------- Sending Request to Server ------------

<configResolveClass

classId="topSystem"

inHierarchical="false">

     <inFilter>

     </inFilter>

</configResolveClass>

-----------------------------------------------------]

DEBUG [Comms Worker Pool - 1] 2016-09-06 11:41:04,757 [com.nuova.centrale.core.comms.NuServerCommunicationManager] - Sending requestcom.nuova.centrale.imp.config.ResolveClassMe@7fc39c69

DEBUG [Comms Worker Pool - 1] 2016-09-06 11:41:04,768 [latency] - Request-Response Latency (ms):11

DEBUG [Comms Worker Pool - 1] 2016-09-06 11:41:04,769 [com.nuova.centrale.core.comms.NuServerCommunicationManager] -

[---------- Received Response from Server -----------

HTML Headers:

    Response: HTTP/1.1 200 OK

    Date: Sun, 04 Sep 2016 07:20:52 GMT

    Server: Apache/2.4.16 (Unix) CiscoSSL/1.0.1l.4.8-fips

    Content-Length: 352

    Keep-Alive: timeout=5, max=100

    Connection: Keep-Alive

    Content-Type: application/soap+xml

[----------debugBuffer----------------]

<configResolveClass cookie="[hidden]" response="yes" classId="topSystem"> <outConfigs>  <topSystem address="10.55.154.6" currentTime="2016-09-04T07:20:52.831" descr="" dn="sys" ipv6Addr="::" mode="cluster" name="UCSPE-10-55-154-6" owner="" site="" systemUpTime="01:21:05:16"/> </outConfigs> </configResolveClass>

-----------------------------------------------------]

devikuma
Cisco Employee
Cisco Employee

Michael,

Sometime there are issues in detecting the log file by PYTHON SDK kit based on the Operating systems. Please follow the steps below to fix that issues.

  • On some operating systems, the program might encounter issues discovering the path to which UI logs are written.
  • convert_to_ucs_python does not work if log path is not detected.
  • Follow the below steps, if case of log_path issues, code $cd ~ $sudo find . -name '.ucsm' ./Library/Application Support/Oracle/Java/Deployment/log/.ucsm
  • so now you can specify log_path argument to convert_to_ucs_python to "./Library/Application Support/Oracle/Java/Deployment/log/.ucsm"

      convert_to_ucs_python(log_path="/Users/<username>//Library/Application Support/Oracle/Java/Deployment/log/.ucsm")

Regards,Devi

pierrepacaud
Community Member

Hi and thanks for your work.

When I try to use UcsHandle, python sends me this error :

>>> from ucsmsdk.ucshandle import UcsHandle

Traceback (most recent call last):

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

  File "C:\Users\PP05647S\Documents\ucsmsdk-0.9.0.0\ucsmsdk\ucshandle.py", line

17, in <module>

    import ucsgenutils

ImportError: No module named 'ucsgenutils'

Do you have an idea on the root cause ?

DANIEL LORCA
Level 1
Level 1

Hi Shin

Were you able to solve the issue?

I'm using ucsmsdk (0.9.2.0) and I'm having the same problem.

>>> converttopython.convert_to_ucs_python()

### Please review the generated cmdlets before deployment.

ucsm logfile: C:\Users\Daniel\AppData\LocalLow\Sun\Java\Deployment\log\.ucsm\centrale_3724.log

Traceback (most recent call last):

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

  File "ucsmsdk\utils\converttopython.py", line 1521, in convert_to_ucs_python

  File "ucsmsdk\utils\converttopython.py", line 1316, in _find_xml_requests_in_file

  File "ucsmsdk\utils\converttopython.py", line 1293, in _extract_xml

  File "ucsmsdk\utils\converttopython.py", line 1237, in _generate_cmdlets

  File "ucsmsdk\utils\converttopython.py", line 646, in _generate_config_conf_cmdlets

  File "ucsmsdk\utils\converttopython.py", line 391, in _get_config_conf_cmdlet

  File "ucsmsdk\utils\converttopython.py", line 513, in _form_configconf_cmdlet

  File "ucsmsdk\utils\converttopython.py", line 79, in _get_class_id_for_dn

  File "ucsmsdk\utils\converttopython.py", line 102, in _get_class_id_for_rn

  File "ucsmsdk\ucscoreutils.py", line 246, in get_mo_property_meta

  File "ucsmsdk\ucscoreutils.py", line 159, in load_class

ImportError: No module named TopRoot

>>>

regards

dani

pierrepacaud
Community Member

Hi,

I changed the file "easy_install.py" to add the path with /ucsmsdk to solve this, but I have a new problem.

The file ucsgenutils line 169 doesn't use the python3's function print ("()" missing)

I tryed to update to version 0.9.2.0 but got the same issue

Could you help me ?

a.hackenberg
Level 1
Level 1

Hi,

what I know the whole SDK is based on Python 2.7

alex

Jaap van Liere
Community Member

Hello,

I don't know if this is the right place to handle a problem, but let's try:

I try to install the plugin and does the following:

( the system is Centos 7.3.1611, python 2.7)

download cisco plugin 0.9.4 and extract it in /root:

     tar zxvf cisco-ucs-nagios-0.9.4 .tar.gz

download UCS sdk:

     pip install ucsmsdk

     cd ucsmsdk

     make install

Whenever i try to install the plugin with:

  ./installer.py from the cisco-ucs-nagios-0.9.4 directory, i got the following error:

Searching for Nagios installation path...

Found the following paths :

1. /usr/local/nagios/etc

2. Provide your custom install path

Type in your choice [Default '1'] :

As no input was provided taking option '1' as default.

Nagios installation found at /usr/local/nagios/etc

This Nagios plugin requires Ucs Python SDK to be installed before we can proceed further.

Download the latest Cisco Ucs Python SDK from the following URL

https://communities.cisco.com/docs/DOC-37174

Aborting the installation

What will be the problem? It seems that the software is looking for a plugin with the name "UcsmSdk" and i've a plugin with the lowercase characters.

Jaap

jomcdono
Cisco Employee
Cisco Employee

Hi Jaap,

The nagios plugin was built against the old version of the UCS Python SDK, it has been deprecated however you can still download it from here, https://communities.cisco.com/docs/DOC-36899

I recommend that you install the deprecated version of UCS Python SDK and then try the nagios install again.

Regards,

John

aranatar
Cisco Employee
Cisco Employee

Hi,

my CVS has

/usr/local/nagios/share/ucs-autodiscovery/autodiscovery/UCSHostInfo.csv

10.10.20.3,admin,password,80,True

when I run "./NagiosAutoDiscoveryUCS.py"

Error while trying to discover :  10.10.20.3

Error is of Type :   URLError  Message >> <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:590)>

Error while trying to auto discover UCS Infrastructure. Check if any of the UCS are reachable.

the --NoSsl ==True option is supposed to ignore certificate check?

./NagiosAutoDiscoveryUCS.py --version

Cisco UCSM Nagios Auto Discovery version :  0.9.4

Thanks in advance

~Aravind

ragupta4
Cisco Employee
Cisco Employee

Hi,

Please check if the ‘HTTP to HTTPS Redirection’ is disabled.

If not please disable it.

If its enable, it means server redirects the HTTP requests to HTTPS.

Thanks

Rahul Gupta

Jaap van Liere
Community Member

That was the solution! Thanks!

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