02-23-2018 07:23 AM - edited 03-01-2019 06:25 PM
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
Solved! Go to Solution.
02-23-2018 02:58 PM
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!
02-23-2018 02:58 PM
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!
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide