cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
2198
Views
0
Helpful
1
Replies

Multiple regex matches

CiscoBill101
Level 1
Level 1

Hi, would appreciate some help with the below please if anyone can

I need to match the CDP model of an IP phone on a CDP neighbor-discovery event - which is fine and working well.

Upon the CDP model check of the phone then check the interface description - if the interface description contains '!' do not do anything.

If the interface description does not contain "!" - do something, like change speed etc.

I have written the below which will detect a '7945' phone correctly but if I put a '!' on it interface description it still executes line 150 onwards !

Confused 

event manager applet CDP_mod
 event neighbor-discovery interface regexp FastEthernet.* cdp add
 action 105 regexp "(7945)" "$_nd_cdp_platform" value
 action 110 if $_regexp_result eq "1"
 action 125  cli command "enable"
 action 130  cli command "show int status"
 action 131  set output "$_cli_result"
 action 132  regexp "!" "$_cli_result" value
 action 135  if $_cli_result eq "1"
 action 150  cli command "enable"
 action 155  cli command "config t"
 action 160  cli command "interface $_nd_local_intf_name"
 action 165  cli command "Description 7945_Detected"
 action 170  cli command "Speed 100"
 action 175  cli command "Duplex full"
 action 180 end

Thanks

 

1 Reply 1

Joe Clarke
Cisco Employee
Cisco Employee

You have a typo.  Action 135 should be:

 

action 135 if $_regexp_result eq 1