Overview¶
The CLI is used to configure the device and monitor its state. The CLI exposes two main modes:
The operational mode (prompt is
hostname>
), where the user can query the state, show the configuration, send commands, etc…The edition mode (prompt ends with
#
), where the user can additionally modify the configuration of the device. This mode is divided into several service contexts, each of them representing a part of the configuration.
At any level in the CLI, if you type a question mark (?
), a list of
available commands and a short help is displayed.
The CLI connects to the device using the NETCONF protocol. The contexts commands are generated from YANG files, which also describes the NETCONF API of the device.
Here is a summary of available commands from the CLI prompt:
|
Display contextual help. |
|
Display the commands list or the help of a command. |
|
Complete or display options from current line. |
|
Move one level up to parent context. |
|
Save staging configuration to a file. |
|
Load a file into the staging configuration. |
|
Commit pending changes in the running. |
|
Fetch the state of the device. |
|
Show the configuration (staging configuration by default in edition mode, or running configuration in operational mode). |
|
Show the differences between two configurations. |
|
Exit from edition mode, or exit the CLI when in operational mode. |
|
Browse the command history. |
|
At the beginning of the line or after a space,
all characters after the |
The CLI stores the history of typed commands in a circular memory. Typed
commands can be recalled with the UP
/DOWN
keys and may be modified
with LEFT
/RIGHT
/INS
/DEL
keys.
Output modifiers¶
The cli commands can be suffixed by output modifiers to change the output of the command. The syntax is quite similar to shell pipes.
The pager can be disabled for a specific command with:
vrouter> show state | no-pager
(...)
Similarly, a pager
modifier can force the activation of the pager.
The match
output modifier acts like the grep
shell command.
Its syntax is match <pattern> [invert] [count] [context <n>]
, with:
<pattern>
: a regular expressioninvert
: invert the patterncount
: count the number of matchescontext <n>
: show n lines before and after each match
For instance, this command counts the number of physical interfaces whose mtu is 1500:
vrouter> show state fullpath | match 'interface physical' | match 'mtu 1500' count
3