A Javascript library to pull AXL data Cisco CUCM via SOAP. The goal of this project is to make it easier for people to use AXL and to include all functionality of AXL. This library utilizes strong-soap to read Cisco's WSDL file. As a result this library can use any function in the schema for the version that you specify.
Administrative XML (AXL) information can be found at:
Administrative XML (AXL) Reference.
Using npm:
npm i -g npm npm i --save cisco-axl
This package uses the built in Fetch API of Node. This feature was first introduced in Node v16.15.0. You may need to enable expermential vm module. Also you can disable warnings with an optional enviromental variable.
Also if you are using self signed certificates on Cisco VOS products you may need to disable TLS verification. This makes TLS, and HTTPS by extension, insecure. The use of this environment variable is strongly discouraged. Please only do this in a lab enviroment.
Suggested enviromental variables:
NODE_OPTIONS=--experimental-vm-modules NODE_NO_WARNINGS=1 NODE_TLS_REJECT_UNAUTHORIZED=0
const axlService = require("cisco-axl"); let service = new axlService("10.10.20.1", "administrator", "ciscopsdt","14.0"); var operation = "addRoutePartition"; var tags = { routePartition: { name: "INTERNAL-PT", description: "Internal directory numbers", timeScheduleIdName: "", useOriginatingDeviceTimeZone: "", timeZone: "", partitionUsage: "", }, }; service .executeOperation(operation, tags) .then((results) => { console.log("addRoutePartition UUID", results); }) .catch((error) => { console.log(error); });
Service constructor for methods. Requires a JSON object consisting of hostname, username, password and version.
let service = new axlService("10.10.20.1", "administrator", "ciscopsdt", "14.0");
Method takes optional argument to filter results. No argument returns all operations. Returns results via Promise.
Method | Argument | Type | Obligatory | Description |
---|---|---|---|---|
returnOperations | filter | string | No | Provide a string to filter results. |
Method requires passing an AXL operation. Returns results via Promise.
Method | Argument | Type | Obligatory | Description |
---|---|---|---|---|
getOperationTags | operation | string | Yes | Provide the name of the AXL operation you wish to retrieve the tags for. |
Method requires passing an AXL operation and JSON object of tags. Returns results via Promise.
Current options include:
option | type | description |
---|---|---|
clean | boolean | Default: false. Allows method to remove all tags that have no values from return data. |
removeAttributes | boolean | Default: false. Allows method to remove all attributes tags return data. |
dataContainerIdentifierTails | string | Default: '_data'. executeOperation will automatically remove any tag with the defined string. This is used with json-variables library. |
Example:
var opts = { clean: true, removeAttributes: false, dataContainerIdentifierTails: "_data", };
Method | Argument | Type | Obligatory | Description |
---|---|---|---|---|
executeOperation | operation | string | Yes | Provide the name of the AXL operation you wish to execute. |
executeOperation | tags | object | Yes | Provide a JSON object of the tags for your operation. |
executeOperation | opts | object | No | Provide a JSON object of options for your operation. |
Check examples folder for different ways to use this library. Each folder should have a README to explain about each example.
You can also run the tests.js against Cisco's DevNet sandbox so see how each various method works.
npm run test
Note: Test are using Cisco's DevNet sandbox information. Find more information here: Cisco DevNet.
At a tactical level, json-variables program lets you take a plain object (JSON files contents) and add special markers in any value which you can then reference in a different path.
This library will recoginize json-variables *_data keys in the tags and delete before executing the operation.
Example:
var lineTemplate = { pattern: "%%_extension_%%", routePartitionName: "", alertingName: "%%_firstName_%% %%_lastName_%%", asciiAlertingName: "%%_firstName_%% %%_lastName_%%", description: "%%_firstName_%% %%_lastName_%%", _data: { extension: "1001", firstName: "Tom", lastName: "Smith", }, }; const lineTags = jVar(lineTemplate); service .executeOperation("updateLine", lineTags) .then((results) => { console.log(results); }) .catch((error) => { console.log(error); });
Note: If you need to change the variables key you can so via options in both the json-variables and with executeOperations.
Example:
... const lineTags = jVar(lineTemplate,{ dataContainerIdentifierTails: "_variables"}); service.executeOperation("updateLine", lineTags,{ dataContainerIdentifierTails: "_variables"}) ...
Currently there is an issue with strong-soap regarding returning nillable values for element tags. These values show if a particular tags is optional or not. Once resolved a method will be added to return tags nillable status (true or false).
If you would like to support my work and the time I put in creating the code, you can click the image below to get me a coffee. I would really appreciate it (but is not required).
Owner
Contributors
Categories
Products
Cisco Unified Communications Manager (CUCM)Programming Languages
JavaScriptLicense
Code Exchange Community
Get help, share code, and collaborate with other developers in the Code Exchange community.View Community