cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1800
Views
0
Helpful
2
Replies

EEM action labeling

aweise
Level 1
Level 1

I'm trying to set up my ISR4331 to reconfigure BGP and OSPF based on a specific tracked event. I have over 10 actions to configure, so when I set it up, the router re-ordered the commands based on the labels. Here's the example:

 

event manager applet Router_DOWN
event track 10 state down
action 1.0 cli command "enable"
action 1.1 cli command "conf t"
action 1.2 cli command "router bgp 12345"
action 1.3 cli command "address-family ipv4"
action 1.4 cli command "no neighbor 10.1.1.1 route-map BGP-ADV-NONE out"
action 1.5 cli command "neighbor 10.1.1.1 route-map BGP-OUT out"
action 1.6 cli command "exit"
action 1.7 cli command "router ospf 1"
action 1.8 cli command "no default-information originate route-map OSPF_METRIC"
action 1.9 cli command "default-information originate"
action 1.10 cli command "exit"
action 1.11 cli command "exit"
action 1.12 cli command "wr mem"

 

After saving the config, the router re-ordered it to the following:

 

event manager applet Router_DOWN
event track 10 state down
action 1.0 cli command "enable"
action 1.1 cli command "conf t"

action 1.10 cli command "exit"
action 1.11 cli command "exit"
action 1.12 cli command "wr mem"
action 1.2 cli command "router bgp 12345"
action 1.3 cli command "address-family ipv4"
action 1.4 cli command "no neighbor 10.1.1.1 route-map BGP-ADV-NONE out"
action 1.5 cli command "neighbor 10.1.1.1 route-map BGP-OUT out"
action 1.6 cli command "exit"
action 1.7 cli command "router ospf 1"
action 1.8 cli command "no default-information originate route-map OSPF_METRIC"
action 1.9 cli command "default-information originate"

To get around this, I made the last three lines like so:

 

action 1.91 cli command "exit"
action 1.92 cli command "exit"
action 1.93 cli command "wr mem"

 

I imagine there are a few lines I could eliminate to shorten the length, but what is the convention for labeling those actions? Can I use something like:

 

action 1.01

action 1.02

action 1.03

 

...and so on?

 

1 Accepted Solution

Accepted Solutions

Seb Rupik
VIP Alumni
VIP Alumni

Hi there,

Yes, adding a zero after the decimal will help with the sorting assuming you never go past 99 items.

Probably the easiest option is to scrap the decimal entirely and just start at 1 going up in intervals of 5 to allow for future insertion of entries.

 

cheers,

Seb.

View solution in original post

2 Replies 2

Seb Rupik
VIP Alumni
VIP Alumni

Hi there,

Yes, adding a zero after the decimal will help with the sorting assuming you never go past 99 items.

Probably the easiest option is to scrap the decimal entirely and just start at 1 going up in intervals of 5 to allow for future insertion of entries.

 

cheers,

Seb.

Hi Seb - thanks for the reply. I tried your suggestion of scrapping the decimals, but it still placed actions in the wrong order. I have 13 lines in this event script. I started with 1, then went to 5, then 10, then 15, and so on. Unfortunately, the IOS moved action item 5 after 45.

 

I went back to the decimal method and used 1.01, 1.02, etc. That placed the actions in the correct order.