diff --git a/neutron/common/ipv6_utils.py b/neutron/common/ipv6_utils.py index 2f275bb2bb9..ee715af0786 100644 --- a/neutron/common/ipv6_utils.py +++ b/neutron/common/ipv6_utils.py @@ -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) diff --git a/neutron/plugins/ml2/drivers/openvswitch/agent/openflow/native/ovs_bridge.py b/neutron/plugins/ml2/drivers/openvswitch/agent/openflow/native/ovs_bridge.py index 52fb05f4079..764417430e2 100644 --- a/neutron/plugins/ml2/drivers/openvswitch/agent/openflow/native/ovs_bridge.py +++ b/neutron/plugins/ml2/drivers/openvswitch/agent/openflow/native/ovs_bridge.py @@ -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)