The Command Set Editor has a number of advanced functions
you can use to edit modeled command sets.
Additional Icons in the Command Set Editor
- Duplicate Roll-up
- To the right of the up and down arrows, there is an icon of two
overlapping sheets of paper. This is the 'Duplicate Roll-up' icon,
and it allows you to duplicate or copy a portion of the command set
that you have already created.
- Duplicate Roll-up is helpful for quickly
adding several of the same items then you can edit them individually.
- Trash can
- Used to delete a highlighted item
- Sheet of paper with diagonal line across
- Marks the current widget as active or inactive
- Green equal sign
- For matching on sibling commands
- Defines required criteria before another change can happen
- Green asterisk
- For adding wildcard flexibility
- Placing wildcard markup on an argument tells the command set interpreter
that the argument is a regular expression and not an explicit string.
- Black 'P'
- 'P' for parameterization
- Creates generic, reusable command sets
- Circle with diagonal line through
- Sets a command to the 'no' version
Examples
- Example 1 – Wildcard match and replace with default value and
parameterization
- The green asterisk (*) is a wildcard matching widget that allows
you to make a change to a field regardless of the current value; no
matching test is required. The black 'P' for parameterization allows
you to create generic, reusable command sets.
- Define Command: Select interface Async in
the left pane, and click on Add Async in the
right pane. Enter the value 1 for the Async
interface number. Since this is an existing Async interface on this
example device, there are no changes to be made in this portion of
the command, so no markup is needed on Async 1.
- Add the Markup: Select arp timeout under
Async 1 in the left pane. Still in Match mode, on the right pane,
select the box to select timeout. You need to add two pieces of markup
to the timeout argument. Select the red box for the value of the timeout
argument, and click the green * wildcard to
indicate that we will match any existing value in this field. Also
click the Modify widget (blue triangle) to
indicate this argument will be modified.
Note: The green wildcard (*)
may also be used to match a portion of a value. For example, on an
ip address field, you could supply the value 10.1.1.* and
all the values 10.1.1.0-255 would be matched.
- Add Markup: Now click the double up-arrow to change to Replace mode.
Notice the timeout parameter box is set to red again and the green
asterisk (*) is gone, but the blue triangle modify icon is still on
the line. Now you can enter 1000 into the red
box as a default value for the change. Click the black 'P' at the
top of the right pane with the other icons. A box requesting you to
fill in a name for the parameter appears. Enter a descriptive name
such as arp timeout and click OK.
Now a black 'P' is on this line next to the blue triangle. When this
command set is applied to the device, you will see the parameter name
you set and be given the opportunity to either keep the default value
of 1000 or change to another value for the arp timeout. So you may
supply a default value, or you may add the 'P' markup, or you may
have both a default value and the 'P' markup. Note that you can place
the 'P' for parameterizing in either the Match or the Replace windows,
or in both allowing maximum flexibility. Using 'P' on the search criteria
lets you decide the value to Match at execution time. In the Command
Set Editor, click on the 'P' to see the assigned parameter name.
- Save the command set.
- Example 2 – Import a configuration
CAUTION: You can import a configuration over the top
of an existing command set. This clears all previously defined commands
and markup.
- Create a new (empty) modeled command set.
- Edit the new command set to open up the Command Set Editor.
- Click in the upper left corner of the window. Double-click
on the realm where the device resides, then double-click the desired
device. Select the configuration you wish to import, and click Import.
Note the configuration list displays timestamps, which are useful
in determining the right one to select.
Note: This provides the exact
information for matching so we do not have to enter it manually. Since
only commands with mark up are utilized in the command set, all the
commands that do not have mark up are ignored when the command set
is submitted.
- Example 3 – Match to Change Sibling Commands
- The green equal icon (=) selects the required criteria before
another change can happen. Currently this allows only searches or
changes between siblings. The device modeling of the SmartModel creates
a hierarchy that defines parent-child relationships. Siblings are
children of the same parent, that is, two or more commands at the
same command level. In an access list, the 'remark', 'permit' and
'deny' statements are siblings of each other. All are at the same
level in the hierarchy, and all are under the access-list parent command.
This example shows how to use the green '=' to select the match criteria
to allow a sibling command to be added. The same logic also applies
for 'deletes' and 'modifies' of a sibling.
- Define command: Import a configuration and open the existing
access list command to be changed. The starting access-list is:
access-list 10 permit 10.10.10.10
access-list 10 remark ACL10
access-list 10 permit 192.168.10.0 0.0.0.255
- Add Markup: While in Match mode, select the sibling line
to match against. In this example, the match is against the remark
ACL10 line. Select this line and click the green =.
- Add Markup: While still in Match mode, expand the 'permit
192.168.10.0' section and click on the IP address. Click on the blue
triangle on the top of the right panel to allow this address to be
changed.
- Add Markup: Click the double up-arrow on the top of the
right panel to go into Replace mode. Expand the permit '192.168.10.0'
section, and click in the empty IP address box. Fill in a default
address and click the 'P' (for parameter) to allow entering a different
IP address at the time of execution.
- Define Command: Click Add permit.
Select any and click log.
- Add Markup: Select the permit any log line
(defined in previous step) and click on the green + to
add this command.
- Save the command set.
Notes
Remember: If there is
no markup, there is no change.
Adding and modifying are
different.
Matching criteria is case-sensitive.
Commands
are interpreted by the operating system on the device and potentially
redefined, for example permit 12.13.14.1 255.255.255.255 is
interpreted to permit host 12.13.14.1
Any command set that
searches for permit 12.13.14.1 255.255.255.255 never finds anything
because the command has been reformatted. The best way to avoid this
issue is to look at the configuration. You can import the configuration
into the command set and use that format.