Using the CLI
From DocWiki
Contents |
Using FACT Command Arguments
An argument is a text expression that denotes one or more objects in the fabric. Arguments are used as srguments to the FACT commands.
Using Singular Arguments
This section describes the syntax for each type of argument. Table 1 lists the argument syntax and the corresponding descriptions.
Table 1: Argument Syntax
Syntax | Argument Description |
---|---|
scan | Scans are numbered chronologically starting from 1. (1 is the oldest; N is the latest.) The latest scan can be specified as “latest.” The show history command shows the number of each scan. |
file | A file or pathname is used by the FACT host platform. |
switch | A switch can be specified in one of the following ways:
|
host | A host can be specified in one of the following ways:
|
chassis | A chassis is either a host or a switch. Any of the previously listed notations for host or switch may be used. |
managed-node | A managed node is either a host or a switch. It must be specified exactly as it appears in the managed-node part of the configuration. See About Managed Node Definitions Files. |
chip | A chip is an InfiniBand switch chip or InfiniBand channel adapter chip. It may be specified in the following ways:
|
port | A port may be specified as a port GUID, relative to a chassis or relative to a chip. As a port GUID, it is specified in eight hexadecimal octets separated by colons, as shown in the following example:
Note: Most switch chips do not have port GUIDs. Chassis-relative form has the 'syntax switch/slot/ext-number, where ext-number is the external port number. Switch has any of the previously listed forms, as shown in the following example:
Note: Internal chips can be specified in chip-relative syntax only. Chip-relative form has the syntax chip/internal-number, where chip is an InfiniBand chip as previously listed, and internal number is the port number on the chip, as shown in the following examples:
|
LID | A LID is a decimal integer. |
MLID | A multicast LID is a decimal integer. |
Using Plural Arguments
Many of the commands in FACT can accept plural arguments. The plurals can be built in several ways. Several alternatives can be separated by commas, with no spaces, as shown in the following example:
- switch01,switch02
Each alternative may contain one or more ranges. A range is surrounded by square brackets and contains one or more comma-separated alternatives. Each alternative may be a single value or a hyphen-separated range of values, as shown in the following example:
- rack[A-C,E]-host[01-10]
- (rackA-host01 through rackA-host10, and similarly for racks B, C, and E, skipping rackD)
Scans, LIDs, and slot, chip, and port numbers are always numeric, so ranges may be specified without the square brackets, as shown in the following example:
- switch03/1/1-4
- (ports 1 through 4 on slot 1 of chassis switch03)
A plural scan always describes a single object in a simple form (by not using any alternatives or images), as shown in the following example:
- switch03
FACT uses the following plural arguments:
- LIDs
- chassis
- chips
- hosts
- managed-nodes
- multicast-groups
- ports
- scans
- switches
Note: Because all keywords can be abbreviated to a unique prefix, plural keywords such as chips and ports can be abbreviated to chip and port for the most common case of referring to a single unit. They keyword chassis can be either singular or plural.
Using Command Modes
FACT has two modes of operation:
- Interactive command-line processor mode
- Single-use command mode that performs a single function
Using Interactive Mode
As a command-line program, FACT reads commands from its input, parses them, and writes their output to its output. The following sample output shows FACT interactive mode:
$ fact Cisco FACT 1.0 Copyright 2008, Cisco Systems, Inc. fact> scan fabric fact> show versions name version ----------------------- ------------------------------------- switch01 TopspinOS 2.9.0 releng #147 10/25/... switch02 TopspinOS 2.8.0 releng #154 07/11/... fact> exit $
Using Single-Command Mode
In single-command mode, a single command is passed to FACT as the program command arguments. FACT then runs the command, prints the results, and exits.
The following sample output shows the FACT single-command mode:
$ fact scan fabric $ fact show versions name version ----------------------- ------------------------------------- switch01 TopspinOS 2.9.0 releng #147 10/25/... switch02 TopspinOS 2.8.0 releng #154 07/11/... $
As a variant of single-command mode, the first word of the command, usually the verb, can be joined to the FACT name with a hyphen. The following sample output shows the FACT single-command mode:
$ fact-scan fabric $ fact-show versions
To use shell completion to see available commands, join the FACT name with a hyphen, and enter the tab key:
$ fact-<TAB>
Command-line Interface
FACT looks for several environmental variables and accepts several command-line options. This section describes the FACT command-line interface and shows how to use it.
Command-line Options
Table 2 lists and describes the command-line options.
Table 2: Command-line Options
Option | Description |
---|---|
-c file
--config-file=file | Reads primary configuration from the specified file. |
--color=always | If tracing, specifies that the transcript is colorized, showing FACT requests in one color and the switch responses in another. |
--color=auto | If tracing, specifies that the transcript is colorized only if the FACT standard output is a terminal. This behavior is the default. |
--color=never | If tracing, specifies that the transcript is not colorized. |
--config-option=
option | Adds or overrides a configuration option. |
--credentials-from=file | Adds credential information from the file. |
--guid-name=guid=name | Adds a GUID name definition.
See About GUID Name Definitions section. |
--guid-names-
from=file | Adds GUID name definitions from the specified file. |
-h
--help | Prints a message describing messages. |
--help-commands | Lists FACT commands. |
--managed-nodes-=type: pattern | Adds a set of managed-nodes to those about which FACT is aware. |
--managed-nodes-from=file | Adds managed-nodes from the file. |
-s
--sequential | Initiates sequential scan sessions to one managed node at a time. This option is helpful with the --trace command because output displays slower and more predictably. By default, FACT connects up to 50 managed nodes at a time during scans and installations. If sequential is specified, then FACT connects to one managed node at a time. |
--subnet-manager=domain name or IP address | Specifies the InfiniBand Subnet Manager host that FACT should use. |
--trace and --sequential | Runs sequential sessions to managed nodes and prints the session transcript. |
-t
--trace | By default, if --trace is not specified, then FACT will print the transcript of each session when that session is closed. If --trace is specified, FACT will print the transcript of each session as it occurs. |
-v
--version | Prints FACT version information and exits. |
Environment Variables
FACT uses environment variables to control the FACT configuration. Table 3 lists and describes the FACT environment variables.
Table 3: Environment Variables
Variable | Description |
---|---|
FACT_CONF | Name of master configturation file. |
FACT_CREDENTIAL_FILES | List of files that contain credentials, separated by colons, as shown in the following example:
|
FACT_GUID_NAMES | List of GUID name definitions, separated by semicolons. Each definition has the form “GUID=name,” as shown in the following example:
|
FACT_GUID_NAME_FILES | List of files containing GUID name definitions, separated by colons, as shown in the following example:
|
FACT_MANAGED_NODES | In-line list of managed node definitions, separated by colons, as shown in the following example:
|
FACT_MANAGED_NODE_FILES | List of files containing managed node definitions, separated by colons, as shown in the following example:
|
Correcting Commands
Note: This feature will be functional at FCS.
The system response to command line-errors is different when you use the question mark (?) to obtain help for a command. In this case, the system repeats your input following the subsequent prompt for ease of editing, as shown in the following example:
fact> show interfce ? ^ % Error: Unrecognized command fact> show interfce
Editing the CLI
Command-line editing lets you modify a command line command that you have just entered or a command line that you entered previously in the CLI session. The CLI supports a variety of ways to move about and edit the currently displayed command line. Table 4 lists and describes these options.
Table 4: Key Stroke Shortcuts
Key Strokes | Description |
---|---|
Ctrl-A | Moves the cursor to the beginning of the line. |
Ctrl-B | Moves the cursor to the left (backward) one character. |
Ctrl-D | Deletes the current character. Exits FACT if the current input line is empty. |
Ctrl-E | Moves the cursor to the end of the line. |
Ctrl-F | Moves the cursor to the right (forward) one character. |
Ctrl-G | Erases the current input line. |
Ctrl-H | Deletes the character to the left of the cursor, analogous to the Backspace key. |
Ctrl-I | Completes the current word, analogous to the Tab key. |
Ctrl-J | Accepts the current line. |
Ctrl-K | Deletes text from the cursor to the end of the line. |
Ctrl-L | Refreshes the input line. |
Ctrl-M | Accepts the current line, analogous to the Return key. |
Ctrl-N | Proceeds to the next line in the command history. |
Ctrl-P | Moves to the previous line in the command history. |
Ctrl-T | Transposes the current and previous characters. |
Ctrl-U | Deletes all text to the left of the cursor, back to the beginning of the line. |
Ctrl-W | Deletes the word to the left of the cursor. |
Ctrl-Z | Suspends the FACT. |
Ctrl-Del | Deletes the chatacter to the left of the cursor, analogous to the Delete key. |
? | Completes the current word. |
Esc-[A | Moves to the previous line in the command history. |
Esc-[B | Proceeds to the next line in the command history. |
Esc-[C | Moves the cursor to the right (forward) one character. |
Esc-[D | Moves the cursor to the left (backward) on character. |
Esc-B | Moves the cursor to the left (backward) one word. |
Esc-C | Capitalizes the word to the right of the cursor (forward). |
Esc-D | Deletes characters from the cursor through the end of the word. |
Esc-F | Moves the cursor right (forward) one word. |
Esc-L | Converts characters, from the cursor to the end of the word, to lowercase. |
Esc-U | Converts characters, from the cursor to the end of the word, to uppercase. |
Esc-Ctrl-H | Deletes the word to the left of the cursor. |
Esc-Delete | Deletes the word to the left of the cursor. |
Down Arrow | Proceeds to the next line in the command history. |
Up Arrow | Moves to the previous line in the command history. |
Left Arrow | Moves the cursor to the left (backward) one character. |
Right Arrow | Moves the cursor to the right (forward) one character. |