Remove copy&paste code from ensure_arp_ndp_enabled_for_bridge
TrivialFix Change-Id: I29d93d2be406867ce5ba394b2dc8e747c05566b2 Signed-off-by: Jakub Libosvar <libosvar@redhat.com>
This commit is contained in:
parent
05b0421464
commit
1a5b44777d
@ -52,6 +52,8 @@ IP_VERSION_4 = 4
|
|||||||
ARP_IPV4_PREFIX = "169.254."
|
ARP_IPV4_PREFIX = "169.254."
|
||||||
NDP_IPV6_PREFIX = "fd53:d91e:400:7f17::"
|
NDP_IPV6_PREFIX = "fd53:d91e:400:7f17::"
|
||||||
|
|
||||||
|
IPV4_OCTET_RANGE = 256
|
||||||
|
|
||||||
BGP_MODE = 'BGP'
|
BGP_MODE = 'BGP'
|
||||||
EVPN_MODE = 'EVPN'
|
EVPN_MODE = 'EVPN'
|
||||||
|
|
||||||
|
@ -133,27 +133,21 @@ def delete_device(device):
|
|||||||
|
|
||||||
|
|
||||||
def ensure_arp_ndp_enabled_for_bridge(bridge, offset, vlan_tag=None):
|
def ensure_arp_ndp_enabled_for_bridge(bridge, offset, vlan_tag=None):
|
||||||
ipv4 = constants.ARP_IPV4_PREFIX + str(int(offset / 256)) + "." + str(
|
ipv4 = "%s%d.%s" % (
|
||||||
offset % 256)
|
constants.ARP_IPV4_PREFIX, offset / constants.IPV4_OCTET_RANGE,
|
||||||
ipv6 = constants.NDP_IPV6_PREFIX + "%x" % offset
|
offset % constants.IPV4_OCTET_RANGE)
|
||||||
try:
|
ipv6 = "%s%x" % (constants.NDP_IPV6_PREFIX, offset)
|
||||||
ovn_bgp_agent.privileged.linux_net.add_ip_to_dev(ipv4, bridge)
|
|
||||||
except agent_exc.IpAddressAlreadyExists:
|
for ip in (ipv4, ipv6):
|
||||||
LOG.debug("IP %s already added on bridge %s", ipv4, bridge)
|
try:
|
||||||
except KeyError as e:
|
ovn_bgp_agent.privileged.linux_net.add_ip_to_dev(ip, bridge)
|
||||||
if "object exists" not in str(e):
|
except agent_exc.IpAddressAlreadyExists:
|
||||||
LOG.error("Unable to add IP on bridge %s to enable arp/ndp. "
|
LOG.debug("IP %s already added on bridge %s", ip, bridge)
|
||||||
"Exception: %s", bridge, e)
|
except KeyError as e:
|
||||||
raise
|
if "object exists" not in str(e):
|
||||||
try:
|
LOG.error("Unable to add IP on bridge %s to enable arp/ndp. "
|
||||||
ovn_bgp_agent.privileged.linux_net.add_ip_to_dev(ipv6, bridge)
|
"Exception: %s", bridge, e)
|
||||||
except agent_exc.IpAddressAlreadyExists:
|
raise
|
||||||
LOG.debug("IP %s already added on bridge %s", 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
|
|
||||||
|
|
||||||
# also enable the arp/ndp on the bridge in case there are flat networks
|
# also enable the arp/ndp on the bridge in case there are flat networks
|
||||||
enable_proxy_arp(bridge)
|
enable_proxy_arp(bridge)
|
||||||
|
Loading…
Reference in New Issue
Block a user