This chapter provides information about using the command-line interface (CLI).
Topics in this chapter include:
The SR OS CLI is a command-driven interface accessible through the console, Telnet and secure shell (SSH). The CLI can be used for configuration and management of routers.
The SR OS CLI command tree is a hierarchical inverted tree. At the highest level is the ROOT level. Below this level are other tree levels with the major command groups; for example, configuration commands and show commands are levels below ROOT.
The CLI is organized so 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.
Figure 1 and Figure 2 are examples displaying the major contexts for router configuration, and are not a definitive list.
The command outputs in the following sections are examples only; actual displays may differ depending on supported functionality and user configuration.
The following sections describe additional navigational and syntax information.
Use the CLI to access, configure, and manage Alcatel-Lucent’s 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 you initially enter a CLI session, you are in the ROOT context. Navigate to another level by entering the name of successively lower contexts. For example, enter either the configure or show commands at the ROOT context to navigate to the config or show context, respectively. For example, at the command prompt (#), enter config. The active context displays in the command prompt.
In a given CLI context, enter commands at that context level by simply entering the text. It is also possible to include a command in a lower context as long as the command is formatted in the proper command and parameter syntax.
The following example shows two methods to navigate to a service SDP ingress level.
Method 1:
Method 2:
The CLI returns an error message when the syntax is incorrect.
The console control commands are the commands that are used for navigating within the CLI and displaying information about the console session. Most of these commands are implemented as global commands. They can be entered at any level in the CLI hierarchy with the exception of the password command which must be entered at the ROOT level. The console control commands are listed in Table 2.
Command | Description |
<Ctrl-c> | Aborts the pending command. |
<Ctrl-z> | Terminates the pending command line and returns to the ROOT context. |
Navigates the user to the parent context. | |
Echos the text that is typed in. Primary use is to display messages to the screen within an exec file. | |
Executes the contents of a text file as if they were CLI commands entered at the console. | |
Returns the user to the previous higher context. | |
exit all | Returns the user to the ROOT context. |
? | Displays help in the CLI. |
Displays a list of the most recently entered commands. | |
Displays the running configuration for a configuration context. | |
Terminates the CLI session. | |
oam | Provides OAM test suite options. See the OAM section of the SR OS OAM and Diagnostic Guide. |
Changes the user CLI login password. The password can only be changed at the ROOT level. | |
Verifies the reachability of a remote host. | |
Displays the present or previous working context of the CLI session. | |
Causes the console session to pause operation (sleep) for one second or for the specified number of seconds. Primary use is to introduce a pause within the execution of an exec file. | |
Opens a secure shell connection to a host. | |
Telnet to a host. | |
Determines the route to a destination address. | |
Displays a list of all commands at the current level and all sublevels. | |
Sends a console message to a specific user or to all users with active console sessions. |
Display the list of all system global commands by entering help globals in the CLI:
Table 3 lists describes command syntax symbols.
Symbol | Description |
| | A vertical line indicates that one of the parameters within the brackets or braces is required. tcp-ack {true | false} |
[ ] | Brackets indicate optional parameters. redirects [number seconds] |
{ } | Braces indicate that one of the parameters must be selected. default-action {drop | forward} |
[{ }] | Braces within square brackets indicates that you must choose one of the optional parameters.
|
Bold | Commands in bold indicate commands and keywords. |
Italic | Commands in italics indicate that you must enter text based on the parameter. interface interface-name |
The CLI environment commands are found in the root>environment context of the CLI tree and controls session preferences for a single CLI session. The CLI environment commands are listed in Table 4.
Command | Description |
Enables the substitution of a command line by an alias. | |
Enables or disables the use of a create parameter check. | |
Configures whether CLI output should be displayed one screen at a time awaiting user input to continue. | |
Configures the maximum number of higher-level CLI context nodes to display by name in the CLI prompt for the current CLI session. | |
Saves the indicator in the prompt. | |
Enables the suggestion of internally created objects while auto completing. | |
Configures the terminal screen length for the current CLI session. | |
Specifies whether time should be displayed in local time or UTC. |
Monitor commands display specified statistical information related to the monitor subject (such as filter, port, QoS, router, service, and VRRP) at a configurable interval until a count is reached. The CLI monitor commands are found in the root>monitor context of the CLI tree.
The monitor command output displays a snapshot of the current statistics. The output display refreshes with subsequent statistical information at each configured interval and is displayed as a delta to the previous display.
The <Ctrl-c> keystroke interrupts a monitoring process. Monitor command configurations cannot be saved. You must enter the command for each monitoring session. Note that if the maximum limits are configured, you can monitor the statistical information for a maximum of 60 * 999 sec ~ 1000 minutes.
The CLI monitor command contexts are listed in Table 5.
Command | Description |
Enables monitoring of ingress FP queue groups. | |
Enables CCAG port monitoring for traffic statistics. This command is supported on the 7450 ESS and 7750 SR; additional restrictions may apply. | |
Monitor command output for CPM filters. | |
Enables IP and MAC filter monitoring at a configurable interval until that count is reached. | |
Enables Link Aggregation Group (LAG) monitoring to display statistics for individual port members and the LAG. | |
Enables management access filter monitoring. | |
Enables port traffic monitoring. The specified port(s) statistical information displays at the configured interval until the configured count is reached. | |
Enables arbiter and scheduler statistics monitoring. | |
Enables virtual router instance monitoring at a configurable interval until that count is reached. | |
Monitors commands for a particular service. |
The help system commands and the ? key display different types of help in the CLI. Table 6 lists the different help commands.
Command | Description |
help ? | List all commands in the current context. |
string ? | List all commands available in the current context that start with string. |
command ? | Displays the command’s syntax and associated keywords. |
command keyword ? | List the associated arguments for keyword in command. |
string<Tab> | Complete a partial command name (auto-completion) or list 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 output on a 7750 SR router.
By default, the CLI command prompt indicates the device being accessed and the current CLI context. For example, the prompt: A:ALA-1>config>router>if# indicates the active context, the user is on the device with hostname ALA-1 in the configure>router>interface context. In the prompt, the separator used between contexts is the “>” symbol.
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. New contexts are newly created for logical entities when the user first navigates into the context.
Since 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.
All special characters (#, $, etc.) must be enclosed within double quotes, otherwise it is seen as a comment character and all characters on the command line following the # are ignored. For example:
When changes are made to the configuration file a “*” appears in the prompt string (*A:ALA-1) indicating that the changes have not been saved. When an admin save command is executed the “*” disappears. This behavior is controlled in the saved-ind-prompt command in the environment context.
The info, info detail and objective commands display 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 shows the output that shows using the info command and the output that shows using 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 by a user 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.
The 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 the following items and more:
If the scripts are located on local compact flash devices then 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.
A single script can be executing at one time. A table (SNMP smRunTable in the DISMAN-SCRIPT-MIB) is used as both an input queue of scripts waiting to be executed as well as for storage of records for completed scripts. If the input queue is full then the script request is discarded.
The command outputs in the following sections are examples only; actual displays may differ depending on supported functionality and user configuration.
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 space bar is pressed. When typing a command, the <Tab> key or space bar invokes auto-completion. If the keystrokes entered are definite, auto-completion will complete the command. If the letters are not sufficient to identify a specific command, pressing the <Tab> key or space bar will display commands matching the letters entered.
System commands are available in all CLI context levels.
In a given 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 will still work as long as enough recognizable characters of the command are entered.
The following output shows different static-route command syntax and an example of the command usage.
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 a value to an unintended 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 larger than 80 characters.
When entering a command, special keystrokes allow for editing of the command. Table 7 lists the command editing keystrokes.
Editing Action | Keystrokes |
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 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 path. The forward slash “/” or backward slash “\” cannot be used as an absolute path at the beginning of the command-string of the environment alias command. Spaces between the slash and the first command will return an error. Commands that are already global (such as ping, telnet, exit, back, etc.) cannot be executed with a forward slash “/” or backward slash “\” at the beginning of the command line.
The command may or may not change the current context depending on whether or not 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 the same as manually entering a series of command line instructions and parameters.
For example, beginning in an IES context service ID 4 (IES 4):
behaves the 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 in Slot 1 on XMA/MDA 1. A port can be denoted with “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 Slot 1 and XMA/MDA 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 will give 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 8.
Limitation | Description |
Up to 6 ranges (including references) may be specified in a single command, and they may not combine to more than 1000 iterations of the command. | It is possible to shut down ports 1 through 10 on XMA/MDA 1 and XMA/MDA 2: 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. |
The range cannot cause a change in contexts. | Commands should be formed in such a way that there is no context change upon command completion. For example, configure port 1/1/[1..10] will attempt to change ten different contexts. When a range is specified in the CLI, the commands are executed in a loop. On the first loop execution, the command changes contexts, but the new context is no longer valid for the second iteration of the range loop. A “Bad Command” error is reported and the command aborts. |
Command completion will cease to work when entering a range. | After entering a range in a CLI command, command and key completion, which normally occurs by pressing the <Tab> or spacebar, will cease to work. If the command line entered is correct and unambiguous, the command works properly; otherwise, an error is returned. |
The SR OS supports the pipe feature to search one or more files for a given character string or pattern.
When using the pipe/match command the variables and attributes must be spelled correctly. The attributes follow the command and must come before the expression/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 9 describes regular expression symbols and interpretation (similar to what is used for route policy regexp matching). Table 10 describes special characters.
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) |
() | Define 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. |
> | Redirect output |
Options | Similar to | Description |
[:upper:] | [A-Z] | uppercase letters |
[:lower:] | [a-z] | |
[:alpha:] | [A-Za-z] | upper- and lowercase letters |
\w | [A-Za-z_] | word characters |
[:alnum:] | [A-Za-z0-9] | digits, upper- and lowercase letters |
[:digit:] | [0-9] | digits |
\d | [0-9] | digits |
[:xdigit:] | [0-9A-Fa-f] | hexadecimal digits |
[:punct:] | [.,!?:...] | punctuation |
[:blank:] | [ \t] | space and TAB |
[:space:] | [ \t\n\r\f\v] | blank characters |
\s | [ \t\n\r\f\v] | blank characters |
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 redirection (“>”) which allows the operator to store the output of a CLI command as a local or remote file. Redirection of output can be used to automatically store results of commands in files (both local and remote).
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, exec files, BOF and any other ASCII file on the system.
VT100 terminal mode is supported. However, if a different terminal mode is configured there will 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 is modifying 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. Should others require access to the vi editor, their profile must be modified allow the access. Access permission for the file directory where the file resides must be performed before a user can opens, read, or write a file processing command. If a user does not have permission to access the directory then the operation must be denied.
When opening a file, a resource check verifies that sufficient resources are available to process that file. If there are not enough resources, then 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 following commands to start and end vi edit sessions, move around in a file, enter new text, modify, move, and delete old text, as well as read from and write to files other files. The following tables list vi commands.
vi Command | Description |
" | Specify a buffer to be used any of the commands using buffers. Follow the " character with a letter or a number, which corresponds to a buffer. |
d | Delete text. dd deletes the current line. A count deletes that many lines. Whatever is deleted is placed into the buffer specified with the " command. If no buffer is specified, then 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.) then '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.) then P uses the general buffer. |
x | Delete character under the cursor. A count tells how many characters to delete. The characters will be deleted after the cursor. |
X | Delete the character before the cursor. |
y | Yank text, putting the result into a buffer. yy yanks the current line. Entering a number yanks that many lines. The buffer can be specified with the " command. If no buffer is specified, then the general buffer is used. |
Y | Yank the current line into the specified buffer. If no buffer is specified, then the general buffer is used. |
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 will be 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 will be 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. |
vi Command | Description |
^B | Scroll backwards one page. A count scrolls that many pages. |
^D | Scroll forwards half a window. A count scrolls that many lines. |
^F | Scroll forwards 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 backwards 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, then go to the end of the file. |
H | Move the cursor to the first non-whitespace character on the top of the screen. |
L | Move the cursor to the first non-whitespace character on the bottom of the screen. |
M | Move the cursor to the first non-whitespace character on 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 to the left one character position. |
j | Move the cursor down one line. |
k | Move the cursor up one line. |
l | Move the cursor to the right one character position. |
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. |
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. z<return> puts the current line on the top of the screen; z. puts the current line on the center of the screen; and z- puts the current line on the bottom of the screen. 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. |
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 the Escape key. |
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 ($) will be put at the last character to be substituted. |
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 given 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 if it's found. |
f | Search the current line for the character specified after the f command. If found, move the cursor to the position. |
n | Repeat last search given 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's found. |
vi Command | Description |
~ | Switch the case of the character under the cursor. |
< | Shift the lines up to where 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 where 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. |
vi Command | Description |
ZZ | Exit the editor, saving if any changes were made. |
vi Command | Description |
^G | Show the current filename and the status. |
^L | Clear and redraw the screen. |
^R | Redraw the screen removing false lines. |
^[ | Escape key. Cancels partially formed command. |
^^ | 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 once the user types return. |
@ | 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 re-do 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. This list given here is not complete, but the commands given are the more commonly used. 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.
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 would insert 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 a sequence of keys. |
:q | Quit vi. If there have been changes made, the editor will issue 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, then all occurrences are substituted. For example, the command :1,$s/Alcatel/Alcatel-Lucent/g substitutes all occurrences of Alcatel to Alcatel-Lucent. |
: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 remove mapping defined by :map. |
:vi filename | Starts editing a new file. If changes have not been saved, the editor will give you 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 configuration and reverts back 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 to not keep the changes (for example, experimentation or when problems are identified in the configuration during actual network operation).
The advantage of this feature are the following:
With the rollback feature, the operator can smoothly revert to previous configurations.
Configuration parameters that changed (or items that changed configuration have dependencies on) are first removed (revert to default), and the previous values are then restored (can be briefly service impacting in changed areas).
A history of changes is preserved (checkpoint ids) that allows rollback to different points, as well as examination of changes made as shown in Figure 3.
The following list describes detailed behavior and CLI usage of the rollback feature:
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 will see a tmnxSysRollbackStarted trap, then a rapid set of “config change” traps, and then finally, the tmnxSysRollbackStatusChange trap.
During the period when a router is processing a rollback revert, both CLI commands (from other users) and SNMP commands will continue to be processed.
A special rescue configuration checkpoint can be created that an operator can rollback 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 (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 correct management access to the node.
The location and filename of the rescue file are configurable. SR OS appends an “.rc” suffix to the specified rescue filename.
The following points offer some operational guidance on the usage of rollback.
Transactional configuration allows an operator to edit a candidate configuration (a set of configuration changes) without actually causing operational changes in the router (the active or operational configuration). Once the candidate configuration is complete the operator can explicitly commit the changes and cause the entire new configuration to become active.
Transactional configuration gives the operator better control and visibility over their router configurations and reduce operational risk while increasing flexibility.
Transactional Configuration and Configuration Rollback support combine to provide the operational model depicted in Figure 5.
In order to edit the candidate configuration the operator must first enter the candidate edit mode (edit-cfg). The operator can enter and quit the configuration mode as many times as they wish before finally committing the candidate.
In edit-cfg mode the operator builds a set candidate configuration changes using the same CLI tree as 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 will commit the changes made by all users.
Users have the ability to exclusively create a candidate configuration by blocking other users (and sessions of the same user) from entering edit-cfg mode.
If a commit operation is successful then all of the candidate changes will 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, then the router will return 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, etc) 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 CLI. Many CLI commands in branches other than configure are supported while in edit-cfg mode, but access to some CLI branches and command are blocked including the:
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 config 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 done via a transaction are reported via the standard SR OS SNMP change traps and basic candidate status information is available via SNMP.
Failure of a commit may be due to one or more of several reasons including:
Error messages that will help the operator to take necessary actions to correct the candidate are provided for commit failures.
Standard line-by-line (immediate operational effect upon pushing the enter/return key) non-transactional CLI and SNMP commands are not blocked during the creation/editing of a candidate or the processing of a commit. These commands take immediate effect as normal.
By default, the SR OS will automatically create a new rollback checkpoint after a commit operation. The rollback checkpoint will include the new configuration changes made by the commit. An optional no-checkpoint keyword can be used to avoid the auto-creation of a rollback checkpoint after a commit. If the commit fails then no new rollback checkpoint is created.
When the commit confirmed option is used then a rollback checkpoint is created after the processing of the commit and will exist 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/new local profile or TACACS+ permissions rules are required (other than allowing access to the candidate branch). For example: if an operator has permissions to access the configure filter context then they will automatically also have access to the configure filter context when in edit-cfg mode.
The candidate load and save operations (if the operator’s profile allows access to the candidate load and save commands) will load and save only those items that the user is authorized to access.
The candidate view will only display the items that the user is authorized to access.
The various candidate editing commands (such as adding lines, removing lines, delete, etc) only allow operations on items that the user is authorized to access.
The candidate commit and discard operations (along with rollback revert) operate on the entire candidate and impact all items (authorization does not apply).