### Install In-Development Version Source: https://github.com/fatestapestry/ciscocucmapi/blob/master/docs/installation.md Install the latest in-development version directly from the GitHub repository. ```bash pip install https://github.com/jonathanelscpt/ciscocucmapi/archive/master.zip ``` -------------------------------- ### Install Stable Version Source: https://github.com/fatestapestry/ciscocucmapi/blob/master/docs/installation.md Install the latest stable release of the ciscocucmapi package from PyPI. ```bash pip install ciscocucmapi ``` -------------------------------- ### Run all test environments in parallel with detox Source: https://github.com/fatestapestry/ciscocucmapi/blob/master/docs/contributing.md Execute all test environments in parallel using detox. Ensure detox is installed via pip. ```bash detox ``` -------------------------------- ### List Phones with Search Criteria Source: https://github.com/fatestapestry/ciscocucmapi/blob/master/README.rst List phones based on specific search criteria and return only the requested tags. This example filters phones by name, device pool, and calling search space name. ```python nyc_bot_attrs = { "name": "BOT%", "devicePoolName": "US_NYC%", "callingSearchSpaceName": "US_స్య%" } yc_bot_devices = axl.phone.list(searchCriteria=nyc_bot_attrs, returnedTags=["name", "description", "lines"]) ``` -------------------------------- ### Delete Phone Source: https://github.com/fatestapestry/ciscocucmapi/blob/master/README.rst This example demonstrates how to delete a phone from CUCM using its UUID. ```python axl.phone.remove(uuid=botuser15.uuid) ``` -------------------------------- ### Get Existing Phone Details Source: https://github.com/fatestapestry/ciscocucmapi/blob/master/docs/readme.md Retrieve details of existing phones using name and specifying returned tags. Supports both null-string dictionaries and lists for returnedTags. ```python # 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"]) ``` -------------------------------- ### Get Existing Phone Details Source: https://github.com/fatestapestry/ciscocucmapi/blob/master/README.rst Retrieve details of an existing phone by its name. You can specify which attributes to return using `returnedTags`, either as a dictionary with null values or a list of tag names. ```python dead_device = axl.phone.get(name="SEPDEADDEADDEAD", returnedTags={"name": "", "devicePoolName": "", "callingSearchSpaceName": ""}) beefy_device = axl.phone.get(name="SEPBEEFBEEFBEEF", returnedTags=["name", "devicePoolName", "callingSearchSpaceName"]) ``` -------------------------------- ### Initialize UCMAXLConnector and Add Phone Source: https://github.com/fatestapestry/ciscocucmapi/blob/master/docs/readme.md Initialize the AXL connector with credentials and FQDN, then add a new IP phone. ```python from ciscocucmapi import UCMAXLConnector import json axl = UCMAXLConnector(username='axl', password='password', fqdn='192.168.99.99') # adding phones ipphone_attributes = { "name": "SEPDEADDEADDEAD", "product": "Cisco 8821", "devicePoolName": "US_NYC_DP", } axl.phone.add(**ipphone_attributes) ``` -------------------------------- ### Initialize UCMAXLConnector with Direct Parameters Source: https://github.com/fatestapestry/ciscocucmapi/blob/master/docs/env.md Alternatively, provide username, password, and FQDN directly to the UCMAXLConnector constructor. This is useful if environment variables are not set or if you need to override them. ```python UCMAXLConnector(username='axl', password='password', fqdn='192.168.99.99') ``` -------------------------------- ### Create Phone Template Source: https://github.com/fatestapestry/ciscocucmapi/blob/master/docs/readme.md Create a new bot device and dump its model to a JSON template file for pre-processing. ```python # 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) ``` -------------------------------- ### Run All Tests Source: https://github.com/fatestapestry/ciscocucmapi/blob/master/docs/development.md Execute all tests using the tox command. ```default tox ``` -------------------------------- ### List All Devices Source: https://github.com/fatestapestry/ciscocucmapi/blob/master/docs/readme.md Retrieve all devices. Use sparingly for large datasets as it can be resource-intensive. ```python # implicit "return all" available for `searchCriteria` and `returnedTags` # use sparingly for large data sets! all_devices = axl.phone.list() ``` -------------------------------- ### Initialize UCMAXLConnector with Environment Variables Source: https://github.com/fatestapestry/ciscocucmapi/blob/master/docs/env.md Use this snippet when you have set the relevant AXL environment variables. The connector will automatically pick them up. ```python UCMAXLConnector() ``` -------------------------------- ### Clone the ciscocucmapi repository Source: https://github.com/fatestapestry/ciscocucmapi/blob/master/docs/contributing.md Clone your forked repository locally to begin development. ```bash git clone git@github.com:jonathanelscpt/ciscocucmapi.git ``` -------------------------------- ### Create a new branch for development Source: https://github.com/fatestapestry/ciscocucmapi/blob/master/docs/contributing.md Create a new branch for your bug fixes or new features. ```bash git checkout -b name-of-your-bugfix-or-feature ``` -------------------------------- ### Initialize UCMAXLConnector Source: https://github.com/fatestapestry/ciscocucmapi/blob/master/README.rst Instantiate the UCMAXLConnector to establish a connection to the Cisco CUCM AXL API. Ensure your username, password, and the Fully Qualified Domain Name (FQDN) of your CUCM server are correctly provided. ```python from ciscocucmapi import UCMAXLConnector import json axl = UCMAXLConnector(username='axl', password='password', fqdn='192.168.99.99') ``` -------------------------------- ### Commit and push changes Source: https://github.com/fatestapestry/ciscocucmapi/blob/master/docs/contributing.md Stage all changes, commit them with a descriptive message, and push the branch to GitHub. ```bash git add . git commit -m "Your detailed description of your changes." git push origin name-of-your-bugfix-or-feature ``` -------------------------------- ### List Phones by Name Pattern Source: https://github.com/fatestapestry/ciscocucmapi/blob/master/docs/readme.md List phones matching specific name, device pool, and calling search space patterns. Supports wildcard matching. ```python # 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"]) ``` -------------------------------- ### Update Phone Configuration Source: https://github.com/fatestapestry/ciscocucmapi/blob/master/README.rst This snippet shows how to update properties of a phone, including its calling search space, new name, and location. It then uses the AXL client to apply these changes. ```python 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) ``` -------------------------------- ### Combine Coverage Data on Windows Source: https://github.com/fatestapestry/ciscocucmapi/blob/master/docs/development.md On Windows, set the PYTEST_ADDOPTS environment variable before running tox to combine coverage data from all tox environments. ```default set PYTEST_ADDOPTS=--cov-append tox ``` -------------------------------- ### Execute Thin AXL SQL Query and Export to CSV Source: https://github.com/fatestapestry/ciscocucmapi/blob/master/docs/readme.md Perform a direct SQL query against AXL, process the results, and export them to a CSV file. ```python # 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 ``` -------------------------------- ### Create Phone Object from Template Source: https://github.com/fatestapestry/ciscocucmapi/blob/master/README.rst Create a phone object using a template and save its model to a JSON file. This is useful for API template development and pre-processing before invoking AXL methods. ```python 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) ``` -------------------------------- ### Run a subset of tests with tox Source: https://github.com/fatestapestry/ciscocucmapi/blob/master/docs/contributing.md Execute a specific subset of tests by specifying the environment name and a pytest filter. ```bash tox -e envname -- pytest -k test_myfeature ``` -------------------------------- ### Combine Coverage Data on Other Systems Source: https://github.com/fatestapestry/ciscocucmapi/blob/master/docs/development.md On systems other than Windows, set the PYTEST_ADDOPTS environment variable before running tox to combine coverage data from all tox environments. ```default PYTEST_ADDOPTS=--cov-append tox ``` -------------------------------- ### Add a New Phone Source: https://github.com/fatestapestry/ciscocucmapi/blob/master/README.rst Add a new phone to Cisco CUCM by providing its attributes. This snippet demonstrates adding a Cisco 8821 phone with specified name, product, and device pool. ```python ipphone_attributes = { "name": "SEPDEADDEADDEAD", "product": "Cisco 8821", "devicePoolName": "US_NYC_DP", } axl.phone.add(**ipphone_attributes) ``` -------------------------------- ### Update Phone Properties Source: https://github.com/fatestapestry/ciscocucmapi/blob/master/docs/readme.md Access and modify phone properties like calling search space and name. Updates are applied using the update method. ```python # 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) ``` -------------------------------- ### Delete Phone by UUID Source: https://github.com/fatestapestry/ciscocucmapi/blob/master/docs/readme.md Remove a phone from CUCM using its unique identifier (UUID). ```python # deleting a phone axl.phone.remove(uuid=botuser15.uuid) ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.