CUCM and Device Functions#

  • fn.get_cucms_associated_via_ndlr: Get all CUCM servers from NDLR (Network Device List Reference) on current the site. The function must be called from a site hierarchy.

Example

Output

hierarchy: sys.hcs.CS-P.CS-NB.Geologic.EMEA.Paarl

{# fn.get_cucms_associated_via_ndlr #}
[
  10.110.11.131
]
  • fn.get_cucm_bkeys_associated_via_ndl: Get all CUCM server business keys from NDL (Network Device List) on current the hierarchy. A business key is a list of: IP, port, hierarchy.

Example

Output

hierarchy: sys.hcs.CS-P

{# fn.get_cucm_bkeys_associated_via_ndl #}
[
  "[\"10.110.11.131\",
    \"8443\",
    \"hcs.CS-P.CS-NB.AAAGlobal\"]"
]
  • fn.cucm_get_line_details: Specify the line pattern and routePartitionName and use the Macro Evaluator function to view the line parameters for the specified line.

    To return the result for a single line parameter, append the required parameter to the end of the macro function, for example:

    {{ fn.cucm_get_line_details 4025 }}

    The macro can only be run at or below the hierarchy level of the Unified CM that is provisioned.

    If no routePartitionName is specified, then only the line directory number pattern is searched for on the Unified CM:

    {{ fn.cucm_get_line_details 4025, }}

    In a multi-cluster environment with more than one device, then an additional optional parameter should be used to specify the Unified CM - its pkid. In this case, using the device parameter also requires that the all parameter be used if all parameters need to be returned.

Multi cluster example (for data/CallManager/57e709467677f0c9ca956f6f)

Example

Output

{{ fn.cucm_get_line_details
   4025,VS-Corp-NewYork,
   all,57e709467677f0c9ca956f6f}}
{

  "is_line_shared": true,
  "remote_destination_profiles": [
      "RDP_vdevenr"
  ],
  "device_profiles": [
      "UDP_vdevenr"
  ],
  "phones":  [
      "SEP002155D547F7",
      "SEP111122223333"
  ]
}

Single cluster examples:

Example

Output

{{ fn.cucm_get_line_details
   4025,VS-Corp-NewYork }}
{

  "is_line_shared": true,
  "remote_destination_profiles": [
      "RDP_vdevenr"
  ],
  "device_profiles": [
      "UDP_vdevenr"
  ],
  "phones":  [
      "SEP002155D547F7",
      "SEP111122223333"
  ]
}
{{ fn.cucm_get_line_details
   4025,VS-Corp-NewYork,
   is_line_shared }}
true
{{ fn.cucm_get_line_details
   4025,VS-Corp-NewYork,
   phones }}
SEP002155D547F7
SEP111122223333
  • fn.get_endpoint_name

    Given a set of gateway input parameters, return an endpoint name. The input parameters are ordered:

    1. gateway product

    2. gateway protocol

    3. gateway name

    4. gateway module

    5. gateway slot (int)

    6. gateway subunit

    7. gateway subunit position (int)

    8. gateway endpoint port (int)

    9. gateway endpoint product

    {{ fn.get_endpoint_name
        VG350 SCCP SKIGW1122111111 ANALOG
        2 SM-D-48FXS-E-SCCP 0 46 'Analog Phone' }}
    
    AN112211111142E
    
    {{ fn.get_endpoint_name
        VG350 MGCP test1.com ANALOG
        2 SM-D-72FXS 0 9 'Cisco MGCP FXS Port' }}
    
    AALN/S2/SU0/[email protected]
    
  • fn.get_sccp_endpoint_name

    Remains available as an alias for get_endpoint_name to support existing features. Given a set of gateway input parameters, return an endpoint name. The input parameters are ordered:

    1. gateway product

    2. gateway protocol

    3. gateway name

    4. gateway module

    5. gateway slot (int)

    6. gateway subunit

    7. gateway subunit position (int)

    8. gateway endpoint port (int)

    9. gateway endpoint product

    {{ fn.get_sccp_endpoint_name
        VG350 SCCP SKIGW1122111111 ANALOG
        2 SM-D-48FXS-E-SCCP 0 46 'Analog Phone' }}
    
    AN112211111142E
    
  • fn.lines_from_hierarchy_devices

    Given a hierarchy and device (one of Phone, Device Profile or Remote Destination Profile), return the list of patterns and routePartitionNames for the device at the hierarchy.

    Example:

    {{ fn.lines_from_hierarchy_devices
       sys.hcs.CS-P.OBCust.OBSite1
       Phone }
    
    { "pattern":  ["555555","710087"],
      "routePartitionName": [None,"Site-CPT1"]}
    }
    
  • fn.default_device

    Given a hierarchy and device (or device and path to pkid), return the default device at the hierarchy according to the device in the Network Device List (NDL) of the hierarchy. Calling the function without a pkid path returns the entire object. If no default device is found, an empty string is returned.

    Example:

    {{ fn.default_device data/CallManager.pkid }}
    
    
    {{ fn.default_device data/CallManager }}
    
    69cer80r903aa8b565784675
    
    
    [
       {
         "pkid": "59ccdc58dcdbfaa51eedbed9",
         "model_type": "data/CallManager",
         "uri": "/api/v0/data/CallManager/69cer80r903aa8b565784675
       }
    ]
    
  • fn.device_meta

    Can take 0, 1 or 2 parameters to return NDL data.

    • If no parameters, the function should be called at a site hierarchy. Returns NDL object data (e.g. details of data/CallManager, data/UnityConnection)

    • If 1 parameter, it must be the hierarchy: as friendly name or fn.hierarchy.

    • If 2 parameters, hierarchy followed by comma, then object name and optionally dot and attribute (pkid example below)

    Example:

    {{ fn.ndl_device_meta fn.hierarchy,
       ndl.data/CallManager.pkid }}
    
    69cer80r903aa8b565784675
    
    {{ fn.ndl_device_meta fn.hierarchy }}
    
    {
        "ndl": {
            "name": "NDL-GeoLogic-1",
            "pkid": "59ccdcd5303aa8b5657426ac",
            "data/CallManager": {
                "pkid": "69cer80r903aa8b565784675",
                "bkey": "[\"10.140.51.164\", \"8443\", \"hcs.CS-P.CS-NB.GeoLogic\"]"
            },
            "bkey": "[\"NDL-GeoLogic-1\", \"hcs.CS-P.CS-NB.GeoLogic\"]",
            "data/Hcmf": {
                "pkid": "59ccd953dc66faa51eeda8d5",
                "bkey": "[\"10.140.51.156\", \"8443\", \"hcs\"]"
            },
            "data/UnityConnection": {
                "pkid": "59ccdc8cb969f577e64fcc98",
                "bkey": "[\"10.140.51.165\", \"8443\", \"hcs.CS-P.CS-NB.GeoLogic\"]"
            }
        }
    }
    
  • fn.get_least_used_site_devicepool

    Important

    This function can only be run at a site and only searches locally, so no device selection is required.

    Return the CUCM DevicePool with the lowest phone count at the submitted site.

    Example:

    {{ fn.get_least_used_site_devicepool }}
    
    Cu1Si1-CAT-Dallas-SRST-DP1
    
  • fn.generic_device_model_custom_operation

    Used to get return values on custom operations for generic driver device models for use in a workflow context.

    Given parameters:

    • full generic driver device type, e.g. device/genericcucm/PbrMac

    • operation_name: e.g. get_mac

    • input_data: as dictionary, e.g. {"extension": "1094"}

    return the value of the custom operation as a dictionary

    Example:

    {{ fn.generic_device_model_custom_operation
       device/genericcucm/PbrMac
       get_mac
       \{"extension": "1094"\}
    }}
    
    {"MAC": "001122AABBCC"}