Junos Automation (Scripting)
Highlighted
Junos Automation (Scripting)

Odd behaviour with attribute matching on triggering or contributing event

[ Edited ]
‎05-27-2015 07:13 AM

I've read about attribute matching for correlating and triggering events on this page, http://www.juniper.net/techpubs/en_US/junos14.2/topics/usage-guidelines/automation-using-correlated-...

 

Now, when I try to configure this, I get an error message which I can't explain.

 

First attribute matching on triggering event. No issue there.

 

events ping_test_failed;
within 300 {
    trigger on 5;
    events ping_test_failed;
}
attributes-match {
    "{$$.test-name}" matches dest_monitoring;
}
then {
   ...

Now let's try to do the same thing with a contributing event. Error!

 

[edit event-options policy agg_dest_unreachable_cmds]
jvalcke@rtr# set attributes-match {$.test-name} matches dest_monitoring
error: conversion error: from-event-attribute: '{$.test-name}': Must be either in event.attribute or {$$.attribute} or {$event.attribute} format where event and attribute start with an alphanumeric character and can consist of alphanumerics, underscores, or hyphens
error: from-event-attribute: '{$.test-name}': Must be either in event.attribute or {$$.attribute} or {$event.attribute} format where event and attribute start with an alphanumeric character and can consist of alphanumerics, underscores, or hyphens
error: statement creation failed: {$.test-name}

So, for some reason the cli doesn't accept attribute matching on a contributing event, although it says that this should be possible in the error message. Strange!

 

Anybody else seen this?

1 REPLY 1
Highlighted
Junos Automation (Scripting)

Re: Odd behaviour with attribute matching on triggering or contributing event

[ Edited ]
‎05-28-2015 08:54 AM

Correcting myself here. When you want to match on the contributing action, you need to include the event name.

So the correct syntax would be:

 

{$ping_test_failed.test-name} matches dest_monitoring;

 

Feedback