mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-08-27 12:30:13 +03:00
Rename device_command_run → device_show_run for clarity
The name device_command_run was ambiguous and easily confused with device_config_send. device_show_run makes the read-only intent explicit, forming a clear pair: config_send (write) vs show_run (read).
This commit is contained in:
parent
e627481ec2
commit
fbb8924a8e
@ -235,14 +235,14 @@ All subsequent tool handler REST API calls use this JWT → zero extra bcrypt
|
||||
| Tool | Description |
|
||||
|------|-------------|
|
||||
| `device_config_send` | Push config commands to devices via console (Nornir + Netmiko). Supports Jinja2 `template` + `vars` |
|
||||
| `device_command_run` | Run read-only show commands on devices. Supports Jinja2 `template` + `vars` |
|
||||
| `device_show_run` | Run read-only show commands on devices. Supports Jinja2 `template` + `vars` |
|
||||
| `vpcs_config_set` | Configure VPCS devices (IP, gateway, etc.) |
|
||||
|
||||
The tool connects to each device's console via telnet/SSH. Nodes must be in the `started` state (use `node_start` or `node_start_all`). Device type is auto-detected from the node's `device_type:<type>` tag in GNS3.
|
||||
|
||||
#### Jinja2 Template Mode
|
||||
|
||||
Both `device_config_send` and `device_command_run` support an optional `template` parameter. When provided, each device's `vars` dict is rendered against the template to produce commands. Entries with the same `device_name` are merged into a single device session.
|
||||
Both `device_config_send` and `device_show_run` support an optional `template` parameter. When provided, each device's `vars` dict is rendered against the template to produce commands. Entries with the same `device_name` are merged into a single device session.
|
||||
|
||||
```python
|
||||
# Direct commands (single/batch)
|
||||
@ -259,7 +259,7 @@ device_config_send(project_id,
|
||||
])
|
||||
|
||||
# Show commands with template
|
||||
device_command_run(project_id,
|
||||
device_show_run(project_id,
|
||||
template="show ip route {{ protocol }}",
|
||||
device_configs=[
|
||||
{"device_name": "R1", "vars": {"protocol": "ospf"}},
|
||||
@ -281,7 +281,7 @@ device_command_run(project_id,
|
||||
|
||||
```python
|
||||
# Save config on device
|
||||
device_command_run(project_id, device_configs=[
|
||||
device_show_run(project_id, device_configs=[
|
||||
{"device_name": "R1", "commands": ["write memory"]},
|
||||
])
|
||||
# Backup
|
||||
|
||||
@ -1356,7 +1356,7 @@ async def image_install() -> list[dict[str, Any]]:
|
||||
# 1. node_list(project_id) → identify device names
|
||||
# 2. node_start_all(project_id) → ensure devices are running
|
||||
# 3. device_config_send(project_id, device_configs=[...]) → push config
|
||||
# 4. device_command_run(project_id, device_commands=[...]) → verify
|
||||
# 4. device_show_run(project_id, device_commands=[...]) → verify
|
||||
|
||||
|
||||
@mcp.tool()
|
||||
@ -1385,7 +1385,7 @@ async def device_config_send(
|
||||
|
||||
|
||||
@mcp.tool()
|
||||
async def device_command_run(
|
||||
async def device_show_run(
|
||||
project_id: Annotated[str, Field(description="UUID of the project")],
|
||||
device_configs: Annotated[list, Field(
|
||||
description="List of device commands. Each entry: {\"device_name\": \"R1\", \"commands\": [\"show ip int brief\", \"show running-config\"]}"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user