CLI Usage

In This Chapter

This chapter provides information about using the Command Line Interface (CLI).

Topics in this chapter include:

CLI Structure

-The Alcatel-Lucent 7705 SAR 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 7705 SAR routers.

The 7705 SAR 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, configure commands and show commands are levels below ROOT.

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.

Figure 1 and Figure 2 display the major contexts for router configuration.

Figure 1:  Root Commands 
Figure 2:  Operational Root Commands 

Navigating in the CLI

The following sections describe additional navigational and syntax information:

CLI Contexts

Use the CLI to access, configure, and manage -Alcatel-Lucent 7705 SAR 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 CSM slot displays in the command prompt at the beginning of the CLI context.

A:ALU-12# config
     A:ALU-12>config#

In a given CLI context, you can 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 of navigating to a service SDP ingress level:

Method 1: Enter all commands on a single line.

     A:ALU-12# configure service cpipe 6 spoke-sdp 2:6 ingress
     *A:ALU-12>config>service>cpipe>spoke-sdp>ingress# 

Method 2: Enter each command on a separate line.

     A:ALU-12>config# service
     A:ALU-12>config>service# cpipe 6
     *A:ALU-12>config>service>cpipe# spoke-sdp 2:6
     *A:ALU-12>config>service>cpipe>spoke-sdp# ingress
     *A:ALU-12>config>service>cpipe>spoke-sdp>ingress#

The CLI returns an error message if the syntax is incorrect.

     *A:ALU-12>config# rooter
     Error: Bad command.

Basic CLI Commands

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.

Table 2:  Console Control Commands  

Command

Description

Page

<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

46

clear

Clears statistics for a specified entity or clears and resets the entity

46

echo

Echoes the text that is typed in. Primary use is to display messages to the screen within an exec file.

47

exec

Executes the contents of a text file as if they were CLI commands entered at the console

47

exit

Returns the user to the previous higher context

48

exit all

Returns the user to the ROOT context

48

help

Displays help in the CLI

49

?

Displays all available options

history

Displays a list of the most recently entered commands

50

info

Displays the running configuration for a configuration context

51

logout

Terminates the CLI session

52

mrinfo

Displays multicast information from the target multicast router. See the 7705 SAR OS OAM and Diagnostics Guide for details.

mstat

Traces a multicast path from a source to a receiver and displays multicast packet rate and loss information. See the 7705 SAR OS OAM and Diagnostics Guide for details.

mtrace

Traces a multicast path from a source to a receiver and displays hop-by-hop information. See the 7705 SAR OS OAM and Diagnostics Guide for details.

oam

Provides OAM test suite options. See the 7705 SAR OS OAM and Diagnostics Guide for details.

password

Changes the user CLI login password. The password can only be changed at the ROOT level.

52

ping

Verifies the reachability of a remote host

53

pwc

Displays the present or previous working context of the CLI session

55

sleep

Causes the console session to pause operation (sleep) for 1 second or for the specified number of seconds. Primary use is to introduce a pause within the execution of an exec file.

55

ssh

Opens a secure shell connection to a host

56

telnet

Telnet to a host

57

traceroute

Determines the route to a destination address

57

tree

Displays a list of all commands at the current level and all sublevels

58

write

Sends a console message to a specific user or to all users with active console sessions

59

The list of all system global commands is displayed by entering help globals in the CLI. For example:

*A:ALU-12>config>service# help globals
     back            - Go back a level in the command tree
     echo            - Echo the text that is typed in
     enable-admin    - Enable the user to become a system administrator
     exec            - Execute a file - use -echo to show the commands and
                       prompts on the screen
     exit            - Exit to intermediate mode - use option all to exit to root
                       prompt
     help            - Display help
     history         - Show command history
     info            - Display configuration for the present node
     logout          - Log off this system
     mrinfo          - Request multicast router information
     mstat           - Trace multicast path from a source to a receiver and 
                       display multicast packet rate and loss information
     mtrace          - Trace multicast path from a source to a receiver
     oam             + OAM Test Suite
     ping            - Verify the reachability of a remote host
     pwc             - Show the present working context
     sleep           - Sleep for specified number of seconds
     ssh             - SSH to a host
     telnet          - Telnet to a host
     traceroute      - Determine the route to a destination address
     tree            - Display command tree structure from the context of execution
     write           - Write text to another user
*A:ALU-12>config>service#

Table 3 lists command syntax symbols. Where the syntax differs between the CLI and the Command Reference sections of the 7705 SAR guides is noted in the table.

Table 3:  Command Syntax Symbols   

Symbol

Description

Example

 |

A vertical line (pipe) indicates that one of the parameters within the brackets or braces is required

tcp-ack {true | false}

[ ]

Brackets indicate optional parameters

router [router-name]

< >

