From ed0da146529c5a38c32ac346335138baab428bac Mon Sep 17 00:00:00 2001 From: fett0 Date: Thu, 19 Jan 2023 18:24:14 +0000 Subject: T4939: VRRP startup delay for bonding fix --- data/templates/high-availability/keepalived.conf.j2 | 5 +++++ interface-definitions/high-availability.xml.in | 19 +++++++++++++++++++ smoketest/scripts/cli/test_ha_vrrp.py | 6 ++++++ 3 files changed, 30 insertions(+) diff --git a/data/templates/high-availability/keepalived.conf.j2 b/data/templates/high-availability/keepalived.conf.j2 index ebff52e1f..4465f8640 100644 --- a/data/templates/high-availability/keepalived.conf.j2 +++ b/data/templates/high-availability/keepalived.conf.j2 @@ -5,6 +5,11 @@ global_defs { dynamic_interfaces script_user root +{% if vrrp.global_parameters is vyos_defined %} +{% if vrrp.global_parameters.startup_delay is vyos_defined %} + vrrp_startup_delay {{ vrrp.global_parameters.startup_delay }} +{% endif %} +{% 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..09ebfdf39 100644 --- a/interface-definitions/high-availability.xml.in +++ b/interface-definitions/high-availability.xml.in @@ -11,6 +11,25 @@ Virtual Router Redundancy Protocol settings + + + VRRP Globas 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 68905e447..fba1f4687 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() -- cgit v1.2.3 From 8f8976d3c55eccfc68efd019bac88664f9792f80 Mon Sep 17 00:00:00 2001 From: fett0 Date: Thu, 19 Jan 2023 19:22:57 +0000 Subject: T4939: VRRP startup delay for bonding fix --- .../.xml" | 38 ++++++++++++++++++++++ interface-definitions/high-availability.xml.in | 2 +- smoketest/scripts/cli/test_ha_vrrp.py | 3 ++ 3 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 "data/templates/high-availability/.xml" diff --git "a/data/templates/high-availability/.xml" "b/data/templates/high-availability/.xml" new file mode 100644 index 000000000..e7e009625 --- /dev/null +++ "b/data/templates/high-availability/.xml" @@ -0,0 +1,38 @@ + + + VRRP Globas parameters + + + + + Time VRRP startup process (in seconds) + + u32:1-600 + Interval in seconds + + + + + > + + + + + + VRRP Globas parameters + + + + + Time vrrp startup process (in seconds) + + u32:1-600 + Interval in seconds + + + + + > + + + \ No newline at end of file diff --git a/interface-definitions/high-availability.xml.in b/interface-definitions/high-availability.xml.in index 09ebfdf39..9436035d8 100644 --- a/interface-definitions/high-availability.xml.in +++ b/interface-definitions/high-availability.xml.in @@ -18,7 +18,7 @@ - Time vrrp startup process (in seconds) + Time VRRP startup process (in seconds) u32:1-600 Interval in seconds diff --git a/smoketest/scripts/cli/test_ha_vrrp.py b/smoketest/scripts/cli/test_ha_vrrp.py index fba1f4687..f18a4ab86 100755 --- a/smoketest/scripts/cli/test_ha_vrrp.py +++ b/smoketest/scripts/cli/test_ha_vrrp.py @@ -137,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' -- cgit v1.2.3 From ff2309972bd3508174f425515d096daa4edb41c5 Mon Sep 17 00:00:00 2001 From: fett0 Date: Thu, 19 Jan 2023 19:33:31 +0000 Subject: T4939: VRRP startup delay for bonding fix --- .../.xml" | 38 ---------------------- 1 file changed, 38 deletions(-) delete mode 100644 "data/templates/high-availability/.xml" diff --git "a/data/templates/high-availability/.xml" "b/data/templates/high-availability/.xml" deleted file mode 100644 index e7e009625..000000000 --- "a/data/templates/high-availability/.xml" +++ /dev/null @@ -1,38 +0,0 @@ - - - VRRP Globas parameters - - - - - Time VRRP startup process (in seconds) - - u32:1-600 - Interval in seconds - - - - - > - - - - - - VRRP Globas parameters - - - - - Time vrrp startup process (in seconds) - - u32:1-600 - Interval in seconds - - - - - > - - - \ No newline at end of file -- cgit v1.2.3 From 6efc73a26b66b5be231dcbe54f95c27cfd8108fa Mon Sep 17 00:00:00 2001 From: fett0 Date: Thu, 19 Jan 2023 19:45:02 +0000 Subject: T4939: VRRP startup delay for bonding fix --- interface-definitions/high-availability.xml.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/interface-definitions/high-availability.xml.in b/interface-definitions/high-availability.xml.in index 9436035d8..37cb90a8d 100644 --- a/interface-definitions/high-availability.xml.in +++ b/interface-definitions/high-availability.xml.in @@ -13,7 +13,7 @@ - VRRP Globas parameters + VRRP global parameters -- cgit v1.2.3 From 798180589854c9296d35b3ece8eb88cf0520dd2b Mon Sep 17 00:00:00 2001 From: fett0 Date: Fri, 20 Jan 2023 18:27:29 +0000 Subject: T4939: VRRP startup delay edit correction --- data/templates/high-availability/keepalived.conf.j2 | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/data/templates/high-availability/keepalived.conf.j2 b/data/templates/high-availability/keepalived.conf.j2 index 4465f8640..828636dc0 100644 --- a/data/templates/high-availability/keepalived.conf.j2 +++ b/data/templates/high-availability/keepalived.conf.j2 @@ -5,10 +5,8 @@ global_defs { dynamic_interfaces script_user root -{% if vrrp.global_parameters is vyos_defined %} -{% if vrrp.global_parameters.startup_delay is vyos_defined %} +{% if vrrp.global_parameters.startup_delay is vyos_defined %} vrrp_startup_delay {{ vrrp.global_parameters.startup_delay }} -{% endif %} {% endif %} notify_fifo /run/keepalived/keepalived_notify_fifo notify_fifo_script /usr/libexec/vyos/system/keepalived-fifo.py -- cgit v1.2.3