Configuring Command Macros
Configuring Command Macros
You can create a new command macro or use an existing macro as a template to create a new macro that
is specific to your application. After you create the macro, you can apply it globally to a switch, to a
switch interface, or to a range of interfaces.
These sections contain this configuration information:
•
•
•
•
•
Default Command Macro Configuration
There are no command macros enabled.
Command Macro Configuration Guidelines
Follow these guidelines when configuring macros on your switch:
•
•
•
•
•
•
•
•
Cisco ME 3400 Ethernet Access Switch Software Configuration Guide
10-2
Default Command Macro Configuration, page 10-2
Command Macro Configuration Guidelines, page 10-2
Creating Command Macros, page 10-3
Applying Command Macros, page 10-4
Displaying Command Macros, page 10-5
When creating a macro, do not use the exit or end commands or change the command mode by using
interface interface-id. This could cause commands that follow exit, end, or interface interface-id
to execute in a different command mode.
When creating a macro, all CLI commands should be in the same configuration mode.
When creating a macro that requires the assignment of unique values, use the parameter value
keywords to designate values specific to the interface. Keyword matching is case sensitive. All
matching occurrences of the keyword are replaced with the corresponding value. Any full match of
a keyword, even if it is part of a larger string, is considered a match and is replaced by the
corresponding value.
Macro names are case sensitive. For example, the commands macro name Sample-Macro and
macro name sample-macro will result in two separate macros.
Some macros might contain keywords that require a parameter value. You can use the macro global
apply macro-name ? global configuration command or the macro apply macro-name ? interface
configuration command to display a list of any required values in the macro. If you apply a macro
without entering the keyword values, the commands are invalid and are not applied.
When a macro is applied globally to a switch or to a switch interface, all existing configuration on
the interface is retained. This is helpful when applying an incremental configuration.
If you modify a macro definition by adding or deleting commands, the changes are not reflected on
the interface where the original macro was applied. You need to reapply the updated macro on the
interface to apply the new or changed commands.
You can use the macro global trace macro-name global configuration command or the macro trace
macro-name interface configuration command to apply and debug a macro to find any syntax or
configuration errors. If a command fails because of a syntax error or a configuration error, the macro
continues to apply the remaining commands.
Chapter 10
Configuring Command Macros
78-17058-01