Merge "Ensure FIPs are exposed as part of cr-lrp binding events"

This commit is contained in:
Zuul 2023-06-20 14:00:42 +00:00 committed by Gerrit Code Review
commit 74b99ff4c2
2 changed files with 16 additions and 1 deletions

View File

@ -908,6 +908,15 @@ class OVNBGPDriver(driver_api.AgentDriverBase):
return False
LOG.debug("Added BGP route for CR-LRP Port %s", ips)
# Expose FIPS
# This is needed in case the router get disabled and enabled
# In that case there may be FIPs already associated to VMs
fips, patch_port_row = self.sb_idl.get_cr_lrp_nat_addresses_info(
cr_lrp_port, self.chassis, self.sb_idl)
fips = [ip for ip in fips if ip not in ips_without_mask]
if fips:
self._expose_ip(fips, patch_port_row, associated_port=cr_lrp_port)
# Check if there are networks attached to the router,
# and if so, add the needed routes/rules
lrp_ports = self.sb_idl.get_lrp_ports_for_router(router_datapath)

View File

@ -1333,6 +1333,9 @@ class TestOVNBGPDriver(test_base.TestCase):
self.sb_idl.get_port_datapath.return_value = 'fake-lrp-dp'
self.sb_idl.get_cr_lrp_nat_addresses_info.return_value = (
[], self.cr_lrp0)
mock_process_lrp_port = mock.patch.object(
self.bgp_driver, '_process_lrp_port').start()
@ -1817,11 +1820,14 @@ class TestOVNBGPDriver(test_base.TestCase):
self.sb_idl.get_provider_ovn_lbs_on_cr_lrp.return_value = (
ovn_lbs)
ips_without_mask = [ip.split("/")[0] for ip in ips]
self.sb_idl.get_cr_lrp_nat_addresses_info.return_value = (
[ips_without_mask[0]], self.cr_lrp0)
self.bgp_driver._expose_cr_lrp_port(
ips, self.mac, self.bridge, None, router_datapath='fake-router-dp',
provider_datapath='fake-provider-dp', cr_lrp_port=self.cr_lrp0)
ips_without_mask = [ip.split("/")[0] for ip in ips]
mock_expose_provider_port.assert_called_once_with(
ips_without_mask, 'fake-provider-dp', self.bridge, None,
lladdr=self.mac, proxy_cidrs=ips)