C H A P T E R 4 |
Mode-Based Command-Line Interface |
The command-line interface (CLI) groups all the commands in appropriate modes according to the nature of the commands. Each of the command modes supports specific FASTPATH software commands.
This chapter includes the following topics:
TABLE 4-1 lists the command modes, the prompts visible in each mode, and the exit method from that mode.
The CLI tree is built on a mode concept in which the commands are available according to the interface. Some of the modes in the mode-based CLI are depicted in FIGURE 4-1.
Note - The User Exec commands are also accessible in the Privileged Exec Mode. |
Note - Access to all commands in the Privileged Exec mode and below is restricted through a password. |
The CLI is divided into modes. The commands in one mode are not available until the operator switches to that particular mode, with the exception of the User Exec mode commands. The User Exec mode commands can also be executed in the Privileged Exec mode.
The commands available to the operator at any time depend upon the mode. Entering a question mark (?) at the CLI prompt displays a list of the currently available commands and descriptions of the commands.
The CLI provides the following modes.
When the operator logs in to the CLI, the User Exec mode is the initial mode. The User Exec mode contains a limited set of commands. The command prompt shown at this level is $>
To have access to the full suite of commands, the operator must enter the Privileged Exec mode. The Privileged Exec mode requires password authentication. From Privileged Exec mode, the operator can issue any Exec command, enter the VLAN mode or enter the Global Config mode. The command prompt shown at this level is $#
This mode groups all the commands pertaining to VLANs. The command prompt shown at this level is $(VLAN)#
This mode permits the operator to make modifications to the running configuration. General setup commands are grouped in this mode. From the Global Config mode, the operator can enter the System Config mode, the Physical Port Config mode, the Interface Config mode, or the protocol-specific modes specified in the following sections. The command prompt at this level is $(Config)#
From the Global Config mode, the operator can enter the following configuration modes.
Many features are enabled for a particular interface. The Interface commands enable or modify the operation of an interface.
In this mode, a physical port is set up for a specific logical connection operation. The Interface Config mode provides access to the router interface configuration commands. The command prompt at this level is $(Interface <slot/port>)#
The resulting prompt for the interface configuration command entered in the Global Configuration mode is $(Config)# interface 2/1 and $(Interface 2/1)#+
This mode allows the operator to configure the console interface. The operator can configure the interface from the directly connected console or the virtual terminal used with Telnet. The command prompt at this level is $(Line)#
Use the policy-map <policy-name> command to access the QoS policy map configuration mode to configure the QoS policy map.
$(Config)# policy map <policy-name>
Use the class <class-name> command to access the QoS policy-classmap mode to attach or remove a diffserv class to a policy and to configure the QoS policy class.
$(Config policy-map)# class <class-name>
This mode consists of class creation, deletion, and matching commands. The class match commands specify layer 2, layer 3, and general match criteria. Use the class-map <class-map-name> commands to access the QoS class map configuration mode to configure QoS class maps.
$(Config)# class-map <class-map-name>
In this mode, the operator is allowed to access the router OSPF configuration commands. The command prompt at this level is:
In this mode, the operator is allowed to access the router RIP configuration commands. The command prompt at this level is:
In this mode, the operator is allowed to access the router BGP-4 configuration commands. The command prompt at this level is:
$(Config)# router bgp <1-65535>
Use the bwprovisioning command to access the Bandwidth provisioning Config mode to configure bandwidth provisioning.
Use the traffic-class command to access the Bandwidth provisioning Config mode to configure bandwidth traffic class.
Use the bwallocation command to access the Bandwidth provisioning Config mode to configure bandwidth allocation.
Use the ip dhcp pool <pool-name> command to access the DHCP Pool Config mode.
$(Config)# ip dhcp pool <pool-name>
This section captures the flow of operation for the CLI.
1. The operator logs in to the CLI session and enters the User Exec mode. In the User Exec mode, the $(exec)> prompt is displayed on the screen.
The parsing process is initiated whenever the operator types a command and presses Enter. The command tree is searched for the command of interest. If the command is not found, the output message indicates where the offending entry begins. For instance, if command node A has the command show arp brief but the operator attempts to execute the command show arpp brief, the output message is $(exec)> show arpp brief^. $%Invalid input detected at '^' marker.
If the operator has given an invalid input parameter in the command, the message conveys to the operator that an invalid input was detected. The layout of the output is:
After all the mandatory parameters are entered, any additional parameters entered are treated as optional parameters. If any of the parameters are not recognized, a syntax error message is displayed.
2. After the command is successfully parsed and validated, the control of execution goes to the corresponding CLI callback function.
3. For mandatory parameters, the command tree extends until the mandatory parameters make the leaf of the branch. The callback function is invoked only when all the mandatory parameters are provided. For optional parameters, the command tree extends until the mandatory parameters and the optional parameters make the leaf of the branch. However, the callback function is associated with the node where the mandatory parameters are fetched. The callback function then takes care of the optional parameters.
4. Once the control has reached the callback function, the callback function has complete information about the parameters entered by the operator.
“No” is a specific form of an existing command and does not represent a new or distinct command. Only the configuration commands are available in the “no” form. The behavior and the support details of the “no” form is captured as part of the mapping sheets.
Almost every configuration command has a “no” form. In general, use the “no” form to reverse the action of a command or reset a value back to the default. For example, the no shutdown interface configuration command reverses the shutdown of an interface. Use the command without the keyword no to re-enable a disabled feature or to enable a feature that is disabled by default.
The “no” form is treated as a specific form of an existing command and does not represent a new or distinct command. The behavior of the “?” and the help text are the same for the “no” form:
Copyright © 2009 Sun Microsystems, Inc. All rights reserved.