12-4
Software Configuration Guide—Release 12.2(25)SG
OL-7659-03
Chapter12 Configuring SmartPort Macros
Configuring Smart-Port Macros
spanning-tree portfast
spanning-tree bpduguard enable
SmartPort Macro Configuration Guidelines
Follow these guidelines when configuring macros on your switch:
Do not use exit or end commands when creating a macro. This a ction 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 will fail the syntax check or
the configuration check, and the switch will return 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 updated macro on the
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 etermine any syntax or configuration errors.
If a command fails when you apply a macro, either due to a syntax error or to 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.
Specific keywords are required when you apply the system-defined macros (cisco- desktop,
cisco-phone, cisco-switch, and cisco-router) on an interface.
At most, 3 keyword-value pairs are allowed per system-defined macro.
Creating and Applying SmartPort Macros
To create and apply a SmartPort macro, perform the following task:
Command Purpose
Step1 Switch # configure terminal Enters global configuration mode.
Step2 Switch(config)# macro name
macro-name
Creates a macro definition, and enters a macro name. A macro definition
can contain up to 3000 characters.
Enters 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.
Do not use the exit or end commands in a macro. This action could
cause any commands following exit or end to execute in a different
command mode. For best results, all commands in a macro should be
interface configuration mode commands.