cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1721
Views
10
Helpful
4
Replies

EEM script on C6500 SUP2T with ios version 15.2(1)SY5 and higher

bmlakar
Level 1
Level 1

Hello;

 

I have several EEM scripts for Catalyst 6500 system. After upgrading from version 15.1(2)SY11 to version 15.2(1)SY5 and higher, scripts with regexp and sub-variable match stopped working.

 

Let me demonstrate this with simple test eem script. 

 

::cisco::eem::event_register_syslog pattern ".*%LINEPROTO.*-5-UPDOWN: Line protocol on Interface .*, changed state to .*" maxrun 20
namespace import ::cisco::eem::*
namespace import ::cisco::lib::*
#
set syslog_info ""
#
array set arr_info [event_reqinfo]

set syslog_info $arr_info(msg)
puts "This was syslog msg: $syslog_info"

regexp {Interface\sLoopback([0-9]+),} $syslog_info match sub1
puts "match variable is: $match"
puts "sub1 variable is: $sub1"

 

Script should return interface Loopback name/id as sub-variable.

 

Test:

 

C6509#sh version | i IOS
Cisco IOS Software, s2t54 Software (s2t54-ADVIPSERVICESK9-M), Version 15.2(1)SY5, RELEASE SOFTWARE (fc4)
C6509#

C6509#ct
Enter configuration commands, one per line. End with CNTL/Z.
C6509(config)#int lo177
C6509(config-if)#shutdown
C6509(config-if)#^Z
C6509#
Feb 14 2018 15:26:50.379 CET: %SYS-5-CONFIG_I: Configured from console by srcsiki on vty0 (172.25.5.77)
C6509#
Feb 14 2018 15:26:51.539 CET: %LINK-5-CHANGED: Interface Loopback177, changed state to administratively down
Feb 14 2018 15:26:52.539 CET: %LINEPROTO-5-UPDOWN: Line protocol on Interface Loopback177, changed state to down
C6509#
Feb 14 2018 15:26:52.687 CET: %HA_EM-6-LOG: test.tcl: This was syslog msg:
Feb 14 2018 15:26:52.687 CET: %HA_EM-6-LOG: test.tcl: Feb 14 2018 15:26:52.539 CET: %LINEPROTO-5-UPDOWN: Line protocol on Interface Loopback177, changed state to down
Feb 14 2018 15:26:52.691 CET: %HA_EM-6-LOG: test.tcl: match variable is: Interface Loopback177,
Feb 14 2018 15:26:52.691 CET: %HA_EM-6-LOG: test.tcl: sub1 variable is:
C6509#

! "sub-variable" is not present only complete "match" variable

 

! "downgrade to version 15.1(2)SY11"

C6509#sh ver | i IOS
Cisco IOS Software, s2t54 Software (s2t54-ADVIPSERVICESK9-M), Version 15.1(2)SY11, RELEASE SOFTWARE (fc3)
C6509#

C6509#ct
Enter configuration commands, one per line. End with CNTL/Z.
C6509(config)#int lo177
C6509(config-if)#shutdown
C6509(config-if)#^Z
C6509#
Feb 14 2018 15:36:06.448 CET: %SYS-5-CONFIG_I: Configured from console by srcsiki on vty0 (172.25.5.77)
Feb 14 2018 15:36:06.920 CET: %LINK-5-CHANGED: Interface Loopback177, changed state to administratively down
C6509#
Feb 14 2018 15:36:07.920 CET: %LINEPROTO-5-UPDOWN: Line protocol on Interface Loopback177, changed state to down
C6509#
Feb 14 2018 15:36:08.052 CET: %HA_EM-6-LOG: test.tcl: This was syslog msg:
Feb 14 2018 15:36:08.052 CET: %HA_EM-6-LOG: test.tcl: Feb 14 2018 15:36:07.920 CET: %LINEPROTO-5-UPDOWN: Line protocol on Interface Loopback177, changed state to down
Feb 14 2018 15:36:08.052 CET: %HA_EM-6-LOG: test.tcl: match variable is: Interface Loopback177,
Feb 14 2018 15:36:08.052 CET: %HA_EM-6-LOG: test.tcl: sub1 variable is: 177
C6509#

! "sub-variable" and "match" variable are present

 

I have tested also with ios version 15.4(1)SY3, result was the same.

 

If using EEM Applet than everything works ok with all ios versions tested.

 

Any idea?

 

Best Regards,

Branko

1 Accepted Solution

Accepted Solutions

Lists are easy with applets.  Any space-separated string can be a list.

set lst "item1 item2 item3"

foreach item $lst

 puts $item

end

View solution in original post

4 Replies 4

Joe Clarke
Cisco Employee
Cisco Employee

This is the first I've heard of this, but it is a known bug: CSCvf41331.  It's broken up through 15.5 exactly how you describe.  Looks like the next release of 15.5 should have the fix.

 

But applets should work correctly.  And you have EEM 4.0 in this code, so there is a lot you can do without needing Tcl.  Certainly this trivial example could be an applet.

Hi Joe;

 

Thanks for info provided. I have assumed something like that. I have already moved some tcl scripts to eem applet, but it is not so flexible and right now I'm struggling with lists. I can not find applets supporting lists, probably I will need to find some workaround for this.

 

Best regards,

Branko

  

 

Lists are easy with applets.  Any space-separated string can be a list.

set lst "item1 item2 item3"

foreach item $lst

 puts $item

end

Joe, thanks a lot.