Merge "Fix arp_proxy LSP option formatting"

This commit is contained in:
Zuul 2025-05-07 12:01:26 +00:00 committed by Gerrit Code Review
commit b09505caa0
2 changed files with 24 additions and 1 deletions

View File

@ -346,7 +346,7 @@ def _ensure_ovn_network_link_internal(ovn_idl, switch_name, provider_cidrs):
# NOTE(ltomasbo): require v23.06.0 so that proxy-arp works as expected.
# If older version the provider_cidrs should contain all the provider
# network cidrs, pointing to the gateway IP of the network.
cidrs = ','.join(provider_cidrs) if provider_cidrs else '0.0.0.0/0'
cidrs = ' '.join(provider_cidrs) if provider_cidrs else '0.0.0.0/0'
options = {'router-port': r_port_name, 'arp_proxy': cidrs}
cmds.extend(_ensure_lsp_cmds(ovn_idl, s_port_name, switch_name,
'router', 'router', **options))

View File

@ -182,6 +182,29 @@ class TestWire(test_base.TestCase):
self.nb_idl.lrp_set_gateway_chassis.assert_called_once_with(
r_port_name, CONF.local_ovn_cluster.bgp_chassis_id, 1)
@mock.patch.object(wire, '_execute_commands')
@mock.patch.object(wire, '_ensure_lsp_cmds')
def test__ensure_ovn_network_link_internal_multiple_cidrs(self,
m_ensure_lsp,
m_cmds):
switch_name = 'internal'
provider_cidrs = ['172.16.0.0/16', '192.0.2.0/24']
r_port_name = "{}-openstack".format(constants.OVN_CLUSTER_ROUTER)
options = {'router-port': r_port_name,
'arp_proxy': '172.16.0.0/16 192.0.2.0/24'}
wire._ensure_ovn_network_link_internal(
self.nb_idl, switch_name, provider_cidrs)
self.nb_idl.lrp_add.assert_called_once_with(
constants.OVN_CLUSTER_ROUTER, r_port_name,
constants.OVN_CLUSTER_ROUTER_INTERNAL_MAC, provider_cidrs, peer=[],
may_exist=True)
m_ensure_lsp.assert_called_once_with(
self.nb_idl, mock.ANY, switch_name, 'router', 'router', **options)
self.nb_idl.lrp_set_gateway_chassis.assert_called_once_with(
r_port_name, CONF.local_ovn_cluster.bgp_chassis_id, 1)
@mock.patch.object(wire, '_execute_commands')
@mock.patch.object(wire, '_ensure_lsp_cmds')
def test__ensure_ovn_network_link_internal_runtime_error(