Set IP/MAC address on VPNaaS gateway port (OVN)

Fix an issue with missing route announcements for
the VPN external port in a setup with OVN, BGP (ovn-bgp-agent)
and VPNaaS. The ovn-bgp-agent won't annouce the address of
the VPN gateway port if its OVN logical switch port only
has address=[unknown].
To set the address on the LSP explicitly, add the device owner
network:vpn_router_gateway to the reasons to do so.

Closes-Bug: #2088286
Change-Id: Ic04833333a04064c2fbd7fb2700d35f2312aef7e
This commit is contained in:
Bodo Petermann
2024-12-02 16:24:02 +01:00
parent 498b0258c5
commit bb2f8edaa8
2 changed files with 8 additions and 2 deletions

View File

@@ -96,3 +96,7 @@ LOWEST_AGENT_BINDING_INDEX = 1
# TODO(ralonsoh): move this constant to neutron_lib.plugins.ml2.ovs_constants # TODO(ralonsoh): move this constant to neutron_lib.plugins.ml2.ovs_constants
DEFAULT_BR_INT = 'br-int' DEFAULT_BR_INT = 'br-int'
# TODO(bpetermann): Remove here after neutron-lib is bumped
DEVICE_OWNER_VPN_ROUTER_GW = (constants.DEVICE_OWNER_NETWORK_PREFIX +
"vpn_router_gateway")

View File

@@ -48,6 +48,7 @@ from ovsdbapp.backend.ovs_idl import idlutils
import tenacity import tenacity
from neutron._i18n import _ from neutron._i18n import _
from neutron.common import _constants as n_const
from neutron.common.ovn import acl as ovn_acl from neutron.common.ovn import acl as ovn_acl
from neutron.common.ovn import constants as ovn_const from neutron.common.ovn import constants as ovn_const
from neutron.common.ovn import utils from neutron.common.ovn import utils
@@ -379,6 +380,7 @@ class OVNClient:
address6_scope_id = "" address6_scope_id = ""
dhcpv4_options = self._get_port_dhcp_options(port, const.IP_VERSION_4) dhcpv4_options = self._get_port_dhcp_options(port, const.IP_VERSION_4)
dhcpv6_options = self._get_port_dhcp_options(port, const.IP_VERSION_6) dhcpv6_options = self._get_port_dhcp_options(port, const.IP_VERSION_6)
device_owner = port.get('device_owner', '')
mtu = '' mtu = ''
if vtep_physical_switch: if vtep_physical_switch:
vtep_logical_switch = bp_info.bp_param.get('vtep-logical-switch') vtep_logical_switch = bp_info.bp_param.get('vtep-logical-switch')
@@ -446,12 +448,13 @@ class OVNClient:
addresses = [] addresses = []
port_security, new_macs = ( port_security, new_macs = (
self._get_allowed_addresses_from_port(port)) self._get_allowed_addresses_from_port(port))
is_vpn_gw_port = device_owner == n_const.DEVICE_OWNER_VPN_ROUTER_GW
# TODO(egarciar): OVN supports MAC learning from v21.03. This # TODO(egarciar): OVN supports MAC learning from v21.03. This
# if-else block is stated so as to keep compatibility with older # if-else block is stated so as to keep compatibility with older
# OVN versions and should be removed in the future. # OVN versions and should be removed in the future.
if self._sb_idl.is_table_present('FDB'): if self._sb_idl.is_table_present('FDB'):
if (port_security or port_type or dhcpv4_options or if (port_security or port_type or dhcpv4_options or
dhcpv6_options): dhcpv6_options or is_vpn_gw_port):
addresses.append(address) addresses.append(address)
addresses.extend(new_macs) addresses.extend(new_macs)
else: else:
@@ -511,7 +514,6 @@ class OVNClient:
'vtep', ovn_const.LSP_TYPE_LOCALPORT, 'router'): 'vtep', ovn_const.LSP_TYPE_LOCALPORT, 'router'):
options.update({ovn_const.LSP_OPTIONS_MCAST_FLOOD_REPORTS: 'true'}) options.update({ovn_const.LSP_OPTIONS_MCAST_FLOOD_REPORTS: 'true'})
device_owner = port.get('device_owner', '')
sg_ids = ' '.join(utils.get_lsp_security_groups(port)) sg_ids = ' '.join(utils.get_lsp_security_groups(port))
return OvnPortInfo(port_type, options, addresses, port_security, return OvnPortInfo(port_type, options, addresses, port_security,
parent_name, tag, dhcpv4_options, dhcpv6_options, parent_name, tag, dhcpv4_options, dhcpv6_options,