Skip to main content

Cisco CUCM API

Python Wrappers for Cisco CUCM SOAP APIs

  • Free software: MIT license

Features

The ciscocucmapi package is inspired by the most excellent webexteamssdk Python API wrapper for Cisco Spark. The library wraps a python-zeep client to manage CUCM SOAP connections (specifically for AXL) and CRUD operations for common API endpoints.

Overview

  • Simplified Pythonic wrappings of Cisco UC SOAP APIs

  • python-zeep-based client under the hood - much faster than suds. WSDL caching is enabled by default.

  • Complete abstraction of AXL SOAP API - no xml!

  • Native Python tooling includes:
    • Native returned AXL data objects modelled with a dict-like interface and characteristics

    • xml order is honoured due to OrderedDict implementation

    • AXL crud operations supported using both Python objects and native AXL calling requirements

  • Transparent sourcing of AXL credentials from local environment variables

  • Easy, template-able reading and writing to JSON objects, making Cisco UC DevOps implementations a reality

Installation

pip install ciscocucmapi

You can also install the in-development version with:

pip install https://github.com/jonathanelscpt/ciscocucmapi/archive/master.zip

Documentation

https://ciscocucmapi.readthedocs.io/

Quick Start

from ciscocucmapi import UCMAXLConnector
import json


axl = UCMAXLConnector()  # env vars for connection params

# adding phones
ipphone_attributes = {
    "name": "SEPDEADDEADDEAD",
    "product": "Cisco 8821",
    "devicePoolName": "US_NYC_DP",
}
axl.phone.add(**ipphone_attributes)

# api endpoints can be created prior to invoking axl method-calling for pre-processing
new_bot_device = axl.phone.create()
# very useful API template development!
with open("/path/to/templates/phone.json", "w") as _:
    json.dump(axl.phone.model(), _, indent=4)

# getting existing phones with null-string dicts or lists of `returnedTags`
dead_device = axl.phone.get(name="SEPDEADDEADDEAD",
                            returnedTags={"name": "", "devicePoolName": "",
                                          "callingSearchSpaceName": ""})
beefy_device = axl.phone.get(name="SEPBEEFBEEFBEEF",
                             returnedTags=["name", "devicePoolName", "callingSearchSpaceName"])

# listing phones by name
nyc_bot_attrs = {
    "name": "BOT%",
    "devicePoolName": "US_NYC%",
    "callingSearchSpaceName": "US_%"
}
nyc_bot_devices = axl.phone.list(searchCriteria=nyc_bot_attrs,
                                 returnedTags=["name", "description", "lines"])
# implicit "return all" available for `searchCriteria` and `returnedTags`
# use sparingly for large data sets!
all_devices = axl.phone.list()

# property-like getters and setters
botuser15 = next(filter(lambda person: person.name == 'BOTUSER015', nyc_bot_devices))
botuser15.callingSearchSpaceName = "US_NYC_NATIONAL_CSS"

# updating a phone
botuser15.callingSearchSpaceName = "US_NYC_INTERNATIONAL_CSS"
botuser15.newName = "BOTJONELS"
botuser15.locationName = "Hub_None"
axl.phone.update(name=botuser15.name,
                 newName=botuser15.newName,
                 callingSearchSpaceName=botuser15.callingSearchSpaceName,
                 locationName=botuser15.locationName)

# deleting a phone
axl.phone.remove(uuid=botuser15.uuid)

# Thin AXL sql querying and execution also available
numplan = axl.sql.query("SELECT * FROM numplan")
directory_numbers = [row['dnorpattern'] for row in numplan]
numplan.csv(destination_path="/path/to/datadump/numplan.csv")  # pathlib also supported

Connector Environment Variables

The following env vars are supported for ease of use:

  • AXL_USERNAME

  • AXL_PASSWORD

  • AXL_WSDL_URL

  • AXL_FQDN

AXL WSDL

