From 8dc6b0aa8d7bbecfc5087a7406725812779eaaf6 Mon Sep 17 00:00:00 2001
From: Daniil Baturin <daniil@baturin.org>
Date: Wed, 10 May 2023 02:42:38 +0100
Subject: vrrp: T5215: Add built-in ping check for VRRP groups

---
 src/conf_mode/high-availability.py | 7 +++++++
 1 file changed, 7 insertions(+)

(limited to 'src')

diff --git a/src/conf_mode/high-availability.py b/src/conf_mode/high-availability.py
index 5e76dd9f9..7a63f5b4b 100755
--- a/src/conf_mode/high-availability.py
+++ b/src/conf_mode/high-availability.py
@@ -106,6 +106,13 @@ def verify(ha):
                 if not {'password', 'type'} <= set(group_config['authentication']):
                     raise ConfigError(f'Authentication requires both type and passwortd to be set in VRRP group "{group}"')
 
+            if 'health_check' in group_config:
+                from vyos.utils.dict import check_mutually_exclusive_options
+                try:
+                    check_mutually_exclusive_options(group_config["health_check"], ["script", "ping"], required=True)
+                except ValueError as e:
+                    raise ConfigError(f'Health check config is incorrect in VRRP group "{group}": {e}')
+
             # Keepalived doesn't allow mixing IPv4 and IPv6 in one group, so we mirror that restriction
             # We also need to make sure VRID is not used twice on the same interface with the
             # same address family.
-- 
cgit v1.2.3