From 56a762fc6c217870a5c54bc0e4e162dfa0a1e9bf Mon Sep 17 00:00:00 2001 From: fett0 Date: Tue, 11 Apr 2023 18:30:02 +0000 Subject: T4939: backport VRRP startup delay --- data/templates/vrrp/keepalived.conf.tmpl | 3 +++ interface-definitions/vrrp.xml.in | 19 +++++++++++++++++++ smoketest/scripts/cli/test_ha_vrrp.py | 9 +++++++++ 3 files changed, 31 insertions(+) diff --git a/data/templates/vrrp/keepalived.conf.tmpl b/data/templates/vrrp/keepalived.conf.tmpl index 10d5c6d24..49c5c3916 100644 --- a/data/templates/vrrp/keepalived.conf.tmpl +++ b/data/templates/vrrp/keepalived.conf.tmpl @@ -5,6 +5,9 @@ global_defs { dynamic_interfaces script_user root +{% if vrrp.global_parameters.startup_delay is vyos_defined %} + vrrp_startup_delay {{ vrrp.global_parameters.startup_delay }} +{% endif %} notify_fifo /run/keepalived/keepalived_notify_fifo notify_fifo_script /usr/libexec/vyos/system/keepalived-fifo.py } diff --git a/interface-definitions/vrrp.xml.in b/interface-definitions/vrrp.xml.in index fed1486f9..80a33c2b2 100644 --- a/interface-definitions/vrrp.xml.in +++ b/interface-definitions/vrrp.xml.in @@ -11,6 +11,25 @@ Virtual Router Redundancy Protocol settings + + + VRRP global parameters + + + + + Time VRRP startup process (in seconds) + + u32:1-600 + Interval in seconds + + + + + + + + VRRP group diff --git a/smoketest/scripts/cli/test_ha_vrrp.py b/smoketest/scripts/cli/test_ha_vrrp.py index 8abc70ccd..ad272f524 100755 --- a/smoketest/scripts/cli/test_ha_vrrp.py +++ b/smoketest/scripts/cli/test_ha_vrrp.py @@ -87,11 +87,13 @@ class TestVRRP(VyOSUnitTestSHIM.TestCase): advertise_interval = '77' priority = '123' preempt_delay = '400' + startup_delay = '120' for group in groups: vlan_id = group.lstrip('VLAN') vip = f'100.64.{vlan_id}.1/24' group_base = base_path + ['group', group] + global_param_base = base_path + ['global-parameters'] self.cli_set(['interfaces', 'ethernet', vrrp_interface, 'vif', vlan_id, 'address', inc_ip(vip, 1) + '/' + vip.split('/')[-1]]) @@ -110,9 +112,16 @@ class TestVRRP(VyOSUnitTestSHIM.TestCase): self.cli_set(group_base + ['authentication', 'type', 'plaintext-password']) self.cli_set(group_base + ['authentication', 'password', f'{group}']) + # Global parameters + self.cli_set(global_param_base + ['startup-delay', f'{startup_delay}']) + # commit changes self.cli_commit() + # Check Global parameters + config = getConfig(f'global_defs') + self.assertIn(f'vrrp_startup_delay {startup_delay}', config) + for group in groups: vlan_id = group.lstrip('VLAN') vip = f'100.64.{vlan_id}.1/24' -- cgit v1.2.3