Unsupported content

 

This version of the documentation is no longer supported. However, the documentation is available for your convenience. You will not be able to leave comments.

Software Development Kit

This section contains detailed information about the BMC Cloud Lifecycle Management Software Development Kit (SDK), which provides a simple way to perform task-based API operations in BMC Cloud Lifecycle Management.

You can use the SDK for the following providers only:

  • VMware
  • Platform as a Service (PaaS)
  • Amazon Web Services (AWS)
  • vCloud Director (vCD)

Note

You cannot use the SDK for Azure and OpenStack providers.

You do not need to interact directly with the BMC Cloud Lifecycle Management RESTful API. Instead, the SDK provides Python bindings to the full RESTful API, enabling you to use a Python command-line, code, or scripts to complete BMC Cloud Lifecycle Management operations with a simplified syntax.

This topic contains the following sections:

Prerequisites for installing the SDK

The SDK is installed as part of your BMC Cloud Lifecycle Management installation, and is located in the sdk folder of the Platform Manager. Alternatively, you can download the SDK from BMC Communities.

To use the SDK, you must first complete the following activities:

  • Download and install Python 2.7.x on the computer that you will use to run SDK commands. Visit www.python.org for the software and documentation.

  • Add the C:\Python27 and C:\Python27\Lib directories to your PATH environment variable .

    Note

    Python 2.7.x is only required on the computer from which you will run the SDK. The BMC Cloud Lifecycle Management server does not require Python.


    If you will install Python on a Red Hat Enterprise Linux (RHEL) system, do not upgrade the existing Python version already installed on your RHEL system. Instead, install Python 2.7.x as a separate program:

    1. Ensure that you have the GNU Compiler Collection (GCC) installed.
      For more information about GCC, see http://gcc.gnu.org.
    2. Download Python 2.7.x
    3. Run the following commands, where x is a number of the Python version you downloaded:

      # tar -xzf Python-2.7.x.tgz
      # cd Python-2.7.x
      # ./configure
      # make altinstall

      The make altinstall command installs Python 2.7.x in parallel with the existing Python version, and enables you to run the newer version using a python2.7 command.

  • Download and install Python Setup tools in your environment. Visit https://pypi.python.org/pypi/setuptools or ez_setup.py.
    •  Run the python ez_setup.py install command. The script downloads the appropriate .egg file and installs it.  
    •  Once installation is complete, an easy_install script is available under the Python Scripts subdirectory.   
    • Add this directory to your PATH environment variable, if it is not already present. 
  • Install pip (a package management system used to install and manage software packages written in Python) in your Python environment. Execute easy_install pip. Visit http://www.pip-installer.org/en/latest/installing.html for more information about pip.

Back to top

Installing the SDK

  1. Copy the Platform_Manager/sdk/python-sdk-1.0-src.zip file from the Platform Manager server to the computer from which you will run SDK commands.
    Consider using C:\sdk (for Windows) or /home/admin (for Linux) as a destination folder.
  2. Extract the .zip file.
  3. Enter the following command: python setup.py install
    The SDK is installed in the C:\Python27\Lib\site-packages\bmc_csm_sdk-4.0-py2.7.egg folder.
  4. Verify that the SDK was installed by entering the following command: pip list
    The SDK is installed if bmc-csm-sdk is listed in the output

Back to top

Executing an SDK API

The following table shows sample API commands:

CommandDescription
clm login --url="http://cloud-test-02349:8080/csm”  --user=”cloudadmin”
--password=”password”
Executes any SDK API
clm pod-list -nLists the pods in the environment

Back to top

Configuring the SDK to use SSL

If you are running BMC Cloud Lifecycle Management Platform Manager by using Secure Sockets Layer (SSL), you must configure the SDK to use SSL by performing the following steps:.

  1. Locate the SSL key and certification files on your Platform Manager installation.
  2. Copy the files to the csmsdk/key_file directory of your SDK installation.
  3. Log in to BMC Cloud Lifecycle Management using the SDK login command, ensuring that you use https instead of http in the --url argument of the command.

    For example:
    python com/bmc/cloud/sdk/commandline/clmcmd.py login --url 
    "https://serverName:443/csm" --user "cloudadmin" --password
    "password"

Back to top

Configuring SDK settings

Once you run at least one command from the command line, an SDK configuration file called csmconfig.ini is created in the csmsdk and folder of your SDK installation. You can configure the following settings in the configuration file:

SettingDescription
localeThe locale of your SDK environment.
waitFor

Time in seconds to wait for response from the server, otherwise the SDK returns the running task details. The default value is 300 seconds.

Any --waitfor arguments used in SDK commands override the setting in the configuration file.

enableWhether SDK activity will be logged. The value can be true or false.
logLevel

The level of logging. The values can be any of the following:

  • DEBUG—All information is logged.
  • INFO—Only information about the status of tasks is logged. This is the default setting.
  • WARNING—Only warnings are logged.
  • ERROR—Only error messages are logged.
maxFileSizeInMegsThe maximum size (in MB) of the log file. The default size is 20 MB.
maxBackupIndexThe maximum number of old log files to retain. The default value is 5.
logFileName

The absolute path and name of the log file to use if SDK logging is enabled. The default value is:

  • (Windows) C:\Users\username\csmsdk\log\csmsdk.log
  • (Linux) /home/username/csmsdk/log/csmsdk.log
key_file

The location of the SSL key file, if BMC Cloud Lifecycle Management Platform Manager is using SSL. The default value is:

  • (Windows) C:\Users\username\csmsdk\key_file\RootCA.key
  • (Linux) /home/username/csmsdk/key_file/rootca.key
cert_file

The location of the SSL certification file, if BMC Cloud Lifecycle Management Platform Manager is using SSL. The default value is:

  • (Windows) C:\Users\username\csmsdk\key_file\mycert.pem
  • (Linux) /home/username/csmsdk/key_file/mycert.pem

Back to top

Uninstalling the SDK

Complete the following steps to uninstall the SDK from your BMC Cloud Lifecycle Management environment:

  1. In a Python client, enter the following command: pip list
    The command returns bmc-csm-sdk.
  2. Enter the following command: pip uninstall bmc-csm-sdk
    The SDK is uninstalled.

Back to top

Related topics

Syntax and usage
Summary of changes to the SDK
SDK reference

This version of the documentation is no longer supported. However, the documentation is available for your convenience. You will not be able to leave comments.

Comments