Angle brackets indicate that the user must enter a value for the parameter inside the brackets (Note: angle brackets are not used in the Command Reference section but are used on the CLI; italics are used in the Command Reference section to indicate the same rule)

interface <interface-name>

{ }

Braces indicate that one of the parameters must be selected

default-action {drop | forward}

[{ }]

Braces within square brackets indicate that the parameters are optional, but if one is selected, the information within the braces is required; for example, if you select the peer parameter, you must enter the keyword “peer” (ip-address is optional)

discovery [{peer [ip-address]} | {interface [ip-int-name]}]

Bold

In the Command Reference section (not on the CLI), bold indicates commands and keywords that the user must enter exactly as shown

scope {inclusive | template}

Italic

In the Command Reference section (not on the CLI), italics indicate parameters that the user must enter a value for

dscp dscp-name

n/a

In the Command Reference section, n/a in the Default field of a command indicates that a default value is not applicable for the command

CLI Environment Commands

The CLI environment commands are found in the root>environment context of the CLI tree. These commands control session preferences for a single CLI session. The CLI environment commands are listed in Table 4.

Table 4:  CLI Environment Commands   

Command

Description

Page

alias

Enables the substitution of a command line by an alias

60

create

Enables or disables the use of a create parameter check

60

more

Configures whether CLI output should be displayed one screen at a time awaiting user input to continue

61

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

61

saved-ind-prompt

Saves the indicator in the prompt

62

terminal

Configures the terminal screen length for the current CLI session

62

time-display

Specifies whether time should be displayed in local time or UTC

63

time-stamp

Specifies whether a timestamp should be displayed before the prompt

63

CLI Monitor Commands

The CLI monitor commands are found in the root>monitor context of the CLI tree. Monitor commands display specified statistical information related to the monitor subject (such as filter, port, router, and service) at a configurable interval until a count is reached.

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. If the maximum limits are configured, you can monitor the statistical information for a maximum of 60 × 999 s (approximately 1000 minutes, or 16.6 hours).

The CLI monitor commands are listed in Table 5.

Table 5:  CLI Monitor Commands   

Command

Description

Page

filter

Enables IP and MAC filter monitoring at a configurable interval until that count is reached

64

management-access-filter

Monitors commands for management access filters

66

port

Enables port traffic monitoring. The specified port(s) statistical information displays at the configured interval until the configured count is reached.

68

router

Enables virtual router instance monitoring at a configurable interval until that count is reached

70

service

Monitors commands for a particular service

77

Getting Help in the CLI

The help system commands and the ? key display different types of help in the CLI. Table 6 lists the help commands.

Table 6:  Online Help Commands   

Command

Description

?

Lists all commands in the current context

string ?

Lists all commands available in the current context that start with string

command ?

Displays the command’s syntax and associated keywords

command keyword ?

Lists the associated arguments for keyword in command

string<Tab> string<Space>

Completes a partial command name (auto-completion) or lists available commands that match string

The tree and tree detail system commands are help commands that are useful when searching for a command in a lower-level context.

Figure 3 displays a partial list of the tree and tree detail command output entered at the config level.

Figure 3:  CLI Display for CLI Tree Help 

The CLI Command Prompt

By default, the CLI command prompt indicates the device being accessed and the current CLI context. For example, the prompt A:ALU-1>config>router# indicates that the active CSM is CSM A, the user is on the device with hostname ALU-1, and the current context is configure router. 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 that the context is an existing context. A $ at the end of the prompt indicates that 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 system command reduced-prompt no-of-nodes-in-prompt allows the user to control the number of levels displayed in the prompt.

