summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Breunig <christian@breunig.cc>2023-01-20 20:07:34 +0100
committerGitHub <noreply@github.com>2023-01-20 20:07:34 +0100
commitbf38bb14f0698b030fa49429ec70ab2edc51c85e (patch)
tree740ff4e6e67efb0a11858448e9bf9fb560bf2b70
parent08949c6e85c6fe02bd702894748b41d600ee7d01 (diff)
parent798180589854c9296d35b3ece8eb88cf0520dd2b (diff)
downloadvyos-1x-bf38bb14f0698b030fa49429ec70ab2edc51c85e.tar.gz
vyos-1x-bf38bb14f0698b030fa49429ec70ab2edc51c85e.zip
Merge pull request #1769 from fett0/T4939
T4939: VRRP startup-delay for bonding fix
-rw-r--r--data/templates/high-availability/keepalived.conf.j23
-rw-r--r--interface-definitions/high-availability.xml.in19
-rwxr-xr-xsmoketest/scripts/cli/test_ha_vrrp.py9
3 files changed, 31 insertions, 0 deletions
diff --git a/data/templates/high-availability/keepalived.conf.j2 b/data/templates/high-availability/keepalived.conf.j2
index ebff52e1f..828636dc0 100644
--- a/data/templates/high-availability/keepalived.conf.j2
+++ b/data/templates/high-availability/keepalived.conf.j2
@@ -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/high-availability.xml.in b/interface-definitions/high-availability.xml.in
index d67a142d1..37cb90a8d 100644
--- a/interface-definitions/high-availability.xml.in
+++ b/interface-definitions/high-availability.xml.in
@@ -11,6 +11,25 @@
<help>Virtual Router Redundancy Protocol settings</help>
</properties>
<children>
+ <node name="global-parameters">
+ <properties>
+ <help>VRRP global parameters</help>
+ </properties>
+ <children>
+ <leafNode name="startup-delay">
+ <properties>
+ <help>Time VRRP startup process (in seconds)</help>
+ <valueHelp>
+ <format>u32:1-600</format>
+ <description>Interval in seconds</description>
+ </valueHelp>
+ <constraint>
+ <validator name="numeric" argument="--range 1-600"/>
+ </constraint>
+ </properties>
+ </leafNode>
+ </children>
+ </node>
<tagNode name="group">
<properties>
<help>VRRP group</help>
diff --git a/smoketest/scripts/cli/test_ha_vrrp.py b/smoketest/scripts/cli/test_ha_vrrp.py
index 68905e447..f18a4ab86 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 + ['vrrp', 'group', group]
+ global_param_base = base_path + ['vrrp', 'global-parameters']
self.cli_set(['interfaces', 'ethernet', vrrp_interface, 'vif', vlan_id, 'address', inc_ip(vip, 1) + '/' + vip.split('/')[-1]])
@@ -110,6 +112,10 @@ class TestVRRP(VyOSUnitTestSHIM.TestCase):
self.cli_set(group_base + ['authentication', 'type', 'plaintext-password'])
self.cli_set(group_base + ['authentication', 'password', f'{group}'])
+ # Global parameters
+ config = getConfig(f'global_defs')
+ self.cli_set(global_param_base + ['startup-delay', f'{startup_delay}'])
+
# commit changes
self.cli_commit()
@@ -131,6 +137,9 @@ class TestVRRP(VyOSUnitTestSHIM.TestCase):
# Authentication
self.assertIn(f'auth_pass "{group}"', config)
self.assertIn(f'auth_type PASS', config)
+ # Global parameters
+ config = getConfig(f'global_defs')
+ self.assertIn(f'vrrp_startup_delay {startup_delay}', config)
def test_03_sync_group(self):
sync_group = 'VyOS'