cisco-axl 1.4.1 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/ci.yml +39 -0
- package/.github/workflows/release.yml +49 -0
- package/README.md +266 -169
- package/bin/cisco-axl.js +2 -0
- package/cli/commands/add.js +175 -0
- package/cli/commands/config.js +155 -0
- package/cli/commands/describe.js +84 -0
- package/cli/commands/execute.js +173 -0
- package/cli/commands/get.js +93 -0
- package/cli/commands/list.js +216 -0
- package/cli/commands/operations.js +80 -0
- package/cli/commands/remove.js +61 -0
- package/cli/commands/sql.js +110 -0
- package/cli/commands/update.js +185 -0
- package/cli/formatters/csv.js +16 -0
- package/cli/formatters/json.js +12 -0
- package/cli/formatters/table.js +55 -0
- package/cli/formatters/toon.js +15 -0
- package/cli/index.js +42 -0
- package/cli/utils/audit.js +89 -0
- package/cli/utils/config.js +296 -0
- package/cli/utils/connection.js +142 -0
- package/cli/utils/output.js +53 -0
- package/cli/utils/readonly.js +31 -0
- package/cli/utils/template.js +80 -0
- package/dist/index.d.ts +209 -2
- package/dist/index.js +778 -349
- package/dist/index.js.map +1 -1
- package/main.mjs +3 -0
- package/package.json +23 -7
- package/skills/cisco-axl-cli/SKILL.md +179 -0
- package/src/index.ts +909 -369
- package/.claude/settings.local.json +0 -10
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [main]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
build:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
|
|
13
|
+
strategy:
|
|
14
|
+
matrix:
|
|
15
|
+
node-version: [18, 20, 22]
|
|
16
|
+
|
|
17
|
+
steps:
|
|
18
|
+
- uses: actions/checkout@v4
|
|
19
|
+
|
|
20
|
+
- name: Use Node.js ${{ matrix.node-version }}
|
|
21
|
+
uses: actions/setup-node@v4
|
|
22
|
+
with:
|
|
23
|
+
node-version: ${{ matrix.node-version }}
|
|
24
|
+
cache: "npm"
|
|
25
|
+
|
|
26
|
+
- name: Install dependencies
|
|
27
|
+
run: npm ci
|
|
28
|
+
|
|
29
|
+
- name: Type check
|
|
30
|
+
run: npm run type-check
|
|
31
|
+
|
|
32
|
+
- name: Build
|
|
33
|
+
run: npm run build
|
|
34
|
+
|
|
35
|
+
- name: Verify ESM import
|
|
36
|
+
run: node --input-type=module -e "import axlService from './main.mjs'; console.log('ESM import OK');"
|
|
37
|
+
|
|
38
|
+
- name: Verify CJS require
|
|
39
|
+
run: node -e "const axlService = require('./dist/index.js'); console.log('CJS require OK');"
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
name: Release
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags:
|
|
6
|
+
- 'v*'
|
|
7
|
+
|
|
8
|
+
permissions:
|
|
9
|
+
id-token: write # Required for OIDC authentication
|
|
10
|
+
contents: write # Required for creating GitHub Release
|
|
11
|
+
|
|
12
|
+
jobs:
|
|
13
|
+
publish:
|
|
14
|
+
runs-on: ubuntu-latest
|
|
15
|
+
steps:
|
|
16
|
+
- name: Checkout
|
|
17
|
+
uses: actions/checkout@v4
|
|
18
|
+
|
|
19
|
+
- name: Setup Node.js
|
|
20
|
+
uses: actions/setup-node@v4
|
|
21
|
+
with:
|
|
22
|
+
node-version: '22'
|
|
23
|
+
registry-url: 'https://registry.npmjs.org'
|
|
24
|
+
|
|
25
|
+
- name: Update npm
|
|
26
|
+
run: npm install -g npm@latest
|
|
27
|
+
|
|
28
|
+
- name: Install dependencies
|
|
29
|
+
run: npm ci
|
|
30
|
+
|
|
31
|
+
- name: Type check
|
|
32
|
+
run: npm run type-check
|
|
33
|
+
|
|
34
|
+
- name: Build
|
|
35
|
+
run: npm run build
|
|
36
|
+
|
|
37
|
+
- name: Verify ESM import
|
|
38
|
+
run: node --input-type=module -e "import axlService from './main.mjs'; console.log('ESM import OK');"
|
|
39
|
+
|
|
40
|
+
- name: Verify CJS require
|
|
41
|
+
run: node -e "const axlService = require('./dist/index.js'); console.log('CJS require OK');"
|
|
42
|
+
|
|
43
|
+
- name: Publish to npm
|
|
44
|
+
run: npm publish --access public
|
|
45
|
+
|
|
46
|
+
- name: Create GitHub Release
|
|
47
|
+
uses: softprops/action-gh-release@v2
|
|
48
|
+
with:
|
|
49
|
+
generate_release_notes: true
|
package/README.md
CHANGED
|
@@ -1,186 +1,295 @@
|
|
|
1
|
-
# Cisco AXL
|
|
1
|
+
# Cisco AXL Library & CLI
|
|
2
2
|
|
|
3
|
-
A
|
|
3
|
+
A JavaScript library and CLI to interact with Cisco CUCM via AXL SOAP API. Dynamically discovers all AXL operations from the WSDL schema — any operation for your specified version is available without static definitions.
|
|
4
4
|
|
|
5
5
|
Administrative XML (AXL) information can be found at:
|
|
6
6
|
[Administrative XML (AXL) Reference](https://developer.cisco.com/docs/axl/#!axl-developer-guide).
|
|
7
7
|
|
|
8
8
|
## Installation
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
```bash
|
|
11
|
+
npm install cisco-axl
|
|
12
|
+
```
|
|
11
13
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
14
|
+
### Global CLI install
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
npm install -g cisco-axl
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Or run without installing:
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
npx cisco-axl --help
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
### AI Agent Skills
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
npx skillsadd sieteunoseis/cisco-axl
|
|
15
30
|
```
|
|
16
31
|
|
|
17
32
|
## Requirements
|
|
18
33
|
|
|
19
|
-
|
|
34
|
+
If you are using self-signed certificates on Cisco VOS products you may need to disable TLS verification, or use the `--insecure` CLI flag.
|
|
20
35
|
|
|
21
|
-
|
|
36
|
+
Supported CUCM versions: `11.0`, `11.5`, `12.0`, `12.5`, `14.0`, `15.0`
|
|
22
37
|
|
|
23
|
-
|
|
38
|
+
## CLI
|
|
24
39
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
```
|
|
40
|
+
The CLI provides full AXL access from the command line — CRUD operations, SQL queries, operation discovery, bulk provisioning from CSV, and a raw execute escape hatch for any AXL operation.
|
|
41
|
+
|
|
42
|
+
### Quick Start
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
# Configure a cluster
|
|
46
|
+
cisco-axl config add lab --host 10.0.0.1 --username admin --password secret --cucm-version 14.0 --insecure
|
|
47
|
+
|
|
48
|
+
# Test the connection
|
|
49
|
+
cisco-axl config test
|
|
30
50
|
|
|
31
|
-
|
|
51
|
+
# List phones
|
|
52
|
+
cisco-axl list Phone --search "name=SEP%"
|
|
32
53
|
|
|
33
|
-
|
|
54
|
+
# Get a specific phone
|
|
55
|
+
cisco-axl get Phone SEP001122334455 --returned-tags "name,model,description"
|
|
34
56
|
|
|
35
|
-
|
|
36
|
-
|
|
57
|
+
# SQL query
|
|
58
|
+
cisco-axl sql query "SELECT name, description FROM device WHERE name LIKE 'SEP%'"
|
|
59
|
+
|
|
60
|
+
# Discover available operations
|
|
61
|
+
cisco-axl operations --filter phone
|
|
62
|
+
cisco-axl operations --type action --filter phone
|
|
63
|
+
|
|
64
|
+
# Describe what tags an operation needs
|
|
65
|
+
cisco-axl describe getPhone --detailed
|
|
66
|
+
|
|
67
|
+
# Execute any AXL operation
|
|
68
|
+
cisco-axl execute doLdapSync --tags '{"name":"LDAP_Main"}'
|
|
37
69
|
```
|
|
38
70
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
71
|
+
### Commands
|
|
72
|
+
|
|
73
|
+
| Command | Description |
|
|
74
|
+
|---------|-------------|
|
|
75
|
+
| `config add/use/list/show/remove/test` | Manage multi-cluster configurations |
|
|
76
|
+
| `get <type> <identifier>` | Get a single item |
|
|
77
|
+
| `list <type>` | List items with search, pagination, returned tags |
|
|
78
|
+
| `add <type>` | Add an item (inline JSON, template, or bulk CSV) |
|
|
79
|
+
| `update <type> <identifier>` | Update an item |
|
|
80
|
+
| `remove <type> <identifier>` | Remove an item |
|
|
81
|
+
| `sql query/update` | Execute SQL against CUCM |
|
|
82
|
+
| `execute <operation>` | Run any raw AXL operation |
|
|
83
|
+
| `operations` | List available operations with `--filter` and `--type crud\|action` |
|
|
84
|
+
| `describe <operation>` | Show tag schema with `--detailed` for required/optional/type info |
|
|
85
|
+
|
|
86
|
+
### Configuration
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
# Multiple clusters
|
|
90
|
+
cisco-axl config add lab --host 10.0.0.1 --username admin --password secret --cucm-version 14.0 --insecure
|
|
91
|
+
cisco-axl config add prod --host 10.0.0.2 --username axladmin --password secret --cucm-version 15.0 --insecure
|
|
92
|
+
cisco-axl config use prod
|
|
93
|
+
cisco-axl config list
|
|
94
|
+
|
|
95
|
+
# Per-command cluster override
|
|
96
|
+
cisco-axl list Phone --search "name=SEP%" --cluster lab
|
|
97
|
+
|
|
98
|
+
# Environment variables (CI/CD, AI agents)
|
|
99
|
+
export CUCM_HOST=10.0.0.1 CUCM_USERNAME=admin CUCM_PASSWORD=secret CUCM_VERSION=14.0
|
|
100
|
+
```
|
|
43
101
|
|
|
44
|
-
|
|
102
|
+
Config stored at `~/.cisco-axl/config.json`. Supports optional [Secret Server](https://github.com/sieteunoseis/ss-cli) integration via `<ss:ID:field>` placeholders.
|
|
45
103
|
|
|
46
|
-
|
|
104
|
+
### Output Formats
|
|
47
105
|
|
|
48
|
-
|
|
49
|
-
-
|
|
50
|
-
-
|
|
51
|
-
-
|
|
52
|
-
-
|
|
53
|
-
|
|
54
|
-
- Debug logging capabilities to help troubleshoot API interactions by setting the DEBUG environment variable
|
|
106
|
+
```bash
|
|
107
|
+
cisco-axl list Phone --search "name=SEP%" --format table # default, human-readable
|
|
108
|
+
cisco-axl list Phone --search "name=SEP%" --format json # structured JSON
|
|
109
|
+
cisco-axl list Phone --search "name=SEP%" --format toon # token-efficient for AI agents
|
|
110
|
+
cisco-axl list Phone --search "name=SEP%" --format csv # spreadsheet export
|
|
111
|
+
```
|
|
55
112
|
|
|
56
|
-
|
|
113
|
+
### Bulk Operations from CSV
|
|
57
114
|
|
|
58
|
-
|
|
59
|
-
const axlService = require("cisco-axl");
|
|
115
|
+
Requires optional packages: `npm install json-variables csv-parse`
|
|
60
116
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
117
|
+
```bash
|
|
118
|
+
# Bulk add phones from template + CSV
|
|
119
|
+
cisco-axl add Phone --template phone-template.json --csv phones.csv
|
|
120
|
+
cisco-axl add Phone --template phone-template.json --csv phones.csv --dry-run # preview first
|
|
121
|
+
|
|
122
|
+
# Single template with inline vars
|
|
123
|
+
cisco-axl add Phone --template phone-template.json --vars '{"mac":"001122334455","dp":"DP_HQ"}'
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
Template file (`phone-template.json`):
|
|
127
|
+
```json
|
|
128
|
+
{
|
|
129
|
+
"name": "SEP%%mac%%",
|
|
130
|
+
"devicePoolName": "%%devicePool%%",
|
|
131
|
+
"description": "%%description%%",
|
|
132
|
+
"protocol": "SIP"
|
|
133
|
+
}
|
|
134
|
+
```
|
|
74
135
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
136
|
+
### Global Flags
|
|
137
|
+
|
|
138
|
+
```
|
|
139
|
+
--format table|json|toon|csv Output format (default: table)
|
|
140
|
+
--insecure Skip TLS certificate verification
|
|
141
|
+
--clean Remove empty/null values from results
|
|
142
|
+
--no-attributes Remove XML attributes from results
|
|
143
|
+
--read-only Restrict to read-only operations
|
|
144
|
+
--no-audit Disable audit logging for this command
|
|
145
|
+
--debug Enable debug logging
|
|
83
146
|
```
|
|
84
147
|
|
|
85
|
-
|
|
148
|
+
### Audit Trail
|
|
86
149
|
|
|
87
|
-
-
|
|
88
|
-
- axlService.testAuthentication()
|
|
89
|
-
- axlService.returnOperations(filter?: string)
|
|
90
|
-
- axlService.getOperationTags(operation: string)
|
|
91
|
-
- axlService.executeOperation(operation: string,tags: obj, opts?: obj)
|
|
150
|
+
All operations are logged to `~/.cisco-axl/audit.jsonl` (JSONL format). Credentials are never logged. Use `--no-audit` to skip.
|
|
92
151
|
|
|
93
|
-
|
|
152
|
+
## Library API
|
|
94
153
|
|
|
95
|
-
|
|
154
|
+
### Setup
|
|
155
|
+
|
|
156
|
+
```javascript
|
|
157
|
+
const axlService = require("cisco-axl");
|
|
96
158
|
|
|
97
|
-
```node
|
|
98
159
|
let service = new axlService("10.10.20.1", "administrator", "ciscopsdt", "14.0");
|
|
160
|
+
|
|
161
|
+
// With options
|
|
162
|
+
let service = new axlService("10.10.20.1", "administrator", "ciscopsdt", "14.0", {
|
|
163
|
+
logging: { level: "info" },
|
|
164
|
+
retry: { retries: 3, retryDelay: 1000 }
|
|
165
|
+
});
|
|
99
166
|
```
|
|
100
167
|
|
|
101
|
-
###
|
|
168
|
+
### Logging
|
|
102
169
|
|
|
103
|
-
|
|
170
|
+
```javascript
|
|
171
|
+
// Via environment variable
|
|
172
|
+
// DEBUG=true
|
|
173
|
+
|
|
174
|
+
// Via constructor
|
|
175
|
+
let service = new axlService("10.10.20.1", "administrator", "ciscopsdt", "14.0", {
|
|
176
|
+
logging: {
|
|
177
|
+
level: "info", // "error" | "warn" | "info" | "debug"
|
|
178
|
+
handler: (level, message, data) => {
|
|
179
|
+
myLogger[level](message, data);
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
});
|
|
104
183
|
|
|
105
|
-
|
|
106
|
-
service.
|
|
107
|
-
.then((success) => {
|
|
108
|
-
console.log('Authentication successful');
|
|
109
|
-
})
|
|
110
|
-
.catch((error) => {
|
|
111
|
-
console.error('Authentication failed:', error.message);
|
|
112
|
-
});
|
|
184
|
+
// Change at runtime
|
|
185
|
+
service.setLogLevel("debug");
|
|
113
186
|
```
|
|
114
187
|
|
|
115
|
-
###
|
|
188
|
+
### Convenience Methods
|
|
116
189
|
|
|
117
|
-
|
|
190
|
+
```javascript
|
|
191
|
+
// Get a single item by name or UUID
|
|
192
|
+
await service.getItem("Phone", "SEP001122334455");
|
|
193
|
+
await service.getItem("Phone", { uuid: "abc-123" });
|
|
194
|
+
|
|
195
|
+
// List items with search criteria and returned tags
|
|
196
|
+
await service.listItems("RoutePartition"); // all partitions
|
|
197
|
+
await service.listItems("Phone", { name: "SEP%" }, { name: "", model: "" });
|
|
198
|
+
|
|
199
|
+
// Add, update, remove
|
|
200
|
+
await service.addItem("RoutePartition", { name: "NEW-PT", description: "New" });
|
|
201
|
+
await service.updateItem("Phone", "SEP001122334455", { description: "Updated" });
|
|
202
|
+
await service.removeItem("RoutePartition", "NEW-PT");
|
|
203
|
+
|
|
204
|
+
// SQL
|
|
205
|
+
const rows = await service.executeSqlQuery("SELECT name FROM routepartition");
|
|
206
|
+
await service.executeSqlUpdate("UPDATE routepartition SET description='test' WHERE name='NEW-PT'");
|
|
207
|
+
```
|
|
118
208
|
|
|
119
|
-
|
|
120
|
-
| :--------------- | :------- | :----- | :--------- | :---------------------------------- |
|
|
121
|
-
| returnOperations | filter | string | No | Provide a string to filter results. |
|
|
209
|
+
### Operation Discovery
|
|
122
210
|
|
|
123
|
-
|
|
211
|
+
```javascript
|
|
212
|
+
// List all operations
|
|
213
|
+
const ops = await service.returnOperations();
|
|
214
|
+
const phoneOps = await service.returnOperations("phone");
|
|
124
215
|
|
|
125
|
-
|
|
216
|
+
// Get tag schema
|
|
217
|
+
const tags = await service.getOperationTags("addRoutePartition");
|
|
126
218
|
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
219
|
+
// Get detailed metadata (required, nillable, type)
|
|
220
|
+
const detailed = await service.getOperationTagsDetailed("addRoutePartition");
|
|
221
|
+
console.log(detailed.routePartition.required); // true
|
|
222
|
+
console.log(detailed.routePartition.children.name.type); // "string"
|
|
223
|
+
```
|
|
130
224
|
|
|
131
|
-
###
|
|
225
|
+
### Execute Any Operation
|
|
132
226
|
|
|
133
|
-
|
|
227
|
+
```javascript
|
|
228
|
+
const tags = await service.getOperationTags("addRoutePartition");
|
|
229
|
+
tags.routePartition.name = "INTERNAL-PT";
|
|
230
|
+
tags.routePartition.description = "Internal directory numbers";
|
|
134
231
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
| clean | boolean | Default: **false**. Allows method to remove all tags that have no values from return data. |
|
|
139
|
-
| removeAttributes | boolean | Default: **false**. Allows method to remove all attributes tags return data. |
|
|
140
|
-
| dataContainerIdentifierTails | string | Default: **'\_data'**. executeOperation will automatically remove any tag with the defined string. This is used with json-variables library. |
|
|
232
|
+
const result = await service.executeOperation("addRoutePartition", tags);
|
|
233
|
+
console.log("UUID:", result);
|
|
234
|
+
```
|
|
141
235
|
|
|
142
|
-
|
|
236
|
+
### Batch Operations
|
|
143
237
|
|
|
144
|
-
```
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
238
|
+
```javascript
|
|
239
|
+
const results = await service.executeBatch([
|
|
240
|
+
{ operation: "getPhone", tags: { name: "SEP001122334455" } },
|
|
241
|
+
{ operation: "getPhone", tags: { name: "SEP556677889900" } },
|
|
242
|
+
], 5); // concurrency limit
|
|
243
|
+
|
|
244
|
+
results.forEach((r) => {
|
|
245
|
+
console.log(r.success ? `${r.operation}: OK` : `${r.operation}: ${r.error.message}`);
|
|
246
|
+
});
|
|
150
247
|
```
|
|
151
248
|
|
|
152
|
-
|
|
153
|
-
| :--------------- | :-------- | :----- | :--------- | :--------------------------------------------------------- |
|
|
154
|
-
| executeOperation | operation | string | Yes | Provide the name of the AXL operation you wish to execute. |
|
|
155
|
-
| executeOperation | tags | object | Yes | Provide a JSON object of the tags for your operation. |
|
|
156
|
-
| executeOperation | opts | object | No | Provide a JSON object of options for your operation. |
|
|
157
|
-
|
|
158
|
-
## Examples
|
|
249
|
+
### Error Handling
|
|
159
250
|
|
|
160
|
-
|
|
251
|
+
```javascript
|
|
252
|
+
const { AXLAuthError, AXLNotFoundError, AXLOperationError, AXLValidationError } = require("cisco-axl");
|
|
253
|
+
|
|
254
|
+
try {
|
|
255
|
+
await service.executeOperation("getPhone", { name: "INVALID" });
|
|
256
|
+
} catch (error) {
|
|
257
|
+
if (error instanceof AXLAuthError) console.log("Bad credentials");
|
|
258
|
+
else if (error instanceof AXLNotFoundError) console.log("Operation not found:", error.operation);
|
|
259
|
+
else if (error instanceof AXLOperationError) console.log("SOAP fault:", error.message);
|
|
260
|
+
else if (error instanceof AXLValidationError) console.log("Invalid input:", error.message);
|
|
261
|
+
}
|
|
262
|
+
```
|
|
161
263
|
|
|
162
|
-
|
|
264
|
+
### Retry Configuration
|
|
163
265
|
|
|
164
266
|
```javascript
|
|
165
|
-
|
|
267
|
+
let service = new axlService("10.10.20.1", "admin", "pass", "14.0", {
|
|
268
|
+
retry: {
|
|
269
|
+
retries: 3,
|
|
270
|
+
retryDelay: 1000,
|
|
271
|
+
retryOn: (error) => error.message.includes("ECONNRESET")
|
|
272
|
+
}
|
|
273
|
+
});
|
|
166
274
|
```
|
|
167
275
|
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
## json-variables support
|
|
276
|
+
### ESM Support
|
|
171
277
|
|
|
172
|
-
|
|
278
|
+
```javascript
|
|
279
|
+
// CommonJS
|
|
280
|
+
const axlService = require("cisco-axl");
|
|
173
281
|
|
|
174
|
-
|
|
282
|
+
// ESM
|
|
283
|
+
import axlService from "cisco-axl";
|
|
284
|
+
import { AXLAuthError, AXLOperationError } from "cisco-axl";
|
|
285
|
+
```
|
|
175
286
|
|
|
176
|
-
|
|
287
|
+
### json-variables Support
|
|
177
288
|
|
|
178
|
-
```
|
|
289
|
+
```javascript
|
|
179
290
|
var lineTemplate = {
|
|
180
291
|
pattern: "%%_extension_%%",
|
|
181
|
-
routePartitionName: "",
|
|
182
292
|
alertingName: "%%_firstName_%% %%_lastName_%%",
|
|
183
|
-
asciiAlertingName: "%%_firstName_%% %%_lastName_%%",
|
|
184
293
|
description: "%%_firstName_%% %%_lastName_%%",
|
|
185
294
|
_data: {
|
|
186
295
|
extension: "1001",
|
|
@@ -190,71 +299,59 @@ var lineTemplate = {
|
|
|
190
299
|
};
|
|
191
300
|
|
|
192
301
|
const lineTags = jVar(lineTemplate);
|
|
193
|
-
|
|
194
|
-
service
|
|
195
|
-
.executeOperation("updateLine", lineTags)
|
|
196
|
-
.then((results) => {
|
|
197
|
-
console.log(results);
|
|
198
|
-
})
|
|
199
|
-
.catch((error) => {
|
|
200
|
-
console.log(error);
|
|
201
|
-
});
|
|
302
|
+
await service.executeOperation("updateLine", lineTags);
|
|
202
303
|
```
|
|
203
304
|
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
305
|
+
## Methods Reference
|
|
306
|
+
|
|
307
|
+
### Core
|
|
308
|
+
|
|
309
|
+
| Method | Description |
|
|
310
|
+
|--------|-------------|
|
|
311
|
+
| `new axlService(host, user, pass, version, opts?)` | Constructor |
|
|
312
|
+
| `testAuthentication()` | Test credentials against AXL endpoint |
|
|
313
|
+
| `returnOperations(filter?)` | List available operations |
|
|
314
|
+
| `getOperationTags(operation)` | Get tag schema for an operation |
|
|
315
|
+
| `getOperationTagsDetailed(operation)` | Get detailed tag metadata (required/nillable/type) |
|
|
316
|
+
| `executeOperation(operation, tags, opts?)` | Execute any AXL operation |
|
|
317
|
+
| `executeBatch(operations[], concurrency?)` | Parallel batch execution |
|
|
318
|
+
| `setLogLevel(level)` | Change log level at runtime |
|
|
319
|
+
|
|
320
|
+
### Convenience
|
|
321
|
+
|
|
322
|
+
| Method | Description |
|
|
323
|
+
|--------|-------------|
|
|
324
|
+
| `getItem(type, identifier, opts?)` | Get single item by name or UUID |
|
|
325
|
+
| `listItems(type, search?, returnedTags?, opts?)` | List items with filtering |
|
|
326
|
+
| `addItem(type, data, opts?)` | Add a new item |
|
|
327
|
+
| `updateItem(type, identifier, updates, opts?)` | Update an existing item |
|
|
328
|
+
| `removeItem(type, identifier, opts?)` | Remove an item |
|
|
329
|
+
| `executeSqlQuery(sql)` | Run a SQL SELECT query |
|
|
330
|
+
| `executeSqlUpdate(sql)` | Run a SQL INSERT/UPDATE/DELETE |
|
|
207
331
|
|
|
208
|
-
|
|
209
|
-
...
|
|
210
|
-
const lineTags = jVar(lineTemplate,{ dataContainerIdentifierTails: "_variables"});
|
|
332
|
+
## Examples
|
|
211
333
|
|
|
212
|
-
|
|
213
|
-
...
|
|
214
|
-
```
|
|
334
|
+
Check the **examples** folder for different ways to use this library.
|
|
215
335
|
|
|
216
|
-
|
|
336
|
+
Run the integration tests against a CUCM cluster:
|
|
217
337
|
|
|
218
|
-
|
|
338
|
+
```bash
|
|
339
|
+
npm run staging
|
|
340
|
+
```
|
|
219
341
|
|
|
220
342
|
## TypeScript Support
|
|
221
343
|
|
|
222
|
-
This library includes TypeScript declarations to provide type safety and improved developer experience.
|
|
223
|
-
|
|
224
|
-
### TypeScript Usage
|
|
225
|
-
|
|
226
344
|
```typescript
|
|
227
345
|
import axlService from 'cisco-axl';
|
|
228
346
|
|
|
229
|
-
const service = new axlService(
|
|
230
|
-
"10.10.20.1",
|
|
231
|
-
"administrator",
|
|
232
|
-
"ciscopsdt",
|
|
233
|
-
"14.0"
|
|
234
|
-
);
|
|
235
|
-
|
|
236
|
-
async function getPartitions() {
|
|
237
|
-
try {
|
|
238
|
-
const operation = "listRoutePartition";
|
|
239
|
-
const tags = await service.getOperationTags(operation);
|
|
240
|
-
tags.searchCriteria.name = "%%";
|
|
241
|
-
|
|
242
|
-
const result = await service.executeOperation(operation, tags);
|
|
243
|
-
return result.routePartition;
|
|
244
|
-
} catch (error) {
|
|
245
|
-
console.error("Error fetching partitions:", error);
|
|
246
|
-
throw error;
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
|
-
```
|
|
250
|
-
|
|
251
|
-
See the `examples/typescript` directory for more TypeScript examples.
|
|
347
|
+
const service = new axlService("10.10.20.1", "administrator", "ciscopsdt", "14.0");
|
|
252
348
|
|
|
253
|
-
|
|
349
|
+
const tags = await service.getOperationTags("listRoutePartition");
|
|
350
|
+
tags.searchCriteria.name = "%%";
|
|
351
|
+
const result = await service.executeOperation("listRoutePartition", tags);
|
|
352
|
+
```
|
|
254
353
|
|
|
255
|
-
|
|
256
|
-
- Add example for reading in CSV and performing a bulk exercise with variables.
|
|
257
|
-
- Add example for saving SQL output to CSV.
|
|
354
|
+
See the `examples/typescript` directory for more examples.
|
|
258
355
|
|
|
259
356
|
## Giving Back
|
|
260
357
|
|
package/bin/cisco-axl.js
ADDED