EasyManua.ls Logo

Cisco Catalyst 4500 Series - Macro Parameter Help

Cisco Catalyst 4500 Series
2086 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
21-3
Catalyst 4500 Series Switch, Cisco IOS Software Configuration Guide - Cisco IOS XE 3.9.xE and IOS 15.2(5)Ex
Chapter 21 Configuring SmartPort Macros
Configuring SmartPort Macros
The macro infrastructure can be enhanced to support accepting parameters while applying a macro. The
parameters are passed as keyword-value pairs.
The CLI limits the number of keyword-value pairs to a maximum of three, where the first parameter must
be the keyword, the second is its corresponding value, and the third parameter is the keyword for the
second keyword-value pair. Here is an example of how to pass parameters to a command macro:
Switch(config)# macro name parameter-test
Enter macro commands one per line. End with the character '@'.
switchport mode access
switchport access vlan $VLANID
switchport port-security
switchport port-security maximum $MAXHOST
If the above macro is applied to some interface without parameters, the invalid commands fail. Instead,
you should apply the macro with appropriate keyword-value pair parameters, as follows:
Switch(config-if)# macro apply parameter-test $VLANID 1 $MAXHOST 5
The above command applies the macro after replacing $VLANID with 1 and $MAXHOST with 5. Be
aware that you can specify any string in the macro as a keyword.
Macro Parameter Help
It is often difficult to remember the macro keywords while applying a macro to an interface or switch.
Macros can contain the definitions for mandatory keywords. If you apply a macro without those keyword
values, the commands are considered invalid and they fail.
You can enhance the macro infrastructure to provide help on keywords defined in macros. While creating
a macro, you can specify a help string (as a comment) to list the mandatory keywords for that macro.
The following example illustrates how to specify the help string for the keywords:
Switch(config)# macro name test
switchport access vlan $VLANID
switchport port-security maximum $MAX
#macro keywords $VLANID $MAX
Help string can be anywhere in the macro. The following example illustrates an alternate way to specify
the help string:
Switch(config)# macro name test
switchport access vlan $VLANID
#macro keywords $VLANID
switchport port-security maximum $MAX
#macro keywords $MAX
Default SmartPort Macro Configuration
This section illustrates the default configurations for the four supported macros. These macros can only
be viewed and applied; they cannot be modified by the user.
cisco-global, page 21-4
cisco-desktop, page 21-4
cisco-phone, page 21-4
cisco-router, page 21-5
cisco-switch, page 21-5

Table of Contents

Other manuals for Cisco Catalyst 4500 Series

Related product manuals