cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
749
Views
0
Helpful
3
Replies

EEM auto change VLAN number

shiran.wang
Level 1
Level 1

Hi All,EEM auto change VLAN, Catalyst 9000

   I want to write a EEM for user auto change VLAN number,

switch have VLAN  10,12,15,16,20,21

switch port G1/0/1 default vlan 10, 

when user disconnect the cable connect to G1/0/1 it auto change to VLAN 12,

next time user disconnect the cable connect to G1/0/1 the interface auto change vlan to 15, 

next time user disconnect the cable connect to G1/0/1 the interface auto change vlan to 16...

if there is way to do this?

switch version is Version 17.3.4b

model is C9200-24T

 

my EEM as below, but seems EEM itself can't match the log created by itself.  "action 1.5" create syslog,

but another EEM can't match this syslog. may I know where I'm wrong.

event manager applet CV
event syslog pattern "Interface Ethernet0/3, changed state to administratively down"
action 1.0 cli command "enable"
action 1.1 cli command "config t"
action 1.3 cli command "interface e0/3"
action 1.4 cli command "switchport access vlan 11"
action 1.5 syslog msg "change to Vlan11"
action 1.6 cli command "end"
action 1.7 wait 30
event syslog pattern "Interface Ethernet0/3, changed state to administratively down"
action 2.0 cli command "enable"
action 2.1 cli command "config t"
action 2.3 cli command "interface e0/3"
action 2.4 cli command "switchport access vlan 12"
action 2.5 syslog msg "change to Vlan12"
action 2.6 cli command "end"
action 2.7 wait 30
event syslog pattern "Interface Ethernet0/3, changed state to administratively down"
action 3.0 cli command "enable"
action 3.1 cli command "config t"
action 3.3 cli command "interface e0/3"
action 3.4 cli command "switchport access vlan 13"
action 3.5 syslog msg "change to Vlan13"
action 3.6 cli command "end"
action 3.7 wait 30

event manager applet MV11
event syslog pattern "change to Vlan11"
action 1.0 cli command "enable"
action 1.1 cli command "config t"
action 1.2 cli command "event manager applet CV"
action 1.3 cli command "no action 1.0"
action 1.4 cli command "no action 1.1"
action 1.5 cli command "no action 1.3"
action 1.6 cli command "no action 1.4"
action 1.7 cli command "no action 1.5"
action 1.8 cli command "no action 1.6"
action 1.9 cli command "no action 1.7"
action 3.0 cli command "end"
action 3.5 wait 30

event manager applet MV12
event syslog pattern "change to Vlan12"
action 1.0 cli command "enable"
action 1.1 cli command "config t"
action 1.2 cli command "event manager applet CV"
action 1.3 cli command "no action 2.0"
action 1.4 cli command "no action 2.1"
action 1.5 cli command "no action 2.3"
action 1.6 cli command "no action 2.4"
action 1.7 cli command "no action 2.5"
action 1.8 cli command "no action 2.6"
action 1.9 cli command "no action 2.7"
action 3.0 cli command "end"
action 3.5 wait 30

3 Replies 3

Leo Laohoo
Hall of Fame
Hall of Fame

That is not EEM but Auto Switchport Macro (ASP).  

Hi Leo,

   if you have a example for this case.

Review Cisco Networking for a $25 gift card