10-30-2017 01:16 PM - edited 03-01-2019 06:13 PM
I'm pretty new to using EEM and in the process of learning. My goal is to use EEM to detect phones using the OUI of the mac address (cdp won't work as the phones used aren't cisco) and then when it detects that particular OUI on an interface it will set the vlan, speed and duplex. I figured to do this I would enter the following:
event manager applet AVAYA-EVENT
event mat interface regexp GigabitEthernet.*
event mat mac-address 0004.0d
action 001 cli command "enable"
action 002 cli command "config t"
action 003 cli command "interface $_mat_intf_name"
action 004 cli command "switchport access vlan 210"
action 005 cli command "switchport voice vlan 5"
action 006 cli command "switchport mode access"
action 006 cli command "speed 100"
action 007 cli command "duplex full"
action 008 cli command "no shutdown"
action 008 cli command "end"
end
However this isn't working.
I also tried by doing the following:
macro auto mac-address-group AVAYA-PHONE
oui list 00040d
end
And then using the build in Cisco macro to see if it would atleast trigger:
macro auto execute AVAYA-PHONE builtin CISCO_PHONE_AUTO_SMARTPORT $ACCESS_VLAN=210 $VOICE_VLAN=5
That also didn't work. Am I at least on the right track with the first one? Any help would be greatly appreciated. I used a mix of what I've seen in other posts but still no luck.
Solved! Go to Solution.
10-31-2017 07:57 AM
I forgot a line, but you may want to enable "debug event manager detect mat" and "debug event manager action cli" to see what is happening:
event manager applet LAPTOP-EVENT
event mat interface regexp GigabitEthernet.* type add
action 001 regexp "c8d3.ff" $_mat_mac_address
action 002 if $_regexp_result eq 1
action 003 cli command "enable"
action 004 cli command "config t"
action 005 cli command "interface $_mat_intf_name"
action 006 cli command "switchport access vlan 210"
action 007 cli command "speed auto"
action 008 cli command "duplex auto"
action 009 cli command "no shutdown"
action 010 cli command "end"
action 011 end
10-30-2017 02:25 PM
What you've configured will not work. What version of IOS do you have and on what switch?
10-31-2017 06:53 AM
I'm using a 3560X POE switch version 12.2(55)SE8.
10-31-2017 07:13 AM
You can do this, then:
event manager applet AVAYA-EVENT
event mat interface regexp GigabitEthernet.*
action 001 regexp "0004.0d" $_mat_mac_address
action 002 if $_regexp_result eq 1
action 003 cli command "enable"
action 004 cli command "config t"
action 005 cli command "interface $_mat_intf_name"
action 006 cli command "switchport access vlan 210"
action 007 cli command "switchport voice vlan 5"
action 008 cli command "switchport mode access"
action 009 cli command "speed 100"
action 010 cli command "duplex full"
action 011 cli command "no shutdown"
action 012 cli command "end"
end
10-31-2017 07:55 AM
Hmmm I tried that and it didn't work. Even tried by connecting my laptop and making another of that nature doing :
event manager applet LAPTOP-EVENT
event mat interface regexp GigabitEthernet.*
action 001 regexp "c8d3.ff" $_mat_mac_address
action 002 if $_regexp_result eq 1
action 003 cli command "enable"
action 004 cli command "config t"
action 005 cli command "interface $_mat_intf_name"
action 006 cli command "switchport access vlan 210"
action 007 cli command "speed auto"
action 008 cli command "duplex auto"
action 009 cli command "no shutdown"
action 010 cli command "end"
end
Made sure I can ping the switch from my laptop and that the switch had my mac address stored on the interface which it did. No luck on it changing anything though.
10-31-2017 07:57 AM
I forgot a line, but you may want to enable "debug event manager detect mat" and "debug event manager action cli" to see what is happening:
event manager applet LAPTOP-EVENT
event mat interface regexp GigabitEthernet.* type add
action 001 regexp "c8d3.ff" $_mat_mac_address
action 002 if $_regexp_result eq 1
action 003 cli command "enable"
action 004 cli command "config t"
action 005 cli command "interface $_mat_intf_name"
action 006 cli command "switchport access vlan 210"
action 007 cli command "speed auto"
action 008 cli command "duplex auto"
action 009 cli command "no shutdown"
action 010 cli command "end"
action 011 end
10-31-2017 08:17 AM
10-31-2017 09:16 AM
It could be as spanning-tree is renegotiated for the new VLAN and the MAC is learned a number of times.
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