Merge "Ensure handling of already added arp/ndp IPs"

This commit is contained in:
Zuul 2022-03-30 14:17:21 +00:00 committed by Gerrit Code Review
commit 0b0fcef680
3 changed files with 16 additions and 4 deletions

View File

@ -135,7 +135,7 @@ class OVNBGPDriver(driver_api.AgentDriverBase):
# 2) Get macs for bridge mappings
extra_routes = {}
with pyroute2.NDB() as ndb:
for bridge_index, bridge_mapping in enumerate(bridge_mappings):
for bridge_index, bridge_mapping in enumerate(bridge_mappings, 1):
network = bridge_mapping.split(":")[0]
bridge = bridge_mapping.split(":")[1]
self.ovn_bridge_mappings[network] = bridge

View File

@ -116,7 +116,7 @@ class OVNEVPNDriver(driver_api.AgentDriverBase):
# 1) Get bridge mappings: xxxx:br-ex,yyyy:br-ex2
bridge_mappings = self.ovs_idl.get_ovn_bridge_mappings()
# 2) Get macs for bridge mappings
for bridge_index, bridge_mapping in enumerate(bridge_mappings):
for bridge_index, bridge_mapping in enumerate(bridge_mappings, 1):
network = bridge_mapping.split(":")[0]
bridge = bridge_mapping.split(":")[1]
self.ovn_bridge_mappings[network] = bridge

View File

@ -82,8 +82,20 @@ def delete_device(device):
def ensure_arp_ndp_enabed_for_bridge(bridge, offset):
ipv4 = "192.168." + str(int(offset / 256)) + "." + str(offset % 256)
ipv6 = "fd53:d91e:400:7f17::%x" % offset
ovn_bgp_agent.privileged.linux_net.add_ip_to_dev(ipv4, bridge)
ovn_bgp_agent.privileged.linux_net.add_ip_to_dev(ipv6, bridge)
try:
ovn_bgp_agent.privileged.linux_net.add_ip_to_dev(ipv4, bridge)
except KeyError as e:
if "object exists" not in str(e):
LOG.error("Unable to add IP on bridge %s to enable arp/ndp. "
"Exception: %s", bridge, e)
raise
try:
ovn_bgp_agent.privileged.linux_net.add_ip_to_dev(ipv6, bridge)
except KeyError as e:
if "object exists" not in str(e):
LOG.error("Unable to add IP on bridge %s to enable arp/ndp. "
"Exception: %s", bridge, e)
raise
def ensure_routing_table_for_bridge(ovn_routing_tables, bridge):