Smartports Macros Configuration

This chapter describes how to configure and display Smartports macros. It contains the following topics:

Understanding Smartports Macros

Smartports macros provide a convenient way to save and share common configurations. You can use Smartports macros to enable features and settings based on the location of a switch module in the network and for mass configuration deployments across the network.

Each Smartports macro is a set of CLI commands. The switch module software has a set of default macros. You can also create your own macros. Smartports macros do not contain new CLI commands; they are simply a group of existing CLI commands.

A macro can be user defined or a system default (which cannot be edited by the user).

Configuring Smartports Macros

Default Smartports Configuration

There are no Smartports macros enabled on the switch module.

 

Table 10-1 Default Smartports Macros

Macro Name 1
Description
Global Configuration Macros

cisco-cg-global

Configures the switch module settings for the industrial Ethernet environment. This macro is automatically applied when you use Express Setup to initially configure the switch module.

Note You must first apply the cisco-cg-global macro for the interface configuration macros to work properly.

cisco-cg-password

Configures the password settings for the switch module.

no-cisco-cg-password

Use the no form to delete the macro from the switch module.

cisco-sniffer

Configures SPAN functionality to analyze traffic on another port of the switch module.

no-cisco-sniffer

Use the no form to delete the macro from the interface.

Interface Configuration Macros

cisco-cg-hmi

Increases network security and reliability when connecting a desktop device, such as a PC, to a switch port. This macro is optimized for utility deployments.

no-cisco-cg-hmi

Use the no form to delete the macro from the switch module.

cisco-cg-ied

Use when connecting the switch module to an IED.

no-cisco-cg-ied

Use the no form to delete the macro from the switch module.

cisco-cg-router

Use when connecting the switch module and a WAN router. This macro is optimized for utility deployments.

no-cisco-cg-router

Use the no form to delete the macro from the switch module.

cisco-cg-switch

Use when connecting a ring of switches. This macro is optimized for utility deployments.

no-cisco-cg-switch

Use to delete the macro from the switch module.

cisco-cg-wireless

Use when connecting the switch module and a wireless access point. This macro is optimized for utility deployments.

no-cisco-cg-wireless

Use the no form to delete the macro from the switch module.

cisco-desktop

Use for increased network security and reliability when connecting a desktop device, such as a PC, to a switch module port. This macro is optimized for utility deployments.

no-cisco-desktop

Use the no form to delete the macro from the interface.

1.Cisco-default Smartports macros vary, depending on the software version running on your switch module.

Smartports Configuration Guidelines

  • You can apply a macro globally or to a specific switch module interface.
  • 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 you apply a macro to an interface, the CLI commands within the macro are configured on the interface. The existing interface configurations are not lost.

The new commands are added to the interface and are saved in the running configuration file. This is helpful when applying an incremental configuration

  • If a command fails because of a syntax or a configuration error, the macro continues to apply the remaining 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.
  • 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.
  • 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.
  • Some CLI commands are specific to certain interface types. If you apply a macro to an interface that does not accept the configuration, the macro fails the syntax or the configuration check, and the switch module returns an error message.
  • 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 interface within the range. If a macro command fails on one interface, it is still applied to the remaining interfaces.
  • When you apply a macro to a switch module or interface, the macro name is automatically added to the switch module or interface. You can display the applied commands and macro names by using the show running-config user EXEC command.
  • When you apply a macro to a user network interface (UNI) or enhanced network interface (ENI), you must first enable the port. UNIs and ENIs are disabled by default.

Applying Smartports Macros

Beginning in privileged EXEC mode, follow these steps to apply a Smartports macro:

 

Step
Command

Step 1

Display the Cisco-default Smartports macros embedded in the switch module software.

show parser macro

Step 2

Display the specific macro that you want to apply.

show parser macro name macro-name

Step 3

Enter global configuration mode.

configure terminal

Step 4

Apply each individual command defined in the macro to the switch module by entering macro global apply macro-name. Specify macro global trace macro-name to apply and to debug a macro to find any syntax or configuration errors.

Append the macro with the required values by using the parameter value keywords. Keywords that begin with $ require a unique parameter value.

You can use the macro global apply macro-name ? command to display a list of any required values for the macro. If you apply a macro without entering the keyword values, the commands are invalid and are not applied.

(Optional) Specify unique parameter values that are specific to the switch module. You can enter up to three keyword-value pairs. Parameter keyword matching is case sensitive. The corresponding value replaces all matching occurrences of the keyword.

macro global { apply | trace } macro-name [ parameter { value }] [ parameter { value }] [ parameter { value }]

Step 5

(Optional) Enter interface configuration mode, and specify the interface on which to apply the macro.

interface interface-id

Step 6

(Optional) Clear all configuration from the specified interface.

default interface interface-id

Step 7

Apply each individual command defined in the macro to the port by entering macro apply macro-name. Specify macro trace macro-name to apply and to debug a macro to find any syntax or configuration errors.

Append the macro with the required values by using the parameter value keywords. Keywords that begin with $ require a unique parameter value.

You can use the macro apply macro-name ? command to display a list of any required values for the macro. If you apply a macro without entering the keyword values, the commands are invalid and are not applied.

(Optional) Specify unique parameter values that are specific to the switch module. You can enter up to three keyword-value pairs. Parameter keyword matching is case sensitive. The corresponding value replaces all matching occurrences of the keyword.

macro { apply | trace } macro-name [ parameter { value }] [ parameter { value }] [ parameter { value }]

Step 8

Return to privileged EXEC mode.

end

Step 9

Verify that the macro is applied to an interface.

show running-config interface interface-id

Step 10

(Optional) Save your entries in the configuration file.

copy running-config startup-config

 

You can delete the cisco-cg-password and cisco-sniffer global macros on a switch module by entering the no version of each command in the macro. The cisco-cg-global global macro does not have a no version. You can delete a macro-applied configuration on a port by entering the default interface interface-id interface configuration command.

This example shows how to display the cisco-desktop macro and how to set the access VLAN ID to 25 on an interface:

 

Switch# show parser macro name cisco-desktop
Macro name : cisco-desktop
Macro type : default interface
# Macro keywords $access_vlan
# macro description cisco-desktop
switchport access vlan $access_vlan
switchport port-security
switchport port-security maximum 1
switchport port-security aging time 2
switchport port-security violation restrict
switchport port-security aging type inactivity
port-type nni
spanning-tree portfast
spanning-tree bpduguard enable
Switch# configure terminal
Switch(config-if)# interface fastethernet 0/2
Switch(config-if)# macro trace cisco-desktop $access_vlan 25
Applying command... 'macro description cisco-desktop'
Applying command... 'switchport access vlan 25'
Applying command... 'switchport port-security'
Applying command... 'switchport port-security maximum 1'
Applying command... 'switchport port-security aging time 2'
Applying command... 'switchport port-security violation restrict'
Applying command... 'switchport port-security aging type inactivity'
Applying command... 'port-type nni'
Applying command... 'spanning-tree portfast'

 

Displaying Smartports Macros

To display the Smartports macros, use one or more of the privileged EXEC commands in Table 10-2 .

 

Table 10-2 Commands for Displaying Smartports Macros

Command
Description

show parser macro

Displays all Smartports macros.

show parser macro name macro-name

Displays a specific Smartports macro.

show parser macro brief

Displays the Smartports macro names.

show parser macro description [ interface interface-id ]

Displays the Smartports macro description for all interfaces or for a specified interface.