Skip to content

Console snippets

A console snippet runs a reviewed set of commands on a running node's built-in text console and saves the output of chosen steps as text files — for example the running configuration — without recording the whole session and without any agent inside the node.

A snippet only ever runs on your own open console: it takes over that console's input until it finishes, and it never opens a connection of its own.

What a run needs

The server checks every point before it sends anything. The two rows marked by default decide what the picker lists; Show all is the only way past them. Every other row always applies.

Requirement Where it is set
Console snippets are enabled on the instance. They are on by default; NOVA_VE_CONSOLE_SNIPPETS_ENABLED=false switches them off for the whole instance. Backend environment
The node's template lists the snippet in its Console snippets allowlist (by default). Library → Images & Templates → Edit
When the definition names images, the node's image matches one (by default). Snippet definition
The definition is written for that console (primary or secondary). Snippet definition
The node is running and has a text (telnet) console of that kind. Node
The built-in console is open in your browser. The run uses exactly that session — not another window's. Lab canvas
Your account may use the built-in (HTML5) console. A user without that access cannot discover, preview or start snippets. Users
The console sits at an idle prompt with nothing typed. You

Node settings never add a snippet to a node's default list: that comes from the server-side template alone.

Choosing a template's snippets

Edit a template under Library → Images & Templates. Console snippets lists every definition in the library, one per line, with the template's saved selections checked and listed first. Check the ones to offer on that template's nodes, then save the template. A template with nothing checked offers none by default.

Running a snippet

  1. Open the node's console and bring it to the prompt the snippet expects. For the shipped Cisco profile that is the privileged EXEC prompt (hostname#).
  2. Press Run snippet in the console's toolbar (tabbed and floating consoles both have it). A node whose template allows a snippet also has Run snippet in its canvas context menu.
  3. Choose a snippet. If it has variables, fill them in; declared defaults are prefilled and each field explains what it accepts.
  4. Check the exact commands the run will send, shown under Commands, then press Run snippet to start.

While the run is going:

  • It alone talks to the console. Keystrokes you type are ignored — they are not queued, so nothing replays afterwards. If the same node console is open in another window, that window's keystrokes are held off too, and it cannot start a run of its own.
  • Nothing is sent on trust. Before every command — after a wait, before a restore — the run checks again that the console sits quietly at the expected prompt; if the device has moved on by itself (a mode change, a pager, a login prompt), the run stops without sending.
  • A wait step lasts its whole duration even if the console prints meanwhile; only cancelling, losing the console or the run's time limit end it early.
  • The panel shows which step is running and lets you cancel. Closing the panel does not cancel; the toolbar button shows the run and reopens it.
  • A whole-session recording, if you started one, keeps recording normally.

When it ends you can download each captured file or open the run in the lab's history. A failed or cancelled run keeps the captures that had already completed and marks the one that did not.

Show all

The picker normally lists only what the node's template allows for its image. To try a reusable snippet on another node, check Show all: the list then holds every definition written for that console. It starts unchecked each time the picker opens, and it is available from a console's toolbar even when the default list is empty.

  • A definition outside the node's normal applicability is marked (out of scope), and selecting it says why: the template does not allow it, it names other images, or both.
  • Preview and run work as usual, and so does every other check: console access, your own attached session, the definition's revision and variables, an idle prompt it recognizes, and exclusive input.
  • An out-of-scope run is marked in the run history and in the activity log.
  • The instance switch still wins: with snippets disabled, nothing is listed or run.

Preview first

A definition outside its scope was not written or verified for that device. The same command can mean something else there, and the prompt, error and pager patterns may not match its output. Read the preview before running it.

Why a run is refused

Nothing is sent to the console in any of these cases.

Message What to do
The console is not at an idle command prompt Press Enter at the console, or finish the command line you started, so the prompt shows on its own. A run never presses Enter for you: that could submit a half-typed command.
Privileged EXEC (enable) access is required Enter enable mode on the console.
The console is at a login prompt Sign in on the console.
The console is paging output (--More--) Press q or Space at the console.
Another snippet is already running on this console Wait for it to finish or cancel it. Each user runs one snippet at a time.
The console session changed The console was reloaded or reopened. Refresh and start again.
The snippet definition changed Refresh the preview and start again.
The node was stopped or restarted Start it and run the snippet again.
The built-in console is no longer attached Open the console and run the snippet from it.

Why a run fails

A failure is always explicit, and only a fully captured response is ever saved.

Reason Meaning
Command error The device answered a step with an error line. The message quotes it.
Incomplete capture The response stopped before the line the snippet expects last, so it was cut off and was not saved.
Unexpected paging Output paged although the snippet expected one continuous response.
Login required / privilege required The console dropped to a login or non-privileged prompt during the run.
Timeout A step or the whole run took longer than the snippet's limits. A prompt only counts after a full quiet interval, and that interval has to fit inside the step's time.
Output limit A step produced more output than the snippet allows.
Console disconnected The console session closed during the run.
Console stopped accepting input The device stopped reading its console; the run gives up on the write rather than hanging.
Cancelled You cancelled it.
Interrupted The backend restarted while it was running.

After a successful run the snippet restores the session settings it changed (the shipped profile sets terminal length back to 24). After a failure nothing more is sent, so the run reports any setting it could not restore.

Run history

Completed runs are kept with the lab and listed in one Snippet runs view, reachable from:

  • the lab toolbar (Snippets) — every run in the lab, with node, snippet and status filters;
  • a node's context menu (Snippet runs) — that node's runs;
  • Lab Management and Running Nodes — a Snippets button per row.

