cisco-axl-cli
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseCisco AXL CLI
Cisco AXL CLI
A CLI for Cisco Unified Communications Manager (CUCM) Administrative XML (AXL) operations.
一个用于执行Cisco Unified Communications Manager (CUCM) 管理XML (AXL) 操作的CLI工具。
Setup
安装配置
The CLI must be available. Either:
bash
undefined需先确保CLI可用,可选择以下任意一种方式:
bash
undefinedOption 1: Use npx (no install needed, works immediately)
选项1:使用npx(无需安装,可直接运行)
npx cisco-axl --help
npx cisco-axl --help
Option 2: Install globally for faster repeated use
选项2:全局安装,便于重复快速使用
npm install -g cisco-axl
If using npx, prefix all commands with `npx`: `npx cisco-axl list Phone ...`
If installed globally, use directly: `cisco-axl list Phone ...`npm install -g cisco-axl
如果使用npx,所有命令前需添加`npx`前缀:`npx cisco-axl list Phone ...`
如果已全局安装,可直接使用:`cisco-axl list Phone ...`Configuration
配置项
Configure a CUCM cluster (interactive prompt for password — never pass credentials on the command line):
bash
cisco-axl config add <name> --host <hostname> --username <user> --cucm-version <ver> --insecure配置CUCM集群(交互式输入密码,永远不要在命令行中传递凭据):
bash
cisco-axl config add <name> --host <hostname> --username <user> --cucm-version <ver> --insecureYou will be prompted securely for the password
系统将安全地提示你输入密码
Valid versions: 11.0, 11.5, 12.0, 12.5, 14.0, 15.0. Use `--insecure` for self-signed certificates (common in CUCM).
Or use environment variables (set via your shell profile, a `.env` file, or a secrets manager — never hardcode credentials):
```bash
支持的版本:11.0, 11.5, 12.0, 12.5, 14.0, 15.0。如果使用自签名证书(CUCM环境中十分常见)请添加`--insecure`参数。
也可使用环境变量(通过shell配置文件、`.env`文件或者密钥管理器设置,永远不要硬编码凭据):
```bashThese should be set securely, e.g. via dotenv, vault, or shell profile
这些变量需要安全设置,例如通过dotenv、vault或者shell配置文件
CUCM_HOST, CUCM_USERNAME, CUCM_PASSWORD, CUCM_VERSION
CUCM_HOST, CUCM_USERNAME, CUCM_PASSWORD, CUCM_VERSION
Test the connection:
```bash
cisco-axl config test
测试连接:
```bash
cisco-axl config testCommon Workflows
常用工作流
Get a single item
获取单个条目
bash
cisco-axl get Phone SEP001122334455
cisco-axl get Line 1001
cisco-axl get RoutePartition PT_INTERNAL
cisco-axl get Phone SEP001122334455 --returned-tags "name,model,description"bash
cisco-axl get Phone SEP001122334455
cisco-axl get Line 1001
cisco-axl get RoutePartition PT_INTERNAL
cisco-axl get Phone SEP001122334455 --returned-tags "name,model,description"List items with search
带搜索条件列出条目
bash
cisco-axl list Phone --search "name=SEP%"
cisco-axl list Line --search "pattern=1%"
cisco-axl list Css --search "name=CSS_%"
cisco-axl list Phone --search "name=SEP%" --returned-tags "name,description" --format toon
cisco-axl list Phone --search "name=SEP%" --auto-page --max-results 5000bash
cisco-axl list Phone --search "name=SEP%"
cisco-axl list Line --search "pattern=1%"
cisco-axl list Css --search "name=CSS_%"
cisco-axl list Phone --search "name=SEP%" --returned-tags "name,description" --format toon
cisco-axl list Phone --search "name=SEP%" --auto-page --max-results 5000Add an item
添加条目
bash
cisco-axl add RoutePartition --data '{"name":"PT_INTERNAL","description":"Internal partition"}'bash
cisco-axl add RoutePartition --data '{"name":"PT_INTERNAL","description":"Internal partition"}'Update an item
更新条目
bash
cisco-axl update Phone SEP001122334455 --data '{"description":"Updated description"}'bash
cisco-axl update Phone SEP001122334455 --data '{"description":"Updated description"}'Remove an item
删除条目
bash
cisco-axl remove RoutePartition PT_INTERNALbash
cisco-axl remove RoutePartition PT_INTERNALSQL queries
SQL查询
bash
cisco-axl sql query "SELECT name, description FROM device WHERE name LIKE 'SEP%'"
cisco-axl sql update "UPDATE device SET description='test' WHERE name='SEP001122334455'"bash
cisco-axl sql query "SELECT name, description FROM device WHERE name LIKE 'SEP%'"
cisco-axl sql update "UPDATE device SET description='test' WHERE name='SEP001122334455'"Discovering Operations
操作发现
This is the CLI's most powerful feature. Discover and use ANY AXL operation dynamically — no static command definitions.
这是本CLI最强大的功能,可动态发现并使用任意AXL操作,无需静态定义命令。
Step 1: Find operations
步骤1:查找操作
bash
cisco-axl operations --filter phone
cisco-axl operations --filter ldap
cisco-axl operations --type action --filter phone # apply, reset, restart, etc.
cisco-axl operations --type crud # add, get, list, update, removebash
cisco-axl operations --filter phone
cisco-axl operations --filter ldap
cisco-axl operations --type action --filter phone # apply、reset、restart等操作
cisco-axl operations --type crud # add、get、list、update、remove操作Step 2: See what tags an operation needs
步骤2:查看操作需要的参数标签
bash
cisco-axl describe getPhone
cisco-axl describe addLine --detailed # shows required/optional/typesbash
cisco-axl describe getPhone
cisco-axl describe addLine --detailed # 展示必填/可选参数及类型Step 3: Execute it
步骤3:执行操作
bash
cisco-axl execute doLdapSync --tags '{"name":"LDAP_Main"}'
cisco-axl execute applyPhone --tags '{"name":"SEP001122334455"}'bash
cisco-axl execute doLdapSync --tags '{"name":"LDAP_Main"}'
cisco-axl execute applyPhone --tags '{"name":"SEP001122334455"}'Bulk Operations from CSV
从CSV执行批量操作
For provisioning multiple items, use templates with CSV files. Requires optional packages:
npm install json-variables csv-parse如需部署多个条目,可结合CSV文件使用模板。需要先安装可选依赖包:
npm install json-variables csv-parseCreate a template (phone-template.json):
创建模板(phone-template.json):
json
{
"name": "SEP%%mac%%",
"devicePoolName": "%%devicePool%%",
"description": "%%description%%",
"class": "Phone",
"protocol": "SIP"
}json
{
"name": "SEP%%mac%%",
"devicePoolName": "%%devicePool%%",
"description": "%%description%%",
"class": "Phone",
"protocol": "SIP"
}Create a CSV (phones.csv):
创建CSV文件(phones.csv):
csv
mac,devicePool,description
001122334455,DP_HQ,Lobby Phone
001122334466,DP_BRANCH,Conf Room Acsv
mac,devicePool,description
001122334455,DP_HQ,Lobby Phone
001122334466,DP_BRANCH,Conf Room ARun bulk add:
运行批量添加:
bash
cisco-axl add Phone --template phone-template.json --csv phones.csv
cisco-axl add Phone --template phone-template.json --csv phones.csv --dry-run # preview first
cisco-axl add Phone --template phone-template.json --csv phones.csv --concurrency 10bash
cisco-axl add Phone --template phone-template.json --csv phones.csv
cisco-axl add Phone --template phone-template.json --csv phones.csv --dry-run # 先预览效果
cisco-axl add Phone --template phone-template.json --csv phones.csv --concurrency 10Single template with inline vars:
单个模板搭配内联变量:
bash
cisco-axl add Phone --template phone-template.json --vars '{"mac":"001122334455","devicePool":"DP_HQ","description":"Lobby"}'bash
cisco-axl add Phone --template phone-template.json --vars '{"mac":"001122334455","devicePool":"DP_HQ","description":"Lobby"}'Bulk updates and execute too:
也支持批量更新和批量执行:
bash
cisco-axl update Phone --template update-template.json --csv updates.csv
cisco-axl execute addLine --template line-template.json --csv lines.csvbash
cisco-axl update Phone --template update-template.json --csv updates.csv
cisco-axl execute addLine --template line-template.json --csv lines.csvOutput Formats
输出格式
Use to control output:
--format- — human-readable tables (default)
--format table - — structured JSON for parsing
--format json - — token-efficient format (recommended for AI agents, ~40% fewer tokens than JSON)
--format toon - — CSV for spreadsheet export
--format csv
For AI agents: Use for list queries to reduce token usage. Use when you need to parse nested structures.
--format toon--format json使用参数控制输出格式:
--format- — 人类易读的表格形式(默认)
--format table - — 结构化JSON,可用于解析
--format json - — 低token格式(推荐AI Agent使用,比JSON少约40%的token)
--format toon - — CSV格式,可导出到电子表格
--format csv
针对AI Agent: 列表查询时使用减少token消耗,需要解析嵌套结构时使用。
--format toon--format jsonMultiple Clusters
多集群管理
bash
cisco-axl config add lab --host 10.0.0.1 --username admin --cucm-version 14.0 --insecure
cisco-axl config add prod --host 10.0.0.2 --username axladmin --cucm-version 15.0 --insecurebash
cisco-axl config add lab --host 10.0.0.1 --username admin --cucm-version 14.0 --insecure
cisco-axl config add prod --host 10.0.0.2 --username axladmin --cucm-version 15.0 --insecureYou will be prompted securely for each password
系统将安全地提示你输入每个集群的密码
cisco-axl config use prod
cisco-axl list Phone --search "name=SEP%" --cluster lab # override per-command
undefinedcisco-axl config use prod
cisco-axl list Phone --search "name=SEP%" --cluster lab # 单条命令指定集群覆盖默认配置
undefinedCommand Chaining
命令链式执行
Shell chains commands sequentially — each waits for the previous to complete, and the chain stops on the first failure:
&&bash
undefinedShell的可按顺序执行命令,每个命令等待上一个完成,遇到第一个错误就终止执行链:
&&bash
undefinedCreate a partition, CSS, and line in order
按顺序创建分区、CSS和线路
cisco-axl add RoutePartition --data '{"name":"PT_INTERNAL","description":"Internal"}' &&
cisco-axl add Css --data '{"name":"CSS_INTERNAL","members":{"member":{"routePartitionName":"PT_INTERNAL","index":"1"}}}' &&
cisco-axl add Line --data '{"pattern":"1000","routePartitionName":"PT_INTERNAL"}'
cisco-axl add Css --data '{"name":"CSS_INTERNAL","members":{"member":{"routePartitionName":"PT_INTERNAL","index":"1"}}}' &&
cisco-axl add Line --data '{"pattern":"1000","routePartitionName":"PT_INTERNAL"}'
undefinedcisco-axl add RoutePartition --data '{"name":"PT_INTERNAL","description":"Internal"}' &&
cisco-axl add Css --data '{"name":"CSS_INTERNAL","members":{"member":{"routePartitionName":"PT_INTERNAL","index":"1"}}}' &&
cisco-axl add Line --data '{"pattern":"1000","routePartitionName":"PT_INTERNAL"}'
cisco-axl add Css --data '{"name":"CSS_INTERNAL","members":{"member":{"routePartitionName":"PT_INTERNAL","index":"1"}}}' &&
cisco-axl add Line --data '{"pattern":"1000","routePartitionName":"PT_INTERNAL"}'
undefinedPiping with --stdin
结合--stdin使用管道
Use to pipe JSON between commands or from other tools:
--stdinbash
undefined使用参数可在命令之间或者从其他工具传递JSON:
--stdinbash
undefinedGet a phone's config, modify it with jq, update it
获取话机配置,用jq修改后更新配置
cisco-axl get Phone SEP001122334455 --format json | jq '.description = "Updated via pipe"' | cisco-axl update Phone SEP001122334455 --stdin
cisco-axl get Phone SEP001122334455 --format json | jq '.description = "Updated via pipe"' | cisco-axl update Phone SEP001122334455 --stdin
Pipe JSON from a file
从文件读取JSON通过管道传递
cat phone-config.json | cisco-axl add Phone --stdin
cat phone-config.json | cisco-axl add Phone --stdin
Chain get → transform → execute
链式执行获取→转换→执行流程
cisco-axl describe applyPhone --format json | jq '.name = "SEP001122334455"' | cisco-axl execute applyPhone --stdin
The `--stdin` flag is available on `add`, `update`, and `execute` commands. It is mutually exclusive with `--data`/`--tags` and `--template`.cisco-axl describe applyPhone --format json | jq '.name = "SEP001122334455"' | cisco-axl execute applyPhone --stdin
`--stdin`参数可用于`add`、`update`和`execute`命令,它与`--data`/`--tags`以及`--template`参数互斥。Global Flags
全局参数
- Item types are PascalCase matching AXL: ,
Phone,Line,RoutePartition,Css,DevicePool,SipTrunk,TransPattern,RouteGroup, etc.RouteList - Use to discover exact type names.
cisco-axl operations - Use to learn required vs optional tags.
cisco-axl describe <operation> --detailed --format json - The flag removes empty/null values from results.
--clean - The flag removes XML attribute metadata.
--no-attributes - The flag is needed for most CUCM environments (self-signed certs).
--insecure - All operations are audit-logged to . Use
~/.cisco-axl/audit.jsonlto skip.--no-audit - Use with templates to preview resolved JSON before executing.
--dry-run
- 条目类型采用PascalCase命名,与AXL规范一致:、
Phone、Line、RoutePartition、Css、DevicePool、SipTrunk、TransPattern、RouteGroup等。RouteList - 使用可发现准确的类型名称。
cisco-axl operations - 使用可了解必填和可选参数标签。
cisco-axl describe <operation> --detailed --format json - 参数可移除结果中的空/Null值。
--clean - 参数可移除XML属性元数据。
--no-attributes - 大多数CUCM环境(自签名证书)需要添加参数。
--insecure - 所有操作都会记录审计日志到,使用
~/.cisco-axl/audit.jsonl可跳过日志记录。--no-audit - 搭配模板使用可在执行前预览解析后的JSON。
--dry-run