In this chapter, “CLI” refers to the classic CLI unless otherwise specified.
The SR OS CLI is a command-driven interface accessible through the console, Telnet, or secure shell (SSH). The CLI can be used for the configuration and management of routers.
The SR OS CLI command tree is a hierarchical inverted tree. The operational root level is the highest level of this tree. When the user enters a CLI session, the user is in the operational root context. Below this level are other tree levels for the major command groups; for example, configure commands and show commands are levels below the operational root level.
The CLI is organized so that related commands with the same scope are at the same level or in the same context. Sublevels or subcontexts have related commands with a more refined scope.
Note: The CLI engine used to execute scripts is the primary CLI engine configured with config>system>management-interface>cli>cli-engine {[classic-cli] [md-cli]}. |
Table 3 describes command syntax symbols used in this guide.
Symbol | Description |
| | A vertical line indicates that only one of the parameters within the brackets or braces can be selected. |
[ ] | Brackets indicate optional parameters. |
{ } | Braces indicate that one of the parameters must be selected. |
[{ }] | Braces within square brackets indicate that the parameters are optional, but if one is selected, the information within the braces is required. |
Bold | Bold indicates commands and keywords. |
Italic | Italics indicates that you must enter text for the parameter. |
Use the CLI to access, configure, and manage Nokia routers. CLI commands are entered at the command line prompt. Access to specific CLI commands is controlled by the permissions set by your system administrator. Entering a CLI command makes navigation possible from one command context (or level) to another.
When the user enters a CLI session, the user is in the operational root context. Navigate to another level by entering the name of successively lower contexts. For example, at the command prompt (#), enter configure or config. See Command Completion for alternative syntax for the same command.The active context displays in the command prompt.
In a CLI context, enter commands at that context level by entering the text. Press <Enter> to move to a lower context. The user can also include commands from lower context at one context level as long as the command and parameter syntax is correct.
The following example shows two methods to navigate to a service SDP ingress level.
Method 1:
Method 2:
The CLI returns an error message if the syntax is incorrect. For example, if the user enters rooter for the root command, it would result in an error.
The command parameter is the means by which a value is passed to the command processing program. The user must enter the value according to the syntax rules and, where applicable, the defined range. In the previous example, “6” and “2:6” are the parameter values that the user must enter to execute the command. The value “6” is the value for the Epipe service identifier parameter. For the value “2:6”, “2” is the value for the SDP identifier parameter and “6” is the value for the virtual circuit identifier.
The commands in Table 4 are available at the operational root level of the CLI hierarchy. For the command descriptions, see the respective command sections in this guide. For descriptions of the clear, monitor, show, and tools commands, refer to the 7450 ESS, 7750 SR, 7950 XRS, and VSR Clear, Monitor, Show, and Tools Command Reference Guide.
Command | Description |
admin | Enters the administrative context for system operations |
bof | Enters the context to configure the boot options file |
clear | Clears statistics or resets the operational state |
configure | Enters the configuration context |
[no] debug | Enters the context to enable or disable debugging and specify debug options |
[no] enable-dynamic-services-config | Enters the context to manually modify the dynamic services in the current CLI session |
[no] enable-vsd-config | Enters the context to manually modify the VSD configuration in the current CLI session |
environment | Enters the environment configuration context |
file | Enters the context for file system commands |
help | Displays help in the CLI |
monitor | Enters the context to monitor statistics |
password | Enters the context to change the user CLI login password |
show | Shows operational information |
tools | Enters the tools context for troubleshooting and debugging |
Global commands are commands that can be entered at any level in the CLI hierarchy. To display the list of all system global commands, enter help globals in the CLI.
The global commands are listed in Table 5. For the command descriptions, see the respective command sections in this guide.
Command | Description |
back | Navigates to the parent context |
candidate | Enters the context to configure candidate parameters |
echo | Echoes the text that is typed in. The primary use is to display messages to the screen within an exec file. |
enable-admin | Enables the user to become a system administrator |
exec | Executes the contents of a text file as if they were CLI commands entered at the console |
exit | Returns to the previous higher context |
help | Displays help in the CLI |
history | Displays a list of the most recently entered commands |
logout | Terminates the CLI session |
mrinfo | Requests multicast router information |
mstat | Traces a multicast path from a source to a receiver and displays multicast packet rate and loss information (IGMP-based) |
mstat2 | Traces a multicast path from a source to a receiver and displays multicast packet rate and loss information (UDP-based) |
mtrace | Traces a multicast path from a source to a receiver (IGMP-based) |
mtrace2 | Traces a multicast path from a source to a receiver (UDP-based) |
oam | Provides OAM test suite options. Refer to the 7450 ESS, 7750 SR, 7950 XRS, and VSR OAM and Diagnostics Guide. |
ping | Verifies the reachability of a remote host |
pwc | Displays the present or previous working context of the CLI session |
sleep | Causes the console session to pause operation (sleep) for 1 s or for the specified number of seconds. The primary use is to introduce a pause in the execution of an exec file. |
ssh | Opens a secure shell connection to a host |
telnet | Connects to a host using Telnet |
traceroute | Determines the route to a destination address |
tree | Displays a list of all commands at the current level and all sublevels |
write | Sends a console message to a specific user or to all users with active console sessions |
The CLI environment commands listed in Table 6 are found in the environment context of the operational root of the CLI tree. These commands control session preferences for a single CLI session. For more information on the commands, see the respective command sections in this guide.
Command | Description |
alias | Enables the substitution of a command line by an alias |
create | Enables or disables the use of a create parameter check |
kernel | Enables or disables the kernel |
more | Enables the CLI output to be displayed one screen at a time, awaiting user input to continue |
reduced-prompt | Configures the maximum number of higher-level CLI context nodes to display by name in the CLI prompt for the current CLI session |
saved-ind-prompt | Saves the indicator in the prompt |
shell | Enables or disables the shell |
suggest-internal-objects | Enables the suggestion of internally created objects while auto-completing |
terminal | Configures the terminal screen length for the current CLI session |
time-display | Specifies whether time should be displayed in local time or UTC |
time-stamp | Specifies whether the timestamp should be displayed before the prompt |
The help system commands and the ? key display different types of help in the CLI. The following table lists the help commands.
Command | Description |
help | Describes the help system |
help globals | Displays information about global commands |
help edit | Displays information about all editing keystrokes |
help special-characters | Displays information about all special characters that can be entered at the command prompt |
? | Displays context-sensitive help information and displays a full list of options and commands available from the current context When entered at the root context, displays a full list of top-level contexts and global commands |
command ? command parameter ? command keyword ? | Displays the available syntax options for the command, lists the associated parameters and keywords, and lists all commands available from the command context |
string? | Lists all commands available in the current context that start with string |
command string? command parameter string? command keyword string? | Lists all commands, parameters, or keywords available in the command context that start with string |
string<Tab> | Completes a partial command name (auto-completion) or lists available commands that match string |
The tree and tree detail system commands are useful when searching for a command in a lower-level context.
The following example shows a partial list of the tree and tree detail command outputs on a 7750 SR.
By default, the CLI command prompt indicates the device being accessed, the active CPM, and the current CLI context. For example, the prompt: A:cses-E11>config>router>if# indicates that the active CPM is CPM A, the user is on the device with the hostname cses-E11, and the current context config>router>interface. In the prompt, the separator used between contexts is the “>” symbol. The active CPM can be A or B on the 7750 SR, and A, B, C, or D on the 7950 XRS.
At the end of the prompt, there is either a pound sign (#) or a dollar sign ($). A “#” at the end of the prompt indicates the context is an existing context. A “$” at the end of the prompt indicates the context has been newly created. Contexts are newly created for logical entities when the user first navigates into the context.
Because there can be a large number of sublevels in the CLI, the environment command reduced-prompt no of nodes in prompt allows the user to control the number of levels displayed in the prompt.
Warning: In CLI command configurations, allowed values in parameter strings are printable, 7-bit ASCII characters. If the string contains special characters (#, $, space), the entire string must be enclosed within double quotes (“). Double quotes within a string are not supported. Parameter strings input by the user must follow this format. This rule supersedes all related parameter descriptions found in this guide. |
When changes are made to the configuration file, a “*” appears in the prompt string (*A:cses-E11), indicating that the changes have not been saved. When an admin save command is executed, the “*” disappears. This behavior is controlled by the saved-ind-prompt command in the environment context.
The info, info detail, and objective commands display the configuration for the current level. The info command shows non-default configurations. The info detail command shows the entire configuration for the current level, including defaults. The info objective command provides an output objective that controls the configuration parameters to be displayed.The following example displays the output from the info command and the info detail command.
The exec command allows you to execute a text file of CLI commands as if it were typed at a console device.
The exec command and the associated exec files can be used to conveniently execute a number of commands that are always executed together in the same order. For example, an exec command can be used to define a set of commonly used standard command aliases.
The echo command can be used within an exec command file to display messages on screen while the file executes.
Arguments can be specified with the exec command. These arguments are passed in to be used inside the text file that includes the CLI commands. The passing of arguments with the exec command only works in the classic CLI. The passing of arguments with the exec command cannot be used in the MD-CLI.
For example, if the file cf3/Test.txt contains the following set of CLI commands:
then executing the following commands:
# exec cf3:/Test.txt -arguments var1=10 var2=20 var3=30
or
# exec cf3:/Test.txt -arguments 10 20 30
produces the following output:
SR OS provides centralized script management for CLI scripts that are used by CRON and the Event Handling System (EHS). A set of script policies and script objects can be configured to control such things as:
If the scripts are located on local compact flash devices, the user must ensure that the scripts are on the compact flash devices of both CPMs so that operation of EHS continues as expected if a CPM switchover occurs.
Only one script can execute at a time. An SNMP table (smRunTable in the DISMAN-SCRIPT-MIB) is used as both an input queue of scripts waiting to be executed and for storage of records for completed scripts. If the input queue is full, the script request is discarded.
The following sections outline the steps to entering CLI commands.
The CLI supports both command abbreviation and command completion. If the keystrokes entered are enough to match a valid command, the CLI displays the remainder of the command syntax when the <Tab> key or spacebar is pressed. When typing a command, the <Tab> key or spacebar invokes auto-completion. If the keystrokes entered are sufficient to identity a specific command, auto-completion completes the command. If the letters are not sufficient to identify a specific command, pressing the <Tab> key or spacebar displays commands matching the letters entered.
System commands are available in all CLI contexts.
In a command context, the CLI accepts command parameters in any order as long as the command is formatted in the proper command keyword and parameter syntax. Command completion works as long as enough recognizable characters of the command are entered.
The following output shows the command syntax for static-route-entry.
Some SR OS CLI commands have multiple unnamed parameters. For example, the subrate csu-mode rate-step command has both a csu-mode parameter and a rate-step parameter that do not have leading keywords. SR OS uses a best-match algorithm to select which parts of the user input are intended to be used for each unnamed parameter. This best-match algorithm depends on the specific command.
In some cases, it is not possible for the algorithm to be 100% accurate, and the SR OS may assign an unintended value to a parameter when two unnamed parameters have similar constraints and syntax. For example, the environment alias alias-name alias-command-name command may reverse the alias-name and alias-command-name parameters if the first parameter entered is more than 80 characters.
When entering a command, special keystrokes allow for editing of the command. Table 8 lists the command editing keystrokes.
Editing Action | Keystrokes |
Stop the current command | <Ctrl-c> |
Delete current character | <Ctrl-d> |
Delete text up to cursor | <Ctrl-u> |
Delete text after cursor | <Ctrl-k> |
Move to beginning of line | <Ctrl-a> |
Move to end of line | <Ctrl-e> |
Get prior command from history | <Ctrl-p> |
Get next command from history | <Ctrl-n> |
Move cursor left | <Ctrl-b> |
Move cursor right | <Ctrl-f> |
Move back one word | <Esc><b> |
Move forward one word | <Esc><f> |
Convert rest of word to uppercase | <Esc><c> |
Convert rest of word to lowercase | <Esc><l> |
Delete remainder of word | <Esc><d> |
Delete word up to cursor | <Ctrl-w> |
Transpose current and previous character | <Ctrl-t> |
Enter command and return to operational root prompt | <Ctrl-z> |
Refresh input line | <Ctrl-l> |
CLI commands can be executed in any context by specifying the full path from the CLI root. To execute an out-of-context command, enter a forward slash (/) or backward slash (\) at the beginning of the command line. The commands are interpreted as absolute paths. Spaces between the slash and the first command return an error.
The “/” or “\” cannot be used as an absolute path at the beginning of the command string of the environment alias command. The command may change the current context depending on whether it is a leaf command. This is the same behavior the CLI performs when CLI commands are entered individually; for example:
or
An absolute path command behaves in the same way as manually entering a series of command line instructions and parameters.
For example, beginning in an IES context service ID 4 (IES 4):
behaves in the way same as the following series of commands:
If the command takes you to a different context, the following occurs:
becomes:
The CLI maintains a history of the most recently entered commands. The history command shows the most recently entered CLI commands.
The SR OS CLI allows the use of a single numerical range as an argument in the command line. This range can be a set or a sequence of numbers, or a combination of both.
A set is a range of numerical values, from a minimum to a maximum, incremented by 1. For example:
A sequence is a list of discrete integer elements, in any order. For example:
A sequence can contain sets as well as integer elements. For example:
For example, it is possible to shut down ports 1 through 10 on an XMA/MDA 1 in chassis slot 1. A port can be denoted by “slot/mda/port”, where slot is the slot number, mda is the XMA/MDA number and port is the port number. To shut down ports 1 through 10 on an XMA/MDA 1 in slot 1, the command is entered as follows:
<Ctrl-c> can be used to abort the execution of a range command.
CLI commands can contain ranges of hexadecimal values. This allows ranges to be used when working with data normally expressed in hexadecimal instead of decimal, such as IPv6 or MAC addresses. For example:
A range can also be a reference to a previous range in the same command. This reference takes the form [$x], where x is an integer between 0 and 5. For example:
This gives vprn 11 the router-id "10.20.11.1", vprn 12 the router-id "10.20.12.1", and so on.
Specifying a range in the CLI does have limitations. These limitations are summarized in Table 9.
Limitation | Description |
For example, ports on two adapter cards can be shut down in one command by using two ranges: configure port 1/[1..2]/[1..10] | |
Ranges within quotation marks are interpreted literally. | In the CLI, enclosing a string in quotation marks (“string”) causes the string to be treated literally and as a single parameter. For example, several commands in the CLI allow the configuration of a descriptive string. If the string is more than one word and includes spaces, it must be enclosed in quotation marks. A range that is enclosed in quotes is also treated literally. For example, configure router interface "A[1..10]" no shutdown creates a single router interface with the name “A[1..10]”. However, a command such as: configure router interface A[1..10] no shutdown creates 10 interfaces with names A1, A2 .. A10. |
Command completion does not work when entering a range. | After entering a range in a CLI command, command and key completion, which normally occurs by pressing the <Tab> key or spacebar, does not work. If the command line entered is correct and unambiguous, the command works properly; otherwise, an error is returned. |
SR OS supports the pipe feature to search one or more files for a character string or pattern.
When using the pipe or match command, the variables and attributes must be spelled correctly. The attributes follow the command and must come before the expression or pattern. The following are examples of how to use the pipe/match command to complete different tasks:
Command syntax:
match pattern context {parents | children | all} [ignore-case] [max-count lines-count] [expression]
match pattern [ignore-case] [invert-match] [pre-lines pre-lines] [post-lines lines-count] [max-count lines-count] [expression]
where:
For example:
Table 10 describes regular expression symbols and their interpretation (similar to what is used for route policy regexp matching). Table 11 describes character class expressions.
String | Description |
. | Matches any single character |
[ ] | Matches a single character that is contained within the brackets [abc] matches “a”, “b”, or “c” [a-z] matches any lowercase letter [A-Z] matches any uppercase letter [0-9] matches any number |
[^ ] | Matches a single character that is not contained within the brackets [^abc] matches any character other than “a”, “b”, or “c” [^a-z] matches any single character that is not a lowercase letter |
^ | Matches the start of the line (or any line, when applied in multiline mode) |
$ | Matches the end of the line (or any line, when applied in multiline mode) |
() | Defines a “marked subexpression” Every matched instance will be available to the next command as a variable |
* | A single character expression followed by “*” matches zero or more copies of the expression |
{m,n} | Matches least m and at most n repetitions of the term |
{m} | Matches exactly m repetitions of the term |
{m,} | Matches m or more repetitions of the term |
? | The preceding item is optional and matched at most once |
+ | The preceding item is matched one or more times |
- | Used between start and end of a range |
\ | An escape character to indicate that the following character is a match criteria and not a grouping delimiter |
> | Redirects output |
Character Class | Characters Matched 1 | Description |
[:alnum:] | ‘ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz 0123456789’ | Alphanumeric characters |
[:alpha:] | ‘ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz’ | Alphabetic characters |
[:blank:] | ‘ \t’ | Space and Tab |
[:cntrl:] | ‘\007\b\t\n\v\f\r\1\2\3\4\5\6\16\17\20 \21\22\23\24\25\26\27\30 \31\32\33\34\35\36\37\177’ | Control characters |
[:digit:] | ‘0123456789’ | Digits |
[:graph:] | ‘ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz 0123456789 !\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~’ | Visible characters |
[:lower:] | ‘abcdefghijklmnopqrstuvwxyz’ | Lowercase letters |
[:print:] | ‘ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz 0123456789!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~ ’ | Visible characters and the Space character |
[:punct:] | ‘!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~’ | Punctuation characters |
[:space:] | ‘\t\n\v\f\r ‘ | Whitespace (blank) characters |
[:upper:] | ‘ABCDEFGHIJKLMNOPQRSTUVWXYZ’ | Uppercase letters |
[:xdigit:] | ‘0123456789ABCDEFabcdef’ | Hexadecimal digits |
Note:
Character class expressions must be enclosed within brackets. The expression [[:digit:]] is treated as a regular expression containing the character class “digit”, while [:digit:] is treated as a regular expression matching “:”, “d”, “i”, “g”, or “t”.
The SR OS supports a pipe/count command (...| count) that provides a count of the number of lines that would have otherwise been displayed. The pipe/count command is particularly useful when used in conjunction with the pipe/match command in order to count the number of output lines that match a specified pattern.
For example:
The SR OS supports a command pipe/reverse-dns (...| reverse-dns) that processes the input to the pipe by performing a reverse DNS lookup on any IPv4 or IPv6 address strings. For each line where an address string is identified and where the reverse DNS lookup locates a match, the output of the lookup is inserted as the next line in the display. If no match is found, nothing is printed. If the output line is more than 80 characters, the line is truncated.
For example:
The user can include a regular expression inside the range operator of any clear, config, show, or tools CLI commands. The beginning and ending of the regular expression must be delimited with the "/" symbol.
SR OS performs the following steps:
Note: The order of execution is the same as the order in which the names are listed in the output display of the CLI info command or in the output display when you invoke the auto-complete function using the <Tab> key. If the execution of the command fails for one of the matching object names, the execution is aborted and the remaining matching object names are not processed. |
For example (assume the following SR-TE LSP names are configured on the router):
The following command displays the subset of all SR-TE LSPs with names that include the expression "LSP":
show router mpls sr-te-lsp [/LSP/]
The SR OS expands this command into the following individual commands:
show router mpls sr-te-lsp RENO194_DET190_LSP1_Profile10
show router mpls sr-te-lsp RENO194_DET190_LSP3
show router mpls sr-te-lsp RENO194_ATL224_LSP1
The output of the three show commands is displayed in the following example:
The user can use all the regular expression symbols listed in Table 10 and Table 11 inside the regular expression to match.
For example, the user can list all LSP names that begin with the string "RENO194_" followed by the string "ATL" as follows:
Note: The following conventions are used in the previous example.
|
Table 12 summarizes special rules governing the use of some of the regular expression symbols inside a regular expression match operation. Any symbol from Table 10 or Table 11 that is not listed in Table 12 can be used directly inside a regular expression match operation.
String | Description |
? | [/\?/] if using as a regular expression and [/\\\?/] if using to match the character ? |
[ ] | [/\[\]/] if using as a regular expression and [/\\\[\\\]/] if using to match the characters [] |
$ | [/$/] if using as a regular expression and [/\\$/] if using to match the character $ |
\ | [/\\\\/] if using to match the character \ |
/ | [/\//] if using to match the character / |
‘ | [/\'/] if using to match the character ' |
* | [/\\*/] if using to match the character * |
. | [/\./] if using as a regular expression and [/\\\./] if using to match the character . |
+ | [/\\+/] if using to match the character + |
, | [/\,/] if using to match the character , |
^ | [/\\^/] if using to match the character ^ |
( | [/\\(/] if using to match the character ( |
) | [/\\)/] if using to match the character ) |
space | [/\ /] if using to match the character space |
The SR OS does not support the combination of a partial string with a regular expression match operation.
For example, if the operator wants to display the SR-TE LSP names that begin with the string "RENO194_ATL", if part of the string is entered directly and the rest of the string is entered inside a regular expression, the command returns no match. The following example demonstrates the incorrect syntax:
To obtain a match, the entire string must be inside the regular expression. The following example demonstrates the correct syntax for finding a match:
The SR OS supports redirection (>), which allows the operator to store the output of a CLI command as a local or remote file.
For example:
In some cases, only part of the output might be applicable. The pipe/match and redirection commands can be combined:
This records only the RTT portion (including the word “time”).
The “vi”sual editor (vi) is a file editor that can edit any ASCII file. This includes configuration files, exec files, and the BOF.
VT100 terminal mode is supported. However, if a different terminal mode is configured, there is no noticeable negative effect.
When a configuration file is changed, a validation check is executed to see if the user is allowed to view or perform configuration changes. When a user modifies the configuration file using the vi editor, these checks do not occur. Because of this, the vi editor is only available to a user with administrator privileges. If others require access to the vi editor, their profile must be modified to allow the access. Access permission for the file directory where the file resides must be performed before a user can open, read, or write a file processing command. If a user does not have permission to access the directory, the operation is denied.
When opening a file, a resource check verifies that sufficient resources are available to process the file. If there are insufficient resources, the operation is denied and the operator is informed of that event.
Multiple sessions are allowed and are limited only by the memory resources available on the node.
The vi editor operates in two modes:
Use the commands in the following tables to start and end vi edit sessions, move around in a file, enter new text, modify, move, and delete existing text, and read from and write to other files.
Table 13 describes the commands to cut, paste, and delete text.
vi Command | Description |
" | Specify a buffer to be used with any of the commands using buffers. Follow the " character with a letter or a number, which corresponds to a buffer. |
d | Delete text. The “dd” command deletes the current line. A count specifies the number of lines to delete. Whatever is deleted is placed into the buffer specified with the " command. If no buffer is specified, the general buffer is used. |
D | Delete to the end of the line from the current cursor position. |
p | Paste the specified buffer after the current cursor position or line. If no buffer is specified (with the " command), 'p' uses the general buffer. |
P | Paste the specified buffer before the current cursor position or line. If no buffer is specified (with the " command), “P” uses the general buffer. |
x | Delete the character under the cursor. A count specifies how many characters to delete. The characters after the cursor are deleted. |
X | Delete the character before the cursor. |
y | Yank text, putting the result into a buffer. The “yy” command yanks the current line. Entering a number yanks that many lines. The buffer can be specified with the " command. If no buffer is specified, the general buffer is used. |
Y | Yank the current line into the specified buffer. If no buffer is specified, the general buffer is used. |
Table 14 describes the commands to insert new text.
vi Command | Description |
A | Append at the end of the current line. |
I | Insert from the beginning of a line. |
O | Enter insert mode in a new line above the current cursor position. |
a | Enter insert mode; the characters typed in are inserted after the current cursor position. A count inserts all the text that was inserted that many times. |
i | Enter insert mode, the characters typed in are inserted before the current cursor position. A count inserts all the text that was inserted that many times. |
o | Enter insert mode in a new line below the current cursor position. |
Table 15 describes the commands to move the cursor within the file.
vi Command | Description |
^B | Scroll backward one page. A count scrolls that many pages. |
^D | Scroll forward half a window. A count scrolls that many lines. |
^F | Scroll forward one page. A count scrolls that many pages. |
^H | Move the cursor one space to the left. A count moves that many spaces. |
^J | Move the cursor down one line in the same column. A count moves that many lines down. |
^M | Move to the first character on the next line. |
^N | Move the cursor down one line in the same column. A count moves that many lines down. |
^P | Move the cursor up one line in the same column. A count moves that many lines up. |
^U | Scroll backward half a window. A count scrolls that many lines. |
$ | Move the cursor to the end of the current line. A count moves to the end of the following lines. |
% | Move the cursor to the matching parenthesis or brace. |
^ | Move the cursor to the first non-whitespace character. |
( | Move the cursor to the beginning of a sentence. |
) | Move the cursor to the beginning of the next sentence. |
{ | Move the cursor to the preceding paragraph. |
} | Move the cursor to the next paragraph. |
| | Move the cursor to the column specified by the count. |
+ | Move the cursor to the first non-whitespace character in the next line. |
- | Move the cursor to the first non-whitespace character in the previous line. |
_ | Move the cursor to the first non-whitespace character in the current line. |
0 | Move the cursor to the first column of the current line. |
B | Move the cursor back one word, skipping over punctuation. |
E | Move forward to the end of a word, skipping over punctuation. |
G | Go to the line number specified as the count. If no count is given, go to the end of the file. |
H | Move the cursor to the first non-whitespace character at the top of the screen. |
L | Move the cursor to the first non-whitespace character at the bottom of the screen. |
M | Move the cursor to the first non-whitespace character in the middle of the screen. |
W | Move forward to the beginning of a word, skipping over punctuation. |
b | Move the cursor back one word. If the cursor is in the middle of a word, move the cursor to the first character of that word. |
e | Move the cursor forward one word. If the cursor is in the middle of a word, move the cursor to the last character of that word. |
h | Move the cursor one character position to the left. |
j | Move the cursor down one line. |
k | Move the cursor up one line. |
l | Move the cursor one character position to the right. |
w | Move the cursor forward one word. If the cursor is in the middle of a word, move the cursor to the first character of the next word. |
Table 16 describes the commands to move the cursor around the screen.
vi Command | Description |
^E | Scroll forwards one line. A count scrolls that many lines. |
^Y | Scroll backwards one line. A count scrolls that many lines. |
z | Redraw the screen with the following options:
If you specify a count before the z command, it changes the current line to the line specified. For example, 16z. puts line 16 on the center of the screen. |
Table 17 describes the commands to replace text.
vi Command | Description |
C | Change to the end of the line from the current cursor position. |
R | Replace characters on the screen with a set of characters entered, ending with <Esc>. |
S | Change an entire line. |
c | Change until cc changes the current line. A count changes that many lines. |
r | Replace one character under the cursor. Specify a count to replace a number of characters. |
s | Substitute one character under the cursor, and go into insert mode. Specify a count to substitute a number of characters. A dollar sign ($) is placed at the last character to be substituted. |
Table 18 describes the commands to search for text or characters in the file.
vi Command | Description |
, | Repeat the last f, F, t or T command in the reverse direction. |
/ | Search the file downwards for the string specified after the /. |
; | Repeat the last f, F, t or T command. |
? | Search the file upwards for the string specified after the ?. |
F | Search the current line backwards for the character specified after the F command. If found, move the cursor to the position. |
N | Repeat the last search done by / or ?, except in the reverse direction. |
T | Search the current line backwards for the character specified after the T command, and move to the column after the character if it is found. |
f | Search the current line for the character specified after the f command. If found, move the cursor to the position. |
n | Repeat the last search done by / or ?. |
t | Search the current line for the character specified after the t command, and move to the column before the character if it is found. |
Table 19 describes the commands to manipulate character and line formatting.
vi Command | Description |
~ | Switch the case of the character under the cursor. |
< | Shift the lines up to the left by one shiftwidth. << shifts the current line to the left and can be specified with a count. |
> | Shift the lines up to the right by one shiftwidth. >> shifts the current line to the right and can be specified with a count. |
J | Join the current line with the next one. A count joins that many lines. |
Table 20 describes the commands to save and quit.
vi Command | Description |
ZZ | Exit the editor, saving if any changes were made. |
Table 21 describes miscellaneous commands.
vi Command | Description |
^G | Show the current filename and the status. |
^L | Clear and redraw the screen. |
^R | Redraw the screen removing false lines. |
^[ | Cancel a partially formed command (escape key). |
^^ | Go back to the last file edited. |
! | Execute a shell (not supported). |
& | Repeat the previous :s command. |
. | Repeat the last command that modified the file. |
: | Begin typing an EX editor command. The command is executed when the user presses <Enter>. |
@ | Type the command stored in the specified buffer. |
U | Restore the current line to the previous state before the cursor entered the line. |
m | Mark the current position with the character specified after the m command. |
u | Undo the last change to the file. Typing u again will redo the change. |
The vi editor is built upon another editor, called the EX. The EX editor only edits by line. From the vi editor you use the : command to start entering an EX command. The following list is not complete; however, it includes the most commonly used commands. If more than one line is to be modified by certain commands (such as :s and :w ), the range must be specified before the command. For example, to substitute lines 3 through 15, the command is :3,15s/from/this/g.
Table 22 describes the EX commands.
vi Command | Description |
:ab string strings | Abbreviation. If a word is typed in vi corresponding to string1, the editor automatically inserts the corresponding words. For example, the abbreviation :ab usa United States of America inserts the words United States of America whenever the word usa is typed in. |
:map keys new_seq | Mapping. This lets you map a key or a sequence of keys to another key or sequence of keys. |
:q | Quit vi. If there have been changes made, the editor issues a warning message. |
:q! | Quit vi without saving changes. |
:s/pattern/to_pattern/options | Substitute. This substitutes the specified pattern with the string in the to_pattern. Without options, it only substitutes the first occurrence of the pattern. If a g is specified, all occurrences are substituted. |
:set [all] | Sets some customizing options to vi and EX. The :set all command gives all the possible options. |
:una string | Removes the abbreviation previously defined by :ab. |
:unm keys | Removes the mapping defined by :map. |
:vi filename | Starts editing a new file. If changes have not been saved, the editor displays a warning. |
:w | Write out the current file. |
:w filename | Write the buffer to the filename specified. |
:w >> filename | Append the contents of the buffer to the filename. |
:wq | Write the buffer and quit. |
The Configuration Rollback feature provides the ability to undo configurations and revert to previous router configuration states while minimizing impacts to services.
This feature gives the operator better control and visibility over the router configurations and reduces operational risk while increasing flexibility and providing powerful recovery options.
Configuration rollback is useful in cases where configuration changes are made but the operator later decides not to keep the changes (for example, experimentation or when problems are identified in the configuration during actual network operation).
The advantages of this feature include the following.
With the rollback feature, the operator can smoothly revert to previous configurations.
Configuration parameters that are changed or items that the changed configuration has dependencies on are removed (revert to default) and the previous values are restored, which may briefly impact services.
A history of changes is preserved using checkpoint IDs, which allows rollback to different points, as well as examination of changes made, as shown in Figure 5.
The following list describes detailed behavior of the rollback feature, including the applicable CLI commands.
The SR OS has SNMP support for rollback status and control. See the TIMETRA-SYSTEM-MIB for details (for example, items such as tmnxSysRollbackStarted).
When the router is doing a rollback revert, SNMP managers see a tmnxSysRollbackStarted trap, then a rapid set of “config change” traps, and finally, the tmnxSysRollbackStatusChange trap.
During the period when a router is processing a rollback revert, both CLI commands from other users and SNMP commands continue to be processed.
A special rescue configuration checkpoint can be created that an operator can revert to at any time. The rescue configuration has its own keyword (rescue) and does not use the same rolling suffix indices as the normal rollback checkpoints. This allows the operator to easily return to the rescue configuration state without having to consider a checkpoint index, and ensures that the rescue checkpoint is always available and does not roll off the bottom of the list of checkpoints.
The operator should define a basic rescue configuration that is known to work and give appropriate management access to the node.
The location and filename of the rescue file are configurable. The SR OS appends the .rc suffix to the specified rescue filename.
The following points offer some operational guidance on the use of rollback.
Transactional configuration allows an operator to edit a candidate configuration (a set of configuration changes) without causing operational changes in the router (the active or operational configuration). When the candidate configuration is complete, the operator can explicitly commit the changes to make the entire new configuration become active.
Transactional configuration gives the operator better control and visibility over their router configurations and reduces operational risk while increasing flexibility.
The transactional configuration and configuration rollback functions combine to provide the operational model depicted in Figure 7.
In order to edit the candidate configuration, the operator must first enter the candidate edit mode (edit-cfg) with the candidate>edit command. The operator can enter and quit the configuration mode as many times as they wish before finally committing the candidate configuration.
In edit-cfg mode, the operator builds a set of candidate configuration changes using the same CLI tree as the standard line-by-line, non-transactional configuration. Tab completion and keyword syntax checking is available.
Just as there is a single operational active configuration that can be modified simultaneously by multiple users in the SR OS, there is also a single global candidate configuration instance. All users make changes in the same global candidate configuration, and a commit operation by any user commits the changes made by all users.
Users can exclusively create a candidate configuration by blocking other users and sessions of the same user from entering edit-cfg mode by specifying the exclusive parameter. The config>system>management-interface>cli>classic-cli>allow-immediate command can be used to enforce the use of candidate configuration, instead of allowing immediate line-by-line configuration changes.
If a commit operation is successful, all of the candidate changes take operational effect and the candidate is cleared. If there is an error in the processing of the commit, or a commit confirmed is not confirmed and an auto-revert occurs, the router returns to a configuration state with none of the candidate changes applied. The operator can then continue editing the candidate and try a commit later.
All commands in the candidate configuration must be in the correct order for a commit to be successful. Configuration that depends on other candidate objects must be placed after those objects in the candidate. A set of candidate editing commands (copy, insert, and so on) are available to correct and reorder the candidate configuration.
The edit-cfg mode is primarily intended for building a candidate configuration while navigating the configure branch of the CLI. Many CLI commands in branches other than configure are supported while in edit-cfg mode, but access to some CLI branches and commands are blocked, including:
The candidate configuration can be saved to a file and subsequently loaded into a candidate configuration. A saved candidate is similar to, but not the same as, an SR OS configuration file generated with an admin save command. The saved candidate cannot be used in general as a configuration file and may not exec without failures.
There is no SNMP access to the candidate configuration and no SNMP management of candidates, although any configuration changes made using transactional configuration are reported via the standard SR OS SNMP change traps and basic candidate status information is available via SNMP.
A commit may fail for a number of reasons, including:
Error messages are provided for commit failures to help the operator take the necessary actions to correct the candidate.
Standard line-by-line, non-transactional CLI and SNMP commands are not blocked during the creation or editing of a candidate or the processing of a commit. These commands take immediate operational effect when <Enter> is pressed.
By default, the SR OS automatically creates a new rollback checkpoint after a commit operation. The rollback checkpoint includes the new configuration changes made by the commit. An optional no-checkpoint keyword can be used to prevent the auto-creation of a rollback checkpoint after a commit. If the commit fails, no new rollback checkpoint is created.
When the commit confirmed option is used, a rollback checkpoint is created after the processing of the commit and exists whether the commit is automatically reverted or not.
Transactional configuration relies on the rollback mechanism to operate. Any commands and configurations that are not supported in a rollback revert are also not supported in edit-cfg mode; for example, changes to chassis-mode.
Authorization works transparently in edit-cfg mode and no unique or new local profile or TACACS+ permissions rules are required other than allowing access to the candidate branch. For example, if an operator has permission to access the configure filter context, they automatically also have access to the configure filter context when in edit-cfg mode.
If the operator’s profile allows access to the candidate load and save commands, the operations load and save only those items that the user is authorized to access.
The candidate view only displays the items that the user is authorized to access.
The candidate editing commands (such as adding lines, removing lines, and delete operations) only allow operations on items that the user is authorized to access.
The candidate commit and discard commands, along with admin rollback revert, operate on the entire candidate and impact all items; authorization does not apply.