Change default IPv4 associated to provider bridges

The IPs to add to the provider bridges for both ARP and NDP
to work are moved to constant, and the IPv4 is changed by the
locallink range so that we avoid collisions with the tenant
networks, otherwise some of them won't have proper connectivity

Change-Id: Iff2fe1dff120139ce71f05e28dfa66cfb6006e10
This commit is contained in:
Luis Tomas Bolivar 2023-04-03 16:50:16 +02:00
parent ddb740e2e4
commit 3c664dd0d1
3 changed files with 8 additions and 4 deletions

View File

@ -32,6 +32,9 @@ FRR_SOCKET_PATH = "/run/frr/"
IP_VERSION_6 = 6
IP_VERSION_4 = 4
ARP_IPV4_PREFIX = "169.254."
NDP_IPV6_PREFIX = "fd53:d91e:400:7f17::"
BGP_MODE = 'BGP'
EVPN_MODE = 'EVPN'

View File

@ -128,7 +128,7 @@ class TestLinuxNet(test_base.TestCase):
linux_net.ensure_arp_ndp_enabled_for_bridge('fake-bridge', 511)
# NOTE(ltomasbo): hardoced starting ipv4 is 192.168.0.0, and ipv6 is
# fd53:d91e:400:7f17::0
ipv4 = '192.168.1.255' # base + 511 offset
ipv4 = '169.254.1.255' # base + 511 offset
ipv6 = 'fd53:d91e:400:7f17::1ff' # base + 5122 offset (to hex)
calls = [mock.call(ipv4, 'fake-bridge'),
mock.call(ipv6, 'fake-bridge')]
@ -144,7 +144,7 @@ class TestLinuxNet(test_base.TestCase):
linux_net.ensure_arp_ndp_enabled_for_bridge('fake-bridge', 511, 11)
# NOTE(ltomasbo): hardoced starting ipv4 is 192.168.0.0, and ipv6 is
# fd53:d91e:400:7f17::0
ipv4 = '192.168.1.255' # base + 511 offset
ipv4 = '169.254.1.255' # base + 511 offset
ipv6 = 'fd53:d91e:400:7f17::1ff' # base + 5122 offset (to hex)
calls = [mock.call(ipv4, 'fake-bridge'),
mock.call(ipv6, 'fake-bridge')]

View File

@ -94,8 +94,9 @@ def delete_device(device):
def ensure_arp_ndp_enabled_for_bridge(bridge, offset, vlan_tag=None):
ipv4 = "192.168." + str(int(offset / 256)) + "." + str(offset % 256)
ipv6 = "fd53:d91e:400:7f17::%x" % offset
ipv4 = constants.ARP_IPV4_PREFIX + str(int(offset / 256)) + "." + str(
offset % 256)
ipv6 = constants.NDP_IPV6_PREFIX + "%x" % offset
try:
ovn_bgp_agent.privileged.linux_net.add_ip_to_dev(ipv4, bridge)
except KeyError as e: