10-2
Catalyst 2940 Switch Software Configuration Guide
78-15507-02
Chapter10 Configuring SmartPort Macros Configuring Smart-Port Macros
Default SmartPort Macro ConfigurationThere are no default SmartPort macros configured on the switch.
SmartPort Macro Configuration GuidelinesFollow these guidelines when configuring macros on your switch:
•Do not use exit or end commands when creating a macro. This could cause commands that follow
exit or end to execute in a different command mode.
•When creating a macro, all CLI commands should be interface configuration mode commands.
•Some CLI commands are specific to certain interface types. The macro f ails the syntax check o r the
configuration check, and the switch returns an error message if it is applied to an interface that does
not accept the configuration.
•When a macro is applied to an interface, all existing configuration on the interface is retained. This
is helpful when applying an incremental configuration to an interface.
•If you modify a macro definition by adding or deleting commands, the change s are not reflected on
the interface where the original macro was applied. You need to reapply the upda te d mac r o o n th e
interface to apply the new or changed commands.
•You can use the macro trace macro-name interface configuration command to show what macros
are running on an interface or to debug the macro to d etermi n e any sy ntax o r c on figurati on error s.
•If a command fails when you apply a macro, either du e to a syntax error or a configuration error, the
macro continues to apply the remaining commands to the interface.
•Applying a macro to an interface range is the same as applying a macro to a single interface. When
you use an interface range, the macro is applied sequentially to each individual interface within the
range. If a macro command fails on one interface, it is still applied to the remaining interfaces.
Creating and Applying SmartPort MacrosBeginning in privileged EXEC mode, follow these steps to create and apply a SmartPort macro:
Command Purpose
Step1 configure terminal Enter global configuration mode.
Step2 macro name macro-name Create a macro definition, and enter a macro name. A macro definition
can contain up to 3000 characters.
Enter the macro commands with one command per line. Use the @
character to end the macro. Use the # character at the beginning of a line
to enter comment text within the macro.
We recommend that you do not use the exit or end commands in a
macro. This could cause any commands following exit or end to execute
in a different command mode. For best results, all com mands in a m acro
should be interface configuration mode commands.
Step3 interface interface-id Enter interface configuration mode, and specify the interface on which
to apply the macro.