diff --git a/neutron/agent/linux/dhcp.py b/neutron/agent/linux/dhcp.py index ce71fea227..aee411c643 100644 --- a/neutron/agent/linux/dhcp.py +++ b/neutron/agent/linux/dhcp.py @@ -23,6 +23,7 @@ import sys import netaddr from oslo.config import cfg +from oslo.serialization import jsonutils import six from neutron.agent.linux import ip_lib @@ -31,7 +32,6 @@ from neutron.common import constants from neutron.common import exceptions from neutron.common import utils as commonutils from neutron.openstack.common import importutils -from neutron.openstack.common import jsonutils from neutron.openstack.common import log as logging from neutron.openstack.common import uuidutils diff --git a/neutron/agent/linux/ovs_lib.py b/neutron/agent/linux/ovs_lib.py index 64cf4eebbb..1148532f26 100644 --- a/neutron/agent/linux/ovs_lib.py +++ b/neutron/agent/linux/ovs_lib.py @@ -17,13 +17,13 @@ import itertools import operator from oslo.config import cfg +from oslo.serialization import jsonutils 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 _LI, _LW -from neutron.openstack.common import jsonutils from neutron.openstack.common import log as logging from neutron.plugins.common import constants diff --git a/neutron/api/rpc/handlers/l3_rpc.py b/neutron/api/rpc/handlers/l3_rpc.py index f5c7389d50..d4b2b95c2a 100644 --- a/neutron/api/rpc/handlers/l3_rpc.py +++ b/neutron/api/rpc/handlers/l3_rpc.py @@ -14,6 +14,7 @@ # limitations under the License. from oslo.config import cfg +from oslo.serialization import jsonutils from neutron.common import constants from neutron.common import exceptions @@ -23,7 +24,6 @@ from neutron import context as neutron_context from neutron.extensions import l3 from neutron.extensions import portbindings from neutron import manager -from neutron.openstack.common import jsonutils from neutron.openstack.common import log as logging from neutron.plugins.common import constants as plugin_constants diff --git a/neutron/db/agents_db.py b/neutron/db/agents_db.py index 0a013d5a08..6931ca9048 100644 --- a/neutron/db/agents_db.py +++ b/neutron/db/agents_db.py @@ -17,6 +17,7 @@ from eventlet import greenthread from oslo.config import cfg from oslo.db import exception as db_exc +from oslo.serialization import jsonutils import sqlalchemy as sa from sqlalchemy.orm import exc from sqlalchemy import sql @@ -27,7 +28,6 @@ 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 import jsonutils from neutron.openstack.common import log as logging from neutron.openstack.common import timeutils diff --git a/neutron/openstack/common/jsonutils.py b/neutron/openstack/common/jsonutils.py deleted file mode 100644 index 502d6bcd0a..0000000000 --- a/neutron/openstack/common/jsonutils.py +++ /dev/null @@ -1,186 +0,0 @@ -# Copyright 2010 United States Government as represented by the -# Administrator of the National Aeronautics and Space Administration. -# Copyright 2011 Justin Santa Barbara -# 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. - -''' -JSON related utilities. - -This module provides a few things: - - 1) A handy function for getting an object down to something that can be - JSON serialized. See to_primitive(). - - 2) Wrappers around loads() and dumps(). The dumps() wrapper will - automatically use to_primitive() for you if needed. - - 3) This sets up anyjson to use the loads() and dumps() wrappers if anyjson - is available. -''' - - -import codecs -import datetime -import functools -import inspect -import itertools -import sys - -if sys.version_info < (2, 7): - # On Python <= 2.6, json module is not C boosted, so try to use - # simplejson module if available - try: - import simplejson as json - except ImportError: - import json -else: - import json - -import six -import six.moves.xmlrpc_client as xmlrpclib - -from neutron.openstack.common import gettextutils -from neutron.openstack.common import importutils -from neutron.openstack.common import strutils -from neutron.openstack.common import timeutils - -netaddr = importutils.try_import("netaddr") - -_nasty_type_tests = [inspect.ismodule, inspect.isclass, inspect.ismethod, - inspect.isfunction, inspect.isgeneratorfunction, - inspect.isgenerator, inspect.istraceback, inspect.isframe, - inspect.iscode, inspect.isbuiltin, inspect.isroutine, - inspect.isabstract] - -_simple_types = (six.string_types + six.integer_types - + (type(None), bool, float)) - - -def to_primitive(value, convert_instances=False, convert_datetime=True, - level=0, max_depth=3): - """Convert a complex object into primitives. - - Handy for JSON serialization. We can optionally handle instances, - but since this is a recursive function, we could have cyclical - data structures. - - To handle cyclical data structures we could track the actual objects - visited in a set, but not all objects are hashable. Instead we just - track the depth of the object inspections and don't go too deep. - - Therefore, convert_instances=True is lossy ... be aware. - - """ - # handle obvious types first - order of basic types determined by running - # full tests on nova project, resulting in the following counts: - # 572754 - # 460353 - # 379632 - # 274610 - # 199918 - # 114200 - # 51817 - # 26164 - # 6491 - # 283 - # 19 - if isinstance(value, _simple_types): - return value - - if isinstance(value, datetime.datetime): - if convert_datetime: - return timeutils.strtime(value) - else: - return value - - # value of itertools.count doesn't get caught by nasty_type_tests - # and results in infinite loop when list(value) is called. - if type(value) == itertools.count: - return six.text_type(value) - - # FIXME(vish): Workaround for LP bug 852095. Without this workaround, - # tests that raise an exception in a mocked method that - # has a @wrap_exception with a notifier will fail. If - # we up the dependency to 0.5.4 (when it is released) we - # can remove this workaround. - if getattr(value, '__module__', None) == 'mox': - return 'mock' - - if level > max_depth: - return '?' - - # The try block may not be necessary after the class check above, - # but just in case ... - try: - recursive = functools.partial(to_primitive, - convert_instances=convert_instances, - convert_datetime=convert_datetime, - level=level, - max_depth=max_depth) - if isinstance(value, dict): - return dict((k, recursive(v)) for k, v in six.iteritems(value)) - elif isinstance(value, (list, tuple)): - return [recursive(lv) for lv in value] - - # It's not clear why xmlrpclib created their own DateTime type, but - # for our purposes, make it a datetime type which is explicitly - # handled - if isinstance(value, xmlrpclib.DateTime): - value = datetime.datetime(*tuple(value.timetuple())[:6]) - - if convert_datetime and isinstance(value, datetime.datetime): - return timeutils.strtime(value) - elif isinstance(value, gettextutils.Message): - return value.data - elif hasattr(value, 'iteritems'): - return recursive(dict(value.iteritems()), level=level + 1) - elif hasattr(value, '__iter__'): - return recursive(list(value)) - elif convert_instances and hasattr(value, '__dict__'): - # Likely an instance of something. Watch for cycles. - # Ignore class member vars. - return recursive(value.__dict__, level=level + 1) - elif netaddr and isinstance(value, netaddr.IPAddress): - return six.text_type(value) - else: - if any(test(value) for test in _nasty_type_tests): - return six.text_type(value) - return value - except TypeError: - # Class objects are tricky since they may define something like - # __iter__ defined but it isn't callable as list(). - return six.text_type(value) - - -def dumps(value, default=to_primitive, **kwargs): - return json.dumps(value, default=default, **kwargs) - - -def loads(s, encoding='utf-8', **kwargs): - return json.loads(strutils.safe_decode(s, encoding), **kwargs) - - -def load(fp, encoding='utf-8', **kwargs): - return json.load(codecs.getreader(encoding)(fp), **kwargs) - - -try: - import anyjson -except ImportError: - pass -else: - anyjson._modules.append((__name__, 'dumps', TypeError, - 'loads', ValueError, 'load')) - anyjson.force_implementation(__name__) diff --git a/neutron/plugins/bigswitch/servermanager.py b/neutron/plugins/bigswitch/servermanager.py index c10ce72bb5..96c5b09379 100644 --- a/neutron/plugins/bigswitch/servermanager.py +++ b/neutron/plugins/bigswitch/servermanager.py @@ -37,11 +37,11 @@ import weakref import eventlet import eventlet.corolocal from oslo.config import cfg +from oslo.serialization import jsonutils from neutron.common import exceptions from neutron.common import utils from neutron.openstack.common import excutils -from neutron.openstack.common import jsonutils from neutron.openstack.common import log as logging from neutron.plugins.bigswitch.db import consistency_db as cdb diff --git a/neutron/plugins/bigswitch/tests/test_server.py b/neutron/plugins/bigswitch/tests/test_server.py index 392ab92e9f..31fb18c8e8 100755 --- a/neutron/plugins/bigswitch/tests/test_server.py +++ b/neutron/plugins/bigswitch/tests/test_server.py @@ -22,11 +22,10 @@ from __future__ import print_function import re +from oslo.serialization import jsonutils from six import moves from wsgiref import simple_server -from neutron.openstack.common import jsonutils - class TestNetworkCtrl(object): diff --git a/neutron/plugins/cisco/cfg_agent/device_drivers/dummy_driver.py b/neutron/plugins/cisco/cfg_agent/device_drivers/dummy_driver.py index 8972c7fd50..d3b7180525 100644 --- a/neutron/plugins/cisco/cfg_agent/device_drivers/dummy_driver.py +++ b/neutron/plugins/cisco/cfg_agent/device_drivers/dummy_driver.py @@ -14,7 +14,8 @@ import logging -from neutron.openstack.common import jsonutils +from oslo.serialization import jsonutils + from neutron.plugins.cisco.cfg_agent.device_drivers import devicedriver_api LOG = logging.getLogger(__name__) diff --git a/neutron/plugins/cisco/l3/rpc/l3_router_cfgagent_rpc_cb.py b/neutron/plugins/cisco/l3/rpc/l3_router_cfgagent_rpc_cb.py index c1d1104c29..d89d6cdc5d 100644 --- a/neutron/plugins/cisco/l3/rpc/l3_router_cfgagent_rpc_cb.py +++ b/neutron/plugins/cisco/l3/rpc/l3_router_cfgagent_rpc_cb.py @@ -12,11 +12,12 @@ # License for the specific language governing permissions and limitations # under the License. +from oslo.serialization import jsonutils + from neutron.common import constants from neutron.common import utils from neutron import context as neutron_context from neutron.extensions import portbindings -from neutron.openstack.common import jsonutils from neutron.openstack.common import log as logging LOG = logging.getLogger(__name__) diff --git a/neutron/plugins/cisco/n1kv/n1kv_client.py b/neutron/plugins/cisco/n1kv/n1kv_client.py index 848215994f..12fa20d236 100644 --- a/neutron/plugins/cisco/n1kv/n1kv_client.py +++ b/neutron/plugins/cisco/n1kv/n1kv_client.py @@ -13,13 +13,14 @@ # under the License. import base64 + import eventlet import netaddr +from oslo.serialization import jsonutils import requests from neutron.common import exceptions as n_exc from neutron.extensions import providernet -from neutron.openstack.common import jsonutils from neutron.openstack.common import log as logging from neutron.plugins.cisco.common import cisco_constants as c_const from neutron.plugins.cisco.common import cisco_credentials_v2 as c_cred diff --git a/neutron/plugins/ml2/driver_context.py b/neutron/plugins/ml2/driver_context.py index 97987a002a..735a5c5e3a 100644 --- a/neutron/plugins/ml2/driver_context.py +++ b/neutron/plugins/ml2/driver_context.py @@ -13,9 +13,10 @@ # License for the specific language governing permissions and limitations # under the License. +from oslo.serialization import jsonutils + from neutron.common import constants from neutron.extensions import portbindings -from neutron.openstack.common import jsonutils from neutron.plugins.ml2 import db from neutron.plugins.ml2 import driver_api as api diff --git a/neutron/plugins/ml2/drivers/l2pop/db.py b/neutron/plugins/ml2/drivers/l2pop/db.py index 446dc89430..d07d0b1af5 100644 --- a/neutron/plugins/ml2/drivers/l2pop/db.py +++ b/neutron/plugins/ml2/drivers/l2pop/db.py @@ -13,13 +13,13 @@ # License for the specific language governing permissions and limitations # under the License. +from oslo.serialization import jsonutils 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 jsonutils 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/mechanism_ncs.py b/neutron/plugins/ml2/drivers/mechanism_ncs.py index 833447731c..99a5efa21d 100644 --- a/neutron/plugins/ml2/drivers/mechanism_ncs.py +++ b/neutron/plugins/ml2/drivers/mechanism_ncs.py @@ -16,9 +16,9 @@ import re from oslo.config import cfg +from oslo.serialization import jsonutils import requests -from neutron.openstack.common import jsonutils from neutron.openstack.common import log from neutron.plugins.ml2 import driver_api as api diff --git a/neutron/plugins/ml2/drivers/mechanism_odl.py b/neutron/plugins/ml2/drivers/mechanism_odl.py index e2fb229c6f..1b8b119bf0 100644 --- a/neutron/plugins/ml2/drivers/mechanism_odl.py +++ b/neutron/plugins/ml2/drivers/mechanism_odl.py @@ -16,6 +16,7 @@ import time from oslo.config import cfg +from oslo.serialization import jsonutils import requests from neutron.common import constants as n_const @@ -23,7 +24,6 @@ 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 jsonutils 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 db0c523563..0f596a66c2 100644 --- a/neutron/plugins/ml2/plugin.py +++ b/neutron/plugins/ml2/plugin.py @@ -18,6 +18,7 @@ from eventlet import greenthread from oslo.config import cfg from oslo.db import exception as os_db_exception +from oslo.serialization import jsonutils from sqlalchemy import exc as sql_exc from sqlalchemy.orm import exc as sa_exc @@ -53,7 +54,6 @@ from neutron import manager from neutron.openstack.common import excutils from neutron.openstack.common.gettextutils import _LI from neutron.openstack.common import importutils -from neutron.openstack.common import jsonutils 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 a7500863a7..967f62b294 100644 --- a/neutron/plugins/mlnx/agent/utils.py +++ b/neutron/plugins/mlnx/agent/utils.py @@ -13,8 +13,9 @@ # See the License for the specific language governing permissions and # limitations under the License. +from oslo.serialization import jsonutils + from neutron.openstack.common import importutils -from neutron.openstack.common import jsonutils 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/nec/common/ofc_client.py b/neutron/plugins/nec/common/ofc_client.py index c06f9ea2a9..1703763835 100644 --- a/neutron/plugins/nec/common/ofc_client.py +++ b/neutron/plugins/nec/common/ofc_client.py @@ -14,10 +14,10 @@ import time +from oslo.serialization import jsonutils import requests from neutron.openstack.common import excutils -from neutron.openstack.common import jsonutils 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/oneconvergence/lib/nvsdlib.py b/neutron/plugins/oneconvergence/lib/nvsdlib.py index 9bd674a6ed..e08a491e99 100644 --- a/neutron/plugins/oneconvergence/lib/nvsdlib.py +++ b/neutron/plugins/oneconvergence/lib/nvsdlib.py @@ -14,8 +14,9 @@ """Intermidiate NVSD Library.""" +from oslo.serialization import jsonutils + from neutron.openstack.common import excutils -from neutron.openstack.common import jsonutils 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/lib/plugin_helper.py b/neutron/plugins/oneconvergence/lib/plugin_helper.py index ede86b5925..f0eb70b84b 100644 --- a/neutron/plugins/oneconvergence/lib/plugin_helper.py +++ b/neutron/plugins/oneconvergence/lib/plugin_helper.py @@ -18,10 +18,10 @@ import httplib import time from oslo.config import cfg +from oslo.serialization import jsonutils import requests from six.moves.urllib import parse -from neutron.openstack.common import jsonutils from neutron.openstack.common import log as logging import neutron.plugins.oneconvergence.lib.exception as exception diff --git a/neutron/plugins/opencontrail/contrail_plugin.py b/neutron/plugins/opencontrail/contrail_plugin.py index 511c684631..80717fcc01 100644 --- a/neutron/plugins/opencontrail/contrail_plugin.py +++ b/neutron/plugins/opencontrail/contrail_plugin.py @@ -14,6 +14,7 @@ # from oslo.config import cfg +from oslo.serialization import jsonutils import requests from neutron.api.v2 import attributes as attr @@ -23,7 +24,6 @@ from neutron.extensions import external_net from neutron.extensions import portbindings from neutron.extensions import securitygroup from neutron import neutron_plugin_base_v2 -from neutron.openstack.common import jsonutils from neutron.openstack.common import log as logging from neutron.plugins.opencontrail.common import exceptions as c_exc diff --git a/neutron/plugins/vmware/api_client/eventlet_request.py b/neutron/plugins/vmware/api_client/eventlet_request.py index c55ccfa383..43c79c810f 100644 --- a/neutron/plugins/vmware/api_client/eventlet_request.py +++ b/neutron/plugins/vmware/api_client/eventlet_request.py @@ -14,11 +14,12 @@ # License for the specific language governing permissions and limitations # under the License. -import eventlet import httplib import urllib -from neutron.openstack.common import jsonutils +import eventlet +from oslo.serialization import jsonutils + from neutron.openstack.common import log as logging from neutron.plugins.vmware.api_client import request diff --git a/neutron/plugins/vmware/common/sync.py b/neutron/plugins/vmware/common/sync.py index c7fa6aeec2..7a9f686ff4 100644 --- a/neutron/plugins/vmware/common/sync.py +++ b/neutron/plugins/vmware/common/sync.py @@ -15,6 +15,8 @@ import random +from oslo.serialization import jsonutils + from neutron.common import constants from neutron.common import exceptions from neutron import context @@ -22,7 +24,6 @@ from neutron.db import external_net_db from neutron.db import l3_db from neutron.db import models_v2 from neutron.extensions import l3 -from neutron.openstack.common import jsonutils from neutron.openstack.common import log from neutron.openstack.common import loopingcall from neutron.openstack.common import timeutils diff --git a/neutron/plugins/vmware/nsxlib/__init__.py b/neutron/plugins/vmware/nsxlib/__init__.py index c267ecc47e..93dfdf590a 100644 --- a/neutron/plugins/vmware/nsxlib/__init__.py +++ b/neutron/plugins/vmware/nsxlib/__init__.py @@ -13,8 +13,9 @@ # License for the specific language governing permissions and limitations # under the License. +from oslo.serialization import jsonutils + from neutron.common import exceptions as exception -from neutron.openstack.common import jsonutils 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/l2gateway.py b/neutron/plugins/vmware/nsxlib/l2gateway.py index 0848ed591f..170ea35538 100644 --- a/neutron/plugins/vmware/nsxlib/l2gateway.py +++ b/neutron/plugins/vmware/nsxlib/l2gateway.py @@ -14,7 +14,8 @@ # under the License. # -from neutron.openstack.common import jsonutils +from oslo.serialization import jsonutils + 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/lsn.py b/neutron/plugins/vmware/nsxlib/lsn.py index 8e54cfa90a..fda319a698 100644 --- a/neutron/plugins/vmware/nsxlib/lsn.py +++ b/neutron/plugins/vmware/nsxlib/lsn.py @@ -13,8 +13,9 @@ # License for the specific language governing permissions and limitations # under the License. +from oslo.serialization import jsonutils + from neutron.common import exceptions as exception -from neutron.openstack.common import jsonutils 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/queue.py b/neutron/plugins/vmware/nsxlib/queue.py index 708a210b6d..791e8f1397 100644 --- a/neutron/plugins/vmware/nsxlib/queue.py +++ b/neutron/plugins/vmware/nsxlib/queue.py @@ -13,10 +13,11 @@ # License for the specific language governing permissions and limitations # under the License. +from oslo.serialization import jsonutils + 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 jsonutils 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 2ef5245ab5..cd8fd494e6 100644 --- a/neutron/plugins/vmware/nsxlib/router.py +++ b/neutron/plugins/vmware/nsxlib/router.py @@ -14,10 +14,10 @@ # under the License. from oslo.config import cfg +from oslo.serialization import jsonutils from neutron.common import exceptions as exception from neutron.openstack.common import excutils -from neutron.openstack.common import jsonutils 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 fe6cc590a8..c380aa7224 100644 --- a/neutron/plugins/vmware/nsxlib/secgroup.py +++ b/neutron/plugins/vmware/nsxlib/secgroup.py @@ -13,10 +13,11 @@ # License for the specific language governing permissions and limitations # under the License. +from oslo.serialization import jsonutils + from neutron.common import constants from neutron.common import exceptions from neutron.openstack.common import excutils -from neutron.openstack.common import jsonutils 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/nsxlib/switch.py b/neutron/plugins/vmware/nsxlib/switch.py index fe98fd531c..adcb6f802c 100644 --- a/neutron/plugins/vmware/nsxlib/switch.py +++ b/neutron/plugins/vmware/nsxlib/switch.py @@ -15,10 +15,10 @@ # from oslo.config import cfg +from oslo.serialization import jsonutils from neutron.common import constants from neutron.common import exceptions as exception -from neutron.openstack.common import jsonutils 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/vshield/common/VcnsApiClient.py b/neutron/plugins/vmware/vshield/common/VcnsApiClient.py index 7127b6780b..1ad688804b 100644 --- a/neutron/plugins/vmware/vshield/common/VcnsApiClient.py +++ b/neutron/plugins/vmware/vshield/common/VcnsApiClient.py @@ -15,8 +15,8 @@ import base64 import eventlet +from oslo.serialization import jsonutils -from neutron.openstack.common import jsonutils from neutron.plugins.vmware.vshield.common import exceptions httplib2 = eventlet.import_patched('httplib2') diff --git a/neutron/plugins/vmware/vshield/edge_appliance_driver.py b/neutron/plugins/vmware/vshield/edge_appliance_driver.py index 700b989190..a97c5d49a6 100644 --- a/neutron/plugins/vmware/vshield/edge_appliance_driver.py +++ b/neutron/plugins/vmware/vshield/edge_appliance_driver.py @@ -12,8 +12,9 @@ # License for the specific language governing permissions and limitations # under the License. +from oslo.serialization import jsonutils + from neutron.openstack.common import excutils -from neutron.openstack.common import jsonutils 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/vcns.py b/neutron/plugins/vmware/vshield/vcns.py index 6b4f248458..68ad9c7b7b 100644 --- a/neutron/plugins/vmware/vshield/vcns.py +++ b/neutron/plugins/vmware/vshield/vcns.py @@ -12,7 +12,8 @@ # License for the specific language governing permissions and limitations # under the License. -from neutron.openstack.common import jsonutils +from oslo.serialization import jsonutils + from neutron.openstack.common import log as logging from neutron.plugins.vmware.vshield.common import VcnsApiClient diff --git a/neutron/services/firewall/agents/varmour/varmour_api.py b/neutron/services/firewall/agents/varmour/varmour_api.py index e191946f8c..65c55f22f6 100755 --- a/neutron/services/firewall/agents/varmour/varmour_api.py +++ b/neutron/services/firewall/agents/varmour/varmour_api.py @@ -17,8 +17,8 @@ import base64 import httplib2 from oslo.config import cfg +from oslo.serialization import jsonutils -from neutron.openstack.common import jsonutils from neutron.openstack.common import log as logging from neutron.services.firewall.agents.varmour import varmour_utils as va_utils diff --git a/neutron/services/loadbalancer/drivers/netscaler/ncc_client.py b/neutron/services/loadbalancer/drivers/netscaler/ncc_client.py index 98c8a35c25..9111f7896e 100644 --- a/neutron/services/loadbalancer/drivers/netscaler/ncc_client.py +++ b/neutron/services/loadbalancer/drivers/netscaler/ncc_client.py @@ -13,10 +13,11 @@ # under the License. import base64 + +from oslo.serialization import jsonutils import requests from neutron.common import exceptions as n_exc -from neutron.openstack.common import jsonutils from neutron.openstack.common import log as logging LOG = logging.getLogger(__name__) diff --git a/neutron/services/loadbalancer/drivers/radware/driver.py b/neutron/services/loadbalancer/drivers/radware/driver.py index 23fa2eae18..d259623119 100644 --- a/neutron/services/loadbalancer/drivers/radware/driver.py +++ b/neutron/services/loadbalancer/drivers/radware/driver.py @@ -24,6 +24,7 @@ import eventlet eventlet.monkey_patch(thread=True) from oslo.config import cfg +from oslo.serialization import jsonutils from six.moves import queue as Queue from neutron.api.v2 import attributes @@ -32,7 +33,6 @@ 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 import jsonutils 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/vpn/device_drivers/cisco_csr_rest_client.py b/neutron/services/vpn/device_drivers/cisco_csr_rest_client.py index 392ffdc27f..de5d47b3f0 100644 --- a/neutron/services/vpn/device_drivers/cisco_csr_rest_client.py +++ b/neutron/services/vpn/device_drivers/cisco_csr_rest_client.py @@ -15,10 +15,10 @@ import time import netaddr +from oslo.serialization import jsonutils import requests from requests import exceptions as r_exc -from neutron.openstack.common import jsonutils from neutron.openstack.common.gettextutils import _LE, _LW from neutron.openstack.common import log as logging diff --git a/neutron/tests/unit/agent/linux/test_ovs_lib.py b/neutron/tests/unit/agent/linux/test_ovs_lib.py index 5af128cd9b..3d2611e2e8 100644 --- a/neutron/tests/unit/agent/linux/test_ovs_lib.py +++ b/neutron/tests/unit/agent/linux/test_ovs_lib.py @@ -15,12 +15,12 @@ import collections import mock from oslo.config import cfg +from oslo.serialization import jsonutils import testtools from neutron.agent.linux import ovs_lib from neutron.agent.linux import utils from neutron.common import exceptions -from neutron.openstack.common import jsonutils from neutron.openstack.common import uuidutils from neutron.plugins.common import constants from neutron.tests import base diff --git a/neutron/tests/unit/bigswitch/fake_server.py b/neutron/tests/unit/bigswitch/fake_server.py index 6c6bb5a650..be49eb2646 100644 --- a/neutron/tests/unit/bigswitch/fake_server.py +++ b/neutron/tests/unit/bigswitch/fake_server.py @@ -12,7 +12,8 @@ # License for the specific language governing permissions and limitations # under the License. -from neutron.openstack.common import jsonutils +from oslo.serialization import jsonutils + from neutron.openstack.common import log as logging from neutron.plugins.bigswitch import servermanager diff --git a/neutron/tests/unit/bigswitch/test_servermanager.py b/neutron/tests/unit/bigswitch/test_servermanager.py index e8d15efa3b..31b1bbd3b4 100644 --- a/neutron/tests/unit/bigswitch/test_servermanager.py +++ b/neutron/tests/unit/bigswitch/test_servermanager.py @@ -18,11 +18,11 @@ import ssl import mock from oslo.config import cfg +from oslo.serialization import jsonutils from neutron import context from neutron import manager from neutron.openstack.common import importutils -from neutron.openstack.common import jsonutils from neutron.plugins.bigswitch import servermanager from neutron.tests.unit.bigswitch import test_restproxy_plugin as test_rp diff --git a/neutron/tests/unit/extensions/foxinsocks.py b/neutron/tests/unit/extensions/foxinsocks.py index 4c95e6a943..a2ff789889 100644 --- a/neutron/tests/unit/extensions/foxinsocks.py +++ b/neutron/tests/unit/extensions/foxinsocks.py @@ -15,8 +15,9 @@ import abc +from oslo.serialization import jsonutils + from neutron.api import extensions -from neutron.openstack.common import jsonutils from neutron import wsgi diff --git a/neutron/tests/unit/ml2/drivers/test_bigswitch_mech.py b/neutron/tests/unit/ml2/drivers/test_bigswitch_mech.py index 4177f2e684..83e1a36837 100644 --- a/neutron/tests/unit/ml2/drivers/test_bigswitch_mech.py +++ b/neutron/tests/unit/ml2/drivers/test_bigswitch_mech.py @@ -18,11 +18,11 @@ import contextlib import functools import mock +from oslo.serialization import jsonutils from neutron import context as neutron_context from neutron.extensions import portbindings from neutron import manager -from neutron.openstack.common import jsonutils from neutron.plugins.bigswitch import servermanager from neutron.plugins.ml2 import config as ml2_config from neutron.plugins.ml2.drivers.mech_bigswitch import driver as bsn_driver diff --git a/neutron/tests/unit/ml2/test_mechanism_odl.py b/neutron/tests/unit/ml2/test_mechanism_odl.py index f9e348170a..f3a8f319f4 100644 --- a/neutron/tests/unit/ml2/test_mechanism_odl.py +++ b/neutron/tests/unit/ml2/test_mechanism_odl.py @@ -14,9 +14,9 @@ # under the License. import mock +from oslo.serialization import jsonutils import requests -from neutron.openstack.common import jsonutils from neutron.plugins.common import constants from neutron.plugins.ml2 import config as config from neutron.plugins.ml2 import driver_api as api diff --git a/neutron/tests/unit/nec/test_ofc_client.py b/neutron/tests/unit/nec/test_ofc_client.py index 56621a04c0..658c138919 100644 --- a/neutron/tests/unit/nec/test_ofc_client.py +++ b/neutron/tests/unit/nec/test_ofc_client.py @@ -14,9 +14,9 @@ import mock from oslo.config import cfg +from oslo.serialization import jsonutils import requests -from neutron.openstack.common import jsonutils from neutron.plugins.nec.common import config from neutron.plugins.nec.common import exceptions as nexc from neutron.plugins.nec.common import ofc_client diff --git a/neutron/tests/unit/oneconvergence/test_nvsdlib.py b/neutron/tests/unit/oneconvergence/test_nvsdlib.py index 2b589780e7..65df031aca 100644 --- a/neutron/tests/unit/oneconvergence/test_nvsdlib.py +++ b/neutron/tests/unit/oneconvergence/test_nvsdlib.py @@ -14,8 +14,8 @@ # import mock +from oslo.serialization import jsonutils -from neutron.openstack.common import jsonutils from neutron.plugins.oneconvergence.lib import nvsdlib from neutron.tests import base diff --git a/neutron/tests/unit/oneconvergence/test_plugin_helper.py b/neutron/tests/unit/oneconvergence/test_plugin_helper.py index 7f7f28fbd9..de4e4d2616 100644 --- a/neutron/tests/unit/oneconvergence/test_plugin_helper.py +++ b/neutron/tests/unit/oneconvergence/test_plugin_helper.py @@ -13,9 +13,9 @@ # under the License. import mock +from oslo.serialization import jsonutils import requests -from neutron.openstack.common import jsonutils from neutron.plugins.oneconvergence.lib import config # noqa from neutron.plugins.oneconvergence.lib import plugin_helper as client from neutron.tests import base diff --git a/neutron/tests/unit/opencontrail/test_contrail_plugin.py b/neutron/tests/unit/opencontrail/test_contrail_plugin.py index a9a37be50e..3c5486d7a5 100644 --- a/neutron/tests/unit/opencontrail/test_contrail_plugin.py +++ b/neutron/tests/unit/opencontrail/test_contrail_plugin.py @@ -20,6 +20,7 @@ import uuid import mock import netaddr from oslo.config import cfg +from oslo.serialization import jsonutils from testtools import matchers import webob.exc @@ -34,7 +35,6 @@ from neutron.db import l3_db from neutron.db import securitygroups_db from neutron.extensions import portbindings from neutron.extensions import securitygroup as ext_sg -from neutron.openstack.common import jsonutils from neutron.tests.unit import _test_extension_portbindings as test_bindings from neutron.tests.unit import test_db_plugin as test_plugin from neutron.tests.unit import test_extension_security_group as test_sg diff --git a/neutron/tests/unit/services/loadbalancer/drivers/radware/test_plugin_driver.py b/neutron/tests/unit/services/loadbalancer/drivers/radware/test_plugin_driver.py index ba5c968bd8..e3bf644bc0 100644 --- a/neutron/tests/unit/services/loadbalancer/drivers/radware/test_plugin_driver.py +++ b/neutron/tests/unit/services/loadbalancer/drivers/radware/test_plugin_driver.py @@ -17,13 +17,13 @@ import re import contextlib import mock from oslo.config import cfg +from oslo.serialization import jsonutils from six.moves import queue as Queue from neutron.api.v2 import attributes from neutron import context from neutron.extensions import loadbalancer from neutron import manager -from neutron.openstack.common import jsonutils from neutron.plugins.common import constants from neutron.services.loadbalancer.drivers.radware import driver from neutron.services.loadbalancer.drivers.radware import exceptions as r_exc diff --git a/neutron/tests/unit/test_extensions.py b/neutron/tests/unit/test_extensions.py index b865f9c30f..0dd279e5b0 100644 --- a/neutron/tests/unit/test_extensions.py +++ b/neutron/tests/unit/test_extensions.py @@ -16,6 +16,7 @@ import abc import mock +from oslo.serialization import jsonutils import routes import webob import webtest @@ -24,7 +25,6 @@ from neutron.api import extensions from neutron.common import config from neutron.common import exceptions from neutron.db import db_base_plugin_v2 -from neutron.openstack.common import jsonutils from neutron.openstack.common import log as logging from neutron.plugins.common import constants from neutron.tests import base diff --git a/neutron/tests/unit/vmware/apiclient/fake.py b/neutron/tests/unit/vmware/apiclient/fake.py index 99485805c4..dfe48cb9e7 100644 --- a/neutron/tests/unit/vmware/apiclient/fake.py +++ b/neutron/tests/unit/vmware/apiclient/fake.py @@ -12,9 +12,9 @@ # License for the specific language governing permissions and limitations # under the License. +from oslo.serialization import jsonutils import six.moves.urllib.parse as urlparse -from neutron.openstack.common import jsonutils from neutron.openstack.common import log as logging from neutron.openstack.common import uuidutils from neutron.plugins.vmware.api_client import exception as api_exc diff --git a/neutron/tests/unit/vmware/nsxlib/test_l2gateway.py b/neutron/tests/unit/vmware/nsxlib/test_l2gateway.py index 006ad38648..2a2311c010 100644 --- a/neutron/tests/unit/vmware/nsxlib/test_l2gateway.py +++ b/neutron/tests/unit/vmware/nsxlib/test_l2gateway.py @@ -15,8 +15,8 @@ # import mock +from oslo.serialization import jsonutils -from neutron.openstack.common import jsonutils from neutron.plugins.vmware.api_client import exception from neutron.plugins.vmware.common import utils as nsx_utils from neutron.plugins.vmware import nsxlib diff --git a/neutron/tests/unit/vmware/nsxlib/test_lsn.py b/neutron/tests/unit/vmware/nsxlib/test_lsn.py index de6713206a..c1b2c71466 100644 --- a/neutron/tests/unit/vmware/nsxlib/test_lsn.py +++ b/neutron/tests/unit/vmware/nsxlib/test_lsn.py @@ -14,9 +14,9 @@ # limitations under the License. import mock +from oslo.serialization import jsonutils from neutron.common import exceptions -from neutron.openstack.common import jsonutils 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 utils diff --git a/neutron/tests/unit/vmware/test_nsx_sync.py b/neutron/tests/unit/vmware/test_nsx_sync.py index cacfc246c1..93a9a5e125 100644 --- a/neutron/tests/unit/vmware/test_nsx_sync.py +++ b/neutron/tests/unit/vmware/test_nsx_sync.py @@ -19,13 +19,13 @@ import time import mock from oslo.config import cfg +from oslo.serialization import jsonutils from neutron.api.v2 import attributes as attr from neutron.common import constants from neutron.common import exceptions as n_exc from neutron import context from neutron.extensions import l3 -from neutron.openstack.common import jsonutils from neutron.openstack.common import log from neutron.plugins.vmware.api_client import client from neutron.plugins.vmware.api_client import exception as api_exc diff --git a/neutron/tests/unit/vmware/vshield/fake_vcns.py b/neutron/tests/unit/vmware/vshield/fake_vcns.py index 64393bcbd4..4b0aed4952 100644 --- a/neutron/tests/unit/vmware/vshield/fake_vcns.py +++ b/neutron/tests/unit/vmware/vshield/fake_vcns.py @@ -14,7 +14,8 @@ import copy -from neutron.openstack.common import jsonutils +from oslo.serialization import jsonutils + from neutron.openstack.common import uuidutils from neutron.plugins.vmware.vshield.common import exceptions diff --git a/neutron/wsgi.py b/neutron/wsgi.py index 73c3cf476c..101c0dc0de 100644 --- a/neutron/wsgi.py +++ b/neutron/wsgi.py @@ -28,6 +28,7 @@ import time import eventlet.wsgi eventlet.patcher.monkey_patch(all=False, socket=True, thread=True) from oslo.config import cfg +from oslo.serialization import jsonutils import routes.middleware import webob.dec import webob.exc @@ -37,7 +38,6 @@ 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 jsonutils from neutron.openstack.common import log as logging from neutron.openstack.common import service as common_service from neutron.openstack.common import systemd diff --git a/openstack-common.conf b/openstack-common.conf index a3bebcc38b..2eb0022ffe 100644 --- a/openstack-common.conf +++ b/openstack-common.conf @@ -9,7 +9,6 @@ module=fixture module=gettextutils module=importutils module=install_venv_common -module=jsonutils module=local module=lockutils module=log