Skip to content

Commit

Permalink
vrrp: T5315: add support to explicitly specify version
Browse files Browse the repository at this point in the history
set high-availability vrrp group <name> version 2|3
  • Loading branch information
c-po committed Jun 26, 2023
1 parent ca7c063 commit 6ca3081
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 0 deletions.
3 changes: 3 additions & 0 deletions data/templates/high-availability/keepalived.conf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ global_defs {
{% if vrrp.global_parameters.garp.master_repeat is vyos_defined %}
vrrp_garp_master_repeat {{ vrrp.global_parameters.garp.master_repeat }}
{% endif %}
{% if vrrp.global_parameters.version is vyos_defined %}
vrrp_version {{ vrrp.global_parameters.version }}
{% endif %}
{% endif %}
notify_fifo /run/keepalived/keepalived_notify_fifo
notify_fifo_script /usr/libexec/vyos/system/keepalived-fifo.py
Expand Down
19 changes: 19 additions & 0 deletions interface-definitions/high-availability.xml.in
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,25 @@
</constraint>
</properties>
</leafNode>
<leafNode name="version">
<properties>
<help>Default VRRP version to use, IPv6 always uses VRRP version 3</help>
<completionHelp>
<list>2 3</list>
</completionHelp>
<valueHelp>
<format>u32:2</format>
<description>VRRP version 2</description>
</valueHelp>
<valueHelp>
<format>u32:3</format>
<description>VRRP version 3</description>
</valueHelp>
<constraint>
<validator name="numeric" argument="--range 2-3"/>
</constraint>
</properties>
</leafNode>
</children>
</node>
<tagNode name="group">
Expand Down
3 changes: 3 additions & 0 deletions smoketest/scripts/cli/test_ha_vrrp.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ def test_02_simple_options(self):
group_garp_master_delay = '12'
group_garp_master_repeat = '13'
group_garp_master_refresh = '14'
vrrp_version = '3'

for group in groups:
vlan_id = group.lstrip('VLAN')
Expand Down Expand Up @@ -133,6 +134,7 @@ def test_02_simple_options(self):
self.cli_set(global_param_base + ['garp', 'master-repeat', f'{garp_master_repeat}'])
self.cli_set(global_param_base + ['garp', 'master-refresh', f'{garp_master_refresh}'])
self.cli_set(global_param_base + ['garp', 'master-refresh-repeat', f'{garp_master_refresh_repeat}'])
self.cli_set(global_param_base + ['version', vrrp_version])

# commit changes
self.cli_commit()
Expand All @@ -145,6 +147,7 @@ def test_02_simple_options(self):
self.assertIn(f'vrrp_garp_master_repeat {garp_master_repeat}', config)
self.assertIn(f'vrrp_garp_master_refresh {garp_master_refresh}', config)
self.assertIn(f'vrrp_garp_master_refresh_repeat {garp_master_refresh_repeat}', config)
self.assertIn(f'vrrp_version {vrrp_version}', config)

for group in groups:
vlan_id = group.lstrip('VLAN')
Expand Down

0 comments on commit 6ca3081

Please sign in to comment.