This chapter provides information about using the command-line interface (CLI).
Nokia’s Operating System (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 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.
This section provides additional navigational and CLI syntax information.
Use the CLI to access, configure, and manage Nokia 7210 SAS devices. 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 CLI context, you can enter commands at that context level by entering the text. It is also possible to include a command in a lower context as long as the command is formatted in the correct command and parameter syntax.
The following example shows two methods to navigate to a service SAP 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 described in the following table.
Command | Description |
<Ctrl-c> | Aborts the pending command. |
<Ctrl-z> | Terminates the pending command line and returns to the ROOT context. |
back | Navigates the user to the parent context. |
clear | Clears statistics for a specified entity or clears and resets the entity. |
echo | Echos the text that is typed in. Primary use is to display messages to the screen within an exec file. |
exec | Executes the contents of a text file as if they were CLI commands entered at the console. |
exit | Returns the user to the previous higher context. |
exit all | Returns the user to the ROOT context. |
help ? | Displays help in the CLI. |
history | Displays a list of the most recently entered commands. |
info | Displays the running configuration for a configuration context. |
logout | Terminates the CLI session. |
oam | Provides OAM test suite options. See the OAM section of the 7210 SAS-Mxp, R6, R12, S, Sx, T OAM and Diagnostics Guide. |
password | Changes the user CLI login password. The password can only be changed at the ROOT level. |
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 one second or for the specified number of seconds. Primary use is to introduce a pause within the execution of an exec file. |
ssh | Opens a secure shell connection to a host. |
telnet | Telnet to a host. |
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 list of all system global commands is displayed by entering help globals in the CLI. For example:
The following table 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] |
< > | Angle brackets indicate that you must enter text based on the parameter inside the brackets. interface <interface-name> |
{ } | 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 command options. |
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 described in the following table.
Command | Description |
alias | Enables the substitution of a command line by an alias. |
create | Enables or disables the use of a create parameter check. |
more | Configures whether CLI output should 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. |
terminal | Configures the terminal screen length for the current CLI session. |
time-display | 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) 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 are described in the following table.
Command | Description |
filter | Enables IP, IPv6 and MAC filter monitoring at a configurable interval until that count is reached. |
lag | Enables Link Aggregation Group (LAG) monitoring to display statistics for individual port members and the LAG. |
port | Enables port traffic monitoring. The specified port(s) statistical information displays at the configured interval until the configured count is reached. |
router | Enables virtual router instance monitoring at a configurable interval until that count is reached. |
service | Monitors commands for a particular service. |
The help system commands and the ? key display different types of help in the CLI. The following table describes 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 help commands useful when searching for a command in a lower-level context.
The following table shows a partial list of the tree and tree detail command output entered at the config level.
A:ALU-7210>config# tree configure +---card | +---card-type | +---mda | | +---access | | +---mda-type | | +---network | | +---shutdown | +---shutdown +---cron | +---action | | +---expire-time | | +---lifetime | | +---max-completed | | +---results | | +---script | | +---shutdown | +---schedule | | +---action | | +---count | | +---day-of-month | | +---description | | +---end-time | | +---hour | | +---interval | | +---minute | | +---month | | +---shutdown | | +---type | | +---weekday | +---script | | +---description | | +---location | | +---shutdown | +---time-range | | +---absolute | | +---daily | | +---description | | +---weekdays | | +---weekend | | +---weekly | +---tod-suite | | +---description | | +---egress | | | +---filter | | | +---qos | | | +---scheduler-policy | | +---ingress | | | +---filter | | | +---qos | | | +---scheduler-policy +---dot1ag | +---domain | | +---association |... | *A:ALA-12>config# tree detail configure +---card <slot-number> | no card <slot-number> | +---card-type <card-type> | | no card-type | +---mda <mda-slot> | | no mda <mda-slot> | | +---access | | +---mda-type <mda-type> | | | no mda-type | | +---network | | +---no shutdown | | | shutdown | +---no shutdown | | shutdown +---cron | +---action <action-name> [owner <action-owner>] | | no action <action-name> [owner <action-owner>] | | +---expire-time {<seconds>|forever} | | +---lifetime {<seconds>|forever} | | +---max-completed <unsigned> | | +---no results | | | results <file-url> | | +---no script | | | script <script-name> [owner <script-owner>] | | +---no shutdown | | | shutdown | +---no schedule <schedule-name> [owner <schedule-owner>] | | schedule <schedule-name> [owner <schedule-owner>] | | +---action <action-name> [owner <action-owner>] | | | no action | | +---count <number> | | | no count | | +---day-of-month {<day-number> [..<day-number>]|all} | | | no day-of-month | | +---description <description-string> | | | no description | | +---end-time [<date>|<day-name>] <time> | | | no end-time | | +---hour {<hour-number> [..<hour-number>]|all} | | | no hour | | +---interval <seconds> | | | no interval | | +---minute {<minute-number> [..<minute-number>]|all} | | | no minute | | +---month {<month-number> [..<month-number>]|<month -name> [..<month-nam>]|all} | | | no month | | +---no shutdown | | | shutdown | | +---type <schedule-type> | | +---weekday {<weekday-number> [..<weekday -number>]|<day-name> [..<day-nme>]|all} |... |
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:ALU-7210) 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 and info detail commands display configuration for the current level. The info command displays non-default configurations. The info detail command displays the entire configuration for the current level, including defaults. The following example shows the output that displays using the info command and the output that displays using the info detail command.
The exec command allows the user 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.
This section provides information about entering CLI commands and parameters.
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 context, the CLI accepts command parameters in any order as long as the command is formatted in the correct 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.
When entering a command, special keystrokes allow for editing of the command. The following table describes 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 forward slash “/” or backward slash “\” cannot be used with the environment alias command.The commands are interpreted as absolute path. 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
Note that 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
Example: config>service>ies>exit all configure service vpls 5 create config>service>vpls>
The CLI maintains a history of the most recently entered commands. The history command displays the most recently entered CLI commands.
The 7210 SAS CLI allows the use of a single numerical range as an argument in the command line. A range in a CLI command is limited to positive integers and is denoted with two numbers enclosed in square brackets with two periods (“..”) between the numbers:
where x and y are positive integers and y-x is less than 1000.
For example, it is possible to shut down ports 1 through 10 in Slot 1 on MDA 1. A port is denoted with “slot/mda/port”, where slot is the slot number, mda is the MDA number and port is the port number. To shut down ports 1 through 10 on Slot 1 and MDA 1, the command is entered as follows:
<Ctrl-C> can be used to abort the execution of a range command.
Specifying a range in the CLI does have limitations. These limitations are described in the following table.
Limitation | Description |
Only a single range can be specified. | It is not possible to shut down ports 1 through 10 on MDA 1 and MDA 2, as the command would look like configure port 1/[1..2]/[1..10] and requires two ranges in the command, [1..2] for the MDA and [1..10] for the port number. |
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 may cease to work when entering a range. | After entering a range in a CLI command, command and key completion, which occurs by pressing the <Tab> or spacebar, may cease to work. If the command line entered is correct and unambiguous, the command works correctly; otherwise, an error is returned. |
The 7210 SAS devices support the pipe feature to search one or more files for a specific character string or pattern.
Note: When using the pipe/match command the variables and attributes must be spelled correctly. The attributes following the command and must come before the expression/pattern. The following are examples of the pipe/match command to complete different tasks:
where:
For example:
The following table describes regular expression symbols and interpretation (similar to what is used for route policy regexp matching). Table 14 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 at 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] | lowercase letters |
[: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 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).
In some cases only part of the output might be applicable. The pipe/match and redirection commands can be combined:
Note: This feature is only supported on 7210 SAS-R6, 7210 SAS-R12, and 7210 SAS-Mxp. |
The Configuration Rollback feature provides the ability to “undo” a configuration and return to previous router configuration states while minimizing impacts to services.
This feature gives the operator better control and visibility over 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, when experimenting or when problems are identified in the configuration during actual network operation).
The advantages of this feature are as follows:
Configuration parameters that changed (or items that a changed configuration has dependencies on) are first removed (return to default), and the previous values are then restored (can be briefly service impacting in changed areas).
A history of changes is preserved using checkpoint IDs that allow rollback to different points, as well as examination of changes made, as shown in the following figure.
The following list describes detailed behavior and CLI usage of the rollback feature:
Note: The automatic synchronize only causes the one new checkpoint file to be copied to both CFs (the other 9 checkpoints are not automatically copied from active to standby, but that can be done manually using the admin>redundancy>rollback-sync command). |
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 indexes 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. The 7210 SAS appends an .rc suffix to the specified rescue filename.
The following points provide some operational guidance on the usage of rollback:
The following are the limitations of the configuration rollback feature for the 7210 SAS-R6, 7210 SAS-R12, and 7210 SAS-Mxp: