Junos Automation (Scripting)
Junos Automation (Scripting)

Chnaging Vrrp priority based on RPM probe

3 weeks ago

Hello

 

I would like to change VRRP priority based on RPM probe outcome, so far i can simply disable/enable with rpm but how would i change vrrp priority (if possible multiple different interface vrrp)?

 

Egert

1 REPLY 1
Junos Automation (Scripting)
Solution
Accepted by topic author Egert
3 weeks ago

Re: Chnaging Vrrp priority based on RPM probe

[ Edited ]
3 weeks ago

Currently i have following code, but when probe fails no changes are made:

 

Edit changed configuration, but still no joy, seems like event-options  are never triggered

 

services {
    rpm {
        probe A {
            test ICMP {
                probe-type icmp-ping;
                target address x.x.x.x;
                test-interval 3;
                thresholds {
                    successive-loss 1;
                }
            }
        }
        inactive: probe B {
            test ICMP2 {
                probe-type icmp-ping;
                target address x.x.x.x;
                test-interval 3;
                thresholds {
                    successive-loss 1;
                }
            }
        }
    }
}
event-options {
    policy failover {
        events ping_test_failed;
        within 100 {
            trigger on 1;
        }
        attributes-match {
            ping_test_failed.test-owner matches A;
            ping_test_failed.test-name matches ICMP;
        }
        then {
            change-configuration {
                retry count 5 interval 4;
                commands {
                    "set interface ge-0/0/0 unit 0 family inet address a.a.a.a/a vrrp-group 2 priority 1";
                    "deactivate services rpm probe A";
                    "activate services rpm probe B";
                }
            }
        }
    }
    policy revert {
        events ping_test_completed;
        within 15 {
            trigger on 1;
        }
        attributes-match {
            ping_test_completed.test-owner matches B;
            ping_test_completed.test-name matches ICMP2;
        }
        then {
            change-configuration {
                retry count 3 interval 3;
                commands {
                    "set interface ge-0/0/0 unit 0 family inet address a.a.a.a/a vrrp-group 2 priority 200";
                    "deactivate services rpm probe B";
                    "activate services rpm probe A";
                }
            }
        }
    }
}

 

Edit: seems the problem is vrrp priority changing command, when i remove it then rpm deactivation/activation is working.

 

Final edit, i had a typo "interface" -> "interfaces". Got it working now.