Adding check for IPv6 address in setup_controllers
If it is IPv6 then adding [] to it before creating the connection string. Change-Id: Idd108cbef944cdd89808bb1ad5c8ab1db202d31a Closes-Bug: #1846494
This commit is contained in:
parent
b7fbb74b46
commit
4d52b903eb
neutron
@ -19,7 +19,7 @@ IPv6-related utilities and helper functions.
|
||||
import netaddr
|
||||
from neutron_lib import constants as const
|
||||
from oslo_log import log
|
||||
|
||||
from oslo_utils import netutils
|
||||
|
||||
LOG = log.getLogger(__name__)
|
||||
|
||||
@ -51,7 +51,7 @@ def valid_ipv6_url(host, port):
|
||||
RFC2732 https://tools.ietf.org/html/rfc2732
|
||||
square brackets always required in ipv6 URI.
|
||||
"""
|
||||
if netaddr.valid_ipv6(host):
|
||||
if netutils.is_valid_ipv6(host):
|
||||
uri = '[%s]:%s' % (host, port)
|
||||
else:
|
||||
uri = '%s:%s' % (host, port)
|
||||
|
@ -19,6 +19,7 @@ from oslo_utils import excutils
|
||||
|
||||
from neutron._i18n import _
|
||||
from neutron.agent.common import ovs_lib
|
||||
from neutron.common import ipv6_utils
|
||||
from neutron.plugins.ml2.drivers.openvswitch.agent.common import constants \
|
||||
as ovs_consts
|
||||
from neutron.plugins.ml2.drivers.openvswitch.agent.openflow \
|
||||
@ -70,12 +71,9 @@ class OVSAgentBridge(ofswitch.OpenFlowSwitchMixin,
|
||||
self._cached_dpid = new_dpid
|
||||
|
||||
def setup_controllers(self, conf):
|
||||
controllers = [
|
||||
"tcp:%(address)s:%(port)s" % {
|
||||
"address": conf.OVS.of_listen_address,
|
||||
"port": conf.OVS.of_listen_port,
|
||||
}
|
||||
]
|
||||
url = ipv6_utils.valid_ipv6_url(conf.OVS.of_listen_address,
|
||||
conf.OVS.of_listen_port)
|
||||
controllers = ["tcp:" + url]
|
||||
self.add_protocols(ovs_consts.OPENFLOW13)
|
||||
self.set_controller(controllers)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user