12-9
Catalyst 3560 Switch Software Configuration Guide
OL-8553-06
Chapter 12 Configuring Auto Smartports Macros
Configuring Auto Smartports
function CISCO_SWITCH_AUTO_SMARTPORT () {
if [[ $LINKUP -eq YES ]]; then
conf t
interface $INTERFACE
macro description $TRIGGER
auto qos voip trust
switchport trunk encapsulation dot1q
switchport trunk native vlan $NATIVE_VLAN
switchport trunk allowed vlan ALL
switchport mode trunk
exit
end
else
conf t
interface $INTERFACE
no macro description
no auto qos voip trust
no switchport mode trunk
no switchport trunk encapsulation dot1q
no switchport trunk native vlan $NATIVE_VLAN
no switchport trunk allowed vlan ALL
exit
end
fi
}
<output truncated>
Configuring Auto Smartports User-Defined Macros
The Cisco IOS shell provides basic scripting capabilities for configuring the user-defined Auto
Smartports macros. These macros can contain multiple lines and can include any CLI command. You
can also define variable substitution, conditionals, functions, and triggers within the macro.
Beginning in privileged EXEC mode, follow these steps to map a user-defined event trigger to a
user-defined macro.
Command Purpose
Step 1 configure terminal Enter global configuration mode.
Step 2 macro auto execute event trigger
[parameter=value] { function
contents }
Specify a user-defined macro that maps to an event trigger.
{ function contents } Specify a user-defined macro to associate with the
trigger. Enter the macro contents within braces. Begin the IOS shell
commands with the left brace and end the command grouping with the right
brace.
(Optional) parameter=value—Replace default values that begin with $, enter
new values in the form of name value pair separated by a space:
[<name1>=<value1> <name2>=<value2>...].
Step 3 end Return to privileged EXEC mode.
Step 4 show running-config Verify your entries.
Step 5 copy running-config startup-config (Optional) Save your entries in the configuration file.