The 7705 SAR CLI allows the use of a single numerical range, a list of values (elements), or a combination of both 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, to configure a range of VPLS service IDs from 20 to 30 for a customer, enter:
config service vpls [20..30] customer 1 create no shutdown
A list of values contains discrete integer elements, in any order. For example, to configure a list of VPLS service IDs that are not sequential, enter:
config service vpls [3,5,7] customer 1 create no shutdown
To configure a list of interface names (interface names must begin with a letter), put the alphabetic part of the name outside of the brackets; for example:
config router interface intf[1,4,6] no shutdown
This command creates interfaces with names intf1, intf4, and intf6.
Lists can contain ranges as elements, as well as values. For example, to configure multiple ports on MDA 1, enter:
config port 1/1[1..6,8,10, 21..32] no shutdown
CLI commands can also contain ranges or lists of hexadecimal values; for example, [0x0f..0x13], [0x4,0x8,0xc]. This allows ranges to be used when working with data that is normally expressed in hexadecimal, such as IPv6 addresses or MAC addresses.
A range can also be a reference to a previous range in the same command. This reference takes the form [$x], where x is an integer between 0 and 5, with 0 referring to the first range in the command, 1 to the second, and so on up to the maximum of six ranges. For example:
config service vprn [11..20] router-id 10.20.[$0].1
gives vprn 11 the router ID 10.20.11.1, vprn 12 the router ID 10.20.12.1, and so on.
<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: CLI Range Use Limitations .
Limitation |
Description/Example |
---|---|
Up to six ranges (including references) can be specified in a single command but must not combine to more than 1000 iterations of the command |
For example, ports on two adapter cards can be shut down in one command by using two ranges: config port 1/[1..2]/[1..10] shutdown This command shuts down ports 1 to 10 on MDA 1 and MDA 2. |
Ranges within quotation marks are interpreted literally |
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 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, to 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] attempts 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. Adding shutdown or no shutdown to the command keeps the same context. |
Command completion may not work when entering a range |
After entering a range in a CLI command, command and key completion, which normally occurs by pressing the <Tab> key or spacebar, may not work. If the command line entered is correct and unambiguous, the command works properly; otherwise, an error is returned. |