The package includes the AXL wsdl for ease of use. The schema will be updated regularly to match the latest CUCM releases. By default, unless an AXL version is specified, the current WSDL will be used.

Due to the strictness of python-zeep’s WSDL and .xsd parsing, numerous AXL defects have been encountered during development and testing. As a result, the packaged WSDL and .xsd files may include patches to mitigate defects where applicable. Known AXL defects which have resulted in patches are catalogued in AXL_DEFECTS.rst.

If you require a more up-to-date WSDL, or are uncomfortable with using a patched schema, all UCSOAPConnector accept a direct path to a local WSDL file as input.

API Endpoint Support

Not all API Endpoints are supported, as API and data models are required to mitigate inconsistencies in the AXL API. If you’d like to extend API support, please create a pull request, or raise a GitHub issue and I’ll add an enhancement.

I am not currently back-testing all version support, and do not intend to test against pre-9 UCM versions. The package has been developed primarily against UCM 11.5. If any API definitions interfere with the backwards compatibility of AXL for prior versions, please raise a GitHub issue and I will address this.

Supported Languages and AXL Versions

  • Currently only Python 3.6+ is supported. There are no plans to support Python 2.7.

  • All AXL versions should be supported, however only 11.5 has been currently tested. All AXL data models include static metadata on mandatory params for add calls. It is not expected that these should change across AXL schema versions. Please raise a defect if you encounter any issues.

  • Other API methods should contain reliable schema-driven metadata and attributes.

Development

To run the all tests run:

tox

Note, to combine the coverage data from all the tox environments run:

Windows

set PYTEST_ADDOPTS=--cov-append
tox

Other

PYTEST_ADDOPTS=--cov-append tox

Donate

If this library has helped you, or if you would like to support future development, donations are most welcome:

Cryptocurrency

Address

BTC

38c7QWggrB2HLUJZFmhAC2zh4t8C57c1ec

ETH

0x01eD3b58a07c6d005281Db76e6c1AE2bfF2226AD

Support

I’m open to discussing ad-hoc commercial support or custom DevOps implementations. Please contact me at jonathanelscpt@gmail.com for more information. Note that asking questions or reporting bugs via this e-mail address may not receive responses. Please rather create GitHub issues for this.

Changelog

0.0.0 (2019-12-30)

  • First alpha release.

Metadata

Release files for ciscocucmapi 0.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ciscocucmapi 0.0.2
File Size Uploaded Provenance Actions
ciscocucmapi-0.0.2.tar.gz 1.7 MB Without provenance Details for ciscocucmapi-0.0.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for ciscocucmapi 0.0.2
File Interpreter ABI Platform Actions
ciscocucmapi-0.0.2-py2.py3-none-any.whl Python 3, Python 2 none any Details for ciscocucmapi-0.0.2-py2.py3-none-any.whl

Total release size: 1.7 MB

Release files / ciscocucmapi-0.0.2.tar.gz

Download URL ciscocucmapi-0.0.2.tar.gz
Size 1.7 MB
Tags Source
SHA-256 checksum
How to use checksums
03f1ff684dc98cc4dbda660f8a7324b52d6c5525cf0fb105f46b90cd7ee66653
BLAKE2b-256 checksum
How to use checksums
e3ed99cec19bc772a52ae8adc1254fb5971c2b980016c90003e78976a853eb1f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.41.0 CPython/3.7.3

Release files / ciscocucmapi-0.0.2-py2.py3-none-any.whl

Download URL ciscocucmapi-0.0.2-py2.py3-none-any.whl
Size 34.6 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
27a1e379b21cd07e6759f8d1227af921fe1b7cf57593399ee1e421ece0879064
BLAKE2b-256 checksum
How to use checksums
dfb16c7aa02c1d92a5ab7fe3bd96576718eddc4efc030378c92202cad57b8b2b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.41.0 CPython/3.7.3

Security for ciscocucmapi 0.0.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.0.2 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page