Each run shows the node name as it was, who ran it, when, its status and, for a failure, the reason. It keeps the rendered plan (what the run intended) apart from the sent steps (what actually reached the console), the values you entered, and every completed capture with a plain-text view and a download. Each step's state is one of:

State Meaning
Sent The console confirmed the command with a validated prompt.
Failed The step ran but failed (an error line, a timeout, paging…).
Unconfirmed The command left for the console, but the run ended — cancelled, disconnected or interrupted by a restart — before the console confirmed it. Check the device if it matters.
Not sent The run stopped before reaching this step.
Skipped A conditional step that did not apply (the console was not in that mode).

The record is written before every command leaves and again once it is confirmed, so after a restart nothing is shown as sent that was only dispatched.

  • Who sees a run: the user who ran it, the lab's owner and administrators. Everyone else does not see it at all.
  • Deleting: any finished run you can see can be deleted; a running one must be cancelled first.
  • Retention: runs live beside the lab's recordings and follow the same setting — NOVA_VE_RECORDINGS_RETENTION_DAYS expires old runs too; zero (the default) keeps them until they are deleted by hand.
  • Lab changes: runs move with a lab that is renamed or moved. A different lab that later reuses the file name does not inherit them. Deleting a lab leaves its recordings and runs on disk, exactly as it leaves recordings, until the folder itself is removed.
  • Definitions: editing or deleting a snippet definition never changes past runs.

Snippet definitions

Administrators manage definitions under Library → Snippets. Shipped definitions are read-only; you can view and export them, and create your own. Custom definitions can be created, edited, imported from and exported to YAML, and deleted. A definition that fails validation stays unavailable — the page says why — and never affects other definitions.

A definition is one YAML document:

version: 1
id: ios-interface-config      # stable id; templates allowlist it
name: Interface configuration
console: primary              # primary | second
images: [csr1000v*]           # optional: only these images
variables:                    # optional: typed values for the command text
  interface:
    type: string              # integer | float | string
    default: GigabitEthernet1
prompt: '(?m)^[A-Za-z0-9_.-]+#[ \t]*$'    # the prompt every step must end at
modes:                        # other prompts the snippet recognizes
  exec: '(?m)^[A-Za-z0-9_.-]+>[ \t]*$'
  config: '(?m)^[A-Za-z0-9_.-]+\(config(-[A-Za-z0-9_-]+)?\)#?[ \t]*$'
  login: '(?im)^[ \t]*(username|user name|password|login)[^\n]*:[ \t]*$'
errors:
  - '(?m)^[ \t]*% .*$'        # a line matching this fails the step
pager: '(?im)^[ \t]*--more.*$'
limits:
  step_timeout: 60            # seconds per step
  run_timeout: 180            # seconds for the whole run
  max_output_bytes: 2097152   # per step
  settle_seconds: 0.5         # silence that confirms a prompt
steps:
  - command: end              # only run from configuration mode
    when_mode: config
  - command: terminal length 0
  - command: show running-config interface {{interface}}
    capture: interface-config # save this response as interface-config.txt
    ends_with: '^end$'        # …only if it ends with this line
restore:                      # run after a successful run
  - command: terminal length 24
    label: terminal length

Rules

  • Patterns match one whole console line. Keep them simple: a pattern may not nest one repetition inside another ((a+)+) or repeat the same atom twice in a row (a*a*), because they run on the server's event loop. Write them in single quotes so \t stays a regex escape.
  • Variables are substituted into command text only — never into patterns, labels or file names — in a single literal pass. An integer or float must be a number (not true/false) within min and max. A string is one word of letters, digits and . _ : / - (up to 64 characters), optionally narrowed by min_length, max_length and pattern. An unknown variable, a missing required one, or a value outside its limits refuses the run before anything is sent.
  • Steps are declarative: command lines or a bounded wait. A command is one printable line with no line breaks. capture names the response to save; ends_with is its required last line. when_mode runs a step only when the console is at that mode.
  • Every step must end at prompt. Use a when_mode step such as end to leave another mode first.
  • Limits are bounded: a step waits at most 300 seconds, a run at most 900, a step's output at most 4 MiB.

Treat definitions and captures as configuration data

Never put a console, enable or login password in a definition — a run never needs one, because it only starts from a prompt you already reached. Captured output is whatever the device prints, which for a configuration includes secrets, so it is stored with owner-only file permissions and is visible only to the run's actor, the lab owner and administrators.

Verified profile

The shipped Running configuration snippet was verified on a Cisco CSR 1000V (IOS-XE) image: from the privileged EXEC prompt, terminal length 0 followed by show running-config returns the configuration ending with the end line, and then the prompt.

Image requirements for that profile:

  • the console is at the privileged EXEC prompt when the run starts;
  • terminal length 0 disables paging for the session;
  • show running-config ends with a line that is exactly end.

The shipped definitions apply to csr1000v* images only. Other IOS-family images (IOSv, IOSvL2, IOL) are not offered by default because their behavior has not been checked the same way; Show all lets you try one. To support an image properly, export the definition, adjust images and — if the device differs — the prompt, error and pager patterns, import it as a custom definition and add it to the template. Interface configuration shows a typed variable in use: it expects show running-config interface <name> to end with end in the same way.

What is logged

Runs appear in the activity log as snippet started, finished, cancelled and deleted, plus definition changes. Entries carry metadata only — the snippet, its revision, the node, the status, counts and, for a Show all run, what put it out of scope. Commands, entered values and captured output are never written to the activity log or the backend log.