From de1ebcdf400f04619d1f999fc24e85aa480dfefe Mon Sep 17 00:00:00 2001 From: Ihar Hrachyshka Date: Mon, 16 Jun 2014 09:17:10 +0200 Subject: [PATCH] Consistently use jsonutils instead of specific implementation jsonutils have several benefits in comparison to pure json implementation, like enabling C boosted encoders and decoders for Python2.6 by using simplejson when available. Change-Id: I24d0cd442e8d9d89fac50e43fc97f7bb4a293c3d Closes-Bug: 1329496 --- neutron/plugins/bigswitch/servermanager.py | 2 +- neutron/plugins/bigswitch/tests/test_server.py | 3 ++- neutron/plugins/nec/common/ofc_client.py | 2 +- neutron/plugins/vmware/api_client/eventlet_request.py | 2 +- neutron/plugins/vmware/nsxlib/__init__.py | 3 +-- neutron/plugins/vmware/nsxlib/l2gateway.py | 3 +-- neutron/plugins/vmware/nsxlib/lsn.py | 3 +-- neutron/plugins/vmware/nsxlib/secgroup.py | 3 +-- neutron/plugins/vmware/nsxlib/switch.py | 3 +-- neutron/tests/unit/bigswitch/fake_server.py | 3 +-- neutron/tests/unit/nec/test_ofc_client.py | 3 +-- neutron/tests/unit/test_policy.py | 2 +- neutron/tests/unit/vmware/apiclient/fake.py | 3 +-- neutron/tests/unit/vmware/nsxlib/test_lsn.py | 2 +- neutron/tests/unit/vmware/vshield/fake_vcns.py | 2 +- 15 files changed, 16 insertions(+), 23 deletions(-) diff --git a/neutron/plugins/bigswitch/servermanager.py b/neutron/plugins/bigswitch/servermanager.py index 74f18de3d..5fda19997 100644 --- a/neutron/plugins/bigswitch/servermanager.py +++ b/neutron/plugins/bigswitch/servermanager.py @@ -33,7 +33,6 @@ The following functionality is handled by this module: """ import base64 import httplib -import json import os import socket import ssl @@ -44,6 +43,7 @@ from oslo.config import cfg from neutron.common import exceptions from neutron.common import utils from neutron.openstack.common import excutils +from neutron.openstack.common import jsonutils as json 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 ad06dde5d..ee0c2be3d 100755 --- a/neutron/plugins/bigswitch/tests/test_server.py +++ b/neutron/plugins/bigswitch/tests/test_server.py @@ -24,12 +24,13 @@ Used for NeutronRestProxy tests """ from __future__ import print_function -import json import re from six import moves from wsgiref import simple_server +from neutron.openstack.common import jsonutils as json + class TestNetworkCtrl(object): diff --git a/neutron/plugins/nec/common/ofc_client.py b/neutron/plugins/nec/common/ofc_client.py index d51738c7a..21fb5f74b 100644 --- a/neutron/plugins/nec/common/ofc_client.py +++ b/neutron/plugins/nec/common/ofc_client.py @@ -15,12 +15,12 @@ # under the License. # @author: Ryota MIBU -import json import time import requests from neutron.openstack.common import excutils +from neutron.openstack.common import jsonutils as json 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/vmware/api_client/eventlet_request.py b/neutron/plugins/vmware/api_client/eventlet_request.py index 9470db235..26c378e0c 100644 --- a/neutron/plugins/vmware/api_client/eventlet_request.py +++ b/neutron/plugins/vmware/api_client/eventlet_request.py @@ -16,9 +16,9 @@ import eventlet import httplib -import json import urllib +from neutron.openstack.common import jsonutils as json from neutron.openstack.common import log as logging from neutron.plugins.vmware.api_client import request diff --git a/neutron/plugins/vmware/nsxlib/__init__.py b/neutron/plugins/vmware/nsxlib/__init__.py index 738246bbb..b09460b59 100644 --- a/neutron/plugins/vmware/nsxlib/__init__.py +++ b/neutron/plugins/vmware/nsxlib/__init__.py @@ -13,9 +13,8 @@ # License for the specific language governing permissions and limitations # under the License. -import json - from neutron.common import exceptions as exception +from neutron.openstack.common import jsonutils as json 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 c0e761724..bd261f922 100644 --- a/neutron/plugins/vmware/nsxlib/l2gateway.py +++ b/neutron/plugins/vmware/nsxlib/l2gateway.py @@ -14,8 +14,7 @@ # under the License. # -import json - +from neutron.openstack.common import jsonutils as json 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 993f9d5bb..f67288bf0 100644 --- a/neutron/plugins/vmware/nsxlib/lsn.py +++ b/neutron/plugins/vmware/nsxlib/lsn.py @@ -15,9 +15,8 @@ # License for the specific language governing permissions and limitations # under the License. -import json - from neutron.common import exceptions as exception +from neutron.openstack.common import jsonutils as json 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 fa4a10ef1..663a090c4 100644 --- a/neutron/plugins/vmware/nsxlib/secgroup.py +++ b/neutron/plugins/vmware/nsxlib/secgroup.py @@ -13,11 +13,10 @@ # License for the specific language governing permissions and limitations # under the License. -import json - from neutron.common import constants from neutron.common import exceptions from neutron.openstack.common import excutils +from neutron.openstack.common import jsonutils as json 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 f84e2f584..b344fa0ee 100644 --- a/neutron/plugins/vmware/nsxlib/switch.py +++ b/neutron/plugins/vmware/nsxlib/switch.py @@ -14,12 +14,11 @@ # under the License. # -import json - from oslo.config import cfg from neutron.common import constants from neutron.common import exceptions as exception +from neutron.openstack.common import jsonutils as json 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/tests/unit/bigswitch/fake_server.py b/neutron/tests/unit/bigswitch/fake_server.py index 2f65549bb..3db3cc3ed 100644 --- a/neutron/tests/unit/bigswitch/fake_server.py +++ b/neutron/tests/unit/bigswitch/fake_server.py @@ -17,8 +17,7 @@ # @author: Kevin Benton, # -import json - +from neutron.openstack.common import jsonutils as json from neutron.openstack.common import log as logging from neutron.plugins.bigswitch import servermanager diff --git a/neutron/tests/unit/nec/test_ofc_client.py b/neutron/tests/unit/nec/test_ofc_client.py index 09a214a1f..93f75a2b0 100644 --- a/neutron/tests/unit/nec/test_ofc_client.py +++ b/neutron/tests/unit/nec/test_ofc_client.py @@ -16,12 +16,11 @@ # # @author: Akihiro Motoki -import json - import mock from oslo.config import cfg import requests +from neutron.openstack.common import jsonutils as json 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/test_policy.py b/neutron/tests/unit/test_policy.py index f0b63df63..a17ac9aeb 100644 --- a/neutron/tests/unit/test_policy.py +++ b/neutron/tests/unit/test_policy.py @@ -15,7 +15,6 @@ """Test of Policy Engine For Neutron""" -import json import urllib2 import fixtures @@ -28,6 +27,7 @@ from neutron.common import exceptions from neutron import context from neutron import manager from neutron.openstack.common import importutils +from neutron.openstack.common import jsonutils as json from neutron.openstack.common import policy as common_policy from neutron import policy from neutron.tests import base diff --git a/neutron/tests/unit/vmware/apiclient/fake.py b/neutron/tests/unit/vmware/apiclient/fake.py index 4d54a1824..eb1f62f49 100644 --- a/neutron/tests/unit/vmware/apiclient/fake.py +++ b/neutron/tests/unit/vmware/apiclient/fake.py @@ -12,10 +12,9 @@ # License for the specific language governing permissions and limitations # under the License. -import json - import six.moves.urllib.parse as urlparse +from neutron.openstack.common import jsonutils as json 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_lsn.py b/neutron/tests/unit/vmware/nsxlib/test_lsn.py index 385a74e35..41c50b6c3 100644 --- a/neutron/tests/unit/vmware/nsxlib/test_lsn.py +++ b/neutron/tests/unit/vmware/nsxlib/test_lsn.py @@ -13,10 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. -import json import mock from neutron.common import exceptions +from neutron.openstack.common import jsonutils as json 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/vshield/fake_vcns.py b/neutron/tests/unit/vmware/vshield/fake_vcns.py index 37dcbf536..2c9aa6162 100644 --- a/neutron/tests/unit/vmware/vshield/fake_vcns.py +++ b/neutron/tests/unit/vmware/vshield/fake_vcns.py @@ -13,8 +13,8 @@ # under the License. import copy -import json +from neutron.openstack.common import jsonutils as json from neutron.openstack.common import uuidutils from neutron.plugins.vmware.vshield.common import exceptions -- 2.45.2