Table of Contents
Overview
This is a place to accumulate information about the Indigo CLI. It needs to be worked in to a full reference manual
The help command in the CLI provides the most up to date information for the version of software running on the switch.
Running the CLI
The CLI is normally invoked interactively with the command cli
. A single CLI command may be run with the cmd
command. This is useful as you can use shell pipes. For example:
cmd flowtable | grep 192.168.1.150
A file of CLI commands can be executed with cmd -f <filename>
.
Command Line Options
The command line options below require the CLI be invoked from the switch_cli directory.
The commands -e
, -f
and -b
are non-interactive commands.
Option |
Explanation |
Arguments |
Example |
Notes |
---|---|---|---|---|
-d |
Set debug level |
String |
cli.lua -d verbose |
Options include verbose, vverb, info, warn, error and none; may be abbreviated |
-m |
Set max port number |
Integer |
cli.lua -m 24 |
Used mostly for debugging |
-e |
Run a command from the command line and exit |
String command |
cli.lua -e "config show" |
Quotes are required around the command |
-f |
Run commands from a file |
String filename |
cli.lua -f script |
Reads and executes commands in script in non-interactive mode |
-b |
Run in non-interactively (batch mode) |
N/A |
cat afile | cli.lua -b |
Turns off inline help, command completion, etc |
Command Line Editing
In general, commands can be edited while being entered with arrow or special command keys. Command completion is done with the 'tab' key. Currently command completion The following keys provide editing functions.
Command history is supported up to 100 lines. Empty lines and repeated lines are not stored in history.
key |
function |
---|---|
control-a |
goto beginning of line |
control-c |
Terminate CLI with error code |
control-d |
Quit CLI normally. Only when cursor is at the start of the line |
control-e |
goto end of line |
control-h |
delete previous character |
control-k |
kill to end of line |
control-u |
kill line |
delete |
delete previous character |
left-arrow |
move cursor left one character |
right-arrow |
move cursor right one character |
up-arrow |
replace line with next older command from history |
down-arrow |
replace line with next newer command from history |
Command Summary
command |
brief description |
---|---|
cli_stat |
Show debug information about CLI |
config |
Show/modify running or saved configuration |
cxn_history |
Show controller connection history |
debug |
Set debug level: error, warn, info, verbose, vverb |
drvcmd |
Run an switch hardware driver command |
echo |
Echo request to command server |
enable |
Enter the 'enable' mode (currently no effect on UI) |
flowtable |
Show the flowtable: brief, extended, full |
help |
Show help for commands |
history |
Show command history |
lua |
Evaluate a lua expression |
mgmtstats |
Show management statistics |
port |
Show/set/stats for ports; use -l to indicate only ports with link (show,stats) |
ps |
Show port info; use -l to indicate only ports with link |
quit |
Quit the CLI (if supported) |
shell |
Run a shell command |
status |
Show switch status |
version |
Show firmware version |
Command Parameters
There are two types of command line parameters:
- Positional parameters
- Keyword parameters
Positional parameters determine their meaning from their position (first parameter means...) Keyword parameters are usually of the form "keyword=value". Some keyword parameters may not take a value and thus are considered "flags". They typically start with a hyphen, -.
Positional parameters must precede keyword parameters. Positional parameters are ended by:
- The parsing description specifies no more positional parameters
- A = occurs after the next token
- The next token starts with - (indicating a "flag" keyword parameter)
- End of the line
Examples
SwitchCLI# port set 3 speed=1000 mtu-1600
- 'set' is a positional parameter, the subcommand.
- '3' is a positional parameter, the port specification
- 'speed' and 'mtu' are keyword parameters
SwitchCLI# port show 1-10 -l
- 'show' is a positional parameter, the subcommand.
- '1-10' is a positional parameter, the port specification
- '-l' is a keyword flag parameter
SwitchCLI# ps -l
- '-l' is a keyword flag parameter; the first positional parameter (port spec) is undefined and, in this case, is given a default value of '*'.
Command Details
cli_stat
Show debug info on CLI
No parameters
config
Show or set configuration parameters
The config command is the primary mechanism for updating the values that determine the initialization sequence of the system. There are a set of known configuration keywords that are documented in the Indigo Initialization and Configuration document. Additional keywords may be added which can be referenced in user generated scripts which source either /etc/find-env or the appropriate sysenv file.
Syntax
config <sub-command> [<variable> [<value>] ]
Examples:
command |
notes |
---|---|
config show |
Show all variables in saved config |
config show dp_mgmt |
Show the value of avar in saved config |
config running |
Show all variables in running config |
config set dp_mgmt yes |
Set dp_mgmt to yes in saved config |
config delete dp_mgmt |
Delete dp_mgmt from saved config |
Parameters
parameter |
notes |
---|---|
1 (Positional) |
Subcommand: show, set, running, delete |
2 (Positional) |
Variable to show, set or delete |
Rest of line |
For 'set', the rest of the line gives the value to use. |
cxn_history
Display controller connection history
debug
Set the system debug level
Parameters
parameter |
notes |
---|---|
1 (Positional) |
Debug level |
drvcmd
Run a switch ASIC driver command
echo
Call the command server with an echo request of line
enable
Enter the enable mode
Note that as of 8/2011, this has no effect (always in enable mode).
flowtable
flowtable [ full | extended ]: Show the flowtable
Parameters
parameter |
notes |
---|---|
1 (Positional) |
brief, extended or full: How much info to show |
help
Show available commands
Examples
command |
notes |
---|---|
help |
List command names and brief description |
help <command> |
Show help for command with parameter help |
help all |
Show all help for all commands with parameter help |
history
Show command history
lua
Evaluate a lua expression
mgmtstats
Display the management statistics
port
Show or set port attributes and statistics.
Syntax
port <subcmd> <p-spec> [<set keyword options>]
Examples
command |
notes |
---|---|
port show * |
Show port attributes |
port show * -l |
Show attributes of all ports with link |
port set 2-4,8,12 speed=1000 |
Set port attributes |
port stats 8,9,15 |
Show port statistics |
Parameters
parameter |
notes |
---|---|
1 (Positional) |
Subcommand: show, set or stats |
2 (Positional) |
Port list like * or 1,2,4-8 |
-l (the letter L) |
For show and stats, show only ports with link |
autoneg |
Enable autoneg, yes or no |
duplex |
full duplex enabled |
enable |
Port enable state |
mtu |
MTU of port in bytes |
rx_pause |
rx_pause enabled |
speed |
Port speed in Mb |
tx_pause |
tx_pause enabled |
ps
Show port status
Parameters
parameter |
notes |
---|---|
1 (Positional) |
Port list like * or 1,2,4-8 |
-l (the letter L) |
Show only ports with link |
quit
Quit the CLI (if supported)
shell
Run the remainder of the line as a shell command
status
Display the status of the switch
version
Display the version of the firmware
Limitations
- Command completion is only supported at the end of a line. Hitting 'tab' when the cursor is in the middle of a line will move the cursor to the end of the line and perform completion on that token.
0 Comments