console
Run batch console operations (send commands, wait for output, read responses, send keystrokes) on GNS3 network nodes for initial setup or when SSH is not available.
Instructions
Execute console operations (BATCH-ONLY)
v0.47.0: Batch-only console tool. Individual console tools removed (aggressive consolidation).
IMPORTANT: Prefer SSH tools when available! Console tools are primarily for:
Initial device configuration (enabling SSH, creating users)
Troubleshooting when SSH is unavailable
Devices without SSH support (VPCS, simple switches)
Two-phase execution:
VALIDATE ALL operations (check nodes exist, required params present)
EXECUTE ALL operations (only if all valid, sequential execution)
Each operation supports all parameters from the underlying console tool:
"send": Send data to console { "type": "send", "node_name": "R1", "data": "show version\n", "raw": false // optional }
"send_and_wait": Send command and wait for pattern { "type": "send_and_wait", "node_name": "R1", "command": "show ip interface brief\n", // optional (v0.49.0: omit for wait-only mode) "wait_pattern": "Router#", // optional "timeout": 30, // optional "raw": false, // optional "handle_pagination": true, // optional (v0.53.4: auto-handle --More--) "pagination_patterns": ["--More--", "---(more)---"], // optional (custom patterns) "pagination_key": " " // optional (default: space, can use "\n" for enter) } Wait-only mode (v0.49.0): Omit "command" to just wait for pattern without sending anything. Useful for monitoring boot sequences or waiting for specific output to appear.
"read": Read console output (NOTE: returns empty if nothing sent yet - this is normal) { "type": "read", "node_name": "R1", "mode": "diff", // optional: diff/last_page/num_pages/all "pages": 1, // optional, only with mode="num_pages" "pattern": "error", // optional grep pattern "case_insensitive": true, // optional "invert": false, // optional "before": 0, // optional context lines "after": 0, // optional context lines "context": 0 // optional context lines (overrides before/after) } IMPORTANT: Console buffer may be empty on first read (QEMU nodes don't output until prompted). Use 'send_and_wait' to explicitly send a command and read the response, or send commands first with 'send'.
"keystroke": Send special keystroke { "type": "keystroke", "node_name": "R1", "key": "enter" // up/down/enter/ctrl_c/etc }
Args: operations: List of operation dictionaries (see examples above)
Returns: JSON with execution results: { "completed": [0, 1, 2], // Indices of successful operations "failed": [3], // Indices of failed operations "results": [ { "operation_index": 0, "success": true, "operation_type": "send_and_wait", "node_name": "R1", "result": {...} // Operation-specific result }, ... ], "total_operations": 4, "execution_time": 5.3 }
Examples: # Multiple commands on one node: >>> console(operations=[ ... {"type": "send_and_wait", "node_name": "R1", "command": "show version\n", "wait_pattern": "Router#"}, ... {"type": "send_and_wait", "node_name": "R1", "command": "show ip route\n", "wait_pattern": "Router#"}, ... {"type": "read", "node_name": "R1", "mode": "diff"} ... ])
# Same command on multiple nodes:
>>> console(operations=[
... {"type": "send_and_wait", "node_name": "R1", "command": "show ip int brief\n", "wait_pattern": "#"},
... {"type": "send_and_wait", "node_name": "R2", "command": "show ip int brief\n", "wait_pattern": "#"},
... {"type": "send_and_wait", "node_name": "R3", "command": "show ip int brief\n", "wait_pattern": "#"}
... ])
# Mixed operations:
>>> console(operations=[
... {"type": "send", "node_name": "R1", "data": "\n"}, # Wake console
... {"type": "read", "node_name": "R1", "mode": "last_page"}, # Check prompt
... {"type": "send_and_wait", "node_name": "R1", "command": "show version\n", "wait_pattern": "#"},
... {"type": "keystroke", "node_name": "R1", "key": "ctrl_c"} # Cancel if needed
... ])Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| operations | Yes | List of console operations (send/send_and_wait/read/keystroke) |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |