.. _cucm-and-device-macro-functions: CUCM and Device Functions ------------------------- .. _19.3.4|EKB-7520: .. _21.1|EKB-7520: .. _19.3.4-PB1|EKB-8205: .. _21.1|EKB-8205: .. index:: Macro function;fn.get_cucms_associated_via_ndlr * *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. .. tabularcolumns:: |p{7cm}|p{8cm}| +-------------------------------------------------------+--------------------+ | Example | Output | +=======================================================+====================+ | | :: | | | | | hierarchy: ``sys.hcs.CS-P.CS-NB.Geologic.EMEA.Paarl`` | [ | | | 10.110.11.131 | | :: | ] | | | | | {# fn.get_cucms_associated_via_ndlr #} | | | | | +-------------------------------------------------------+--------------------+ .. index:: Macro function;fn.get_cucm_bkeys_associated_via_ndl * *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. .. tabularcolumns:: |p{7cm}|p{8cm}| +-----------------------------------------------+---------------------------------------+ | Example | Output | +===============================================+=======================================+ | | :: | | | | | hierarchy: ``sys.hcs.CS-P`` | [ | | | "[\"10.110.11.131\", | | :: | \"8443\", | | | \"hcs.CS-P.CS-NB.AAAGlobal\"]" | | {# fn.get_cucm_bkeys_associated_via_ndl #} | ] | | | | +-----------------------------------------------+---------------------------------------+ .. index:: Macro function;fn.cucm_get_line_details * *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``) .. tabularcolumns:: |p{7cm}|p{8cm}| +-------------------------------------+---------------------------------------+ | 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: .. tabularcolumns:: |p{7cm}|p{8cm}| +----------------------------------+---------------------------------------+ | 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 | true | | 4025,VS-Corp-NewYork, | | | is_line_shared }} | | | | | +----------------------------------+---------------------------------------+ | :: | :: | | | | | {{ fn.cucm_get_line_details | SEP002155D547F7 | | 4025,VS-Corp-NewYork, | SEP111122223333 | | phones }} | | | | | +----------------------------------+---------------------------------------+ .. index:: Macro function;fn.get_endpoint_name * *fn.get_endpoint_name* Given a set of gateway input parameters, return an endpoint name. The input parameters are ordered: 1. gateway product #. gateway protocol #. gateway name #. gateway module #. gateway slot (int) #. gateway subunit #. gateway subunit position (int) #. gateway endpoint port (int) #. gateway endpoint product +---------------------------------------------------+----------------------------+ | :: | :: | | | | | {{ fn.get_endpoint_name | AN112211111142E | | VG350 SCCP SKIGW1122111111 ANALOG | | | 2 SM-D-48FXS-E-SCCP 0 46 'Analog Phone' }} | | | | | +---------------------------------------------------+----------------------------+ | :: | :: | | | | | {{ fn.get_endpoint_name | AALN/S2/SU0/9@test1.com | | VG350 MGCP test1.com ANALOG | | | 2 SM-D-72FXS 0 9 'Cisco MGCP FXS Port' }} | | | | | +---------------------------------------------------+----------------------------+ .. index:: Macro function;fn.get_sccp_endpoint_name * *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 #. gateway protocol #. gateway name #. gateway module #. gateway slot (int) #. gateway subunit #. gateway subunit position (int) #. gateway endpoint port (int) #. gateway endpoint product +---------------------------------------------------+--------------------+ | :: | :: | | | | | {{ fn.get_sccp_endpoint_name | AN112211111142E | | VG350 SCCP SKIGW1122111111 ANALOG | | | 2 SM-D-48FXS-E-SCCP 0 46 'Analog Phone' }} | | | | | +---------------------------------------------------+--------------------+ .. index:: Macro function;fn.lines_from_hierarchy_devices * *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 | { "pattern": ["555555","710087"], | | sys.hcs.CS-P.OBCust.OBSite1 | "routePartitionName": [None,"Site-CPT1"]} | | Phone } | } | | | | +---------------------------------------+-------------------------------------------------+ .. index:: Macro function;fn.default_device * *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 }} | 69cer80r903aa8b565784675 | | | | | | | | {{ fn.default_device data/CallManager }} | [ | | | { | | | "pkid": "59ccdc58dcdbfaa51eedbed9", | | | "model_type": "data/CallManager", | | | "uri": "/api/v0/data/CallManager/69cer80r903aa8b565784675 | | | } | | | ] | +----------------------------------------------------+--------------------------------------------------------------------+ .. index:: Macro function;fn.device_meta * *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, | 69cer80r903aa8b565784675 | | ndl.data/CallManager.pkid }} | | | | | +-------------------------------------------+---------------------------------------------------------------------------------------+ | :: | :: | | | | | {{ 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\"]" | | | } | | | } | | | } | | | | +-------------------------------------------+---------------------------------------------------------------------------------------+ .. index:: Macro function;fn.get_least_used_site_devicepool * *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 Unified CM DevicePool with the lowest phone count at the submitted site. Example: +-------------------------------------------+--------------------------------+ | :: | :: | | | | | {{ fn.get_least_used_site_devicepool }} | Cu1Si1-CAT-Dallas-SRST-DP1 | | | | +-------------------------------------------+--------------------------------+ .. index:: Macro function;fn.generic_device_model_custom_operation * *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 | {"MAC": "001122AABBCC"} | | \{"extension": "1094"\} | | | }} | | +-----------------------------------------------+----------------------------+ .. |VOSS Automate| replace:: VOSS Automate .. |Unified CM| replace:: Unified CM