CML Topology Builder
MCP Server
- Command:
cml-mcp (pip-installed, stdio transport)
- Requires:
CML_URL, CML_USERNAME, CML_PASSWORD environment variables
Available Tools
Node Management
| Tool |
Parameters |
What It Does |
get_node_defs |
none |
List all available node definitions (IOSv, NX-OS, IOS-XR, etc.) |
create_node |
lab_id/lab_title, node_def, label, x, y |
Add a node to a lab |
get_nodes |
lab_id/lab_title |
List all nodes in a lab |
get_node |
lab_id/lab_title, node_id/node_label |
Get details of a specific node |
Interface Management
| Tool |
Parameters |
What It Does |
create_interface |
lab_id/lab_title, node_id/node_label, slot? |
Create a new interface on a node |
get_interfaces |
lab_id/lab_title, node_id/node_label |
List all interfaces on a node |
get_interface |
lab_id/lab_title, node_id/node_label, interface_id/interface_label |
Get interface details |
Link Management
| Tool |
Parameters |
What It Does |
create_link |
lab_id/lab_title, src_node/src_label, src_intf, dst_node/dst_label, dst_intf |
Create a link between two interfaces |
get_links |
lab_id/lab_title |
List all links in a lab |
get_link |
lab_id/lab_title, link_id |
Get link details |
set_link_condition |
lab_id/lab_title, link_id, bandwidth?, latency?, jitter?, loss? |
Set link conditioning (WAN simulation) |
set_link_state |
lab_id/lab_title, link_id, state |
Set link state (up/down) — simulate link failures |
Annotations
| Tool |
Parameters |
What It Does |
create_annotation |
lab_id/lab_title, annotation_type, content, x, y, width?, height? |
Add a text/shape annotation |
get_annotations |
lab_id/lab_title |
List all annotations |
delete_annotation |
lab_id/lab_title, annotation_id |
Remove an annotation |
Available Node Definitions
Common node types available in CML (use get_node_defs to get the full list):
| Node Definition ID |
Description |
Typical Use |
iosv |
Cisco IOSv (IOS 15.x) |
Routing, switching labs |
iosvl2 |
Cisco IOSv L2 |
Layer 2 switching labs |
iosxrv9000 |
Cisco IOS XR 9000v |
SP, MPLS, Segment Routing |
nxosv9000 |
Cisco NX-OS 9000v |
Data center, VXLAN |
csr1000v |
Cisco CSR 1000v (IOS-XE) |
SD-WAN, routing |
cat8000v |
Cisco Catalyst 8000v |
Enterprise routing |
asav |
Cisco ASAv |
Firewall labs |
server |
Ubuntu/Alpine server |
Traffic gen, testing |
external_connector |
External bridge |
Connect lab to host/internet |
unmanaged_switch |
Unmanaged L2 switch |
Simple L2 connectivity |
wan_emulator |
WAN emulator |
Add latency/loss between nodes |
Workflow: Build Topology from Description
When the user describes a topology:
- Create the lab (or get an existing one via
get_lab)
- Get node definitions:
get_node_defs to know what's available
- Plan the layout: Calculate x,y coordinates for visual placement
- Use a grid layout: 200px spacing horizontally, 200px vertically
- Group by role: core in center, edge on sides, servers at bottom
- Create nodes:
create_node for each device with meaningful labels
- Create interfaces:
create_interface for each connection point
- Wire links:
create_link to connect interface pairs
- Set conditions (if requested):
set_link_condition for WAN links
- Add annotations:
create_annotation for labels, IP addressing plans
- Report the topology: List all nodes, interfaces, and links
Layout Guidelines
When placing nodes, use this visual grid approach:
Topology Layout (x, y coordinates):
Layer 0 (Top): Core routers y=100
Layer 1: Distribution y=300
Layer 2: Access / Leaf y=500
Layer 3 (Bottom): Servers / Endpoints y=700
x spacing: 200px between nodes in the same layer
Center the topology: start x at 100, distribute evenly
Example for a 2-spine, 4-leaf topology:
Spine1: (300, 100) Spine2: (500, 100)
Leaf1: (100, 300) Leaf2: (300, 300) Leaf3: (500, 300) Leaf4: (700, 300)
Srv1: (100, 500) Srv2: (300, 500) Srv3: (500, 500) Srv4: (700, 500)
Link Conditioning
Use set_link_condition to simulate real-world WAN characteristics:
| Scenario |
Bandwidth |
Latency |
Jitter |
Loss |
| LAN |
(none) |
(none) |
(none) |
(none) |
| Metro Ethernet |
100 Mbps |
5 ms |
1 ms |
0% |
| WAN (good) |
50 Mbps |
20 ms |
5 ms |
0.1% |
| WAN (poor) |
10 Mbps |
100 ms |
20 ms |
1% |
| Satellite |
5 Mbps |
300 ms |
50 ms |
2% |
| Congested link |
1 Mbps |
200 ms |
100 ms |
5% |
Workflow: Annotate Topology
After building a topology, add visual documentation:
- Title annotation: Lab name and purpose at the top
- IP addressing: Annotation blocks showing subnet assignments per link
- AS numbers: Label BGP AS boundaries
- Area labels: Mark OSPF areas, VRF names, VLAN IDs
- Notes: Any special instructions or test scenarios
Workflow: Simulate Link Failure
When testing network resilience:
- Get the link:
get_links to find the link ID between the two nodes
- Capture baseline: Use
execute_command to check routing tables before failure
- Bring link down:
set_link_state with state "down"
- Observe convergence: Execute show commands on affected nodes (OSPF neighbors, BGP summary, routing table)
- Optionally capture traffic: Use cml-packet-capture to capture reconvergence traffic
- Restore link:
set_link_state with state "up"
- Verify recovery: Confirm routing adjacencies re-establish
- Report: Document failover/failback time and behavior
Important Rules
- Always use
get_node_defs first to verify available node types before creating nodes
- Create interfaces before links — you need interface IDs to wire links
- Use descriptive labels — "R1-Core" not "Node1"
- Plan before building — figure out the full topology before starting to create nodes
- Lab must be STOPPED to add nodes — cannot modify topology of a running lab
- Position nodes logically — hierarchical layout makes the topology readable in CML UI
- Record in GAIT — log topology creation for audit trail
1---2name: cml-topology-builder3description: Build CML topologies — add nodes, create interfaces, wire links, set link conditioning, add annotations. Use when building a network topology in CML, adding routers or switches to a lab, wiring links between nodes, or simulating WAN conditions.4license: Apache-2.05---6
7# CML Topology Builder
8
9## MCP Server
10
11- **Command**: `cml-mcp` (pip-installed, stdio transport)
12- **Requires**: `CML_URL`, `CML_USERNAME`, `CML_PASSWORD` environment variables
13
14## Available Tools
15
16### Node Management
17
18| Tool | Parameters | What It Does |
19|------|-----------|-------------|
20| `get_node_defs` | none | List all available node definitions (IOSv, NX-OS, IOS-XR, etc.) |
21| `create_node` | `lab_id`/`lab_title`, `node_def`, `label`, `x`, `y` | Add a node to a lab |
22| `get_nodes` | `lab_id`/`lab_title` | List all nodes in a lab |
23| `get_node` | `lab_id`/`lab_title`, `node_id`/`node_label` | Get details of a specific node |
24
25### Interface Management
26
27| Tool | Parameters | What It Does |
28|------|-----------|-------------|
29| `create_interface` | `lab_id`/`lab_title`, `node_id`/`node_label`, `slot?` | Create a new interface on a node |
30| `get_interfaces` | `lab_id`/`lab_title`, `node_id`/`node_label` | List all interfaces on a node |
31| `get_interface` | `lab_id`/`lab_title`, `node_id`/`node_label`, `interface_id`/`interface_label` | Get interface details |
32
33### Link Management
34
35| Tool | Parameters | What It Does |
36|------|-----------|-------------|
37| `create_link` | `lab_id`/`lab_title`, `src_node`/`src_label`, `src_intf`, `dst_node`/`dst_label`, `dst_intf` | Create a link between two interfaces |
38| `get_links` | `lab_id`/`lab_title` | List all links in a lab |
39| `get_link` | `lab_id`/`lab_title`, `link_id` | Get link details |
40| `set_link_condition` | `lab_id`/`lab_title`, `link_id`, `bandwidth?`, `latency?`, `jitter?`, `loss?` | Set link conditioning (WAN simulation) |
41| `set_link_state` | `lab_id`/`lab_title`, `link_id`, `state` | Set link state (up/down) — simulate link failures |
42
43### Annotations
44
45| Tool | Parameters | What It Does |
46|------|-----------|-------------|
47| `create_annotation` | `lab_id`/`lab_title`, `annotation_type`, `content`, `x`, `y`, `width?`, `height?` | Add a text/shape annotation |
48| `get_annotations` | `lab_id`/`lab_title` | List all annotations |
49| `delete_annotation` | `lab_id`/`lab_title`, `annotation_id` | Remove an annotation |
50
51## Available Node Definitions
52
53Common node types available in CML (use `get_node_defs` to get the full list):
54
55| Node Definition ID | Description | Typical Use |
56|--------------------|-------------|-------------|
57| `iosv` | Cisco IOSv (IOS 15.x) | Routing, switching labs |
58| `iosvl2` | Cisco IOSv L2 | Layer 2 switching labs |
59| `iosxrv9000` | Cisco IOS XR 9000v | SP, MPLS, Segment Routing |
60| `nxosv9000` | Cisco NX-OS 9000v | Data center, VXLAN |
61| `csr1000v` | Cisco CSR 1000v (IOS-XE) | SD-WAN, routing |
62| `cat8000v` | Cisco Catalyst 8000v | Enterprise routing |
63| `asav` | Cisco ASAv | Firewall labs |
64| `server` | Ubuntu/Alpine server | Traffic gen, testing |
65| `external_connector` | External bridge | Connect lab to host/internet |
66| `unmanaged_switch` | Unmanaged L2 switch | Simple L2 connectivity |
67| `wan_emulator` | WAN emulator | Add latency/loss between nodes |
68
69## Workflow: Build Topology from Description
70
71When the user describes a topology:
72
731. **Create the lab** (or get an existing one via `get_lab`)
742. **Get node definitions**: `get_node_defs` to know what's available
753. **Plan the layout**: Calculate x,y coordinates for visual placement
76 - Use a grid layout: 200px spacing horizontally, 200px vertically
77 - Group by role: core in center, edge on sides, servers at bottom
784. **Create nodes**: `create_node` for each device with meaningful labels
795. **Create interfaces**: `create_interface` for each connection point
806. **Wire links**: `create_link` to connect interface pairs
817. **Set conditions** (if requested): `set_link_condition` for WAN links
828. **Add annotations**: `create_annotation` for labels, IP addressing plans
839. **Report the topology**: List all nodes, interfaces, and links
84
85## Layout Guidelines
86
87When placing nodes, use this visual grid approach:
88
89```
90Topology Layout (x, y coordinates):
91
92Layer 0 (Top): Core routers y=100
93Layer 1: Distribution y=300
94Layer 2: Access / Leaf y=500
95Layer 3 (Bottom): Servers / Endpoints y=700
96
97x spacing: 200px between nodes in the same layer
98Center the topology: start x at 100, distribute evenly
99```
100
101Example for a 2-spine, 4-leaf topology:
102```
103Spine1: (300, 100) Spine2: (500, 100)
104Leaf1: (100, 300) Leaf2: (300, 300) Leaf3: (500, 300) Leaf4: (700, 300)
105Srv1: (100, 500) Srv2: (300, 500) Srv3: (500, 500) Srv4: (700, 500)
106```
107
108## Link Conditioning
109
110Use `set_link_condition` to simulate real-world WAN characteristics:
111
112| Scenario | Bandwidth | Latency | Jitter | Loss |
113|----------|-----------|---------|--------|------|
114| LAN | (none) | (none) | (none) | (none) |
115| Metro Ethernet | 100 Mbps | 5 ms | 1 ms | 0% |
116| WAN (good) | 50 Mbps | 20 ms | 5 ms | 0.1% |
117| WAN (poor) | 10 Mbps | 100 ms | 20 ms | 1% |
118| Satellite | 5 Mbps | 300 ms | 50 ms | 2% |
119| Congested link | 1 Mbps | 200 ms | 100 ms | 5% |
120
121## Workflow: Annotate Topology
122
123After building a topology, add visual documentation:
124
1251. **Title annotation**: Lab name and purpose at the top
1262. **IP addressing**: Annotation blocks showing subnet assignments per link
1273. **AS numbers**: Label BGP AS boundaries
1284. **Area labels**: Mark OSPF areas, VRF names, VLAN IDs
1295. **Notes**: Any special instructions or test scenarios
130
131## Workflow: Simulate Link Failure
132
133When testing network resilience:
134
1351. **Get the link**: `get_links` to find the link ID between the two nodes
1362. **Capture baseline**: Use `execute_command` to check routing tables before failure
1373. **Bring link down**: `set_link_state` with state "down"
1384. **Observe convergence**: Execute show commands on affected nodes (OSPF neighbors, BGP summary, routing table)
1395. **Optionally capture traffic**: Use cml-packet-capture to capture reconvergence traffic
1406. **Restore link**: `set_link_state` with state "up"
1417. **Verify recovery**: Confirm routing adjacencies re-establish
1428. **Report**: Document failover/failback time and behavior
143
144## Important Rules
145
146- **Always use `get_node_defs` first** to verify available node types before creating nodes
147- **Create interfaces before links** — you need interface IDs to wire links
148- **Use descriptive labels** — "R1-Core" not "Node1"
149- **Plan before building** — figure out the full topology before starting to create nodes
150- **Lab must be STOPPED to add nodes** — cannot modify topology of a running lab
151- **Position nodes logically** — hierarchical layout makes the topology readable in CML UI
152- **Record in GAIT** — log topology creation for audit trail