cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1208
Views
5
Helpful
1
Replies
nishanthbabuece1
Beginner

EEM scripts Doubt

I want the below script to be applied only to particular ports of my 24-port switch. I don't want this to be applied to all my gigabit ports. Help me to make small changes in the script.

 

Example : I don't want the script to be applied to port 5-10 and port 12.

 

event manager applet update-port-description

event neighbor-discovery interface regexp GigabitEthernet.* cdp add

action 1.0 cli command "enable"

action 2.0 cli command "config t"

action 3.0 cli command "interface $_nd_local_intf_name"

action 4.0 cli command "description $_nd_cdp_entry_name:$_nd_port_id"


Output :

description SDCC_IDF_1.11:TenGigabitEthernet0/1

 

1 ACCEPTED SOLUTION

Accepted Solutions
brselzer
Cisco Employee

Hello,

 

You can use the regex part of the trigger to filter out the interfaces you don't want:

 

event manager applet update-port-description
event neighbor-discovery interface regexp GigabitEthernet0\/([1-5]\s|1[1,3-9]|[2][0-4]) cdp add
action 1.0 cli command "enable"
action 2.0 cli command "config t"
action 3.0 cli command "interface $_nd_local_intf_name"
action 4.0 cli command "description $_nd_cdp_entry_name:$_nd_port_id"

 

This should trigger only when an interface that starts with Gig0/1-5,11,13-24 comes up. You can double check my regex to be sure. 

 

Hope that helps!

-Bradley Selzer
CCIE# 60833

View solution in original post

1 REPLY 1
brselzer
Cisco Employee

Hello,

 

You can use the regex part of the trigger to filter out the interfaces you don't want:

 

event manager applet update-port-description
event neighbor-discovery interface regexp GigabitEthernet0\/([1-5]\s|1[1,3-9]|[2][0-4]) cdp add
action 1.0 cli command "enable"
action 2.0 cli command "config t"
action 3.0 cli command "interface $_nd_local_intf_name"
action 4.0 cli command "description $_nd_cdp_entry_name:$_nd_port_id"

 

This should trigger only when an interface that starts with Gig0/1-5,11,13-24 comes up. You can double check my regex to be sure. 

 

Hope that helps!

-Bradley Selzer
CCIE# 60833

View solution in original post

Content for Community-Ad