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

This ensures the FIPs associated to cr-lrps are processed as part
of the cr-lrp chassis binding event

Closes-Bug: #2024196
Change-Id: I5bfa99c8ee7decf7ff50a2a7de87362eed9eb7a0
This commit is contained in:
Luis Tomas Bolivar 2023-06-16 15:50:23 +02:00
parent a5d8436049
commit 3e50c275dd
2 changed files with 16 additions and 1 deletions

View File

@ -907,6 +907,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

@ -1334,6 +1334,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()
@ -1818,11 +1821,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)