All special characters (#, $, and so on) must be enclosed within double quotes; otherwise, the character is seen as a comment character and all characters on the command line following the # are ignored. For example:

*A:ALU-1>config>router>mpls# authentication-key "router#1"

This example shows a security configuration over a network link. Because the string “router#1” is enclosed within double quotes, it is recognized as a password for the link.

When changes are made to the configuration file, a “*” appears in the prompt string (*A:ALU-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.

Displaying Configuration Contexts

The info and info detail commands display the 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.

*A:ALU-1>config>router# interface system
*A:ALU-1>config>router>if# info
----------------------------------------------
            address 10.221.221.72/32
----------------------------------------------
*A:ALU-1>config>router>if# 
*A:ALU-1>config>router>if# info detail
----------------------------------------------
            address 10.221.221.72/32
            no description
            no arp-timeout
            icmp
                mask-reply
                unreachables 100 10
                ttl-expired 100 10
            exit
            no ntp-broadcast
            no shutdown
            no bfd
----------------------------------------------
*A:ALU-1>config>router>if#

EXEC Files

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.

Entering CLI Commands

The following sections describe additional information on entering CLI commands:

Command Completion

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 identify 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 context levels.

Unordered Parameters

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.

*A:ALU-12>config>router# static-route ?
- [no] static-route {<ip-prefix/prefix-length> | <ip-prefix> <netmask>} [metric
<metric>] [enable | disable] next-hop <ip-address> [bfd-enable]
- [no] static-route {<ip-prefix/mask> | <ip-prefix> <netmask>} [preference
<preference>] [metric <metric>] [tag <tag>] [enable | disable] indirect <ip-address>
[ldp [disallow-igp]]
- [no] static-route {<ip-prefix/mask> | <ip-prefix> <netmask>} [preference
<preference>] [metric <metric>] [tag <tag>] [enable | disable] black-hole
*A:ALU-12>config>router# static-route preference 1 10.1.0.0/16 metric

Editing Keystrokes

When entering a command, special keystrokes allow for editing of the command. Table 7 lists the command editing keystrokes.

Table 7:  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>

Absolute Paths

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 will return an error.

*A:ALU-12# configure router 
*A:ALU-12>config>router# interface system address 1.2.3.4 
*A:ALU-12>config>router# /admin save 
A:ALU-12>config>router# \clear router bfd session all 
A:ALU-12>config>router# 

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:

*A:ALU-12# admin 
*A:ALU-12>admin# save

or

*A:ALU-12# admin save
*A:ALU-12# 

History

The CLI maintains a history of the most recently entered commands. The history command displays the most recently entered CLI commands.

*A:ALU-1# history 
     1 environment terminal length 48 
     2 show version 
     3 configure port 1/1/1 
     4 info 
     5 show port 1/1/1
     6 \con port 1/1/1
     7 \configure router mpls 
     8 info 
     9 \configure system login-control 
     10 info 
     11 history 
*A:ALU-1# !2
*A:ALU-1# show version 
TiMOS-B-0.0.I322 both/hops ALCATEL SAR 7705 
Copyright (c) 2000-2008 Alcatel-Lucent.All rights reserved. 
All use subject to applicable license agreements.
Built on Wed Jan 16 01:05:13 EST 2008 by csabuild in /rel0.0/I322/panos/main
*A:ALU-1#

Entering Numerical Ranges

The 7705 SAR OS 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 [x.. y] 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 on MDA 1. A port is denoted by slot/mda/port, where slot identifies the IOM card slot ID (always 1), 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:

config port 1/1/[1..10] shutdown

<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 summarized in Table 8.

Table 8:  CLI Range Use Limitations   

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

config 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 7705 SAR OS 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 7705 SAR OS 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,

config router interface "A[1..10]" no shutdown

creates a single router interface with the name “A[1..10]”. However, a command such as:

config 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,

config port 1/1/[1..10]

will attempt to change 10 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 normally occurs by pressing the <Tab> or spacebar, may cease to work. If the command line entered is correct and unambiguous, the command works properly; otherwise, an error is returned.

Pipe/Match

The 7705 SAR OS supports the pipe feature to search one or more files for a given character string or pattern.

Match syntax:

match [ignore-case] [invert-match] [post-lines num-lines] [max-count num-matches] [expression] pattern

where:

num-lines: 1 to 2147483647

num-matches: 1 to 2147483647

pattern : string or regular expression

For example:

A:Dut-C# show log log-id 98 | match ignore-case "sdp bind"
"Status of SDP Bind 101:1002 in service 1001 (customer 1)changed to admin=up oper=up
flags="
"Processing of a SDP state change event is finished and status of all affected SDP
Bindings on SDP 101 has been updated."
 
A:Dut-C# show log log-id 98 | match max-count 1 "service 1001"
"Status of service 1001 (customer 1)changed to administrative state: up, operational
state: up"
 
*A:ALU-1# admin display-config | match post-lines 5 max-count 2 expression "snmp”
 
        snmp
        exit
        login-control
            idle-timeout disable
            pre-login-message "csasim2 - " name
        exit
            snmp
                view "testview" subtree "1"
                    mask ff
                exit
                view "testview" subtree "1.3.6.1.2"
                    mask ff type excluded
*A:ALU-1#

Table 9 describes regular expression symbols and interpretation (similar to what is used for route policy regexp matching).

Table 9:  Pipe/Match 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

Table 10 identifies the special character options.

Table 10:  Special Characters   

Options

Similar to

Description

[:upper:]

[A-Z]

uppercase letters

[:lower:]

[a-z]

lowercase letters

[:alpha:]

[A-Za-z]

uppercase and lowercase letters

\w

[A-Za-z_]

word characters

[:alnum:]

[A-Za-z0-9]

digits, uppercase 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

Redirection

The 7705 SAR 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).

‘ping <customer_ip> > cf3:/ping/result.txt’
‘ping <customer_ip> > ftp://ron@ftp.alcatel.com/ping/result.txt’

In some cases only part of the output might be applicable. The pipe/match and redirection commands can be combined:

ping 10.0.0.1 | match expression “time.\d+” > cf3:/ping/time.txt

This records only the RTT portion (including the word “time”).