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.

help [<command>]

Display the commands list or the help of a command.

TAB

Complete or display options from current line.

..

Move one level up to parent context.

save file <name>

Save staging configuration to a file.

load file <name>

Load a file into the staging configuration.

commit

Commit pending changes in the running.

show state [<path>]

Fetch the state of the device.

show config [<confname>] [<path>]

Show the configuration (staging configuration by default in edition mode, or running configuration in operational mode).

diff [<confname1> <confname2>|state] [<path>]

Show the differences between two configurations or a configuration and the state.

exit or CTRL-D

Exit from edition mode, or exit the CLI when in operational mode.

UP, DOWN

Browse the command history.

CTRL-R

Search a command in the history.

CTRL-A/CTRL-E

Move to the start/end of the current line.

#

At the beginning of the line or after a space, all characters after the # are interpreted as comments.

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:

vsr> 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 expression

  • invert: invert the pattern

  • count: count the number of matches

  • context <n>: show n lines before and after each match

For instance, this command counts the number of physical interfaces whose mtu is 1500:

vsr> show state fullpath | match 'interface physical' | match 'mtu 1500' count
3