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.


TABLE 4-1 CLI Command Modes

Command Mode

Access Method

Prompt

Exit or Access Previous Mode

User Exec

This is the first level of access for performing basic tasks and listing system information.

Switch>

Enter logout command

Privileged Exec

From the User Exec mode, enter the enable command.

Switch#

Type exit or press Ctrl-Z to exit to the User Exec mode.

VLAN

From the Privileged Exec mode, enter the vlan database command.

Switch(Vlan)#

Type exit to exit to the Privileged Exec mode, or press Ctrl-Z to switch to the User Exec mode.

Global Config

From the Privileged Exec mode, enter the configure command.

Switch(Config)#

Type exit to exit to the Privileged Exec mode, or press Ctrl-Z to switch to the User Exec mode.

Interface Config

From the Global Config mode, enter the interface <slot/port> command.

Switch (Interface “if number”)#

Type exit to exit to the Global Config mode, or press Ctrl-Z to switch to the User Exec mode.

Line Config

From the Global Config mode, enter the lineconfig command.

Switch (line)#

Type exit to exit to the Global Config mode, or press Ctrl-Z to switch to the User Exec mode.

Policy Map Config

From the Global Config mode, enter the policy-map <policy-name> command.

Switch (Config-policy-map)#

Type exit to exit to the Global Config mode, or press Ctrl-Z to switch to the User Exec mode.

Policy Class Config

From the Policy Map mode, enter the class command.

Switch (Config-policy-classmap)#

Type exit to exit to the Policy Map mode, or press Ctrl-Z to switch to the User Exec mode.

Class Map Config

From the Global Config mode, enter the class-map <class-map-name> command.

Switch (Config-classmap)#

Type exit to exit to the Global Config mode, or press Ctrl-Z to switch to the User Exec mode.

Router OSPF Config

From the Global Config mode, enter the router ospf command.

Switch (Config-router)#

Type exit to exit to the Global Config mode, or press Ctrl-Z to switch to the User Exec mode.

Router RIP Config

From the Global Config mode, enter the router rip command.

Switch (Config-router)#

Type exit to exit to the Global Config mode, or press Ctrl-Z to switch to the User Exec mode.

Router BGP Config

From the Global Config mode, enter the router bgp <asnumber> command.

Switch (Config-router)#

Type exit to exit to the Global Config mode, or press Ctrl-Z to switch to the User Exec mode.

Bwprovisioning Config

From the Global Config mode, enter the bwprovisioning command.

Switch (Config-bwp)#

Type exit to exit to the Global Config mode, or press Ctrl-Z to switch to the User Exec mode.

Bwprovisioning-Trafficclass Config

From the Bwprovisioning mode, enter the traffic-class command.

Switch (Config-bwp-trafficclass)#

Type exit to exit to the Bwprovisioning Config mode, or press Ctrl-Z to switch to the User Exec mode.

Bwprovisioning-bwallocation Config

From the Bwprovisioning mode, enter the bwallocation command.

Switch (Config-bwp-bwallocation)#

Type exit to exit to the Bwprovisioning mode. To return to the User Exec mode, enter Ctrl-Z.

DHCP Pool Config

From the Global Config mode, enter the ip dhcp pool <pool-name> command.

Switch (Config-dhcp-pool)#

Type exit to exit to the Global Config mode, or press Ctrl-Z to switch to the User Exec mode.



Mode-Based Topology

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.


FIGURE 4-1 Mode-based CLI



Mode-Based Command Hierarchy

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.

User Exec Mode

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 $>

Privileged Exec Mode

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 $#

VLAN Mode

This mode groups all the commands pertaining to VLANs. The command prompt shown at this level is $(VLAN)#

Global Config Mode

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.

Interface Config Mode

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)#+

Line Config Mode

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)#

Policy Map Mode

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>

$(Config-policy-map)#

Policy Class Mode

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>

$(Config-policy-classmap)#

Class Map Mode

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>

$(Config class-map)#

Router OSPF Config Mode

In this mode, the operator is allowed to access the router OSPF configuration commands. The command prompt at this level is:

$(Config)# router ospf

$(Config router)#

Router RIP Config Mode

In this mode, the operator is allowed to access the router RIP configuration commands. The command prompt at this level is:

$(Config)# router rip

$(Config router)#

Router BGP Config Mode

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>

$(Config-routerbgp)#

Bwprovisioning Config Mode

Use the bwprovisioning command to access the Bandwidth provisioning Config mode to configure bandwidth provisioning.

$(Config)# bwprovisioning

$(Config-bwp)#

Bwprovisioning Trafficclass Mode

Use the traffic-class command to access the Bandwidth provisioning Config mode to configure bandwidth traffic class.

$(Config bwp)# traffic-class

$(Config-bwp-trafficclass)#

Bwprovisioning bwallocation Mode

Use the bwallocation command to access the Bandwidth provisioning Config mode to configure bandwidth allocation.

$(Config bwp)# bwallocation

$(Config bwp-bwallocation)#

DHCP Pool Config Mode

Use the ip dhcp pool <pool-name> command to access the DHCP Pool Config mode.

$(Config)# ip dhcp pool <pool-name>

$(Config-dhcp-pool)#


Flow of Operation

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:


(exec) #show arpp brief
                ^
%Invalid input detected at ‘^’ marker.

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” Form of a Command

“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.

Support for “No” Form

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.

Behavior of Command Help (?)

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: