From: Ihar Hrachyshka Date: Thu, 9 Oct 2014 14:21:49 +0000 (+0200) Subject: Migrate to oslo.utils X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=dac6a0c79e56a8b724dcfbf2c3058fbbc79cc7b0;p=openstack-build%2Fneutron-build.git Migrate to oslo.utils The following modules are removed: - excutils, - importutils, - network_utils, - strutils, - timeutils. Closes-Bug: #1385355 Change-Id: I1f34f17f5dbf37032584008f27e65d4dc4d475f4 --- diff --git a/neutron/agent/dhcp_agent.py b/neutron/agent/dhcp_agent.py index d1455346c..95182c99e 100644 --- a/neutron/agent/dhcp_agent.py +++ b/neutron/agent/dhcp_agent.py @@ -23,6 +23,7 @@ eventlet.monkey_patch() import netaddr from oslo.config import cfg from oslo import messaging +from oslo.utils import importutils from neutron.agent.common import config from neutron.agent.linux import dhcp @@ -39,7 +40,6 @@ from neutron.common import utils from neutron import context from neutron import manager from neutron.openstack.common.gettextutils import _LE, _LI, _LW -from neutron.openstack.common import importutils from neutron.openstack.common import log as logging from neutron.openstack.common import loopingcall from neutron.openstack.common import service diff --git a/neutron/agent/l3_agent.py b/neutron/agent/l3_agent.py index 728df0235..32bbc1ace 100644 --- a/neutron/agent/l3_agent.py +++ b/neutron/agent/l3_agent.py @@ -23,6 +23,9 @@ import netaddr import os from oslo.config import cfg from oslo import messaging +from oslo.utils import excutils +from oslo.utils import importutils +from oslo.utils import timeutils import Queue from neutron.agent.common import config @@ -42,15 +45,12 @@ from neutron.common import topics from neutron.common import utils as common_utils from neutron import context as n_context from neutron import manager -from neutron.openstack.common import excutils from neutron.openstack.common.gettextutils import _LE, _LI, _LW -from neutron.openstack.common import importutils from neutron.openstack.common import log as logging from neutron.openstack.common import loopingcall from neutron.openstack.common import periodic_task from neutron.openstack.common import processutils from neutron.openstack.common import service -from neutron.openstack.common import timeutils from neutron import service as neutron_service from neutron.services.firewall.agents.l3reference import firewall_l3_agent diff --git a/neutron/agent/linux/dhcp.py b/neutron/agent/linux/dhcp.py index 714b2070f..ceae81c11 100644 --- a/neutron/agent/linux/dhcp.py +++ b/neutron/agent/linux/dhcp.py @@ -24,6 +24,7 @@ import sys import netaddr from oslo.config import cfg from oslo.serialization import jsonutils +from oslo.utils import importutils import six from neutron.agent.linux import ip_lib @@ -32,7 +33,6 @@ from neutron.common import constants from neutron.common import exceptions from neutron.common import utils as commonutils from neutron.openstack.common.gettextutils import _LE -from neutron.openstack.common import importutils from neutron.openstack.common import log as logging from neutron.openstack.common import uuidutils diff --git a/neutron/agent/linux/interface.py b/neutron/agent/linux/interface.py index fdc1d8e3f..adbd0e9fd 100644 --- a/neutron/agent/linux/interface.py +++ b/neutron/agent/linux/interface.py @@ -17,6 +17,7 @@ import abc import netaddr from oslo.config import cfg +from oslo.utils import importutils import six from neutron.agent.common import config @@ -27,7 +28,6 @@ from neutron.common import constants as n_const from neutron.common import exceptions from neutron.extensions import flavor from neutron.openstack.common.gettextutils import _LE, _LI -from neutron.openstack.common import importutils from neutron.openstack.common import log as logging diff --git a/neutron/agent/linux/iptables_manager.py b/neutron/agent/linux/iptables_manager.py index 135155939..b59c43ba3 100644 --- a/neutron/agent/linux/iptables_manager.py +++ b/neutron/agent/linux/iptables_manager.py @@ -23,12 +23,12 @@ import os import re from oslo.config import cfg +from oslo.utils import excutils from neutron.agent.common import config from neutron.agent.linux import iptables_comments as ic from neutron.agent.linux import utils as linux_utils from neutron.common import utils -from neutron.openstack.common import excutils from neutron.openstack.common.gettextutils import _LE, _LW from neutron.openstack.common import lockutils from neutron.openstack.common import log as logging diff --git a/neutron/agent/linux/ovs_lib.py b/neutron/agent/linux/ovs_lib.py index a2a8d4b3a..a500e51d3 100644 --- a/neutron/agent/linux/ovs_lib.py +++ b/neutron/agent/linux/ovs_lib.py @@ -18,11 +18,11 @@ import operator from oslo.config import cfg from oslo.serialization import jsonutils +from oslo.utils import excutils from neutron.agent.linux import ip_lib from neutron.agent.linux import utils from neutron.common import exceptions -from neutron.openstack.common import excutils from neutron.openstack.common.gettextutils import _LE, _LI, _LW from neutron.openstack.common import log as logging from neutron.plugins.common import constants diff --git a/neutron/agent/linux/utils.py b/neutron/agent/linux/utils.py index c10d79cd0..5f59adde8 100644 --- a/neutron/agent/linux/utils.py +++ b/neutron/agent/linux/utils.py @@ -23,10 +23,10 @@ import tempfile from eventlet.green import subprocess from eventlet import greenthread +from oslo.utils import excutils from neutron.common import constants from neutron.common import utils -from neutron.openstack.common import excutils from neutron.openstack.common import log as logging diff --git a/neutron/agent/metadata/agent.py b/neutron/agent/metadata/agent.py index 1a9e84774..e0f78c014 100644 --- a/neutron/agent/metadata/agent.py +++ b/neutron/agent/metadata/agent.py @@ -25,6 +25,7 @@ import httplib2 from neutronclient.v2_0 import client from oslo.config import cfg from oslo import messaging +from oslo.utils import excutils import six.moves.urllib.parse as urlparse import webob @@ -37,7 +38,6 @@ from neutron.common import topics from neutron.common import utils from neutron import context from neutron.openstack.common.cache import cache -from neutron.openstack.common import excutils from neutron.openstack.common.gettextutils import _LE, _LW from neutron.openstack.common import log as logging from neutron.openstack.common import loopingcall diff --git a/neutron/agent/netns_cleanup_util.py b/neutron/agent/netns_cleanup_util.py index d6eafffe1..f40d5e408 100644 --- a/neutron/agent/netns_cleanup_util.py +++ b/neutron/agent/netns_cleanup_util.py @@ -19,6 +19,7 @@ import eventlet eventlet.monkey_patch() from oslo.config import cfg +from oslo.utils import importutils from neutron.agent.common import config as agent_config from neutron.agent import dhcp_agent @@ -30,7 +31,6 @@ from neutron.agent.linux import ovs_lib from neutron.api.v2 import attributes from neutron.common import config from neutron.openstack.common.gettextutils import _LE -from neutron.openstack.common import importutils from neutron.openstack.common import log as logging diff --git a/neutron/agent/rpc.py b/neutron/agent/rpc.py index 48876ccdd..3f8d5e291 100644 --- a/neutron/agent/rpc.py +++ b/neutron/agent/rpc.py @@ -15,12 +15,12 @@ import itertools from oslo import messaging +from oslo.utils import timeutils from neutron.common import rpc as n_rpc from neutron.common import topics from neutron.openstack.common.gettextutils import _LW from neutron.openstack.common import log as logging -from neutron.openstack.common import timeutils LOG = logging.getLogger(__name__) diff --git a/neutron/agent/securitygroups_rpc.py b/neutron/agent/securitygroups_rpc.py index 78439b052..a6aab260d 100644 --- a/neutron/agent/securitygroups_rpc.py +++ b/neutron/agent/securitygroups_rpc.py @@ -18,11 +18,11 @@ import functools from oslo.config import cfg from oslo import messaging +from oslo.utils import importutils from neutron.agent import firewall from neutron.common import topics from neutron.openstack.common.gettextutils import _LI, _LW -from neutron.openstack.common import importutils from neutron.openstack.common import log as logging LOG = logging.getLogger(__name__) diff --git a/neutron/api/rpc/handlers/dhcp_rpc.py b/neutron/api/rpc/handlers/dhcp_rpc.py index d2ba30d99..add359caf 100644 --- a/neutron/api/rpc/handlers/dhcp_rpc.py +++ b/neutron/api/rpc/handlers/dhcp_rpc.py @@ -16,6 +16,7 @@ from oslo.config import cfg from oslo.db import exception as db_exc from oslo import messaging +from oslo.utils import excutils from neutron.api.v2 import attributes from neutron.common import constants @@ -23,7 +24,6 @@ from neutron.common import exceptions as n_exc from neutron.common import utils from neutron.extensions import portbindings from neutron import manager -from neutron.openstack.common import excutils from neutron.openstack.common.gettextutils import _LW from neutron.openstack.common import log as logging diff --git a/neutron/api/v2/base.py b/neutron/api/v2/base.py index 5af0d81dc..a68477f6e 100644 --- a/neutron/api/v2/base.py +++ b/neutron/api/v2/base.py @@ -18,6 +18,7 @@ import netaddr import webob.exc from oslo.config import cfg +from oslo.utils import excutils from neutron.api import api_common from neutron.api.rpc.agentnotifiers import dhcp_rpc_agent_api @@ -26,7 +27,6 @@ from neutron.api.v2 import resource as wsgi_resource from neutron.common import constants as const from neutron.common import exceptions from neutron.common import rpc as n_rpc -from neutron.openstack.common import excutils from neutron.openstack.common.gettextutils import _LE, _LI from neutron.openstack.common import log as logging from neutron.openstack.common import policy as common_policy diff --git a/neutron/common/exceptions.py b/neutron/common/exceptions.py index dc9a8b611..ccbe891ca 100644 --- a/neutron/common/exceptions.py +++ b/neutron/common/exceptions.py @@ -17,7 +17,7 @@ Neutron base exception handling. """ -from neutron.openstack.common import excutils +from oslo.utils import excutils class NeutronException(Exception): diff --git a/neutron/common/utils.py b/neutron/common/utils.py index 5bb893faa..a5ae64a1a 100644 --- a/neutron/common/utils.py +++ b/neutron/common/utils.py @@ -31,9 +31,9 @@ import uuid from eventlet.green import subprocess from oslo.config import cfg +from oslo.utils import excutils from neutron.common import constants as q_const -from neutron.openstack.common import excutils from neutron.openstack.common import lockutils from neutron.openstack.common import log as logging diff --git a/neutron/db/agents_db.py b/neutron/db/agents_db.py index 5893ef1e7..9f13ef487 100644 --- a/neutron/db/agents_db.py +++ b/neutron/db/agents_db.py @@ -19,6 +19,8 @@ from oslo.config import cfg from oslo.db import exception as db_exc from oslo import messaging from oslo.serialization import jsonutils +from oslo.utils import excutils +from oslo.utils import timeutils import sqlalchemy as sa from sqlalchemy.orm import exc from sqlalchemy import sql @@ -27,10 +29,8 @@ from neutron.db import model_base from neutron.db import models_v2 from neutron.extensions import agent as ext_agent from neutron import manager -from neutron.openstack.common import excutils from neutron.openstack.common.gettextutils import _LW from neutron.openstack.common import log as logging -from neutron.openstack.common import timeutils LOG = logging.getLogger(__name__) cfg.CONF.register_opt( diff --git a/neutron/db/db_base_plugin_v2.py b/neutron/db/db_base_plugin_v2.py index b6288ddfa..e7108e2c6 100644 --- a/neutron/db/db_base_plugin_v2.py +++ b/neutron/db/db_base_plugin_v2.py @@ -17,6 +17,7 @@ import random import netaddr from oslo.config import cfg +from oslo.utils import excutils from sqlalchemy import and_ from sqlalchemy import event from sqlalchemy import orm @@ -33,7 +34,6 @@ from neutron.db import sqlalchemyutils from neutron.extensions import l3 from neutron import manager from neutron import neutron_plugin_base_v2 -from neutron.openstack.common import excutils from neutron.openstack.common.gettextutils import _LE, _LI from neutron.openstack.common import log as logging from neutron.openstack.common import uuidutils diff --git a/neutron/db/l3_agentschedulers_db.py b/neutron/db/l3_agentschedulers_db.py index dd3d7ee8a..c2308cb5a 100644 --- a/neutron/db/l3_agentschedulers_db.py +++ b/neutron/db/l3_agentschedulers_db.py @@ -19,6 +19,7 @@ import time from oslo.config import cfg from oslo.db import exception as db_exc from oslo import messaging +from oslo.utils import timeutils import sqlalchemy as sa from sqlalchemy import func from sqlalchemy import orm @@ -38,7 +39,6 @@ from neutron import manager from neutron.openstack.common.gettextutils import _LE, _LI, _LW from neutron.openstack.common import log as logging from neutron.openstack.common import loopingcall -from neutron.openstack.common import timeutils LOG = logging.getLogger(__name__) diff --git a/neutron/db/l3_hamode_db.py b/neutron/db/l3_hamode_db.py index a35709ead..3d28f8667 100644 --- a/neutron/db/l3_hamode_db.py +++ b/neutron/db/l3_hamode_db.py @@ -16,6 +16,7 @@ import netaddr from oslo.config import cfg from oslo.db import exception as db_exc +from oslo.utils import excutils import sqlalchemy as sa from sqlalchemy import orm @@ -26,7 +27,6 @@ from neutron.db import l3_dvr_db from neutron.db import model_base from neutron.db import models_v2 from neutron.extensions import l3_ext_ha_mode as l3_ha -from neutron.openstack.common import excutils from neutron.openstack.common.gettextutils import _LI from neutron.openstack.common.gettextutils import _LW from neutron.openstack.common import log as logging diff --git a/neutron/db/loadbalancer/loadbalancer_db.py b/neutron/db/loadbalancer/loadbalancer_db.py index 1baffc1bc..651d3351f 100644 --- a/neutron/db/loadbalancer/loadbalancer_db.py +++ b/neutron/db/loadbalancer/loadbalancer_db.py @@ -14,6 +14,7 @@ # from oslo.db import exception +from oslo.utils import excutils import sqlalchemy as sa from sqlalchemy import orm from sqlalchemy.orm import exc @@ -27,7 +28,6 @@ from neutron.db import models_v2 from neutron.db import servicetype_db as st_db from neutron.extensions import loadbalancer from neutron import manager -from neutron.openstack.common import excutils from neutron.openstack.common import log as logging from neutron.openstack.common import uuidutils from neutron.plugins.common import constants diff --git a/neutron/db/vpn/vpn_db.py b/neutron/db/vpn/vpn_db.py index 678320024..c32f98486 100644 --- a/neutron/db/vpn/vpn_db.py +++ b/neutron/db/vpn/vpn_db.py @@ -14,6 +14,7 @@ # under the License. import netaddr +from oslo.utils import excutils import sqlalchemy as sa from sqlalchemy import orm from sqlalchemy.orm import exc @@ -27,7 +28,6 @@ from neutron.db import models_v2 from neutron.db.vpn import vpn_validator from neutron.extensions import vpnaas from neutron import manager -from neutron.openstack.common import excutils from neutron.openstack.common.gettextutils import _LW from neutron.openstack.common import log as logging from neutron.openstack.common import uuidutils diff --git a/neutron/debug/shell.py b/neutron/debug/shell.py index 73b075cfc..c5f66357d 100644 --- a/neutron/debug/shell.py +++ b/neutron/debug/shell.py @@ -16,11 +16,11 @@ import sys from oslo.config import cfg +from oslo.utils import importutils from neutron.agent.common import config from neutron.agent.linux import interface from neutron.debug import debug_agent -from neutron.openstack.common import importutils from neutronclient.common import exceptions as exc from neutronclient import shell diff --git a/neutron/extensions/quotasv2.py b/neutron/extensions/quotasv2.py index 19fa85dbf..43d9e214c 100644 --- a/neutron/extensions/quotasv2.py +++ b/neutron/extensions/quotasv2.py @@ -14,6 +14,7 @@ # under the License. from oslo.config import cfg +from oslo.utils import importutils import webob from neutron.api import extensions @@ -23,7 +24,6 @@ from neutron.api.v2 import resource from neutron.common import constants as const from neutron.common import exceptions as n_exc from neutron import manager -from neutron.openstack.common import importutils from neutron import quota from neutron import wsgi diff --git a/neutron/manager.py b/neutron/manager.py index 3a21f617f..ac16df86c 100644 --- a/neutron/manager.py +++ b/neutron/manager.py @@ -16,10 +16,10 @@ import weakref from oslo.config import cfg +from oslo.utils import importutils from neutron.common import rpc as n_rpc from neutron.common import utils -from neutron.openstack.common import importutils from neutron.openstack.common import log as logging from neutron.openstack.common import periodic_task from neutron.plugins.common import constants diff --git a/neutron/openstack/common/excutils.py b/neutron/openstack/common/excutils.py deleted file mode 100644 index 5b3c5c86b..000000000 --- a/neutron/openstack/common/excutils.py +++ /dev/null @@ -1,113 +0,0 @@ -# Copyright 2011 OpenStack Foundation. -# Copyright 2012, Red Hat, Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -""" -Exception related utilities. -""" - -import logging -import sys -import time -import traceback - -import six - -from neutron.openstack.common.gettextutils import _LE - - -class save_and_reraise_exception(object): - """Save current exception, run some code and then re-raise. - - In some cases the exception context can be cleared, resulting in None - being attempted to be re-raised after an exception handler is run. This - can happen when eventlet switches greenthreads or when running an - exception handler, code raises and catches an exception. In both - cases the exception context will be cleared. - - To work around this, we save the exception state, run handler code, and - then re-raise the original exception. If another exception occurs, the - saved exception is logged and the new exception is re-raised. - - In some cases the caller may not want to re-raise the exception, and - for those circumstances this context provides a reraise flag that - can be used to suppress the exception. For example:: - - except Exception: - with save_and_reraise_exception() as ctxt: - decide_if_need_reraise() - if not should_be_reraised: - ctxt.reraise = False - - If another exception occurs and reraise flag is False, - the saved exception will not be logged. - - If the caller wants to raise new exception during exception handling - he/she sets reraise to False initially with an ability to set it back to - True if needed:: - - except Exception: - with save_and_reraise_exception(reraise=False) as ctxt: - [if statements to determine whether to raise a new exception] - # Not raising a new exception, so reraise - ctxt.reraise = True - """ - def __init__(self, reraise=True): - self.reraise = reraise - - def __enter__(self): - self.type_, self.value, self.tb, = sys.exc_info() - return self - - def __exit__(self, exc_type, exc_val, exc_tb): - if exc_type is not None: - if self.reraise: - logging.error(_LE('Original exception being dropped: %s'), - traceback.format_exception(self.type_, - self.value, - self.tb)) - return False - if self.reraise: - six.reraise(self.type_, self.value, self.tb) - - -def forever_retry_uncaught_exceptions(infunc): - def inner_func(*args, **kwargs): - last_log_time = 0 - last_exc_message = None - exc_count = 0 - while True: - try: - return infunc(*args, **kwargs) - except Exception as exc: - this_exc_message = six.u(str(exc)) - if this_exc_message == last_exc_message: - exc_count += 1 - else: - exc_count = 1 - # Do not log any more frequently than once a minute unless - # the exception message changes - cur_time = int(time.time()) - if (cur_time - last_log_time > 60 or - this_exc_message != last_exc_message): - logging.exception( - _LE('Unexpected exception occurred %d time(s)... ' - 'retrying.') % exc_count) - last_log_time = cur_time - last_exc_message = this_exc_message - exc_count = 0 - # This should be a very rare event. In case it isn't, do - # a sleep. - time.sleep(1) - return inner_func diff --git a/neutron/openstack/common/importutils.py b/neutron/openstack/common/importutils.py deleted file mode 100644 index 4038808ce..000000000 --- a/neutron/openstack/common/importutils.py +++ /dev/null @@ -1,73 +0,0 @@ -# Copyright 2011 OpenStack Foundation. -# All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -""" -Import related utilities and helper functions. -""" - -import sys -import traceback - - -def import_class(import_str): - """Returns a class from a string including module and class.""" - mod_str, _sep, class_str = import_str.rpartition('.') - __import__(mod_str) - try: - return getattr(sys.modules[mod_str], class_str) - except AttributeError: - raise ImportError('Class %s cannot be found (%s)' % - (class_str, - traceback.format_exception(*sys.exc_info()))) - - -def import_object(import_str, *args, **kwargs): - """Import a class and return an instance of it.""" - return import_class(import_str)(*args, **kwargs) - - -def import_object_ns(name_space, import_str, *args, **kwargs): - """Tries to import object from default namespace. - - Imports a class and return an instance of it, first by trying - to find the class in a default namespace, then failing back to - a full path if not found in the default namespace. - """ - import_value = "%s.%s" % (name_space, import_str) - try: - return import_class(import_value)(*args, **kwargs) - except ImportError: - return import_class(import_str)(*args, **kwargs) - - -def import_module(import_str): - """Import a module.""" - __import__(import_str) - return sys.modules[import_str] - - -def import_versioned_module(version, submodule=None): - module = 'neutron.v%s' % version - if submodule: - module = '.'.join((module, submodule)) - return import_module(module) - - -def try_import(import_str, default=None): - """Try to import a module and if it fails return default.""" - try: - return import_module(import_str) - except ImportError: - return default diff --git a/neutron/openstack/common/network_utils.py b/neutron/openstack/common/network_utils.py deleted file mode 100644 index d9640d15a..000000000 --- a/neutron/openstack/common/network_utils.py +++ /dev/null @@ -1,89 +0,0 @@ -# Copyright 2012 OpenStack Foundation. -# All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -""" -Network-related utilities and helper functions. -""" - -# TODO(jd) Use six.moves once -# https://bitbucket.org/gutworth/six/pull-request/28 -# is merged -try: - import urllib.parse - SplitResult = urllib.parse.SplitResult -except ImportError: - import urlparse - SplitResult = urlparse.SplitResult - -from six.moves.urllib import parse - - -def parse_host_port(address, default_port=None): - """Interpret a string as a host:port pair. - - An IPv6 address MUST be escaped if accompanied by a port, - because otherwise ambiguity ensues: 2001:db8:85a3::8a2e:370:7334 - means both [2001:db8:85a3::8a2e:370:7334] and - [2001:db8:85a3::8a2e:370]:7334. - - >>> parse_host_port('server01:80') - ('server01', 80) - >>> parse_host_port('server01') - ('server01', None) - >>> parse_host_port('server01', default_port=1234) - ('server01', 1234) - >>> parse_host_port('[::1]:80') - ('::1', 80) - >>> parse_host_port('[::1]') - ('::1', None) - >>> parse_host_port('[::1]', default_port=1234) - ('::1', 1234) - >>> parse_host_port('2001:db8:85a3::8a2e:370:7334', default_port=1234) - ('2001:db8:85a3::8a2e:370:7334', 1234) - - """ - if address[0] == '[': - # Escaped ipv6 - _host, _port = address[1:].split(']') - host = _host - if ':' in _port: - port = _port.split(':')[1] - else: - port = default_port - else: - if address.count(':') == 1: - host, port = address.split(':') - else: - # 0 means ipv4, >1 means ipv6. - # We prohibit unescaped ipv6 addresses with port. - host = address - port = default_port - - return (host, None if port is None else int(port)) - - -def urlsplit(url, scheme='', allow_fragments=True): - """Parse a URL using urlparse.urlsplit(), splitting query and fragments. - This function papers over Python issue9374 when needed. - - The parameters are the same as urlparse.urlsplit. - """ - scheme, netloc, path, query, fragment = parse.urlsplit( - url, scheme, allow_fragments) - if allow_fragments and '#' in path: - path, fragment = path.split('#', 1) - if '?' in path: - path, query = path.split('?', 1) - return SplitResult(scheme, netloc, path, query, fragment) diff --git a/neutron/openstack/common/strutils.py b/neutron/openstack/common/strutils.py deleted file mode 100644 index 8c796d4f7..000000000 --- a/neutron/openstack/common/strutils.py +++ /dev/null @@ -1,239 +0,0 @@ -# Copyright 2011 OpenStack Foundation. -# All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -""" -System-level utilities and helper functions. -""" - -import math -import re -import sys -import unicodedata - -import six - -from neutron.openstack.common.gettextutils import _ - - -UNIT_PREFIX_EXPONENT = { - 'k': 1, - 'K': 1, - 'Ki': 1, - 'M': 2, - 'Mi': 2, - 'G': 3, - 'Gi': 3, - 'T': 4, - 'Ti': 4, -} -UNIT_SYSTEM_INFO = { - 'IEC': (1024, re.compile(r'(^[-+]?\d*\.?\d+)([KMGT]i?)?(b|bit|B)$')), - 'SI': (1000, re.compile(r'(^[-+]?\d*\.?\d+)([kMGT])?(b|bit|B)$')), -} - -TRUE_STRINGS = ('1', 't', 'true', 'on', 'y', 'yes') -FALSE_STRINGS = ('0', 'f', 'false', 'off', 'n', 'no') - -SLUGIFY_STRIP_RE = re.compile(r"[^\w\s-]") -SLUGIFY_HYPHENATE_RE = re.compile(r"[-\s]+") - - -def int_from_bool_as_string(subject): - """Interpret a string as a boolean and return either 1 or 0. - - Any string value in: - - ('True', 'true', 'On', 'on', '1') - - is interpreted as a boolean True. - - Useful for JSON-decoded stuff and config file parsing - """ - return bool_from_string(subject) and 1 or 0 - - -def bool_from_string(subject, strict=False, default=False): - """Interpret a string as a boolean. - - A case-insensitive match is performed such that strings matching 't', - 'true', 'on', 'y', 'yes', or '1' are considered True and, when - `strict=False`, anything else returns the value specified by 'default'. - - Useful for JSON-decoded stuff and config file parsing. - - If `strict=True`, unrecognized values, including None, will raise a - ValueError which is useful when parsing values passed in from an API call. - Strings yielding False are 'f', 'false', 'off', 'n', 'no', or '0'. - """ - if not isinstance(subject, six.string_types): - subject = six.text_type(subject) - - lowered = subject.strip().lower() - - if lowered in TRUE_STRINGS: - return True - elif lowered in FALSE_STRINGS: - return False - elif strict: - acceptable = ', '.join( - "'%s'" % s for s in sorted(TRUE_STRINGS + FALSE_STRINGS)) - msg = _("Unrecognized value '%(val)s', acceptable values are:" - " %(acceptable)s") % {'val': subject, - 'acceptable': acceptable} - raise ValueError(msg) - else: - return default - - -def safe_decode(text, incoming=None, errors='strict'): - """Decodes incoming text/bytes string using `incoming` if they're not - already unicode. - - :param incoming: Text's current encoding - :param errors: Errors handling policy. See here for valid - values http://docs.python.org/2/library/codecs.html - :returns: text or a unicode `incoming` encoded - representation of it. - :raises TypeError: If text is not an instance of str - """ - if not isinstance(text, (six.string_types, six.binary_type)): - raise TypeError("%s can't be decoded" % type(text)) - - if isinstance(text, six.text_type): - return text - - if not incoming: - incoming = (sys.stdin.encoding or - sys.getdefaultencoding()) - - try: - return text.decode(incoming, errors) - except UnicodeDecodeError: - # Note(flaper87) If we get here, it means that - # sys.stdin.encoding / sys.getdefaultencoding - # didn't return a suitable encoding to decode - # text. This happens mostly when global LANG - # var is not set correctly and there's no - # default encoding. In this case, most likely - # python will use ASCII or ANSI encoders as - # default encodings but they won't be capable - # of decoding non-ASCII characters. - # - # Also, UTF-8 is being used since it's an ASCII - # extension. - return text.decode('utf-8', errors) - - -def safe_encode(text, incoming=None, - encoding='utf-8', errors='strict'): - """Encodes incoming text/bytes string using `encoding`. - - If incoming is not specified, text is expected to be encoded with - current python's default encoding. (`sys.getdefaultencoding`) - - :param incoming: Text's current encoding - :param encoding: Expected encoding for text (Default UTF-8) - :param errors: Errors handling policy. See here for valid - values http://docs.python.org/2/library/codecs.html - :returns: text or a bytestring `encoding` encoded - representation of it. - :raises TypeError: If text is not an instance of str - """ - if not isinstance(text, (six.string_types, six.binary_type)): - raise TypeError("%s can't be encoded" % type(text)) - - if not incoming: - incoming = (sys.stdin.encoding or - sys.getdefaultencoding()) - - if isinstance(text, six.text_type): - return text.encode(encoding, errors) - elif text and encoding != incoming: - # Decode text before encoding it with `encoding` - text = safe_decode(text, incoming, errors) - return text.encode(encoding, errors) - else: - return text - - -def string_to_bytes(text, unit_system='IEC', return_int=False): - """Converts a string into an float representation of bytes. - - The units supported for IEC :: - - Kb(it), Kib(it), Mb(it), Mib(it), Gb(it), Gib(it), Tb(it), Tib(it) - KB, KiB, MB, MiB, GB, GiB, TB, TiB - - The units supported for SI :: - - kb(it), Mb(it), Gb(it), Tb(it) - kB, MB, GB, TB - - Note that the SI unit system does not support capital letter 'K' - - :param text: String input for bytes size conversion. - :param unit_system: Unit system for byte size conversion. - :param return_int: If True, returns integer representation of text - in bytes. (default: decimal) - :returns: Numerical representation of text in bytes. - :raises ValueError: If text has an invalid value. - - """ - try: - base, reg_ex = UNIT_SYSTEM_INFO[unit_system] - except KeyError: - msg = _('Invalid unit system: "%s"') % unit_system - raise ValueError(msg) - match = reg_ex.match(text) - if match: - magnitude = float(match.group(1)) - unit_prefix = match.group(2) - if match.group(3) in ['b', 'bit']: - magnitude /= 8 - else: - msg = _('Invalid string format: %s') % text - raise ValueError(msg) - if not unit_prefix: - res = magnitude - else: - res = magnitude * pow(base, UNIT_PREFIX_EXPONENT[unit_prefix]) - if return_int: - return int(math.ceil(res)) - return res - - -def to_slug(value, incoming=None, errors="strict"): - """Normalize string. - - Convert to lowercase, remove non-word characters, and convert spaces - to hyphens. - - Inspired by Django's `slugify` filter. - - :param value: Text to slugify - :param incoming: Text's current encoding - :param errors: Errors handling policy. See here for valid - values http://docs.python.org/2/library/codecs.html - :returns: slugified unicode representation of `value` - :raises TypeError: If text is not an instance of str - """ - value = safe_decode(value, incoming, errors) - # NOTE(aababilov): no need to use safe_(encode|decode) here: - # encodings are always "ascii", error handling is always "ignore" - # and types are always known (first: unicode; second: str) - value = unicodedata.normalize("NFKD", value).encode( - "ascii", "ignore").decode("ascii") - value = SLUGIFY_STRIP_RE.sub("", value).strip().lower() - return SLUGIFY_HYPHENATE_RE.sub("-", value) diff --git a/neutron/openstack/common/timeutils.py b/neutron/openstack/common/timeutils.py deleted file mode 100644 index c48da95f1..000000000 --- a/neutron/openstack/common/timeutils.py +++ /dev/null @@ -1,210 +0,0 @@ -# Copyright 2011 OpenStack Foundation. -# All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -""" -Time related utilities and helper functions. -""" - -import calendar -import datetime -import time - -import iso8601 -import six - - -# ISO 8601 extended time format with microseconds -_ISO8601_TIME_FORMAT_SUBSECOND = '%Y-%m-%dT%H:%M:%S.%f' -_ISO8601_TIME_FORMAT = '%Y-%m-%dT%H:%M:%S' -PERFECT_TIME_FORMAT = _ISO8601_TIME_FORMAT_SUBSECOND - - -def isotime(at=None, subsecond=False): - """Stringify time in ISO 8601 format.""" - if not at: - at = utcnow() - st = at.strftime(_ISO8601_TIME_FORMAT - if not subsecond - else _ISO8601_TIME_FORMAT_SUBSECOND) - tz = at.tzinfo.tzname(None) if at.tzinfo else 'UTC' - st += ('Z' if tz == 'UTC' else tz) - return st - - -def parse_isotime(timestr): - """Parse time from ISO 8601 format.""" - try: - return iso8601.parse_date(timestr) - except iso8601.ParseError as e: - raise ValueError(six.text_type(e)) - except TypeError as e: - raise ValueError(six.text_type(e)) - - -def strtime(at=None, fmt=PERFECT_TIME_FORMAT): - """Returns formatted utcnow.""" - if not at: - at = utcnow() - return at.strftime(fmt) - - -def parse_strtime(timestr, fmt=PERFECT_TIME_FORMAT): - """Turn a formatted time back into a datetime.""" - return datetime.datetime.strptime(timestr, fmt) - - -def normalize_time(timestamp): - """Normalize time in arbitrary timezone to UTC naive object.""" - offset = timestamp.utcoffset() - if offset is None: - return timestamp - return timestamp.replace(tzinfo=None) - offset - - -def is_older_than(before, seconds): - """Return True if before is older than seconds.""" - if isinstance(before, six.string_types): - before = parse_strtime(before).replace(tzinfo=None) - else: - before = before.replace(tzinfo=None) - - return utcnow() - before > datetime.timedelta(seconds=seconds) - - -def is_newer_than(after, seconds): - """Return True if after is newer than seconds.""" - if isinstance(after, six.string_types): - after = parse_strtime(after).replace(tzinfo=None) - else: - after = after.replace(tzinfo=None) - - return after - utcnow() > datetime.timedelta(seconds=seconds) - - -def utcnow_ts(): - """Timestamp version of our utcnow function.""" - if utcnow.override_time is None: - # NOTE(kgriffs): This is several times faster - # than going through calendar.timegm(...) - return int(time.time()) - - return calendar.timegm(utcnow().timetuple()) - - -def utcnow(): - """Overridable version of utils.utcnow.""" - if utcnow.override_time: - try: - return utcnow.override_time.pop(0) - except AttributeError: - return utcnow.override_time - return datetime.datetime.utcnow() - - -def iso8601_from_timestamp(timestamp): - """Returns an iso8601 formatted date from timestamp.""" - return isotime(datetime.datetime.utcfromtimestamp(timestamp)) - - -utcnow.override_time = None - - -def set_time_override(override_time=None): - """Overrides utils.utcnow. - - Make it return a constant time or a list thereof, one at a time. - - :param override_time: datetime instance or list thereof. If not - given, defaults to the current UTC time. - """ - utcnow.override_time = override_time or datetime.datetime.utcnow() - - -def advance_time_delta(timedelta): - """Advance overridden time using a datetime.timedelta.""" - assert utcnow.override_time is not None - try: - for dt in utcnow.override_time: - dt += timedelta - except TypeError: - utcnow.override_time += timedelta - - -def advance_time_seconds(seconds): - """Advance overridden time by seconds.""" - advance_time_delta(datetime.timedelta(0, seconds)) - - -def clear_time_override(): - """Remove the overridden time.""" - utcnow.override_time = None - - -def marshall_now(now=None): - """Make an rpc-safe datetime with microseconds. - - Note: tzinfo is stripped, but not required for relative times. - """ - if not now: - now = utcnow() - return dict(day=now.day, month=now.month, year=now.year, hour=now.hour, - minute=now.minute, second=now.second, - microsecond=now.microsecond) - - -def unmarshall_time(tyme): - """Unmarshall a datetime dict.""" - return datetime.datetime(day=tyme['day'], - month=tyme['month'], - year=tyme['year'], - hour=tyme['hour'], - minute=tyme['minute'], - second=tyme['second'], - microsecond=tyme['microsecond']) - - -def delta_seconds(before, after): - """Return the difference between two timing objects. - - Compute the difference in seconds between two date, time, or - datetime objects (as a float, to microsecond resolution). - """ - delta = after - before - return total_seconds(delta) - - -def total_seconds(delta): - """Return the total seconds of datetime.timedelta object. - - Compute total seconds of datetime.timedelta, datetime.timedelta - doesn't have method total_seconds in Python2.6, calculate it manually. - """ - try: - return delta.total_seconds() - except AttributeError: - return ((delta.days * 24 * 3600) + delta.seconds + - float(delta.microseconds) / (10 ** 6)) - - -def is_soon(dt, window): - """Determines if time is going to happen in the next window seconds. - - :param dt: the time - :param window: minimum seconds to remain to consider the time not soon - - :return: True if expiration is within the given duration - """ - soon = (utcnow() + datetime.timedelta(seconds=window)) - return normalize_time(dt) <= soon diff --git a/neutron/plugins/bigswitch/agent/restproxy_agent.py b/neutron/plugins/bigswitch/agent/restproxy_agent.py index 910be0656..e528cb082 100644 --- a/neutron/plugins/bigswitch/agent/restproxy_agent.py +++ b/neutron/plugins/bigswitch/agent/restproxy_agent.py @@ -23,6 +23,7 @@ import eventlet eventlet.monkey_patch() from oslo.config import cfg +from oslo.utils import excutils from neutron.agent.linux import ovs_lib from neutron.agent.linux import utils @@ -33,7 +34,6 @@ from neutron.common import rpc as n_rpc from neutron.common import topics from neutron import context as q_context from neutron.extensions import securitygroup as ext_sg -from neutron.openstack.common import excutils from neutron.openstack.common import log from neutron.plugins.bigswitch import config as pl_config diff --git a/neutron/plugins/bigswitch/l3_router_plugin.py b/neutron/plugins/bigswitch/l3_router_plugin.py index 2b2529e44..617ccec77 100644 --- a/neutron/plugins/bigswitch/l3_router_plugin.py +++ b/neutron/plugins/bigswitch/l3_router_plugin.py @@ -23,6 +23,7 @@ Big Switch core plugin. """ from oslo.config import cfg +from oslo.utils import excutils from neutron.api import extensions as neutron_extensions from neutron.common import exceptions @@ -30,7 +31,6 @@ from neutron.common import log from neutron.common import utils from neutron.db import l3_db from neutron.extensions import l3 -from neutron.openstack.common import excutils from neutron.openstack.common import log as logging from neutron.plugins.bigswitch import extensions from neutron.plugins.bigswitch import plugin as cplugin diff --git a/neutron/plugins/bigswitch/plugin.py b/neutron/plugins/bigswitch/plugin.py index e3c4febc9..ba06b9113 100644 --- a/neutron/plugins/bigswitch/plugin.py +++ b/neutron/plugins/bigswitch/plugin.py @@ -48,6 +48,7 @@ import re import eventlet from oslo.config import cfg from oslo import messaging +from oslo.utils import importutils from sqlalchemy.orm import exc as sqlexc from neutron.agent import securitygroups_rpc as sg_rpc @@ -78,7 +79,6 @@ from neutron.extensions import external_net from neutron.extensions import extra_dhcp_opt as edo_ext from neutron.extensions import portbindings from neutron import manager -from neutron.openstack.common import importutils from neutron.openstack.common import log as logging from neutron.plugins.bigswitch import config as pl_config from neutron.plugins.bigswitch.db import porttracker_db diff --git a/neutron/plugins/bigswitch/servermanager.py b/neutron/plugins/bigswitch/servermanager.py index 8d91c7101..2389c0671 100644 --- a/neutron/plugins/bigswitch/servermanager.py +++ b/neutron/plugins/bigswitch/servermanager.py @@ -38,9 +38,9 @@ import eventlet import eventlet.corolocal from oslo.config import cfg from oslo.serialization import jsonutils +from oslo.utils import excutils from neutron.common import exceptions -from neutron.openstack.common import excutils from neutron.openstack.common import log as logging from neutron.plugins.bigswitch.db import consistency_db as cdb diff --git a/neutron/plugins/brocade/NeutronPlugin.py b/neutron/plugins/brocade/NeutronPlugin.py index 267c9ca7e..4437c0128 100644 --- a/neutron/plugins/brocade/NeutronPlugin.py +++ b/neutron/plugins/brocade/NeutronPlugin.py @@ -21,6 +21,7 @@ from oslo.config import cfg from oslo import messaging +from oslo.utils import importutils from neutron.agent import securitygroups_rpc as sg_rpc from neutron.api.rpc.agentnotifiers import dhcp_rpc_agent_api @@ -45,7 +46,6 @@ from neutron.db import securitygroups_rpc_base as sg_db_rpc from neutron.extensions import portbindings from neutron.extensions import securitygroup as ext_sg from neutron.openstack.common import context -from neutron.openstack.common import importutils from neutron.openstack.common import log as logging from neutron.plugins.brocade.db import models as brocade_db from neutron.plugins.brocade import vlanbm as vbm diff --git a/neutron/plugins/brocade/nos/nosdriver.py b/neutron/plugins/brocade/nos/nosdriver.py index fe09c0bf2..700516bbf 100644 --- a/neutron/plugins/brocade/nos/nosdriver.py +++ b/neutron/plugins/brocade/nos/nosdriver.py @@ -19,8 +19,8 @@ Neutron network life-cycle management. """ from ncclient import manager +from oslo.utils import excutils -from neutron.openstack.common import excutils from neutron.openstack.common import log as logging from neutron.plugins.brocade.nos import nctemplates as template diff --git a/neutron/plugins/cisco/cfg_agent/cfg_agent.py b/neutron/plugins/cisco/cfg_agent/cfg_agent.py index 9563a903a..3b600117c 100644 --- a/neutron/plugins/cisco/cfg_agent/cfg_agent.py +++ b/neutron/plugins/cisco/cfg_agent/cfg_agent.py @@ -20,6 +20,8 @@ import time from oslo.config import cfg from oslo import messaging +from oslo.utils import importutils +from oslo.utils import timeutils from neutron.agent.common import config from neutron.agent.linux import external_process @@ -30,13 +32,11 @@ from neutron.common import rpc as n_rpc from neutron.common import topics from neutron import context as n_context from neutron import manager -from neutron.openstack.common import importutils from neutron.openstack.common import lockutils from neutron.openstack.common import log as logging from neutron.openstack.common import loopingcall from neutron.openstack.common import periodic_task from neutron.openstack.common import service -from neutron.openstack.common import timeutils from neutron.openstack.common.gettextutils import _LE, _LI, _LW from neutron.plugins.cisco.cfg_agent import device_status from neutron.plugins.cisco.common import cisco_constants as c_constants diff --git a/neutron/plugins/cisco/cfg_agent/device_drivers/driver_mgr.py b/neutron/plugins/cisco/cfg_agent/device_drivers/driver_mgr.py index 69a2e3cec..e74876ca0 100644 --- a/neutron/plugins/cisco/cfg_agent/device_drivers/driver_mgr.py +++ b/neutron/plugins/cisco/cfg_agent/device_drivers/driver_mgr.py @@ -12,9 +12,10 @@ # License for the specific language governing permissions and limitations # under the License. -from neutron.openstack.common import excutils +from oslo.utils import excutils +from oslo.utils import importutils + from neutron.openstack.common.gettextutils import _LE -from neutron.openstack.common import importutils from neutron.openstack.common import log as logging from neutron.plugins.cisco.cfg_agent import cfg_exceptions diff --git a/neutron/plugins/cisco/cfg_agent/device_status.py b/neutron/plugins/cisco/cfg_agent/device_status.py index a41f8f407..b6721eca5 100644 --- a/neutron/plugins/cisco/cfg_agent/device_status.py +++ b/neutron/plugins/cisco/cfg_agent/device_status.py @@ -15,10 +15,10 @@ import datetime from oslo.config import cfg +from oslo.utils import timeutils from neutron.agent.linux import utils as linux_utils from neutron.openstack.common import log as logging -from neutron.openstack.common import timeutils from neutron.openstack.common.gettextutils import _LI, _LW diff --git a/neutron/plugins/cisco/cfg_agent/service_helpers/routing_svc_helper.py b/neutron/plugins/cisco/cfg_agent/service_helpers/routing_svc_helper.py index 2dee6c44f..fadab29de 100644 --- a/neutron/plugins/cisco/cfg_agent/service_helpers/routing_svc_helper.py +++ b/neutron/plugins/cisco/cfg_agent/service_helpers/routing_svc_helper.py @@ -13,17 +13,17 @@ # under the License. import collections + import eventlet import netaddr - from oslo import messaging +from oslo.utils import excutils from neutron.common import constants as l3_constants from neutron.common import rpc as n_rpc from neutron.common import topics from neutron.common import utils as common_utils from neutron import context as n_context -from neutron.openstack.common import excutils from neutron.openstack.common import log as logging from neutron.openstack.common.gettextutils import _LE, _LI, _LW from neutron.plugins.cisco.cfg_agent import cfg_exceptions diff --git a/neutron/plugins/cisco/db/l3/device_handling_db.py b/neutron/plugins/cisco/db/l3/device_handling_db.py index c3fe25c52..6eb0730ad 100644 --- a/neutron/plugins/cisco/db/l3/device_handling_db.py +++ b/neutron/plugins/cisco/db/l3/device_handling_db.py @@ -17,6 +17,8 @@ import random from keystoneclient import exceptions as k_exceptions from keystoneclient.v2_0 import client as k_client from oslo.config import cfg +from oslo.utils import importutils +from oslo.utils import timeutils from sqlalchemy.orm import exc from sqlalchemy.orm import joinedload @@ -25,9 +27,7 @@ from neutron.common import utils from neutron import context as neutron_context from neutron.db import agents_db from neutron import manager -from neutron.openstack.common import importutils from neutron.openstack.common import log as logging -from neutron.openstack.common import timeutils from neutron.openstack.common import uuidutils from neutron.openstack.common.gettextutils import _LE, _LI, _LW from neutron.plugins.cisco.common import cisco_constants as c_constants diff --git a/neutron/plugins/cisco/models/virt_phy_sw_v2.py b/neutron/plugins/cisco/models/virt_phy_sw_v2.py index 706ca00c6..91fd1a136 100644 --- a/neutron/plugins/cisco/models/virt_phy_sw_v2.py +++ b/neutron/plugins/cisco/models/virt_phy_sw_v2.py @@ -15,13 +15,14 @@ import inspect +from oslo.utils import excutils +from oslo.utils import importutils + from neutron.api.v2 import attributes from neutron.extensions import portbindings from neutron.extensions import providernet as provider from neutron import neutron_plugin_base_v2 -from neutron.openstack.common import excutils from neutron.openstack.common.gettextutils import _LE, _LI -from neutron.openstack.common import importutils from neutron.openstack.common import log as logging from neutron.plugins.cisco.common import cisco_constants as const from neutron.plugins.cisco.common import cisco_credentials_v2 as cred diff --git a/neutron/plugins/cisco/n1kv/n1kv_neutron_plugin.py b/neutron/plugins/cisco/n1kv/n1kv_neutron_plugin.py index 8bafe9a58..947fdebb4 100644 --- a/neutron/plugins/cisco/n1kv/n1kv_neutron_plugin.py +++ b/neutron/plugins/cisco/n1kv/n1kv_neutron_plugin.py @@ -15,6 +15,8 @@ import eventlet from oslo.config import cfg as q_conf +from oslo.utils import excutils +from oslo.utils import importutils from neutron.api.rpc.agentnotifiers import dhcp_rpc_agent_api from neutron.api.rpc.handlers import dhcp_rpc @@ -34,9 +36,7 @@ from neutron.db import quota_db from neutron.extensions import portbindings from neutron.extensions import providernet from neutron import manager -from neutron.openstack.common import excutils from neutron.openstack.common.gettextutils import _LW -from neutron.openstack.common import importutils from neutron.openstack.common import log as logging from neutron.openstack.common import uuidutils as uuidutils from neutron.plugins.cisco.common import cisco_constants as c_const diff --git a/neutron/plugins/cisco/network_plugin.py b/neutron/plugins/cisco/network_plugin.py index e60da7987..b8c48769f 100644 --- a/neutron/plugins/cisco/network_plugin.py +++ b/neutron/plugins/cisco/network_plugin.py @@ -12,13 +12,12 @@ # License for the specific language governing permissions and limitations # under the License. - +from oslo.utils import importutils import webob.exc as wexc from neutron.api import extensions as neutron_extensions from neutron.api.v2 import base from neutron.db import db_base_plugin_v2 -from neutron.openstack.common import importutils from neutron.openstack.common import log as logging from neutron.plugins.cisco.common import cisco_exceptions as cexc from neutron.plugins.cisco.common import config diff --git a/neutron/plugins/ibm/sdnve_neutron_plugin.py b/neutron/plugins/ibm/sdnve_neutron_plugin.py index f90e18d8f..9b3aa32ce 100644 --- a/neutron/plugins/ibm/sdnve_neutron_plugin.py +++ b/neutron/plugins/ibm/sdnve_neutron_plugin.py @@ -19,6 +19,7 @@ import functools from oslo.config import cfg from oslo import messaging +from oslo.utils import excutils from neutron.common import constants as n_const from neutron.common import exceptions as n_exc @@ -31,7 +32,6 @@ from neutron.db import l3_gwmode_db from neutron.db import portbindings_db from neutron.db import quota_db # noqa from neutron.extensions import portbindings -from neutron.openstack.common import excutils from neutron.openstack.common import log as logging from neutron.plugins.ibm.common import config # noqa from neutron.plugins.ibm.common import constants diff --git a/neutron/plugins/metaplugin/meta_neutron_plugin.py b/neutron/plugins/metaplugin/meta_neutron_plugin.py index d8fb71a33..e956eaee6 100644 --- a/neutron/plugins/metaplugin/meta_neutron_plugin.py +++ b/neutron/plugins/metaplugin/meta_neutron_plugin.py @@ -14,6 +14,7 @@ # under the License. from oslo.config import cfg +from oslo.utils import importutils from neutron.common import exceptions as exc from neutron.common import topics @@ -24,7 +25,6 @@ from neutron.db import extraroute_db from neutron.db import l3_db from neutron.db import models_v2 from neutron.extensions import flavor as ext_flavor -from neutron.openstack.common import importutils from neutron.openstack.common import log as logging from neutron.plugins.metaplugin.common import config # noqa from neutron.plugins.metaplugin import meta_db_v2 diff --git a/neutron/plugins/midonet/plugin.py b/neutron/plugins/midonet/plugin.py index 5bfafb05a..956e46b70 100644 --- a/neutron/plugins/midonet/plugin.py +++ b/neutron/plugins/midonet/plugin.py @@ -20,6 +20,7 @@ from midonetclient import api from midonetclient import exc from midonetclient.neutron import client as n_client from oslo.config import cfg +from oslo.utils import excutils from sqlalchemy.orm import exc as sa_exc from webob import exc as w_exc @@ -42,7 +43,6 @@ from neutron.extensions import external_net as ext_net from neutron.extensions import l3 from neutron.extensions import portbindings from neutron.extensions import securitygroup as ext_sg -from neutron.openstack.common import excutils from neutron.openstack.common import log as logging from neutron.plugins.midonet.common import config # noqa from neutron.plugins.midonet.common import net_util diff --git a/neutron/plugins/ml2/drivers/brocade/mechanism_brocade.py b/neutron/plugins/ml2/drivers/brocade/mechanism_brocade.py index 1cebdac44..e0b027bfc 100644 --- a/neutron/plugins/ml2/drivers/brocade/mechanism_brocade.py +++ b/neutron/plugins/ml2/drivers/brocade/mechanism_brocade.py @@ -17,9 +17,9 @@ """Implentation of Brocade ML2 Mechanism driver for ML2 Plugin.""" from oslo.config import cfg +from oslo.utils import importutils from neutron.openstack.common.gettextutils import _LE, _LI -from neutron.openstack.common import importutils from neutron.openstack.common import log as logging from neutron.plugins.ml2 import driver_api from neutron.plugins.ml2.drivers.brocade.db import models as brocade_db diff --git a/neutron/plugins/ml2/drivers/brocade/nos/nosdriver.py b/neutron/plugins/ml2/drivers/brocade/nos/nosdriver.py index 53a3f265c..afa41672c 100644 --- a/neutron/plugins/ml2/drivers/brocade/nos/nosdriver.py +++ b/neutron/plugins/ml2/drivers/brocade/nos/nosdriver.py @@ -19,9 +19,9 @@ Neutron network life-cycle management. """ from ncclient import manager +from oslo.utils import excutils from xml.etree import ElementTree -from neutron.openstack.common import excutils from neutron.openstack.common.gettextutils import _LE from neutron.openstack.common import log as logging from neutron.plugins.ml2.drivers.brocade.nos import nctemplates as template diff --git a/neutron/plugins/ml2/drivers/cisco/nexus/nexus_network_driver.py b/neutron/plugins/ml2/drivers/cisco/nexus/nexus_network_driver.py index 18e9689dd..826b4460b 100644 --- a/neutron/plugins/ml2/drivers/cisco/nexus/nexus_network_driver.py +++ b/neutron/plugins/ml2/drivers/cisco/nexus/nexus_network_driver.py @@ -17,8 +17,9 @@ Implements a Nexus-OS NETCONF over SSHv2 API Client """ -from neutron.openstack.common import excutils -from neutron.openstack.common import importutils +from oslo.utils import excutils +from oslo.utils import importutils + from neutron.openstack.common import log as logging from neutron.plugins.ml2.drivers.cisco.nexus import config as conf from neutron.plugins.ml2.drivers.cisco.nexus import constants as const diff --git a/neutron/plugins/ml2/drivers/l2pop/db.py b/neutron/plugins/ml2/drivers/l2pop/db.py index d07d0b1af..11f185b10 100644 --- a/neutron/plugins/ml2/drivers/l2pop/db.py +++ b/neutron/plugins/ml2/drivers/l2pop/db.py @@ -14,13 +14,13 @@ # under the License. from oslo.serialization import jsonutils +from oslo.utils import timeutils from sqlalchemy import sql from neutron.common import constants as const from neutron.db import agents_db from neutron.db import common_db_mixin as base_db from neutron.db import models_v2 -from neutron.openstack.common import timeutils from neutron.plugins.ml2.drivers.l2pop import constants as l2_const from neutron.plugins.ml2 import models as ml2_models diff --git a/neutron/plugins/ml2/drivers/mech_bigswitch/driver.py b/neutron/plugins/ml2/drivers/mech_bigswitch/driver.py index 61a8c5ddd..e292b33f8 100644 --- a/neutron/plugins/ml2/drivers/mech_bigswitch/driver.py +++ b/neutron/plugins/ml2/drivers/mech_bigswitch/driver.py @@ -18,13 +18,13 @@ import httplib import eventlet from oslo.config import cfg +from oslo.utils import excutils +from oslo.utils import timeutils from neutron import context as ctx from neutron.extensions import portbindings -from neutron.openstack.common import excutils from neutron.openstack.common.gettextutils import _LE, _LW from neutron.openstack.common import log -from neutron.openstack.common import timeutils from neutron.plugins.bigswitch import config as pl_config from neutron.plugins.bigswitch import plugin from neutron.plugins.bigswitch import servermanager diff --git a/neutron/plugins/ml2/drivers/mechanism_odl.py b/neutron/plugins/ml2/drivers/mechanism_odl.py index 1b8b119bf..487863d9a 100644 --- a/neutron/plugins/ml2/drivers/mechanism_odl.py +++ b/neutron/plugins/ml2/drivers/mechanism_odl.py @@ -17,13 +17,13 @@ import time from oslo.config import cfg from oslo.serialization import jsonutils +from oslo.utils import excutils import requests from neutron.common import constants as n_const from neutron.common import exceptions as n_exc from neutron.common import utils from neutron.extensions import portbindings -from neutron.openstack.common import excutils from neutron.openstack.common import log from neutron.plugins.common import constants from neutron.plugins.ml2 import driver_api as api diff --git a/neutron/plugins/ml2/plugin.py b/neutron/plugins/ml2/plugin.py index 9e171dfcf..c7587bf3a 100644 --- a/neutron/plugins/ml2/plugin.py +++ b/neutron/plugins/ml2/plugin.py @@ -19,6 +19,8 @@ from eventlet import greenthread from oslo.config import cfg from oslo.db import exception as os_db_exception from oslo.serialization import jsonutils +from oslo.utils import excutils +from oslo.utils import importutils from sqlalchemy import exc as sql_exc from sqlalchemy.orm import exc as sa_exc @@ -52,9 +54,7 @@ from neutron.extensions import l3agentscheduler from neutron.extensions import portbindings from neutron.extensions import providernet as provider from neutron import manager -from neutron.openstack.common import excutils from neutron.openstack.common.gettextutils import _LE, _LI, _LW -from neutron.openstack.common import importutils from neutron.openstack.common import lockutils from neutron.openstack.common import log from neutron.openstack.common import uuidutils diff --git a/neutron/plugins/mlnx/agent/utils.py b/neutron/plugins/mlnx/agent/utils.py index 967f62b29..5a6bc8977 100644 --- a/neutron/plugins/mlnx/agent/utils.py +++ b/neutron/plugins/mlnx/agent/utils.py @@ -14,8 +14,8 @@ # limitations under the License. from oslo.serialization import jsonutils +from oslo.utils import importutils -from neutron.openstack.common import importutils from neutron.openstack.common import log as logging from neutron.plugins.mlnx.common import comm_utils from neutron.plugins.mlnx.common import exceptions diff --git a/neutron/plugins/mlnx/mlnx_plugin.py b/neutron/plugins/mlnx/mlnx_plugin.py index f68437fbc..4e0d71865 100644 --- a/neutron/plugins/mlnx/mlnx_plugin.py +++ b/neutron/plugins/mlnx/mlnx_plugin.py @@ -16,6 +16,7 @@ import sys from oslo.config import cfg +from oslo.utils import importutils from neutron.agent import securitygroups_rpc as sg_rpc from neutron.api.rpc.agentnotifiers import dhcp_rpc_agent_api @@ -42,7 +43,6 @@ from neutron.db import quota_db # noqa from neutron.db import securitygroups_rpc_base as sg_db_rpc from neutron.extensions import portbindings from neutron.extensions import providernet as provider -from neutron.openstack.common import importutils from neutron.openstack.common import log as logging from neutron.plugins.common import constants as svc_constants from neutron.plugins.common import utils as plugin_utils diff --git a/neutron/plugins/nec/common/ofc_client.py b/neutron/plugins/nec/common/ofc_client.py index 170376383..c48f52ffa 100644 --- a/neutron/plugins/nec/common/ofc_client.py +++ b/neutron/plugins/nec/common/ofc_client.py @@ -15,9 +15,9 @@ import time from oslo.serialization import jsonutils +from oslo.utils import excutils import requests -from neutron.openstack.common import excutils from neutron.openstack.common import log as logging from neutron.plugins.nec.common import config from neutron.plugins.nec.common import exceptions as nexc diff --git a/neutron/plugins/nec/drivers/__init__.py b/neutron/plugins/nec/drivers/__init__.py index 7788ea757..2b8a475de 100644 --- a/neutron/plugins/nec/drivers/__init__.py +++ b/neutron/plugins/nec/drivers/__init__.py @@ -12,7 +12,8 @@ # License for the specific language governing permissions and limitations # under the License. -from neutron.openstack.common import importutils +from oslo.utils import importutils + from neutron.openstack.common import log as logging diff --git a/neutron/plugins/nec/nec_plugin.py b/neutron/plugins/nec/nec_plugin.py index 1845c688d..ad171c313 100644 --- a/neutron/plugins/nec/nec_plugin.py +++ b/neutron/plugins/nec/nec_plugin.py @@ -13,6 +13,8 @@ # under the License. from oslo import messaging +from oslo.utils import excutils +from oslo.utils import importutils from neutron.agent import securitygroups_rpc as sg_rpc from neutron.api import extensions as neutron_extensions @@ -37,8 +39,6 @@ from neutron.db import quota_db # noqa from neutron.db import securitygroups_rpc_base as sg_db_rpc from neutron.extensions import allowedaddresspairs as addr_pair from neutron.extensions import portbindings -from neutron.openstack.common import excutils -from neutron.openstack.common import importutils from neutron.openstack.common import log as logging from neutron.openstack.common import uuidutils from neutron.plugins.common import constants as svc_constants diff --git a/neutron/plugins/nec/nec_router.py b/neutron/plugins/nec/nec_router.py index 5c4088ea7..42abc6ac5 100644 --- a/neutron/plugins/nec/nec_router.py +++ b/neutron/plugins/nec/nec_router.py @@ -12,6 +12,9 @@ # License for the specific language governing permissions and limitations # under the License. +from oslo.utils import excutils +from oslo.utils import importutils + from neutron.api.rpc.agentnotifiers import l3_rpc_agent_api from neutron.api.v2 import attributes as attr from neutron.common import exceptions as n_exc @@ -22,8 +25,6 @@ from neutron.db import l3_db from neutron.db import l3_gwmode_db from neutron.db import models_v2 from neutron.extensions import l3 -from neutron.openstack.common import excutils -from neutron.openstack.common import importutils from neutron.openstack.common import log as logging from neutron.plugins.nec.common import config from neutron.plugins.nec.common import constants as nconst diff --git a/neutron/plugins/nec/packet_filter.py b/neutron/plugins/nec/packet_filter.py index 0b73dc783..1f8a725c4 100644 --- a/neutron/plugins/nec/packet_filter.py +++ b/neutron/plugins/nec/packet_filter.py @@ -12,7 +12,8 @@ # License for the specific language governing permissions and limitations # under the License. -from neutron.openstack.common import excutils +from oslo.utils import excutils + from neutron.openstack.common import log as logging from neutron.plugins.nec.common import config from neutron.plugins.nec.common import exceptions as nexc diff --git a/neutron/plugins/nec/router_drivers.py b/neutron/plugins/nec/router_drivers.py index 58c83e339..250bd93ef 100644 --- a/neutron/plugins/nec/router_drivers.py +++ b/neutron/plugins/nec/router_drivers.py @@ -15,11 +15,11 @@ import abc import httplib +from oslo.utils import excutils import six from neutron.common import log as call_log from neutron.common import utils -from neutron.openstack.common import excutils from neutron.openstack.common import log as logging from neutron.plugins.nec.common import constants as nconst from neutron.plugins.nec.common import exceptions as nexc diff --git a/neutron/plugins/nuage/plugin.py b/neutron/plugins/nuage/plugin.py index 995a8fa8d..0da031d8b 100644 --- a/neutron/plugins/nuage/plugin.py +++ b/neutron/plugins/nuage/plugin.py @@ -17,6 +17,8 @@ import re import netaddr from oslo.config import cfg +from oslo.utils import excutils +from oslo.utils import importutils from sqlalchemy.orm import exc from neutron.api import extensions as neutron_extensions @@ -36,8 +38,6 @@ from neutron.extensions import l3 from neutron.extensions import portbindings from neutron.extensions import providernet as pnet from neutron.extensions import securitygroup as ext_sg -from neutron.openstack.common import excutils -from neutron.openstack.common import importutils from neutron.openstack.common import lockutils from neutron.openstack.common import log as logging from neutron.openstack.common import loopingcall diff --git a/neutron/plugins/nuage/syncmanager.py b/neutron/plugins/nuage/syncmanager.py index 8656e15b0..517dcedcb 100644 --- a/neutron/plugins/nuage/syncmanager.py +++ b/neutron/plugins/nuage/syncmanager.py @@ -14,13 +14,13 @@ # from oslo.config import cfg +from oslo.utils import importutils import sqlalchemy.orm.exc as db_exc from neutron import context as ncontext from neutron.db import db_base_plugin_v2 from neutron.db import extraroute_db from neutron.db import securitygroups_db -from neutron.openstack.common import importutils from neutron.openstack.common import log from neutron.openstack.common.gettextutils import _LE, _LI, _LW from neutron.plugins.nuage.common import config diff --git a/neutron/plugins/oneconvergence/lib/nvsdlib.py b/neutron/plugins/oneconvergence/lib/nvsdlib.py index e08a491e9..d66abe795 100644 --- a/neutron/plugins/oneconvergence/lib/nvsdlib.py +++ b/neutron/plugins/oneconvergence/lib/nvsdlib.py @@ -15,8 +15,8 @@ """Intermidiate NVSD Library.""" from oslo.serialization import jsonutils +from oslo.utils import excutils -from neutron.openstack.common import excutils from neutron.openstack.common import log as logging import neutron.plugins.oneconvergence.lib.exception as nvsdexception from neutron.plugins.oneconvergence.lib import plugin_helper diff --git a/neutron/plugins/oneconvergence/plugin.py b/neutron/plugins/oneconvergence/plugin.py index cd3b04365..5b612c6f8 100644 --- a/neutron/plugins/oneconvergence/plugin.py +++ b/neutron/plugins/oneconvergence/plugin.py @@ -15,6 +15,8 @@ """Implementation of OneConvergence Neutron Plugin.""" from oslo.config import cfg +from oslo.utils import excutils +from oslo.utils import importutils from neutron.agent import securitygroups_rpc as sg_rpc from neutron.api.rpc.agentnotifiers import dhcp_rpc_agent_api @@ -38,8 +40,6 @@ from neutron.db import portbindings_base from neutron.db import quota_db # noqa from neutron.db import securitygroups_rpc_base as sg_db_rpc from neutron.extensions import portbindings -from neutron.openstack.common import excutils -from neutron.openstack.common import importutils from neutron.openstack.common import log as logging from neutron.plugins.common import constants as svc_constants import neutron.plugins.oneconvergence.lib.config # noqa diff --git a/neutron/plugins/openvswitch/agent/ovs_dvr_neutron_agent.py b/neutron/plugins/openvswitch/agent/ovs_dvr_neutron_agent.py index 3dfa020fa..4bf603f24 100644 --- a/neutron/plugins/openvswitch/agent/ovs_dvr_neutron_agent.py +++ b/neutron/plugins/openvswitch/agent/ovs_dvr_neutron_agent.py @@ -15,11 +15,11 @@ from oslo import messaging +from oslo.utils import excutils from neutron.api.rpc.handlers import dvr_rpc from neutron.common import constants as n_const from neutron.common import utils as n_utils -from neutron.openstack.common import excutils from neutron.openstack.common.gettextutils import _LE, _LI, _LW from neutron.openstack.common import log as logging from neutron.plugins.openvswitch.common import constants diff --git a/neutron/plugins/plumgrid/plumgrid_plugin/plumgrid_plugin.py b/neutron/plugins/plumgrid/plumgrid_plugin/plumgrid_plugin.py index e132cc266..b879f6dfd 100644 --- a/neutron/plugins/plumgrid/plumgrid_plugin/plumgrid_plugin.py +++ b/neutron/plugins/plumgrid/plumgrid_plugin/plumgrid_plugin.py @@ -20,6 +20,7 @@ to the PLUMgrid Network Management System called Director import netaddr from oslo.config import cfg +from oslo.utils import importutils from sqlalchemy.orm import exc as sa_exc from neutron.api.v2 import attributes @@ -32,7 +33,6 @@ from neutron.db import quota_db # noqa from neutron.db import securitygroups_db from neutron.extensions import portbindings from neutron.extensions import securitygroup as sec_grp -from neutron.openstack.common import importutils from neutron.openstack.common import log as logging from neutron.plugins.plumgrid.common import exceptions as plum_excep from neutron.plugins.plumgrid.plumgrid_plugin import plugin_ver diff --git a/neutron/plugins/vmware/api_client/request.py b/neutron/plugins/vmware/api_client/request.py index bfc80fcbc..78cf81f56 100644 --- a/neutron/plugins/vmware/api_client/request.py +++ b/neutron/plugins/vmware/api_client/request.py @@ -17,14 +17,14 @@ import abc import copy -import eventlet import httplib import time +import eventlet +from oslo.utils import excutils import six import six.moves.urllib.parse as urlparse -from neutron.openstack.common import excutils from neutron.openstack.common import log as logging from neutron.plugins.vmware import api_client diff --git a/neutron/plugins/vmware/common/sync.py b/neutron/plugins/vmware/common/sync.py index 42c749556..c7621a79b 100644 --- a/neutron/plugins/vmware/common/sync.py +++ b/neutron/plugins/vmware/common/sync.py @@ -16,6 +16,7 @@ import random from oslo.serialization import jsonutils +from oslo.utils import timeutils from neutron.common import constants from neutron.common import exceptions @@ -26,7 +27,6 @@ from neutron.db import models_v2 from neutron.extensions import l3 from neutron.openstack.common import log from neutron.openstack.common import loopingcall -from neutron.openstack.common import timeutils from neutron.plugins.vmware.api_client import exception as api_exc from neutron.plugins.vmware.common import exceptions as nsx_exc from neutron.plugins.vmware.common import nsx_utils diff --git a/neutron/plugins/vmware/dbexts/db.py b/neutron/plugins/vmware/dbexts/db.py index 37dd6a77f..55f2bb058 100644 --- a/neutron/plugins/vmware/dbexts/db.py +++ b/neutron/plugins/vmware/dbexts/db.py @@ -15,10 +15,10 @@ # under the License. from oslo.db import exception as db_exc +from oslo.utils import excutils from sqlalchemy.orm import exc import neutron.db.api as db -from neutron.openstack.common import excutils from neutron.openstack.common import log as logging from neutron.plugins.vmware.dbexts import models from neutron.plugins.vmware.dbexts import networkgw_db diff --git a/neutron/plugins/vmware/dhcp_meta/lsnmanager.py b/neutron/plugins/vmware/dhcp_meta/lsnmanager.py index 4c61a93a8..9d861329d 100644 --- a/neutron/plugins/vmware/dhcp_meta/lsnmanager.py +++ b/neutron/plugins/vmware/dhcp_meta/lsnmanager.py @@ -17,9 +17,9 @@ from oslo.config import cfg from oslo.db import exception as db_exc +from oslo.utils import excutils from neutron.common import exceptions as n_exc -from neutron.openstack.common import excutils from neutron.openstack.common import log as logging from neutron.plugins.vmware.api_client import exception as api_exc from neutron.plugins.vmware.common import exceptions as p_exc diff --git a/neutron/plugins/vmware/dhcp_meta/nsx.py b/neutron/plugins/vmware/dhcp_meta/nsx.py index 5c1f3971a..b26960b47 100644 --- a/neutron/plugins/vmware/dhcp_meta/nsx.py +++ b/neutron/plugins/vmware/dhcp_meta/nsx.py @@ -16,6 +16,7 @@ # from oslo.config import cfg +from oslo.utils import excutils from neutron.api.v2 import attributes as attr from neutron.common import constants as const @@ -23,7 +24,6 @@ from neutron.common import exceptions as n_exc from neutron.db import db_base_plugin_v2 from neutron.db import l3_db from neutron.extensions import external_net -from neutron.openstack.common import excutils from neutron.openstack.common import log as logging from neutron.plugins.vmware.common import exceptions as p_exc from neutron.plugins.vmware.dhcp_meta import constants as d_const diff --git a/neutron/plugins/vmware/dhcpmeta_modes.py b/neutron/plugins/vmware/dhcpmeta_modes.py index 32b66d16d..addc71878 100644 --- a/neutron/plugins/vmware/dhcpmeta_modes.py +++ b/neutron/plugins/vmware/dhcpmeta_modes.py @@ -16,6 +16,7 @@ # from oslo.config import cfg +from oslo.utils import importutils from neutron.api.rpc.agentnotifiers import dhcp_rpc_agent_api from neutron.api.rpc.handlers import dhcp_rpc @@ -24,7 +25,6 @@ from neutron.common import constants as const from neutron.common import rpc as n_rpc from neutron.common import topics from neutron.db import agents_db -from neutron.openstack.common import importutils from neutron.openstack.common import log as logging from neutron.plugins.vmware.common import config from neutron.plugins.vmware.common import exceptions as nsx_exc diff --git a/neutron/plugins/vmware/nsxlib/queue.py b/neutron/plugins/vmware/nsxlib/queue.py index 791e8f139..ac2f4df4d 100644 --- a/neutron/plugins/vmware/nsxlib/queue.py +++ b/neutron/plugins/vmware/nsxlib/queue.py @@ -14,10 +14,10 @@ # under the License. from oslo.serialization import jsonutils +from oslo.utils import excutils from neutron.api.v2 import attributes as attr from neutron.common import exceptions as exception -from neutron.openstack.common import excutils from neutron.openstack.common import log from neutron.plugins.vmware.api_client import exception as api_exc from neutron.plugins.vmware.common import utils diff --git a/neutron/plugins/vmware/nsxlib/router.py b/neutron/plugins/vmware/nsxlib/router.py index cd8fd494e..95a29ae52 100644 --- a/neutron/plugins/vmware/nsxlib/router.py +++ b/neutron/plugins/vmware/nsxlib/router.py @@ -15,9 +15,9 @@ from oslo.config import cfg from oslo.serialization import jsonutils +from oslo.utils import excutils from neutron.common import exceptions as exception -from neutron.openstack.common import excutils from neutron.openstack.common import log from neutron.plugins.vmware.api_client import exception as api_exc from neutron.plugins.vmware.common import exceptions as nsx_exc diff --git a/neutron/plugins/vmware/nsxlib/secgroup.py b/neutron/plugins/vmware/nsxlib/secgroup.py index c380aa722..91e4f5631 100644 --- a/neutron/plugins/vmware/nsxlib/secgroup.py +++ b/neutron/plugins/vmware/nsxlib/secgroup.py @@ -14,10 +14,10 @@ # under the License. from oslo.serialization import jsonutils +from oslo.utils import excutils from neutron.common import constants from neutron.common import exceptions -from neutron.openstack.common import excutils from neutron.openstack.common import log from neutron.plugins.vmware.common import utils from neutron.plugins.vmware import nsxlib diff --git a/neutron/plugins/vmware/plugins/base.py b/neutron/plugins/vmware/plugins/base.py index 9b1f95a5e..c28a940d0 100644 --- a/neutron/plugins/vmware/plugins/base.py +++ b/neutron/plugins/vmware/plugins/base.py @@ -17,6 +17,7 @@ import uuid from oslo.config import cfg from oslo.db import exception as db_exc +from oslo.utils import excutils from sqlalchemy import exc as sql_exc from sqlalchemy.orm import exc as sa_exc import webob.exc @@ -50,7 +51,6 @@ from neutron.extensions import portbindings as pbin from neutron.extensions import portsecurity as psec from neutron.extensions import providernet as pnet from neutron.extensions import securitygroup as ext_sg -from neutron.openstack.common import excutils from neutron.openstack.common.gettextutils import _LE from neutron.openstack.common import lockutils from neutron.openstack.common import log as logging diff --git a/neutron/plugins/vmware/plugins/service.py b/neutron/plugins/vmware/plugins/service.py index d7e32e2f2..32299b333 100644 --- a/neutron/plugins/vmware/plugins/service.py +++ b/neutron/plugins/vmware/plugins/service.py @@ -16,6 +16,7 @@ import netaddr from oslo.config import cfg +from oslo.utils import excutils from neutron.common import constants from neutron.common import exceptions as n_exc @@ -28,7 +29,6 @@ from neutron.extensions import firewall as fw_ext from neutron.extensions import l3 from neutron.extensions import routedserviceinsertion as rsi from neutron.extensions import vpnaas as vpn_ext -from neutron.openstack.common import excutils from neutron.openstack.common import log as logging from neutron.plugins.common import constants as service_constants from neutron.plugins.vmware.api_client import exception as api_exc diff --git a/neutron/plugins/vmware/vshield/edge_appliance_driver.py b/neutron/plugins/vmware/vshield/edge_appliance_driver.py index a97c5d49a..c9f59ec61 100644 --- a/neutron/plugins/vmware/vshield/edge_appliance_driver.py +++ b/neutron/plugins/vmware/vshield/edge_appliance_driver.py @@ -13,8 +13,8 @@ # under the License. from oslo.serialization import jsonutils +from oslo.utils import excutils -from neutron.openstack.common import excutils from neutron.openstack.common import log as logging from neutron.plugins.vmware.common import utils from neutron.plugins.vmware.vshield.common import constants as vcns_const diff --git a/neutron/plugins/vmware/vshield/edge_firewall_driver.py b/neutron/plugins/vmware/vshield/edge_firewall_driver.py index 09b618cba..ad9985168 100644 --- a/neutron/plugins/vmware/vshield/edge_firewall_driver.py +++ b/neutron/plugins/vmware/vshield/edge_firewall_driver.py @@ -12,8 +12,9 @@ # License for the specific language governing permissions and limitations # under the License. +from oslo.utils import excutils + from neutron.db import db_base_plugin_v2 -from neutron.openstack.common import excutils from neutron.openstack.common import log as logging from neutron.plugins.common import constants from neutron.plugins.vmware.dbexts import vcns_db diff --git a/neutron/plugins/vmware/vshield/edge_ipsecvpn_driver.py b/neutron/plugins/vmware/vshield/edge_ipsecvpn_driver.py index 7e74fe1f8..6ae188910 100644 --- a/neutron/plugins/vmware/vshield/edge_ipsecvpn_driver.py +++ b/neutron/plugins/vmware/vshield/edge_ipsecvpn_driver.py @@ -12,7 +12,8 @@ # License for the specific language governing permissions and limitations # under the License. -from neutron.openstack.common import excutils +from oslo.utils import excutils + from neutron.openstack.common import log as logging from neutron.plugins.vmware.vshield.common import ( exceptions as vcns_exc) diff --git a/neutron/plugins/vmware/vshield/edge_loadbalancer_driver.py b/neutron/plugins/vmware/vshield/edge_loadbalancer_driver.py index faad6e889..1b3ce55bd 100644 --- a/neutron/plugins/vmware/vshield/edge_loadbalancer_driver.py +++ b/neutron/plugins/vmware/vshield/edge_loadbalancer_driver.py @@ -12,7 +12,8 @@ # License for the specific language governing permissions and limitations # under the License. -from neutron.openstack.common import excutils +from oslo.utils import excutils + from neutron.openstack.common import log as logging from neutron.plugins.vmware.dbexts import vcns_db from neutron.plugins.vmware.vshield.common import ( diff --git a/neutron/policy.py b/neutron/policy.py index 3ca112a07..de64cc943 100644 --- a/neutron/policy.py +++ b/neutron/policy.py @@ -23,14 +23,14 @@ import logging import re from oslo.config import cfg +from oslo.utils import excutils +from oslo.utils import importutils from neutron.api.v2 import attributes from neutron.common import constants as const from neutron.common import exceptions import neutron.common.utils as utils -from neutron.openstack.common import excutils from neutron.openstack.common.gettextutils import _LE, _LI, _LW -from neutron.openstack.common import importutils from neutron.openstack.common import log from neutron.openstack.common import policy diff --git a/neutron/quota.py b/neutron/quota.py index 3fc07a326..fbac9c12e 100644 --- a/neutron/quota.py +++ b/neutron/quota.py @@ -17,10 +17,10 @@ import sys from oslo.config import cfg +from oslo.utils import importutils import webob from neutron.common import exceptions -from neutron.openstack.common import importutils from neutron.openstack.common import log as logging LOG = logging.getLogger(__name__) diff --git a/neutron/service.py b/neutron/service.py index 1761bacc4..c72e5e5b4 100644 --- a/neutron/service.py +++ b/neutron/service.py @@ -20,14 +20,14 @@ import random from oslo.config import cfg from oslo.messaging import server as rpc_server +from oslo.utils import excutils +from oslo.utils import importutils from neutron.common import config from neutron.common import rpc as n_rpc from neutron import context from neutron.db import api as session from neutron import manager -from neutron.openstack.common import excutils -from neutron.openstack.common import importutils from neutron.openstack.common import log as logging from neutron.openstack.common import loopingcall from neutron.openstack.common import service as common_service diff --git a/neutron/services/firewall/agents/l3reference/firewall_l3_agent.py b/neutron/services/firewall/agents/l3reference/firewall_l3_agent.py index 67b9324ad..e5f43568a 100644 --- a/neutron/services/firewall/agents/l3reference/firewall_l3_agent.py +++ b/neutron/services/firewall/agents/l3reference/firewall_l3_agent.py @@ -14,6 +14,7 @@ # under the License. from oslo.config import cfg +from oslo.utils import importutils from neutron.agent.common import config from neutron.agent.linux import ip_lib @@ -21,7 +22,6 @@ from neutron.common import topics from neutron import context from neutron.extensions import firewall as fw_ext from neutron.openstack.common.gettextutils import _LE -from neutron.openstack.common import importutils from neutron.openstack.common import log as logging from neutron.plugins.common import constants from neutron.services.firewall.agents import firewall_agent_api as api diff --git a/neutron/services/l3_router/brocade/l3_router_plugin.py b/neutron/services/l3_router/brocade/l3_router_plugin.py index 079e6fc68..141aed1e6 100644 --- a/neutron/services/l3_router/brocade/l3_router_plugin.py +++ b/neutron/services/l3_router/brocade/l3_router_plugin.py @@ -18,9 +18,9 @@ """Implentation of Brocade SVI service Plugin.""" from oslo.config import cfg +from oslo.utils import excutils from neutron.common import constants as l3_constants -from neutron.openstack.common import excutils from neutron.openstack.common.gettextutils import _LE, _LI from neutron.openstack.common import log as logging from neutron.plugins.ml2 import db diff --git a/neutron/services/l3_router/l3_apic.py b/neutron/services/l3_router/l3_apic.py index 18896b50f..c4139a651 100644 --- a/neutron/services/l3_router/l3_apic.py +++ b/neutron/services/l3_router/l3_apic.py @@ -14,11 +14,11 @@ # under the License. from apicapi import apic_mapper +from oslo.utils import excutils from neutron.db import db_base_plugin_v2 from neutron.db import extraroute_db from neutron.db import l3_dvr_db -from neutron.openstack.common import excutils from neutron.plugins.common import constants from neutron.plugins.ml2.drivers.cisco.apic import mechanism_apic diff --git a/neutron/services/l3_router/l3_arista.py b/neutron/services/l3_router/l3_arista.py index f1c12d7e3..4206066d3 100644 --- a/neutron/services/l3_router/l3_arista.py +++ b/neutron/services/l3_router/l3_arista.py @@ -16,6 +16,7 @@ import copy import threading from oslo.config import cfg +from oslo.utils import excutils from neutron.api.rpc.agentnotifiers import l3_rpc_agent_api from neutron.api.rpc.handlers import l3_rpc @@ -28,7 +29,6 @@ from neutron.db import db_base_plugin_v2 from neutron.db import extraroute_db from neutron.db import l3_agentschedulers_db from neutron.db import l3_gwmode_db -from neutron.openstack.common import excutils from neutron.openstack.common.gettextutils import _LE, _LI from neutron.openstack.common import log as logging from neutron.plugins.common import constants diff --git a/neutron/services/l3_router/l3_router_plugin.py b/neutron/services/l3_router/l3_router_plugin.py index 4ebd9224b..117a99080 100644 --- a/neutron/services/l3_router/l3_router_plugin.py +++ b/neutron/services/l3_router/l3_router_plugin.py @@ -14,6 +14,7 @@ # under the License. from oslo.config import cfg +from oslo.utils import importutils from neutron.api.rpc.agentnotifiers import l3_rpc_agent_api from neutron.api.rpc.handlers import l3_rpc @@ -26,7 +27,6 @@ from neutron.db import l3_dvrscheduler_db from neutron.db import l3_gwmode_db from neutron.db import l3_hamode_db from neutron.db import l3_hascheduler_db -from neutron.openstack.common import importutils from neutron.plugins.common import constants diff --git a/neutron/services/loadbalancer/agent/agent_manager.py b/neutron/services/loadbalancer/agent/agent_manager.py index 94b439b07..efa91b222 100644 --- a/neutron/services/loadbalancer/agent/agent_manager.py +++ b/neutron/services/loadbalancer/agent/agent_manager.py @@ -13,6 +13,7 @@ # under the License. from oslo.config import cfg +from oslo.utils import importutils from neutron.agent import rpc as agent_rpc from neutron.common import constants as n_const @@ -21,7 +22,6 @@ from neutron.common import rpc as n_rpc from neutron.common import topics from neutron import context from neutron.openstack.common.gettextutils import _LE, _LI -from neutron.openstack.common import importutils from neutron.openstack.common import log as logging from neutron.openstack.common import loopingcall from neutron.openstack.common import periodic_task diff --git a/neutron/services/loadbalancer/drivers/common/agent_driver_base.py b/neutron/services/loadbalancer/drivers/common/agent_driver_base.py index c9d3d0bd3..3a8bd4456 100644 --- a/neutron/services/loadbalancer/drivers/common/agent_driver_base.py +++ b/neutron/services/loadbalancer/drivers/common/agent_driver_base.py @@ -16,6 +16,7 @@ import uuid from oslo.config import cfg from oslo import messaging +from oslo.utils import importutils from neutron.common import constants as q_const from neutron.common import exceptions as n_exc @@ -26,7 +27,6 @@ from neutron.db.loadbalancer import loadbalancer_db from neutron.extensions import lbaas_agentscheduler from neutron.extensions import portbindings from neutron.openstack.common.gettextutils import _LW -from neutron.openstack.common import importutils from neutron.openstack.common import log as logging from neutron.plugins.common import constants from neutron.services.loadbalancer.drivers import abstract_driver diff --git a/neutron/services/loadbalancer/drivers/haproxy/namespace_driver.py b/neutron/services/loadbalancer/drivers/haproxy/namespace_driver.py index a2ff329d3..f243173b4 100644 --- a/neutron/services/loadbalancer/drivers/haproxy/namespace_driver.py +++ b/neutron/services/loadbalancer/drivers/haproxy/namespace_driver.py @@ -18,15 +18,15 @@ import socket import netaddr from oslo.config import cfg +from oslo.utils import excutils +from oslo.utils import importutils from neutron.agent.common import config from neutron.agent.linux import ip_lib from neutron.agent.linux import utils from neutron.common import exceptions from neutron.common import utils as n_utils -from neutron.openstack.common import excutils from neutron.openstack.common.gettextutils import _LE, _LW -from neutron.openstack.common import importutils from neutron.openstack.common import log as logging from neutron.plugins.common import constants from neutron.services.loadbalancer.agent import agent_device_driver diff --git a/neutron/services/loadbalancer/drivers/radware/driver.py b/neutron/services/loadbalancer/drivers/radware/driver.py index 8eeaea4cc..4355a7229 100644 --- a/neutron/services/loadbalancer/drivers/radware/driver.py +++ b/neutron/services/loadbalancer/drivers/radware/driver.py @@ -25,6 +25,7 @@ eventlet.monkey_patch(thread=True) from oslo.config import cfg from oslo.serialization import jsonutils +from oslo.utils import excutils from six.moves import queue as Queue from neutron.api.v2 import attributes @@ -32,7 +33,6 @@ from neutron.common import log as call_log from neutron import context from neutron.db.loadbalancer import loadbalancer_db as lb_db from neutron.extensions import loadbalancer -from neutron.openstack.common import excutils from neutron.openstack.common.gettextutils import _LE, _LI, _LW from neutron.openstack.common import log as logging from neutron.plugins.common import constants diff --git a/neutron/services/loadbalancer/plugin.py b/neutron/services/loadbalancer/plugin.py index 14a1cda54..d0006f4f6 100644 --- a/neutron/services/loadbalancer/plugin.py +++ b/neutron/services/loadbalancer/plugin.py @@ -13,13 +13,14 @@ # License for the specific language governing permissions and limitations # under the License. +from oslo.utils import excutils + from neutron.api.v2 import attributes as attrs from neutron.common import exceptions as n_exc from neutron import context from neutron.db.loadbalancer import loadbalancer_db as ldb from neutron.db import servicetype_db as st_db from neutron.extensions import loadbalancer -from neutron.openstack.common import excutils from neutron.openstack.common.gettextutils import _LE from neutron.openstack.common import log as logging from neutron.plugins.common import constants diff --git a/neutron/services/metering/agents/metering_agent.py b/neutron/services/metering/agents/metering_agent.py index 75eca17cc..21f5c6e70 100644 --- a/neutron/services/metering/agents/metering_agent.py +++ b/neutron/services/metering/agents/metering_agent.py @@ -20,6 +20,7 @@ eventlet.monkey_patch() from oslo.config import cfg from oslo import messaging +from oslo.utils import importutils from neutron.agent.common import config from neutron.agent import rpc as agent_rpc @@ -31,7 +32,6 @@ from neutron.common import utils from neutron import context from neutron import manager from neutron.openstack.common.gettextutils import _LE, _LI, _LW -from neutron.openstack.common import importutils from neutron.openstack.common import log as logging from neutron.openstack.common import loopingcall from neutron.openstack.common import periodic_task diff --git a/neutron/services/metering/drivers/iptables/iptables_driver.py b/neutron/services/metering/drivers/iptables/iptables_driver.py index aed58028d..8741c72cf 100644 --- a/neutron/services/metering/drivers/iptables/iptables_driver.py +++ b/neutron/services/metering/drivers/iptables/iptables_driver.py @@ -13,6 +13,7 @@ # under the License. from oslo.config import cfg +from oslo.utils import importutils import six from neutron.agent.common import config @@ -22,7 +23,6 @@ from neutron.common import constants as constants from neutron.common import ipv6_utils from neutron.common import log from neutron.openstack.common.gettextutils import _LI -from neutron.openstack.common import importutils from neutron.openstack.common import log as logging from neutron.services.metering.drivers import abstract_driver diff --git a/neutron/services/service_base.py b/neutron/services/service_base.py index 6b4f44243..f8139c610 100644 --- a/neutron/services/service_base.py +++ b/neutron/services/service_base.py @@ -15,13 +15,13 @@ import abc +from oslo.utils import excutils +from oslo.utils import importutils import six from neutron.api import extensions from neutron.db import servicetype_db as sdb -from neutron.openstack.common import excutils from neutron.openstack.common.gettextutils import _LE, _LI -from neutron.openstack.common import importutils from neutron.openstack.common import log as logging from neutron.services import provider_configuration as pconf diff --git a/neutron/services/vpn/agent.py b/neutron/services/vpn/agent.py index 6f67ccf1f..62807bb17 100644 --- a/neutron/services/vpn/agent.py +++ b/neutron/services/vpn/agent.py @@ -12,11 +12,12 @@ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. + from oslo.config import cfg +from oslo.utils import importutils from neutron.agent import l3_agent from neutron.extensions import vpnaas -from neutron.openstack.common import importutils vpn_agent_opts = [ cfg.MultiStrOpt( diff --git a/neutron/tests/functional/agent/linux/test_ip_lib.py b/neutron/tests/functional/agent/linux/test_ip_lib.py index f0b42150f..5abc4c80c 100644 --- a/neutron/tests/functional/agent/linux/test_ip_lib.py +++ b/neutron/tests/functional/agent/linux/test_ip_lib.py @@ -16,12 +16,12 @@ import collections from oslo.config import cfg +from oslo.utils import importutils from neutron.agent.common import config from neutron.agent.linux import interface from neutron.agent.linux import ip_lib from neutron.common import utils -from neutron.openstack.common import importutils from neutron.openstack.common import log as logging from neutron.tests.functional.agent.linux import base diff --git a/neutron/tests/unit/api/rpc/agentnotifiers/test_dhcp_rpc_agent_api.py b/neutron/tests/unit/api/rpc/agentnotifiers/test_dhcp_rpc_agent_api.py index 6df1bbf9c..df6198c8f 100644 --- a/neutron/tests/unit/api/rpc/agentnotifiers/test_dhcp_rpc_agent_api.py +++ b/neutron/tests/unit/api/rpc/agentnotifiers/test_dhcp_rpc_agent_api.py @@ -16,10 +16,11 @@ import datetime import mock +from oslo.utils import timeutils + from neutron.api.rpc.agentnotifiers import dhcp_rpc_agent_api from neutron.common import utils from neutron.db import agents_db -from neutron.openstack.common import timeutils from neutron.tests import base diff --git a/neutron/tests/unit/bigswitch/test_restproxy_agent.py b/neutron/tests/unit/bigswitch/test_restproxy_agent.py index f7d9009ed..7dd710eab 100644 --- a/neutron/tests/unit/bigswitch/test_restproxy_agent.py +++ b/neutron/tests/unit/bigswitch/test_restproxy_agent.py @@ -16,8 +16,8 @@ import contextlib import mock +from oslo.utils import importutils -from neutron.openstack.common import importutils from neutron.tests import base OVSBRIDGE = 'neutron.agent.linux.ovs_lib.OVSBridge' diff --git a/neutron/tests/unit/bigswitch/test_servermanager.py b/neutron/tests/unit/bigswitch/test_servermanager.py index 3b2aa8cd0..ffb7ee991 100644 --- a/neutron/tests/unit/bigswitch/test_servermanager.py +++ b/neutron/tests/unit/bigswitch/test_servermanager.py @@ -20,10 +20,10 @@ import mock from oslo.config import cfg from oslo.db import exception as db_exc from oslo.serialization import jsonutils +from oslo.utils import importutils from neutron import context from neutron import manager -from neutron.openstack.common import importutils from neutron.plugins.bigswitch.db import consistency_db from neutron.plugins.bigswitch import servermanager from neutron.tests.unit.bigswitch import test_restproxy_plugin as test_rp diff --git a/neutron/tests/unit/brocade/test_brocade_plugin.py b/neutron/tests/unit/brocade/test_brocade_plugin.py index 0e3a6ef69..b93e99685 100644 --- a/neutron/tests/unit/brocade/test_brocade_plugin.py +++ b/neutron/tests/unit/brocade/test_brocade_plugin.py @@ -15,9 +15,9 @@ import mock +from oslo.utils import importutils from neutron.extensions import portbindings -from neutron.openstack.common import importutils from neutron.plugins.brocade import NeutronPlugin as brocade_plugin from neutron.tests.unit import _test_extension_portbindings as test_bindings from neutron.tests.unit import test_db_plugin as test_plugin diff --git a/neutron/tests/unit/cisco/l3/device_handling_test_support.py b/neutron/tests/unit/cisco/l3/device_handling_test_support.py index 1bcbc6a29..91f5c8394 100644 --- a/neutron/tests/unit/cisco/l3/device_handling_test_support.py +++ b/neutron/tests/unit/cisco/l3/device_handling_test_support.py @@ -15,10 +15,10 @@ import mock from novaclient import exceptions as nova_exc from oslo.config import cfg +from oslo.utils import excutils from neutron import context as n_context from neutron import manager -from neutron.openstack.common import excutils from neutron.openstack.common.gettextutils import _LE from neutron.openstack.common import log as logging from neutron.openstack.common import uuidutils diff --git a/neutron/tests/unit/cisco/l3/test_l3_router_appliance_plugin.py b/neutron/tests/unit/cisco/l3/test_l3_router_appliance_plugin.py index b926b76be..00e2336bd 100644 --- a/neutron/tests/unit/cisco/l3/test_l3_router_appliance_plugin.py +++ b/neutron/tests/unit/cisco/l3/test_l3_router_appliance_plugin.py @@ -14,6 +14,7 @@ import mock from oslo.config import cfg +from oslo.utils import timeutils from webob import exc import neutron @@ -23,7 +24,6 @@ from neutron.db import agents_db from neutron.db import common_db_mixin from neutron.extensions import providernet as pnet from neutron import manager -from neutron.openstack.common import timeutils from neutron.plugins.cisco.common import cisco_constants as c_constants from neutron.plugins.cisco.db.l3 import device_handling_db from neutron.plugins.cisco.db.l3 import l3_router_appliance_db diff --git a/neutron/tests/unit/db/firewall/test_db_firewall.py b/neutron/tests/unit/db/firewall/test_db_firewall.py index 64f236507..fbb37ad12 100644 --- a/neutron/tests/unit/db/firewall/test_db_firewall.py +++ b/neutron/tests/unit/db/firewall/test_db_firewall.py @@ -18,6 +18,7 @@ from oslo.config import cfg import contextlib import mock +from oslo.utils import importutils import webob.exc from neutron.api import extensions as api_ext @@ -27,7 +28,6 @@ from neutron.db.firewall import firewall_db as fdb import neutron.extensions from neutron.extensions import firewall from neutron import manager -from neutron.openstack.common import importutils from neutron.openstack.common import uuidutils from neutron.plugins.common import constants from neutron.services.firewall import fwaas_plugin diff --git a/neutron/tests/unit/db/test_agent_db.py b/neutron/tests/unit/db/test_agent_db.py index b2db78b20..b0a1daef3 100644 --- a/neutron/tests/unit/db/test_agent_db.py +++ b/neutron/tests/unit/db/test_agent_db.py @@ -15,12 +15,12 @@ import mock from oslo.db import exception as exc +from oslo.utils import timeutils from neutron.common import constants from neutron import context from neutron.db import agents_db from neutron.db import db_base_plugin_v2 as base_plugin -from neutron.openstack.common import timeutils from neutron.tests.unit import testlib_api diff --git a/neutron/tests/unit/ml2/drivers/brocade/test_brocade_l3_plugin.py b/neutron/tests/unit/ml2/drivers/brocade/test_brocade_l3_plugin.py index ec8bc5f51..2dd1abfef 100644 --- a/neutron/tests/unit/ml2/drivers/brocade/test_brocade_l3_plugin.py +++ b/neutron/tests/unit/ml2/drivers/brocade/test_brocade_l3_plugin.py @@ -17,10 +17,10 @@ import mock from oslo.config import cfg +from oslo.utils import importutils from neutron.db import api as db from neutron.openstack.common import context -from neutron.openstack.common import importutils from neutron.openstack.common import log as logging from neutron.tests.unit import test_l3_plugin diff --git a/neutron/tests/unit/ml2/drivers/brocade/test_brocade_mechanism_driver.py b/neutron/tests/unit/ml2/drivers/brocade/test_brocade_mechanism_driver.py index 5eea451d1..b8cbb5ff5 100644 --- a/neutron/tests/unit/ml2/drivers/brocade/test_brocade_mechanism_driver.py +++ b/neutron/tests/unit/ml2/drivers/brocade/test_brocade_mechanism_driver.py @@ -14,8 +14,8 @@ # limitations under the License. import mock +from oslo.utils import importutils -from neutron.openstack.common import importutils from neutron.openstack.common import log as logging from neutron.plugins.ml2 import config as ml2_config from neutron.plugins.ml2.drivers.brocade import (mechanism_brocade diff --git a/neutron/tests/unit/ml2/drivers/cisco/nexus/test_cisco_nexus.py b/neutron/tests/unit/ml2/drivers/cisco/nexus/test_cisco_nexus.py index 84f997947..58100149f 100644 --- a/neutron/tests/unit/ml2/drivers/cisco/nexus/test_cisco_nexus.py +++ b/neutron/tests/unit/ml2/drivers/cisco/nexus/test_cisco_nexus.py @@ -15,11 +15,11 @@ import collections import mock +from oslo.utils import importutils import testtools from neutron.common import constants as n_const from neutron.extensions import portbindings -from neutron.openstack.common import importutils from neutron.plugins.ml2 import driver_api as api from neutron.plugins.ml2.drivers.cisco.nexus import constants from neutron.plugins.ml2.drivers.cisco.nexus import exceptions diff --git a/neutron/tests/unit/ml2/drivers/test_l2population.py b/neutron/tests/unit/ml2/drivers/test_l2population.py index 70aa4945a..92f133e6a 100644 --- a/neutron/tests/unit/ml2/drivers/test_l2population.py +++ b/neutron/tests/unit/ml2/drivers/test_l2population.py @@ -14,7 +14,9 @@ # under the License. import contextlib + import mock +from oslo.utils import timeutils from neutron.agent import l2population_rpc from neutron.common import constants @@ -24,7 +26,6 @@ from neutron.db import agents_db from neutron.extensions import portbindings from neutron.extensions import providernet as pnet from neutron import manager -from neutron.openstack.common import timeutils from neutron.plugins.ml2.drivers.l2pop import mech_driver as l2pop_mech_driver from neutron.plugins.ml2.drivers.l2pop import rpc as l2pop_rpc from neutron.plugins.ml2 import managers diff --git a/neutron/tests/unit/ofagent/ofa_test_base.py b/neutron/tests/unit/ofagent/ofa_test_base.py index 3578f2160..60c03ce76 100644 --- a/neutron/tests/unit/ofagent/ofa_test_base.py +++ b/neutron/tests/unit/ofagent/ofa_test_base.py @@ -17,8 +17,8 @@ import mock from oslo.config import cfg +from oslo.utils import importutils -from neutron.openstack.common import importutils from neutron.tests import base from neutron.tests.unit.ofagent import fake_oflib diff --git a/neutron/tests/unit/ofagent/test_arp_lib.py b/neutron/tests/unit/ofagent/test_arp_lib.py index f0c1d6958..883abaff8 100644 --- a/neutron/tests/unit/ofagent/test_arp_lib.py +++ b/neutron/tests/unit/ofagent/test_arp_lib.py @@ -19,8 +19,8 @@ import contextlib import copy import mock +from oslo.utils import importutils -from neutron.openstack.common import importutils import neutron.plugins.ofagent.agent.metadata as meta from neutron.tests.unit.ofagent import ofa_test_base diff --git a/neutron/tests/unit/ofagent/test_ofa_flows.py b/neutron/tests/unit/ofagent/test_ofa_flows.py index a73328803..5c8b4c692 100644 --- a/neutron/tests/unit/ofagent/test_ofa_flows.py +++ b/neutron/tests/unit/ofagent/test_ofa_flows.py @@ -16,8 +16,8 @@ import mock +from oslo.utils import importutils -from neutron.openstack.common import importutils import neutron.plugins.ofagent.agent.metadata as meta from neutron.tests.unit.ofagent import ofa_test_base diff --git a/neutron/tests/unit/ofagent/test_ofa_neutron_agent.py b/neutron/tests/unit/ofagent/test_ofa_neutron_agent.py index 55c105168..f3f431bce 100644 --- a/neutron/tests/unit/ofagent/test_ofa_neutron_agent.py +++ b/neutron/tests/unit/ofagent/test_ofa_neutron_agent.py @@ -26,10 +26,10 @@ import copy import mock import netaddr from oslo.config import cfg +from oslo.utils import importutils import testtools from neutron.common import constants as n_const -from neutron.openstack.common import importutils from neutron.plugins.common import constants as p_const from neutron.plugins.ml2.drivers.l2pop import rpc as l2pop_rpc from neutron.tests.unit.ofagent import ofa_test_base diff --git a/neutron/tests/unit/ofagent/test_ofswitch.py b/neutron/tests/unit/ofagent/test_ofswitch.py index bf35e2ed6..ecf4a6618 100644 --- a/neutron/tests/unit/ofagent/test_ofswitch.py +++ b/neutron/tests/unit/ofagent/test_ofswitch.py @@ -16,8 +16,8 @@ import mock +from oslo.utils import importutils -from neutron.openstack.common import importutils from neutron.tests.unit.ofagent import ofa_test_base diff --git a/neutron/tests/unit/openvswitch/test_agent_scheduler.py b/neutron/tests/unit/openvswitch/test_agent_scheduler.py index ccd046864..29dcab553 100644 --- a/neutron/tests/unit/openvswitch/test_agent_scheduler.py +++ b/neutron/tests/unit/openvswitch/test_agent_scheduler.py @@ -21,6 +21,7 @@ import mock from oslo.config import cfg from oslo.db import exception as db_exc from oslo import messaging +from oslo.utils import timeutils from webob import exc from neutron.api import extensions @@ -36,7 +37,6 @@ from neutron.extensions import agent from neutron.extensions import dhcpagentscheduler from neutron.extensions import l3agentscheduler from neutron import manager -from neutron.openstack.common import timeutils from neutron.openstack.common import uuidutils from neutron.plugins.common import constants as service_constants from neutron.tests import fake_notifier diff --git a/neutron/tests/unit/plumgrid/extensions/test_securitygroups.py b/neutron/tests/unit/plumgrid/extensions/test_securitygroups.py index 482c1b06b..a98bd773d 100644 --- a/neutron/tests/unit/plumgrid/extensions/test_securitygroups.py +++ b/neutron/tests/unit/plumgrid/extensions/test_securitygroups.py @@ -18,8 +18,8 @@ PLUMgrid plugin security group extension unit tests """ import mock +from oslo.utils import importutils -from neutron.openstack.common import importutils from neutron.plugins.plumgrid.plumgrid_plugin import plumgrid_plugin from neutron.tests.unit import test_extension_security_group as ext_sg diff --git a/neutron/tests/unit/plumgrid/test_plumgrid_plugin.py b/neutron/tests/unit/plumgrid/test_plumgrid_plugin.py index b40883976..4e04b95b8 100644 --- a/neutron/tests/unit/plumgrid/test_plumgrid_plugin.py +++ b/neutron/tests/unit/plumgrid/test_plumgrid_plugin.py @@ -17,11 +17,11 @@ Test cases for Neutron PLUMgrid Plug-in """ import mock +from oslo.utils import importutils from neutron.extensions import portbindings from neutron.extensions import providernet as provider from neutron import manager -from neutron.openstack.common import importutils from neutron.plugins.plumgrid.plumgrid_plugin import plumgrid_plugin from neutron.tests.unit import _test_extension_portbindings as test_bindings from neutron.tests.unit import test_db_plugin as test_plugin diff --git a/neutron/tests/unit/services/firewall/agents/l3reference/test_firewall_l3_agent.py b/neutron/tests/unit/services/firewall/agents/l3reference/test_firewall_l3_agent.py index c675bce7c..22b4169ed 100644 --- a/neutron/tests/unit/services/firewall/agents/l3reference/test_firewall_l3_agent.py +++ b/neutron/tests/unit/services/firewall/agents/l3reference/test_firewall_l3_agent.py @@ -66,7 +66,7 @@ class TestFwaasL3AgentRpcCallback(base.BaseTestCase): def test_fw_config_match(self): test_agent_class = _setup_test_agent_class([constants.FIREWALL]) cfg.CONF.set_override('enabled', True, 'fwaas') - with mock.patch('neutron.openstack.common.importutils.import_object'): + with mock.patch('oslo.utils.importutils.import_object'): test_agent_class(cfg.CONF) def test_fw_config_mismatch_plugin_enabled_agent_disabled(self): @@ -77,7 +77,7 @@ class TestFwaasL3AgentRpcCallback(base.BaseTestCase): def test_fw_plugin_list_unavailable(self): test_agent_class = _setup_test_agent_class(None) cfg.CONF.set_override('enabled', False, 'fwaas') - with mock.patch('neutron.openstack.common.importutils.import_object'): + with mock.patch('oslo.utils.importutils.import_object'): test_agent_class(cfg.CONF) def test_create_firewall(self): diff --git a/neutron/tests/unit/services/l3_router/test_l3_apic_plugin.py b/neutron/tests/unit/services/l3_router/test_l3_apic_plugin.py index b2ead4e69..89e1f6cf1 100644 --- a/neutron/tests/unit/services/l3_router/test_l3_apic_plugin.py +++ b/neutron/tests/unit/services/l3_router/test_l3_apic_plugin.py @@ -105,8 +105,7 @@ class TestCiscoApicL3Plugin(testlib_api.SqlTestCase, 'add_router_interface').start() mock.patch('neutron.db.l3_dvr_db.L3_NAT_with_dvr_db_mixin.' 'remove_router_interface').start() - mock.patch('neutron.openstack.common.excutils.' - 'save_and_reraise_exception').start() + mock.patch('oslo.utils.excutils.save_and_reraise_exception').start() def _test_add_router_interface(self, interface_info): mgr = self.plugin.manager diff --git a/neutron/tests/unit/services/metering/test_metering_plugin.py b/neutron/tests/unit/services/metering/test_metering_plugin.py index c2eaad5af..d41ec1751 100644 --- a/neutron/tests/unit/services/metering/test_metering_plugin.py +++ b/neutron/tests/unit/services/metering/test_metering_plugin.py @@ -13,6 +13,7 @@ # under the License. import mock +from oslo.utils import timeutils from neutron.api.v2 import attributes as attr from neutron.common import constants as n_constants @@ -24,7 +25,6 @@ from neutron.db.metering import metering_rpc from neutron.extensions import l3 as ext_l3 from neutron.extensions import metering as ext_metering from neutron import manager -from neutron.openstack.common import timeutils from neutron.openstack.common import uuidutils from neutron.plugins.common import constants from neutron.tests.unit.db.metering import test_db_metering diff --git a/neutron/tests/unit/test_agent_ext_plugin.py b/neutron/tests/unit/test_agent_ext_plugin.py index 039af6181..e5f5557e0 100644 --- a/neutron/tests/unit/test_agent_ext_plugin.py +++ b/neutron/tests/unit/test_agent_ext_plugin.py @@ -17,6 +17,7 @@ import copy import time from oslo.config import cfg +from oslo.utils import timeutils from webob import exc from neutron.api.v2 import attributes @@ -27,7 +28,6 @@ from neutron.db import agents_db from neutron.db import db_base_plugin_v2 from neutron.extensions import agent from neutron.openstack.common import log as logging -from neutron.openstack.common import timeutils from neutron.openstack.common import uuidutils from neutron.tests.unit import test_api_v2 from neutron.tests.unit import test_db_plugin diff --git a/neutron/tests/unit/test_agent_netns_cleanup.py b/neutron/tests/unit/test_agent_netns_cleanup.py index ff2d62e01..ef10b8ab5 100644 --- a/neutron/tests/unit/test_agent_netns_cleanup.py +++ b/neutron/tests/unit/test_agent_netns_cleanup.py @@ -36,7 +36,7 @@ class TestNetnsCleanup(base.BaseTestCase): conf.AGENT.root_helper = 'sudo', conf.dhcp_driver = 'driver' - method_to_patch = 'neutron.openstack.common.importutils.import_object' + method_to_patch = 'oslo.utils.importutils.import_object' with mock.patch(method_to_patch) as import_object: driver = mock.Mock() diff --git a/neutron/tests/unit/test_db_plugin.py b/neutron/tests/unit/test_db_plugin.py index b5051b38e..f1f54c3a1 100644 --- a/neutron/tests/unit/test_db_plugin.py +++ b/neutron/tests/unit/test_db_plugin.py @@ -19,6 +19,7 @@ import itertools import mock from oslo.config import cfg +from oslo.utils import importutils from testtools import matchers import webob.exc @@ -36,7 +37,6 @@ from neutron import context from neutron.db import db_base_plugin_v2 from neutron.db import models_v2 from neutron import manager -from neutron.openstack.common import importutils from neutron.tests import base from neutron.tests.unit import test_extensions from neutron.tests.unit import testlib_api diff --git a/neutron/tests/unit/test_dhcp_scheduler.py b/neutron/tests/unit/test_dhcp_scheduler.py index 293255eb9..cf4f130bf 100644 --- a/neutron/tests/unit/test_dhcp_scheduler.py +++ b/neutron/tests/unit/test_dhcp_scheduler.py @@ -15,13 +15,14 @@ import mock +from oslo.utils import timeutils + from neutron.common import constants from neutron.common import topics from neutron import context from neutron.db import agents_db from neutron.db import agentschedulers_db from neutron.db import models_v2 -from neutron.openstack.common import timeutils from neutron.scheduler import dhcp_agent_scheduler from neutron.tests.unit import testlib_api diff --git a/neutron/tests/unit/test_l3_plugin.py b/neutron/tests/unit/test_l3_plugin.py index 98daad208..daf5052c4 100644 --- a/neutron/tests/unit/test_l3_plugin.py +++ b/neutron/tests/unit/test_l3_plugin.py @@ -20,6 +20,7 @@ import copy import mock import netaddr from oslo.config import cfg +from oslo.utils import importutils from webob import exc from neutron.api.rpc.agentnotifiers import l3_rpc_agent_api @@ -39,7 +40,6 @@ from neutron.extensions import external_net from neutron.extensions import l3 from neutron.extensions import portbindings from neutron import manager -from neutron.openstack.common import importutils from neutron.openstack.common import log as logging from neutron.openstack.common import uuidutils from neutron.plugins.common import constants as service_constants diff --git a/neutron/tests/unit/test_l3_schedulers.py b/neutron/tests/unit/test_l3_schedulers.py index e9af85d49..c6c1a10da 100644 --- a/neutron/tests/unit/test_l3_schedulers.py +++ b/neutron/tests/unit/test_l3_schedulers.py @@ -19,6 +19,8 @@ import uuid import mock from oslo.config import cfg +from oslo.utils import importutils +from oslo.utils import timeutils from sqlalchemy.orm import query from neutron.common import constants @@ -33,8 +35,6 @@ from neutron.db import l3_dvrscheduler_db from neutron.db import l3_hamode_db from neutron.db import l3_hascheduler_db from neutron import manager -from neutron.openstack.common import importutils -from neutron.openstack.common import timeutils from neutron.scheduler import l3_agent_scheduler from neutron.tests import base from neutron.tests.unit import test_db_plugin diff --git a/neutron/tests/unit/test_metadata_agent.py b/neutron/tests/unit/test_metadata_agent.py index 8734d370f..ea87913da 100644 --- a/neutron/tests/unit/test_metadata_agent.py +++ b/neutron/tests/unit/test_metadata_agent.py @@ -168,7 +168,7 @@ class TestMetadataProxyHandlerCache(TestMetadataProxyHandlerBase): 'not_used': [1, 2, 3]} expected_networks = ('network_id1',) with mock.patch( - 'neutron.openstack.common.timeutils.utcnow_ts', return_value=0): + 'oslo.utils.timeutils.utcnow_ts', return_value=0): mock_list_ports = self.qclient.return_value.list_ports mock_list_ports.return_value = ports networks = self.handler._get_router_networks(router_id) diff --git a/neutron/tests/unit/test_policy.py b/neutron/tests/unit/test_policy.py index 16cbc29fd..73cde0949 100644 --- a/neutron/tests/unit/test_policy.py +++ b/neutron/tests/unit/test_policy.py @@ -23,6 +23,7 @@ import fixtures import mock from oslo.config import cfg from oslo.serialization import jsonutils +from oslo.utils import importutils import six import six.moves.urllib.request as urlrequest @@ -32,7 +33,6 @@ from neutron.common import constants as const from neutron.common import exceptions from neutron import context from neutron import manager -from neutron.openstack.common import importutils from neutron.openstack.common import policy as common_policy from neutron import policy from neutron.tests import base diff --git a/neutron/wsgi.py b/neutron/wsgi.py index 101c0dc0d..ef189a89a 100644 --- a/neutron/wsgi.py +++ b/neutron/wsgi.py @@ -29,6 +29,7 @@ import eventlet.wsgi eventlet.patcher.monkey_patch(all=False, socket=True, thread=True) from oslo.config import cfg from oslo.serialization import jsonutils +from oslo.utils import excutils import routes.middleware import webob.dec import webob.exc @@ -36,7 +37,6 @@ import webob.exc from neutron.common import exceptions as exception from neutron import context from neutron.db import api -from neutron.openstack.common import excutils from neutron.openstack.common import gettextutils from neutron.openstack.common import log as logging from neutron.openstack.common import service as common_service diff --git a/openstack-common.conf b/openstack-common.conf index 2eb0022ff..250aac48a 100644 --- a/openstack-common.conf +++ b/openstack-common.conf @@ -3,11 +3,9 @@ module=cache module=context module=eventlet_backdoor -module=excutils module=fileutils module=fixture module=gettextutils -module=importutils module=install_venv_common module=local module=lockutils @@ -19,15 +17,12 @@ module=middleware.correlation_id module=middleware.debug module=middleware.request_id module=middleware.sizelimit -module=network_utils module=periodic_task module=policy module=processutils module=service -module=strutils module=systemd module=threadgroup -module=timeutils module=uuidutils # The base module to hold the copy of openstack.common