[c-nsp] Switchport trunk allowed issues

Arie Vayner (avayner) avayner at cisco.com
Wed Apr 17 18:12:09 EDT 2013

Something like this should do the trick:

event manager applet ALLOWED-VLAN
 event cli pattern "switchport trunk allowed vlan +[0-9]+.*" mode "interface" enter
 action 001 puts "ERROR: "switchport trunk allowed vlan" is not allowed. Use Add/Remove"
 action 002 set _exit_status "0"

The regex on the cli pattern catches only the "switchport trunk allowed vlan" with numbers directly after the "vlan" keyword (skipping 1+ spaces).
If you try the add/remove/none options the regexp would not match.

I didn't test it too much, so please do before deploying in production.


-----Original Message-----
From: cisco-nsp [mailto:cisco-nsp-bounces at puck.nether.net] On Behalf Of amir agha
Sent: Wednesday, April 17, 2013 04:08
To: cisco-nsp at puck.nether.net
Subject: [c-nsp] Switchport trunk allowed issues

I am writing a EEM using Cisco ios cli, can anyone have valuable suggestion about how to materialize it. Following is the topic Using following command on switch i.e
 switchport trunk allowed vlan <add/remove/all/except/none> <range>

However, if one forgets to include the <add/remove/all/except/none> keyword, the command defaults to replace:

switchport trunk allowed vlan <range>
the VLAN that has already been placed on vlan deleted and result in downtime

I would like to disable the use of: "switchport trunk allowed vlan <range>", 
and replace it with a custom EEM command like: 
	1. switchport trunk allowed vlan none.
	2. switchport trunk allowed vlan add <add> <range>
	3. switchport trunk allowed vlan add <remove> <range> This would correct a dangerous IOS syntax.
Looking forward
cisco-nsp mailing list  cisco-nsp at puck.nether.net https://puck.nether.net/mailman/listinfo/cisco-nsp
archive at http://puck.nether.net/pipermail/cisco-nsp/

More information about the cisco-nsp mailing list