diff --git a/tox.ini b/tox.ini index 942d98a13d..8dbcfdbdb6 100644 --- a/tox.ini +++ b/tox.ini @@ -82,3 +82,4 @@ commands = [hacking] import_exceptions = neutron.i18n +local-check-factory = neutron.hacking.checks.factory diff --git a/vmware_nsx/neutron/plugins/vmware/api_client/base.py b/vmware_nsx/neutron/plugins/vmware/api_client/base.py index 3d7daba1c9..8399ce97c4 100644 --- a/vmware_nsx/neutron/plugins/vmware/api_client/base.py +++ b/vmware_nsx/neutron/plugins/vmware/api_client/base.py @@ -19,7 +19,7 @@ import httplib import six import time -from oslo.config import cfg +from oslo_config import cfg from oslo_log import log as logging from neutron.i18n import _LE, _LI, _LW diff --git a/vmware_nsx/neutron/plugins/vmware/api_client/eventlet_request.py b/vmware_nsx/neutron/plugins/vmware/api_client/eventlet_request.py index f07bfb3559..d839c56111 100644 --- a/vmware_nsx/neutron/plugins/vmware/api_client/eventlet_request.py +++ b/vmware_nsx/neutron/plugins/vmware/api_client/eventlet_request.py @@ -18,8 +18,8 @@ import httplib import urllib import eventlet -from oslo.serialization import jsonutils from oslo_log import log as logging +from oslo_serialization import jsonutils from neutron.i18n import _LI, _LW from vmware_nsx.neutron.plugins.vmware.api_client import request diff --git a/vmware_nsx/neutron/plugins/vmware/api_client/request.py b/vmware_nsx/neutron/plugins/vmware/api_client/request.py index 141157d551..d68accdc3b 100644 --- a/vmware_nsx/neutron/plugins/vmware/api_client/request.py +++ b/vmware_nsx/neutron/plugins/vmware/api_client/request.py @@ -21,8 +21,8 @@ import httplib import time import eventlet -from oslo.utils import excutils from oslo_log import log as logging +from oslo_utils import excutils import six import six.moves.urllib.parse as urlparse diff --git a/vmware_nsx/neutron/plugins/vmware/check_nsx_config.py b/vmware_nsx/neutron/plugins/vmware/check_nsx_config.py index cb9975817d..8aa2593c76 100644 --- a/vmware_nsx/neutron/plugins/vmware/check_nsx_config.py +++ b/vmware_nsx/neutron/plugins/vmware/check_nsx_config.py @@ -17,7 +17,7 @@ from __future__ import print_function import sys -from oslo.config import cfg +from oslo_config import cfg from neutron.common import config from vmware_nsx.neutron.plugins.vmware.common import config as nsx_config # noqa diff --git a/vmware_nsx/neutron/plugins/vmware/common/config.py b/vmware_nsx/neutron/plugins/vmware/common/config.py index 25c5106b69..829511774c 100644 --- a/vmware_nsx/neutron/plugins/vmware/common/config.py +++ b/vmware_nsx/neutron/plugins/vmware/common/config.py @@ -14,9 +14,9 @@ import logging -from neutron.i18n import _LW -from oslo.config import cfg +from oslo_config import cfg +from neutron.i18n import _LW from vmware_nsx.neutron.plugins.vmware.common import exceptions as nsx_exc LOG = logging.getLogger(__name__) diff --git a/vmware_nsx/neutron/plugins/vmware/common/sync.py b/vmware_nsx/neutron/plugins/vmware/common/sync.py index 90dcb35b39..dbb44229eb 100644 --- a/vmware_nsx/neutron/plugins/vmware/common/sync.py +++ b/vmware_nsx/neutron/plugins/vmware/common/sync.py @@ -15,6 +15,10 @@ import random +from oslo_log import log +from oslo_serialization import jsonutils +from oslo_utils import timeutils + from neutron.common import constants from neutron.common import exceptions from neutron import context @@ -24,10 +28,6 @@ from neutron.db import models_v2 from neutron.extensions import l3 from neutron.i18n import _LE, _LI, _LW from neutron.openstack.common import loopingcall -from oslo.serialization import jsonutils -from oslo.utils import timeutils -from oslo_log import log - from vmware_nsx.neutron.plugins.vmware.api_client import exception as api_exc from vmware_nsx.neutron.plugins.vmware.common import exceptions as nsx_exc from vmware_nsx.neutron.plugins.vmware.common import nsx_utils diff --git a/vmware_nsx/neutron/plugins/vmware/dbexts/db.py b/vmware_nsx/neutron/plugins/vmware/dbexts/db.py index 42761b6b62..63336e7f90 100644 --- a/vmware_nsx/neutron/plugins/vmware/dbexts/db.py +++ b/vmware_nsx/neutron/plugins/vmware/dbexts/db.py @@ -14,9 +14,9 @@ # License for the specific language governing permissions and limitations # under the License. -from oslo.db import exception as db_exc -from oslo.utils import excutils +from oslo_db import exception as db_exc from oslo_log import log as logging +from oslo_utils import excutils from sqlalchemy.orm import exc import neutron.db.api as db diff --git a/vmware_nsx/neutron/plugins/vmware/dbexts/lsn_db.py b/vmware_nsx/neutron/plugins/vmware/dbexts/lsn_db.py index 756f1bd097..0f4826d8a7 100644 --- a/vmware_nsx/neutron/plugins/vmware/dbexts/lsn_db.py +++ b/vmware_nsx/neutron/plugins/vmware/dbexts/lsn_db.py @@ -15,11 +15,11 @@ # under the License. # -from neutron.plugins.vmware.dbexts import nsx_models -from oslo.db import exception as d_exc +from oslo_db import exception as d_exc from oslo_log import log as logging from sqlalchemy import orm +from neutron.plugins.vmware.dbexts import nsx_models from vmware_nsx.neutron.plugins.vmware.common import exceptions as p_exc diff --git a/vmware_nsx/neutron/plugins/vmware/dbexts/nsxv_db.py b/vmware_nsx/neutron/plugins/vmware/dbexts/nsxv_db.py index 65fdbe36ae..308d6e2a29 100644 --- a/vmware_nsx/neutron/plugins/vmware/dbexts/nsxv_db.py +++ b/vmware_nsx/neutron/plugins/vmware/dbexts/nsxv_db.py @@ -14,9 +14,9 @@ # License for the specific language governing permissions and limitations # under the License. -from oslo.db import exception as db_exc -from oslo.utils import excutils +from oslo_db import exception as db_exc from oslo_log import log as logging +from oslo_utils import excutils from sqlalchemy.orm import exc from sqlalchemy.sql import expression as expr diff --git a/vmware_nsx/neutron/plugins/vmware/dhcp_meta/lsnmanager.py b/vmware_nsx/neutron/plugins/vmware/dhcp_meta/lsnmanager.py index 68ca975e0e..9ca10b6f45 100644 --- a/vmware_nsx/neutron/plugins/vmware/dhcp_meta/lsnmanager.py +++ b/vmware_nsx/neutron/plugins/vmware/dhcp_meta/lsnmanager.py @@ -15,13 +15,13 @@ # under the License. # +from oslo_config import cfg +from oslo_db import exception as db_exc +from oslo_log import log as logging +from oslo_utils import excutils + from neutron.common import exceptions as n_exc from neutron.i18n import _LE, _LW -from oslo.config import cfg -from oslo.db import exception as db_exc -from oslo.utils import excutils -from oslo_log import log as logging - from vmware_nsx.neutron.plugins.vmware.api_client import exception as api_exc from vmware_nsx.neutron.plugins.vmware.common import exceptions as p_exc from vmware_nsx.neutron.plugins.vmware.common import nsx_utils diff --git a/vmware_nsx/neutron/plugins/vmware/dhcp_meta/nsx.py b/vmware_nsx/neutron/plugins/vmware/dhcp_meta/nsx.py index d0ea38bb5b..91ff9d715c 100644 --- a/vmware_nsx/neutron/plugins/vmware/dhcp_meta/nsx.py +++ b/vmware_nsx/neutron/plugins/vmware/dhcp_meta/nsx.py @@ -15,6 +15,10 @@ # under the License. # +from oslo_config import cfg +from oslo_log import log as logging +from oslo_utils import excutils + from neutron.api.v2 import attributes as attr from neutron.common import constants as const from neutron.common import exceptions as n_exc @@ -22,10 +26,6 @@ from neutron.db import db_base_plugin_v2 from neutron.db import l3_db from neutron.extensions import external_net from neutron.i18n import _LE, _LI -from oslo.config import cfg -from oslo.utils import excutils -from oslo_log import log as logging - from vmware_nsx.neutron.plugins.vmware.common import exceptions as p_exc from vmware_nsx.neutron.plugins.vmware.dhcp_meta import constants as d_const from vmware_nsx.neutron.plugins.vmware.nsxlib import lsn as lsn_api diff --git a/vmware_nsx/neutron/plugins/vmware/dhcp_meta/rpc.py b/vmware_nsx/neutron/plugins/vmware/dhcp_meta/rpc.py index fb9963977f..0702f22d41 100644 --- a/vmware_nsx/neutron/plugins/vmware/dhcp_meta/rpc.py +++ b/vmware_nsx/neutron/plugins/vmware/dhcp_meta/rpc.py @@ -16,6 +16,9 @@ from eventlet import greenthread import netaddr +from oslo_config import cfg +from oslo_log import log as logging + from neutron.api.rpc.agentnotifiers import dhcp_rpc_agent_api from neutron.api.v2 import attributes from neutron.common import constants as const @@ -24,9 +27,6 @@ from neutron.db import db_base_plugin_v2 from neutron.db import l3_db from neutron.db import models_v2 from neutron.i18n import _LE, _LI, _LW -from oslo.config import cfg -from oslo_log import log as logging - from vmware_nsx.neutron.plugins.vmware.api_client import exception as api_exc from vmware_nsx.neutron.plugins.vmware.common import config from vmware_nsx.neutron.plugins.vmware.common import exceptions as nsx_exc diff --git a/vmware_nsx/neutron/plugins/vmware/dhcpmeta_modes.py b/vmware_nsx/neutron/plugins/vmware/dhcpmeta_modes.py index 2719b7beb8..691c1c902d 100644 --- a/vmware_nsx/neutron/plugins/vmware/dhcpmeta_modes.py +++ b/vmware_nsx/neutron/plugins/vmware/dhcpmeta_modes.py @@ -15,9 +15,9 @@ # under the License. # -from oslo.concurrency import lockutils -from oslo.config import cfg -from oslo.utils import importutils +from oslo_concurrency import lockutils +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 diff --git a/vmware_nsx/neutron/plugins/vmware/dvs/dvs.py b/vmware_nsx/neutron/plugins/vmware/dvs/dvs.py index 22fa78cd88..e57da1114b 100644 --- a/vmware_nsx/neutron/plugins/vmware/dvs/dvs.py +++ b/vmware_nsx/neutron/plugins/vmware/dvs/dvs.py @@ -12,11 +12,11 @@ # License for the specific language governing permissions and limitations # under the License. -from oslo.utils import excutils -from oslo.vmware import vim_util - +from oslo_utils import excutils +from oslo_vmware import vim_util from neutron.common import exceptions +from neutron.i18n import _LE, _LI from neutron.openstack.common import log as logging from vmware_nsx.neutron.plugins.vmware.common import exceptions as nsx_exc from vmware_nsx.neutron.plugins.vmware.dvs import dvs_utils @@ -87,10 +87,10 @@ class DvsManager(object): except Exception: # NOTE(garyk): handle more specific exceptions with excutils.save_and_reraise_exception(): - LOG.exception(_('Failed to create port group for ' - '%(net_id)s with tag %(tag)s.'), + LOG.exception(_LE('Failed to create port group for ' + '%(net_id)s with tag %(tag)s.'), {'net_id': net_id, 'tag': vlan_tag}) - LOG.info("%(net_id)s with tag %(vlan_tag)s created on %(dvs)s.", + LOG.info(_LI("%(net_id)s with tag %(vlan_tag)s created on %(dvs)s."), {'net_id': net_id, 'vlan_tag': vlan_tag, 'dvs': dvs_utils.dvs_name_get()}) @@ -129,7 +129,8 @@ class DvsManager(object): except Exception: # NOTE(garyk): handle more specific exceptions with excutils.save_and_reraise_exception(): - LOG.exception(_('Failed to delete port group for %s.'), net_id) - LOG.info("%(net_id)s delete from %(dvs)s.", + LOG.exception(_LE('Failed to delete port group for %s.'), + net_id) + LOG.info(_LI("%(net_id)s delete from %(dvs)s."), {'net_id': net_id, 'dvs': dvs_utils.dvs_name_get()}) diff --git a/vmware_nsx/neutron/plugins/vmware/dvs/dvs_utils.py b/vmware_nsx/neutron/plugins/vmware/dvs/dvs_utils.py index 203408e426..0e6b0a8009 100644 --- a/vmware_nsx/neutron/plugins/vmware/dvs/dvs_utils.py +++ b/vmware_nsx/neutron/plugins/vmware/dvs/dvs_utils.py @@ -12,8 +12,8 @@ # License for the specific language governing permissions and limitations # under the License. -from oslo.config import cfg -from oslo.vmware import api +from oslo_config import cfg +from oslo_vmware import api dvs_opts = [ cfg.StrOpt('host_ip', diff --git a/vmware_nsx/neutron/plugins/vmware/nsx_cluster.py b/vmware_nsx/neutron/plugins/vmware/nsx_cluster.py index 7fc2857764..f7cee35b30 100644 --- a/vmware_nsx/neutron/plugins/vmware/nsx_cluster.py +++ b/vmware_nsx/neutron/plugins/vmware/nsx_cluster.py @@ -13,10 +13,10 @@ # License for the specific language governing permissions and limitations # under the License. -from neutron.i18n import _LI -from oslo.config import cfg +from oslo_config import cfg from oslo_log import log as logging +from neutron.i18n import _LI from vmware_nsx.neutron.plugins.vmware.common import exceptions LOG = logging.getLogger(__name__) diff --git a/vmware_nsx/neutron/plugins/vmware/nsxlib/__init__.py b/vmware_nsx/neutron/plugins/vmware/nsxlib/__init__.py index 887a7466bc..3ce476dbcb 100644 --- a/vmware_nsx/neutron/plugins/vmware/nsxlib/__init__.py +++ b/vmware_nsx/neutron/plugins/vmware/nsxlib/__init__.py @@ -13,11 +13,11 @@ # License for the specific language governing permissions and limitations # under the License. +from oslo_log import log +from oslo_serialization import jsonutils + from neutron.common import exceptions as exception from neutron import version -from oslo.serialization import jsonutils -from oslo_log import log - from vmware_nsx.neutron.plugins.vmware.api_client import exception as api_exc from vmware_nsx.neutron.plugins.vmware.common import exceptions as nsx_exc diff --git a/vmware_nsx/neutron/plugins/vmware/nsxlib/l2gateway.py b/vmware_nsx/neutron/plugins/vmware/nsxlib/l2gateway.py index 86f44c5afb..9214d67247 100644 --- a/vmware_nsx/neutron/plugins/vmware/nsxlib/l2gateway.py +++ b/vmware_nsx/neutron/plugins/vmware/nsxlib/l2gateway.py @@ -14,8 +14,8 @@ # under the License. # -from oslo.serialization import jsonutils from oslo_log import log +from oslo_serialization import jsonutils from vmware_nsx.neutron.plugins.vmware.api_client import exception as api_exc from vmware_nsx.neutron.plugins.vmware.common import exceptions as nsx_exc diff --git a/vmware_nsx/neutron/plugins/vmware/nsxlib/lsn.py b/vmware_nsx/neutron/plugins/vmware/nsxlib/lsn.py index e57c2606d9..2714398250 100644 --- a/vmware_nsx/neutron/plugins/vmware/nsxlib/lsn.py +++ b/vmware_nsx/neutron/plugins/vmware/nsxlib/lsn.py @@ -13,10 +13,10 @@ # License for the specific language governing permissions and limitations # under the License. -from neutron.common import exceptions as exception -from oslo.serialization import jsonutils from oslo_log import log +from oslo_serialization import jsonutils +from neutron.common import exceptions as exception from vmware_nsx.neutron.plugins.vmware.api_client import exception as api_exc from vmware_nsx.neutron.plugins.vmware.common import exceptions as nsx_exc from vmware_nsx.neutron.plugins.vmware.common import utils diff --git a/vmware_nsx/neutron/plugins/vmware/nsxlib/queue.py b/vmware_nsx/neutron/plugins/vmware/nsxlib/queue.py index feb5ff968b..020ac3970c 100644 --- a/vmware_nsx/neutron/plugins/vmware/nsxlib/queue.py +++ b/vmware_nsx/neutron/plugins/vmware/nsxlib/queue.py @@ -13,13 +13,12 @@ # License for the specific language governing permissions and limitations # under the License. -from oslo.serialization import jsonutils -from oslo.utils import excutils from oslo_log import log +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 vmware_nsx.neutron.plugins.vmware.api_client import exception as api_exc from vmware_nsx.neutron.plugins.vmware.common import utils from vmware_nsx.neutron.plugins.vmware import nsxlib diff --git a/vmware_nsx/neutron/plugins/vmware/nsxlib/router.py b/vmware_nsx/neutron/plugins/vmware/nsxlib/router.py index 2fb69eb1f6..eed214df07 100644 --- a/vmware_nsx/neutron/plugins/vmware/nsxlib/router.py +++ b/vmware_nsx/neutron/plugins/vmware/nsxlib/router.py @@ -13,14 +13,13 @@ # License for the specific language governing permissions and limitations # under the License. -from oslo.config import cfg -from oslo.serialization import jsonutils -from oslo.utils import excutils +from oslo_config import cfg from oslo_log import log +from oslo_serialization import jsonutils +from oslo_utils import excutils from neutron.common import exceptions as exception from neutron.i18n import _LE, _LI, _LW - from vmware_nsx.neutron.plugins.vmware.api_client import exception as api_exc from vmware_nsx.neutron.plugins.vmware.common import exceptions as nsx_exc from vmware_nsx.neutron.plugins.vmware.common import utils diff --git a/vmware_nsx/neutron/plugins/vmware/nsxlib/secgroup.py b/vmware_nsx/neutron/plugins/vmware/nsxlib/secgroup.py index 2d21f6f4aa..a0bcc97642 100644 --- a/vmware_nsx/neutron/plugins/vmware/nsxlib/secgroup.py +++ b/vmware_nsx/neutron/plugins/vmware/nsxlib/secgroup.py @@ -13,13 +13,13 @@ # License for the specific language governing permissions and limitations # under the License. +from oslo_log import log +from oslo_serialization import jsonutils +from oslo_utils import excutils + from neutron.common import constants from neutron.common import exceptions from neutron.i18n import _LW -from oslo.serialization import jsonutils -from oslo.utils import excutils -from oslo_log import log - from vmware_nsx.neutron.plugins.vmware.common import utils from vmware_nsx.neutron.plugins.vmware import nsxlib diff --git a/vmware_nsx/neutron/plugins/vmware/nsxlib/switch.py b/vmware_nsx/neutron/plugins/vmware/nsxlib/switch.py index 0c1a4592ca..ed2d843334 100644 --- a/vmware_nsx/neutron/plugins/vmware/nsxlib/switch.py +++ b/vmware_nsx/neutron/plugins/vmware/nsxlib/switch.py @@ -14,13 +14,13 @@ # under the License. # +from oslo_config import cfg +from oslo_log import log +from oslo_serialization import jsonutils + from neutron.common import constants from neutron.common import exceptions as exception from neutron.i18n import _LE, _LI, _LW -from oslo.config import cfg -from oslo.serialization import jsonutils -from oslo_log import log - from vmware_nsx.neutron.plugins.vmware.api_client import exception as api_exc from vmware_nsx.neutron.plugins.vmware.common import exceptions as nsx_exc from vmware_nsx.neutron.plugins.vmware.common import utils diff --git a/vmware_nsx/neutron/plugins/vmware/plugins/base.py b/vmware_nsx/neutron/plugins/vmware/plugins/base.py index ccd51dee01..bda37efd20 100644 --- a/vmware_nsx/neutron/plugins/vmware/plugins/base.py +++ b/vmware_nsx/neutron/plugins/vmware/plugins/base.py @@ -15,11 +15,11 @@ import uuid -from oslo.config import cfg -from oslo.db import exception as db_exc -from oslo.utils import excutils from oslo_concurrency import lockutils +from oslo_config import cfg +from oslo_db import exception as db_exc from oslo_log import log as logging +from oslo_utils import excutils from sqlalchemy import exc as sql_exc from sqlalchemy.orm import exc as sa_exc import webob.exc diff --git a/vmware_nsx/neutron/plugins/vmware/plugins/dvs.py b/vmware_nsx/neutron/plugins/vmware/plugins/dvs.py index 9d9fe4a19f..31ebccb693 100644 --- a/vmware_nsx/neutron/plugins/vmware/plugins/dvs.py +++ b/vmware_nsx/neutron/plugins/vmware/plugins/dvs.py @@ -15,8 +15,8 @@ import uuid -from oslo.utils import excutils from oslo_log import log as logging +from oslo_utils import excutils from neutron.api import extensions as neutron_extensions from neutron.api.v2 import attributes as attr @@ -32,7 +32,7 @@ from neutron.extensions import multiprovidernet as mpnet from neutron.extensions import portbindings as pbin from neutron.extensions import portsecurity as psec from neutron.extensions import providernet as pnet - +from neutron.i18n import _LE, _LW from vmware_nsx.neutron.plugins import vmware from vmware_nsx.neutron.plugins.vmware.common import config # noqa from vmware_nsx.neutron.plugins.vmware.common import exceptions as nsx_exc @@ -119,9 +119,9 @@ class NsxDvsV2(addr_pair_db.AllowedAddressPairsMixin, def _dvs_create_network(self, context, network): net_data = network['network'] if net_data['admin_state_up'] is False: - LOG.warning(_("Network with admin_state_up=False are not yet " - "supported by this plugin. Ignoring setting for " - "network %s"), net_data.get('name', '')) + LOG.warning(_LW("Network with admin_state_up=False are not yet " + "supported by this plugin. Ignoring setting for " + "network %s"), net_data.get('name', '')) net_data['id'] = str(uuid.uuid4()) vlan_tag = 0 if net_data.get(pnet.NETWORK_TYPE) == c_utils.NetworkTypes.VLAN: @@ -144,7 +144,7 @@ class NsxDvsV2(addr_pair_db.AllowedAddressPairsMixin, vlan_tag) except Exception: with excutils.save_and_reraise_exception(): - LOG.exception(_('Failed to create network')) + LOG.exception(_LE('Failed to create network')) self._dvs.delete_port_group(dvs_id) new_net[pnet.NETWORK_TYPE] = net_data.get(pnet.NETWORK_TYPE) @@ -164,7 +164,7 @@ class NsxDvsV2(addr_pair_db.AllowedAddressPairsMixin, try: self._dvs.delete_port_group(dvs_id) except Exception: - LOG.exception(_('Unable to delete DVS port group %s'), id) + LOG.exception(_LE('Unable to delete DVS port group %s'), id) self.handle_network_dhcp_access(context, id, action='delete_network') def delete_network(self, context, id): @@ -232,8 +232,8 @@ class NsxDvsV2(addr_pair_db.AllowedAddressPairsMixin, # remove ATTR_NOT_SPECIFIED port_data[addr_pair.ADDRESS_PAIRS] = [] - LOG.debug(_("create_port completed on NSX for tenant " - "%(tenant_id)s: (%(id)s)"), port_data) + LOG.debug("create_port completed on NSX for tenant " + "%(tenant_id)s: (%(id)s)", port_data) self._process_portbindings_create_and_update(context, port['port'], @@ -289,7 +289,7 @@ class NsxDvsV2(addr_pair_db.AllowedAddressPairsMixin, self._process_port_port_security_update( context, port['port'], ret_port) - LOG.debug(_("Updating port: %s"), port) + LOG.debug("Updating port: %s", port) self._process_portbindings_create_and_update(context, port['port'], ret_port) diff --git a/vmware_nsx/neutron/plugins/vmware/plugins/managers.py b/vmware_nsx/neutron/plugins/vmware/plugins/managers.py index 4cd1d9ddfc..8e5a544297 100644 --- a/vmware_nsx/neutron/plugins/vmware/plugins/managers.py +++ b/vmware_nsx/neutron/plugins/vmware/plugins/managers.py @@ -13,11 +13,12 @@ # License for the specific language governing permissions and limitations # under the License. -from oslo.config import cfg +from oslo_config import cfg import stevedore from oslo_log import log +from neutron.i18n import _LE, _LI from vmware_nsx.neutron.plugins.vmware.common import exceptions as nsx_exc @@ -32,14 +33,14 @@ class RouterTypeManager(stevedore.named.NamedExtensionManager): # Mapping from type name to DriverManager self.drivers = {} - LOG.info(_("Configured router type driver names: %s"), + LOG.info(_LI("Configured router type driver names: %s"), ROUTER_TYPE_DRIVERS) super(RouterTypeManager, self).__init__( 'vmware_nsx.neutron.nsxv.router_type_drivers', ROUTER_TYPE_DRIVERS, invoke_on_load=True, invoke_args=(plugin,)) - LOG.info(_("Loaded type driver names: %s"), self.names()) + LOG.info(_LI("Loaded type driver names: %s"), self.names()) self._register_types() self._check_tenant_router_types(cfg.CONF.nsxv.tenant_router_types) @@ -47,15 +48,15 @@ class RouterTypeManager(stevedore.named.NamedExtensionManager): for ext in self: router_type = ext.obj.get_type() if router_type in self.drivers: - LOG.error(_("Type driver '%(new_driver)s' ignored because " - "type driver '%(old_driver)s' is already " - "registered for type '%(type)s'"), + LOG.error(_LE("Type driver '%(new_driver)s' ignored because " + "type driver '%(old_driver)s' is already " + "registered for type '%(type)s'"), {'new_driver': ext.name, 'old_driver': self.drivers[router_type].name, 'type': router_type}) else: self.drivers[router_type] = ext - LOG.info(_("Registered types: %s"), self.drivers.keys()) + LOG.info(_LI("Registered types: %s"), self.drivers.keys()) def _check_tenant_router_types(self, types): self.tenant_router_types = [] @@ -67,7 +68,7 @@ class RouterTypeManager(stevedore.named.NamedExtensionManager): "Service terminated!") % router_type LOG.error(msg) raise SystemExit(msg) - LOG.info(_("Tenant router_types: %s"), self.tenant_router_types) + LOG.info(_LI("Tenant router_types: %s"), self.tenant_router_types) def get_tenant_router_driver(self, context, router_type): driver = self.drivers.get(router_type) diff --git a/vmware_nsx/neutron/plugins/vmware/plugins/nsx_v.py b/vmware_nsx/neutron/plugins/vmware/plugins/nsx_v.py index 08ecd98e8b..3e3dab2cb2 100644 --- a/vmware_nsx/neutron/plugins/vmware/plugins/nsx_v.py +++ b/vmware_nsx/neutron/plugins/vmware/plugins/nsx_v.py @@ -16,10 +16,10 @@ import uuid import netaddr -from oslo.config import cfg -from oslo.utils import excutils from oslo_concurrency import lockutils +from oslo_config import cfg from oslo_log import log as logging +from oslo_utils import excutils from sqlalchemy.orm import exc as sa_exc from neutron.api import extensions as neutron_extensions @@ -46,13 +46,12 @@ 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.i18n import _LE, _LW +from neutron.i18n import _LE, _LI, _LW from neutron.openstack.common import uuidutils from neutron.plugins.vmware.extensions import ( advancedserviceproviders as as_providers) from neutron.plugins.vmware.extensions import ( vnicindex as ext_vnic_idx) - from vmware_nsx.neutron.plugins import vmware from vmware_nsx.neutron.plugins.vmware.common import config # noqa from vmware_nsx.neutron.plugins.vmware.common import exceptions as nsx_exc @@ -457,8 +456,8 @@ class NsxVPluginV2(agents_db.AgentDbMixin, try: h, c = self.nsx_v.vcns.add_member_to_security_group( sg_id, vnic_id) - LOG.info(_("Added %s(sg_id)s member to NSX security " - "group %(vnic_id)s"), + LOG.info(_LI("Added %s(sg_id)s member to NSX security " + "group %(vnic_id)s"), {'sg_id': sg_id, 'vnic_id': vnic_id}) except Exception as e: LOG.debug("NSX security group %(sg_id)s member add " @@ -693,7 +692,7 @@ class NsxVPluginV2(agents_db.AgentDbMixin, self._delete_dhcp_edge_service(context, id) except Exception: with excutils.save_and_reraise_exception(): - LOG.exception(_('Failed to delete network')) + LOG.exception(_LE('Failed to delete network')) with context.session.begin(subtransactions=True): self._process_l3_delete(context, id) @@ -752,10 +751,10 @@ class NsxVPluginV2(agents_db.AgentDbMixin, original_network[psec.PORTSECURITY] != net_attrs[psec.PORTSECURITY]) if psec_update and not net_attrs[psec.PORTSECURITY]: - LOG.warning(_("Disabling port-security on network %s would " - "require instance in the network to have VM tools " - "installed in order for security-groups to " - "function properly.")) + LOG.warning(_LW("Disabling port-security on network %s would " + "require instance in the network to have VM tools " + "installed in order for security-groups to " + "function properly.")) with context.session.begin(subtransactions=True): net_res = super(NsxVPluginV2, self).update_network(context, id, @@ -848,10 +847,10 @@ class NsxVPluginV2(agents_db.AgentDbMixin, self._update_vnic_assigned_addresses( context.session, original_port, vnic_id) else: - LOG.warning(_("port-security is disabled on port %(id)s, " - "VM tools must be installed on instance " - "%(device_id)s for security-groups to function " - "properly "), + LOG.warning(_LW("port-security is disabled on port %(id)s, " + "VM tools must be installed on instance " + "%(device_id)s for security-groups to " + "function properly."), {'id': id, 'device_id': original_port['device_id']}) @@ -921,10 +920,11 @@ class NsxVPluginV2(agents_db.AgentDbMixin, self._update_vnic_assigned_addresses( context.session, ret_port, vnic_id) if not has_port_security and has_security_groups: - LOG.warning(_("port-security is disabled on port %(id)s, " - "VM tools must be installed on instance " - "%(device_id)s for security-groups to " - "function properly "), + LOG.warning(_LW("port-security is disabled on " + "port %(id)s, " + "VM tools must be installed on instance " + "%(device_id)s for security-groups to " + "function properly "), {'id': id, 'device_id': original_port['device_id']}) if delete_security_groups or has_security_groups: @@ -1846,7 +1846,7 @@ class NsxVPluginV2(agents_db.AgentDbMixin, try: self.nsx_v.vcns.edges_lock_operation() except Exception: - LOG.info(_("Unable to set manager lock operation")) + LOG.info(_LI("Unable to set manager lock operation")) def _validate_config(self): if not self.nsx_v.vcns.validate_dvs(cfg.CONF.nsxv.dvs_id): diff --git a/vmware_nsx/neutron/plugins/vmware/plugins/nsx_v_drivers/distributed_router_driver.py b/vmware_nsx/neutron/plugins/vmware/plugins/nsx_v_drivers/distributed_router_driver.py index 4f12a9028b..25d3b427c8 100644 --- a/vmware_nsx/neutron/plugins/vmware/plugins/nsx_v_drivers/distributed_router_driver.py +++ b/vmware_nsx/neutron/plugins/vmware/plugins/nsx_v_drivers/distributed_router_driver.py @@ -12,7 +12,7 @@ # License for the specific language governing permissions and limitations # under the License. -from oslo.utils import excutils +from oslo_utils import excutils from neutron.common import exceptions as n_exc diff --git a/vmware_nsx/neutron/plugins/vmware/plugins/nsx_v_drivers/shared_router_driver.py b/vmware_nsx/neutron/plugins/vmware/plugins/nsx_v_drivers/shared_router_driver.py index c694ceffb5..0ed0321349 100644 --- a/vmware_nsx/neutron/plugins/vmware/plugins/nsx_v_drivers/shared_router_driver.py +++ b/vmware_nsx/neutron/plugins/vmware/plugins/nsx_v_drivers/shared_router_driver.py @@ -12,14 +12,13 @@ # License for the specific language governing permissions and limitations # under the License. -from oslo.config import cfg from oslo_concurrency import lockutils +from oslo_config import cfg from neutron import context as neutron_context from neutron.db import l3_db from neutron.db import models_v2 from neutron.openstack.common import log as logging - from vmware_nsx.neutron.plugins.vmware.common import exceptions as nsx_exc from vmware_nsx.neutron.plugins.vmware.dbexts import nsxv_db from vmware_nsx.neutron.plugins.vmware.plugins import nsx_v diff --git a/vmware_nsx/neutron/plugins/vmware/plugins/nsx_v_md_proxy.py b/vmware_nsx/neutron/plugins/vmware/plugins/nsx_v_md_proxy.py index 295fbcbf83..2fd1d31591 100644 --- a/vmware_nsx/neutron/plugins/vmware/plugins/nsx_v_md_proxy.py +++ b/vmware_nsx/neutron/plugins/vmware/plugins/nsx_v_md_proxy.py @@ -19,14 +19,15 @@ import hmac import time import netaddr -from oslo.config import cfg -from oslo.db import exception as db_exc +from oslo_config import cfg +from oslo_db import exception as db_exc +from oslo_log import log as logging from oslo_utils import excutils from neutron.api.v2 import attributes as attr from neutron.common import constants from neutron import context as neutron_context -from oslo_log import log as logging +from neutron.i18n import _LE from vmware_nsx.neutron.plugins.vmware.common import exceptions as nsxv_exc from vmware_nsx.neutron.plugins.vmware.common import nsxv_constants from vmware_nsx.neutron.plugins.vmware.dbexts import nsxv_db @@ -155,8 +156,8 @@ class NsxVMetadataProxyHandler: if internal_net: self.nsxv_plugin.delete_network(self.context, internal_net) - LOG.exception(_("Exception %s while creating internal network " - "for metadata service"), e) + LOG.exception(_LE("Exception %s while creating internal " + "network for metadata service"), e) # Update the new network_id in DB nsxv_db.update_nsxv_internal_network( @@ -307,8 +308,8 @@ class NsxVMetadataProxyHandler: if rtr_id: self.nsxv_plugin.delete_router(self.context, rtr_id) - LOG.exception(_("Exception %s while creating internal edge " - "for metadata service"), e) + LOG.exception(_LE("Exception %s while creating internal edge " + "for metadata service"), e) def _get_address_groups(self, context, network_id, device_id, is_proxy): diff --git a/vmware_nsx/neutron/plugins/vmware/vshield/common/VcnsApiClient.py b/vmware_nsx/neutron/plugins/vmware/vshield/common/VcnsApiClient.py index 1e3c3e91d5..59884777ba 100644 --- a/vmware_nsx/neutron/plugins/vmware/vshield/common/VcnsApiClient.py +++ b/vmware_nsx/neutron/plugins/vmware/vshield/common/VcnsApiClient.py @@ -15,7 +15,7 @@ import base64 import eventlet -from oslo.serialization import jsonutils +from oslo_serialization import jsonutils from vmware_nsx.neutron.plugins.vmware.vshield.common import exceptions diff --git a/vmware_nsx/neutron/plugins/vmware/vshield/common/constants.py b/vmware_nsx/neutron/plugins/vmware/vshield/common/constants.py index aff10efadc..d0dfdb83a2 100644 --- a/vmware_nsx/neutron/plugins/vmware/vshield/common/constants.py +++ b/vmware_nsx/neutron/plugins/vmware/vshield/common/constants.py @@ -13,7 +13,7 @@ # License for the specific language governing permissions and limitations # under the License. -from oslo.config import cfg +from oslo_config import cfg from vmware_nsx.neutron.plugins.vmware.common import nsxv_constants diff --git a/vmware_nsx/neutron/plugins/vmware/vshield/edge_appliance_driver.py b/vmware_nsx/neutron/plugins/vmware/vshield/edge_appliance_driver.py index 5dd4948886..7792223d16 100644 --- a/vmware_nsx/neutron/plugins/vmware/vshield/edge_appliance_driver.py +++ b/vmware_nsx/neutron/plugins/vmware/vshield/edge_appliance_driver.py @@ -16,10 +16,10 @@ import time -from oslo.config import cfg -from oslo.serialization import jsonutils -from oslo.utils import excutils +from oslo_config import cfg from oslo_log import log as logging +from oslo_serialization import jsonutils +from oslo_utils import excutils from neutron.i18n import _LE, _LI, _LW from vmware_nsx.neutron.plugins.vmware.common import nsxv_constants @@ -497,7 +497,7 @@ class EdgeApplianceDriver(object): header = self.vcns.deploy_edge(edge, async=False)[0] edge_id = header['location'].split('/')[-1] - LOG.debug(_("VCNS: deploying edge %s"), edge_id) + LOG.debug("VCNS: deploying edge %s", edge_id) self.callbacks.edge_deploy_started_sync( jobdata['context'], edge_id, name, @@ -512,7 +512,7 @@ class EdgeApplianceDriver(object): jobdata['context'], edge_id, name, jobdata['router_id'], dist, False) with excutils.save_and_reraise_exception(): - LOG.exception(_("NSXv: deploy edge failed.")) + LOG.exception(_LE("NSXv: deploy edge failed.")) def update_edge(self, router_id, edge_id, name, internal_network, jobdata=None, dist=False, loadbalancer_enable=True, diff --git a/vmware_nsx/neutron/plugins/vmware/vshield/edge_firewall_driver.py b/vmware_nsx/neutron/plugins/vmware/vshield/edge_firewall_driver.py index 7a839a421e..8f3e4d10d4 100644 --- a/vmware_nsx/neutron/plugins/vmware/vshield/edge_firewall_driver.py +++ b/vmware_nsx/neutron/plugins/vmware/vshield/edge_firewall_driver.py @@ -12,7 +12,7 @@ # License for the specific language governing permissions and limitations # under the License. -from oslo.utils import excutils +from oslo_utils import excutils from neutron.db import db_base_plugin_v2 from neutron.i18n import _, _LE diff --git a/vmware_nsx/neutron/plugins/vmware/vshield/edge_ipsecvpn_driver.py b/vmware_nsx/neutron/plugins/vmware/vshield/edge_ipsecvpn_driver.py index 59ba5c6ae2..c013a01b52 100644 --- a/vmware_nsx/neutron/plugins/vmware/vshield/edge_ipsecvpn_driver.py +++ b/vmware_nsx/neutron/plugins/vmware/vshield/edge_ipsecvpn_driver.py @@ -12,7 +12,7 @@ # License for the specific language governing permissions and limitations # under the License. -from oslo.utils import excutils +from oslo_utils import excutils from neutron.i18n import _LE, _LW from neutron.openstack.common import log as logging diff --git a/vmware_nsx/neutron/plugins/vmware/vshield/edge_loadbalancer_driver.py b/vmware_nsx/neutron/plugins/vmware/vshield/edge_loadbalancer_driver.py index 3d2cc03eca..390de9bc28 100644 --- a/vmware_nsx/neutron/plugins/vmware/vshield/edge_loadbalancer_driver.py +++ b/vmware_nsx/neutron/plugins/vmware/vshield/edge_loadbalancer_driver.py @@ -12,7 +12,7 @@ # License for the specific language governing permissions and limitations # under the License. -from oslo.utils import excutils +from oslo_utils import excutils from neutron.i18n import _LE from neutron.openstack.common import log as logging diff --git a/vmware_nsx/neutron/plugins/vmware/vshield/edge_utils.py b/vmware_nsx/neutron/plugins/vmware/vshield/edge_utils.py index 1f0f7bdada..d47be233d5 100644 --- a/vmware_nsx/neutron/plugins/vmware/vshield/edge_utils.py +++ b/vmware_nsx/neutron/plugins/vmware/vshield/edge_utils.py @@ -16,10 +16,10 @@ import eventlet import time -from oslo.config import cfg -from oslo.utils import excutils from oslo_concurrency import lockutils +from oslo_config import cfg from oslo_log import log as logging +from oslo_utils import excutils from sqlalchemy.orm import exc as sa_exc from neutron.common import exceptions as n_exc @@ -702,9 +702,9 @@ class EdgeManager(object): except Exception: with excutils.save_and_reraise_exception(): LOG.exception( - _('Failed to delete vnic %(vnic_index)d ' - 'tunnel %(tunnel_index)d on edge ' - '%(edge_id)s'), + _LE('Failed to delete vnic %(vnic_index)d ' + 'tunnel %(tunnel_index)d on edge ' + '%(edge_id)s'), {'vnic_index': old_vnic_index, 'tunnel_index': old_tunnel_index, 'edge_id': edge_id}) @@ -1361,8 +1361,8 @@ def delete_interface(nsxv_manager, context, router_id, network_id, edge_vnic_binding = nsxv_db.get_edge_vnic_binding( context.session, edge_id, network_id) if not edge_vnic_binding: - LOG.warning(_("Failed to find the network %(net_id)s " - "corresponding vnic index on edge %(edge_id)s"), + LOG.warning(_LW("Failed to find the network %(net_id)s " + "corresponding vnic index on edge %(edge_id)s"), {'net_id': network_id, 'edge_id': edge_id}) @@ -1429,8 +1429,8 @@ def check_network_in_use_at_backend(context, network_id): context.session, network_id) if not edge_vnic_bindings: return - LOG.warning(_('NSXv: network is still in use at the backend')) - LOG.error(_('NSXv: network is still in use at the backend')) + LOG.warning(_LW('NSXv: network is still in use at the backend')) + LOG.error(_LE('NSXv: network is still in use at the backend')) class NsxVCallbacks(object): diff --git a/vmware_nsx/neutron/plugins/vmware/vshield/nsxv_edge_cfg_obj.py b/vmware_nsx/neutron/plugins/vmware/vshield/nsxv_edge_cfg_obj.py index 1fad22f989..aad90b3edc 100644 --- a/vmware_nsx/neutron/plugins/vmware/vshield/nsxv_edge_cfg_obj.py +++ b/vmware_nsx/neutron/plugins/vmware/vshield/nsxv_edge_cfg_obj.py @@ -15,7 +15,7 @@ import abc -from oslo.serialization import jsonutils +from oslo_serialization import jsonutils import six from vmware_nsx.neutron.plugins.vmware.vshield import vcns diff --git a/vmware_nsx/neutron/plugins/vmware/vshield/vcns.py b/vmware_nsx/neutron/plugins/vmware/vshield/vcns.py index 91c4e3c360..319188609a 100644 --- a/vmware_nsx/neutron/plugins/vmware/vshield/vcns.py +++ b/vmware_nsx/neutron/plugins/vmware/vshield/vcns.py @@ -14,9 +14,9 @@ # License for the specific language governing permissions and limitations # under the License. -from oslo.config import cfg -from oslo.serialization import jsonutils +from oslo_config import cfg from oslo_log import log as logging +from oslo_serialization import jsonutils import retrying import xml.etree.ElementTree as et diff --git a/vmware_nsx/neutron/plugins/vmware/vshield/vcns_driver.py b/vmware_nsx/neutron/plugins/vmware/vshield/vcns_driver.py index b19b0bdbf4..30ec7a366a 100644 --- a/vmware_nsx/neutron/plugins/vmware/vshield/vcns_driver.py +++ b/vmware_nsx/neutron/plugins/vmware/vshield/vcns_driver.py @@ -14,7 +14,7 @@ # License for the specific language governing permissions and limitations # under the License. -from oslo.config import cfg +from oslo_config import cfg from oslo_log import log as logging from vmware_nsx.neutron.plugins.vmware.common import config # noqa diff --git a/vmware_nsx/neutron/tests/unit/__init__.py b/vmware_nsx/neutron/tests/unit/__init__.py index 3e3c66c01f..faed26a532 100644 --- a/vmware_nsx/neutron/tests/unit/__init__.py +++ b/vmware_nsx/neutron/tests/unit/__init__.py @@ -13,7 +13,7 @@ # License for the specific language governing permissions and limitations # under the License. -from oslo.config import cfg +from oslo_config import cfg cfg.CONF.use_stderr = False diff --git a/vmware_nsx/neutron/tests/unit/vmware/apiclient/fake.py b/vmware_nsx/neutron/tests/unit/vmware/apiclient/fake.py index 1e4b4ff9dd..814c508692 100644 --- a/vmware_nsx/neutron/tests/unit/vmware/apiclient/fake.py +++ b/vmware_nsx/neutron/tests/unit/vmware/apiclient/fake.py @@ -12,11 +12,11 @@ # License for the specific language governing permissions and limitations # under the License. -from neutron.openstack.common import uuidutils -from oslo.serialization import jsonutils from oslo_log import log as logging +from oslo_serialization import jsonutils import six.moves.urllib.parse as urlparse +from neutron.openstack.common import uuidutils from vmware_nsx.neutron.plugins.vmware.api_client import exception as api_exc diff --git a/vmware_nsx/neutron/tests/unit/vmware/db/test_nsx_db.py b/vmware_nsx/neutron/tests/unit/vmware/db/test_nsx_db.py index a998d3c46b..f398723f72 100644 --- a/vmware_nsx/neutron/tests/unit/vmware/db/test_nsx_db.py +++ b/vmware_nsx/neutron/tests/unit/vmware/db/test_nsx_db.py @@ -13,7 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -from oslo.db import exception as d_exc +from oslo_db import exception as d_exc from neutron import context from neutron.db import models_v2 diff --git a/vmware_nsx/neutron/tests/unit/vmware/extensions/test_maclearning.py b/vmware_nsx/neutron/tests/unit/vmware/extensions/test_maclearning.py index 50352e2204..b7f2c0f381 100644 --- a/vmware_nsx/neutron/tests/unit/vmware/extensions/test_maclearning.py +++ b/vmware_nsx/neutron/tests/unit/vmware/extensions/test_maclearning.py @@ -15,8 +15,7 @@ import contextlib import mock - -from oslo.config import cfg +from oslo_config import cfg from neutron.api.v2 import attributes from neutron.common import test_lib diff --git a/vmware_nsx/neutron/tests/unit/vmware/extensions/test_networkgw.py b/vmware_nsx/neutron/tests/unit/vmware/extensions/test_networkgw.py index c2f100989a..9bd7aa5dd4 100644 --- a/vmware_nsx/neutron/tests/unit/vmware/extensions/test_networkgw.py +++ b/vmware_nsx/neutron/tests/unit/vmware/extensions/test_networkgw.py @@ -15,7 +15,7 @@ import contextlib import mock -from oslo.config import cfg +from oslo_config import cfg from webob import exc import webtest @@ -33,7 +33,6 @@ from neutron.tests.unit import test_api_v2 from neutron.tests.unit import test_db_plugin from neutron.tests.unit import test_extensions from neutron.tests.unit import testlib_plugin - from vmware_nsx.neutron.plugins.vmware.api_client import exception as api_exc from vmware_nsx.neutron.plugins.vmware.common import exceptions as nsx_exc from vmware_nsx.neutron.plugins.vmware.dbexts import networkgw_db diff --git a/vmware_nsx/neutron/tests/unit/vmware/extensions/test_providernet.py b/vmware_nsx/neutron/tests/unit/vmware/extensions/test_providernet.py index f759262289..7c9380033d 100644 --- a/vmware_nsx/neutron/tests/unit/vmware/extensions/test_providernet.py +++ b/vmware_nsx/neutron/tests/unit/vmware/extensions/test_providernet.py @@ -13,7 +13,7 @@ # License for the specific language governing permissions and limitations # under the License. -from oslo.config import cfg +from oslo_config import cfg import webob.exc from neutron.extensions import multiprovidernet as mpnet diff --git a/vmware_nsx/neutron/tests/unit/vmware/extensions/test_qosqueues.py b/vmware_nsx/neutron/tests/unit/vmware/extensions/test_qosqueues.py index 900a9def3f..fab77cb78a 100644 --- a/vmware_nsx/neutron/tests/unit/vmware/extensions/test_qosqueues.py +++ b/vmware_nsx/neutron/tests/unit/vmware/extensions/test_qosqueues.py @@ -16,13 +16,12 @@ import contextlib import mock -from oslo.config import cfg +from oslo_config import cfg import webob.exc from neutron import context from neutron.plugins.vmware.extensions import qos as ext_qos from neutron.tests.unit import test_extensions - from vmware_nsx.neutron.plugins.vmware.dbexts import qos_db from vmware_nsx.neutron.plugins.vmware import nsxlib from vmware_nsx.neutron.tests.unit import vmware diff --git a/vmware_nsx/neutron/tests/unit/vmware/extensions/test_vnic_index.py b/vmware_nsx/neutron/tests/unit/vmware/extensions/test_vnic_index.py index aa700dbac0..c2cd069ec1 100644 --- a/vmware_nsx/neutron/tests/unit/vmware/extensions/test_vnic_index.py +++ b/vmware_nsx/neutron/tests/unit/vmware/extensions/test_vnic_index.py @@ -13,8 +13,8 @@ # License for the specific language governing permissions and limitations # under the License. -from oslo.config import cfg -from oslo.db import exception as d_exc +from oslo_config import cfg +from oslo_db import exception as d_exc from neutron.api.v2 import attributes as attr from neutron import context as neutron_context diff --git a/vmware_nsx/neutron/tests/unit/vmware/nsx_v/test_nsxv_loadbalancer.py b/vmware_nsx/neutron/tests/unit/vmware/nsx_v/test_nsxv_loadbalancer.py index 8e7fb8fb92..f61cbe33cf 100644 --- a/vmware_nsx/neutron/tests/unit/vmware/nsx_v/test_nsxv_loadbalancer.py +++ b/vmware_nsx/neutron/tests/unit/vmware/nsx_v/test_nsxv_loadbalancer.py @@ -13,9 +13,8 @@ # License for the specific language governing permissions and limitations # under the License. -import json - import mock +from oslo_serialization import jsonutils from neutron.tests import base from vmware_nsx.neutron.plugins.vmware.vshield import nsxv_loadbalancer @@ -79,7 +78,7 @@ class NsxvLoadbalancerTestCase(base.BaseTestCase): def test_get_edge_loadbalancer(self): h = None - v = json.loads(self.EDGE_OBJ_JSON) + v = jsonutils.loads(self.EDGE_OBJ_JSON) with mock.patch.object(self._vcns, 'do_request', return_value=(h, v)) as mock_do_request: diff --git a/vmware_nsx/neutron/tests/unit/vmware/nsxlib/test_l2gateway.py b/vmware_nsx/neutron/tests/unit/vmware/nsxlib/test_l2gateway.py index 6cd992623b..47379bd9f8 100644 --- a/vmware_nsx/neutron/tests/unit/vmware/nsxlib/test_l2gateway.py +++ b/vmware_nsx/neutron/tests/unit/vmware/nsxlib/test_l2gateway.py @@ -15,9 +15,9 @@ # import mock -from neutron.tests.unit import test_api_v2 -from oslo.serialization import jsonutils +from oslo_serialization import jsonutils +from neutron.tests.unit import test_api_v2 from vmware_nsx.neutron.plugins.vmware.api_client import exception from vmware_nsx.neutron.plugins.vmware.common import utils as nsx_utils from vmware_nsx.neutron.plugins.vmware import nsxlib diff --git a/vmware_nsx/neutron/tests/unit/vmware/nsxlib/test_lsn.py b/vmware_nsx/neutron/tests/unit/vmware/nsxlib/test_lsn.py index 2a62642fdd..2c0ffdc862 100644 --- a/vmware_nsx/neutron/tests/unit/vmware/nsxlib/test_lsn.py +++ b/vmware_nsx/neutron/tests/unit/vmware/nsxlib/test_lsn.py @@ -14,9 +14,10 @@ # limitations under the License. import mock +from oslo_serialization import jsonutils + from neutron.common import exceptions from neutron.tests import base -from oslo.serialization import jsonutils from vmware_nsx.neutron.plugins.vmware.api_client import exception as api_exc from vmware_nsx.neutron.plugins.vmware.common import exceptions as nsx_exc diff --git a/vmware_nsx/neutron/tests/unit/vmware/nsxlib/test_router.py b/vmware_nsx/neutron/tests/unit/vmware/nsxlib/test_router.py index c17fc8daa4..1510cae779 100644 --- a/vmware_nsx/neutron/tests/unit/vmware/nsxlib/test_router.py +++ b/vmware_nsx/neutron/tests/unit/vmware/nsxlib/test_router.py @@ -16,7 +16,7 @@ import mock -from oslo.config import cfg +from oslo_config import cfg from neutron.common import exceptions from neutron.openstack.common import uuidutils diff --git a/vmware_nsx/neutron/tests/unit/vmware/test_agent_scheduler.py b/vmware_nsx/neutron/tests/unit/vmware/test_agent_scheduler.py index cf03c590a6..fe5923272c 100644 --- a/vmware_nsx/neutron/tests/unit/vmware/test_agent_scheduler.py +++ b/vmware_nsx/neutron/tests/unit/vmware/test_agent_scheduler.py @@ -14,7 +14,7 @@ # under the License. import mock -from oslo.config import cfg +from oslo_config import cfg from neutron.common import constants from neutron.common import test_lib diff --git a/vmware_nsx/neutron/tests/unit/vmware/test_dhcpmeta.py b/vmware_nsx/neutron/tests/unit/vmware/test_dhcpmeta.py index 332e20e10c..14b5363a34 100644 --- a/vmware_nsx/neutron/tests/unit/vmware/test_dhcpmeta.py +++ b/vmware_nsx/neutron/tests/unit/vmware/test_dhcpmeta.py @@ -14,12 +14,13 @@ # limitations under the License. import mock +from oslo_config import cfg + from neutron.common import constants as n_consts from neutron.common import exceptions as n_exc from neutron import context from neutron.tests import base from neutron.tests.unit import testlib_api -from oslo.config import cfg from vmware_nsx.neutron.plugins.vmware.api_client import exception from vmware_nsx.neutron.plugins.vmware.common import exceptions as p_exc diff --git a/vmware_nsx/neutron/tests/unit/vmware/test_dvs.py b/vmware_nsx/neutron/tests/unit/vmware/test_dvs.py index c626a67680..b7debce35c 100644 --- a/vmware_nsx/neutron/tests/unit/vmware/test_dvs.py +++ b/vmware_nsx/neutron/tests/unit/vmware/test_dvs.py @@ -15,7 +15,7 @@ import contextlib import mock -from oslo.config import cfg +from oslo_config import cfg from neutron.common import exceptions as exp from neutron import context diff --git a/vmware_nsx/neutron/tests/unit/vmware/test_dvs_utils.py b/vmware_nsx/neutron/tests/unit/vmware/test_dvs_utils.py index 54fcc95353..5605be3433 100644 --- a/vmware_nsx/neutron/tests/unit/vmware/test_dvs_utils.py +++ b/vmware_nsx/neutron/tests/unit/vmware/test_dvs_utils.py @@ -14,8 +14,8 @@ # limitations under the License. import mock -from oslo.config import cfg -from oslo.vmware import api +from oslo_config import cfg +from oslo_vmware import api from neutron.tests import base from vmware_nsx.neutron.plugins.vmware.dvs import dvs_utils diff --git a/vmware_nsx/neutron/tests/unit/vmware/test_nsx_opts.py b/vmware_nsx/neutron/tests/unit/vmware/test_nsx_opts.py index fba304a3ee..833f42c79a 100644 --- a/vmware_nsx/neutron/tests/unit/vmware/test_nsx_opts.py +++ b/vmware_nsx/neutron/tests/unit/vmware/test_nsx_opts.py @@ -16,12 +16,11 @@ import fixtures import mock -from oslo.config import cfg +from oslo_config import cfg from neutron import manager from neutron.openstack.common import uuidutils from neutron.tests import base - from vmware_nsx.neutron.plugins.vmware.api_client import client from vmware_nsx.neutron.plugins.vmware.api_client import version from vmware_nsx.neutron.plugins.vmware.common import config # noqa diff --git a/vmware_nsx/neutron/tests/unit/vmware/test_nsx_plugin.py b/vmware_nsx/neutron/tests/unit/vmware/test_nsx_plugin.py index 355cf309a5..8e7401e336 100644 --- a/vmware_nsx/neutron/tests/unit/vmware/test_nsx_plugin.py +++ b/vmware_nsx/neutron/tests/unit/vmware/test_nsx_plugin.py @@ -18,8 +18,8 @@ import uuid import mock import netaddr -from oslo.config import cfg -from oslo.db import exception as db_exc +from oslo_config import cfg +from oslo_db import exception as db_exc from oslo_log import log from sqlalchemy import exc as sql_exc import webob.exc diff --git a/vmware_nsx/neutron/tests/unit/vmware/test_nsx_sync.py b/vmware_nsx/neutron/tests/unit/vmware/test_nsx_sync.py index df748d06d5..75d1891a90 100644 --- a/vmware_nsx/neutron/tests/unit/vmware/test_nsx_sync.py +++ b/vmware_nsx/neutron/tests/unit/vmware/test_nsx_sync.py @@ -18,9 +18,9 @@ import contextlib import time import mock -from oslo.config import cfg -from oslo.serialization import jsonutils +from oslo_config import cfg from oslo_log import log +from oslo_serialization import jsonutils from neutron.api.v2 import attributes as attr from neutron.common import constants diff --git a/vmware_nsx/neutron/tests/unit/vmware/test_nsx_v_plugin.py b/vmware_nsx/neutron/tests/unit/vmware/test_nsx_v_plugin.py index 21679d5234..f6ec49bb9c 100644 --- a/vmware_nsx/neutron/tests/unit/vmware/test_nsx_v_plugin.py +++ b/vmware_nsx/neutron/tests/unit/vmware/test_nsx_v_plugin.py @@ -16,7 +16,7 @@ import contextlib from eventlet import greenthread import mock -from oslo.config import cfg +from oslo_config import cfg import webob.exc from neutron.api.v2 import attributes @@ -443,12 +443,10 @@ class TestPortsV2(NsxVPluginV2TestCase, instance with existing port. """ with self.port() as port: - with mock.patch(PLUGIN_NAME + '._create_dhcp_static_binding') as ( - _create_dhcp_static_binding_mock): + with mock.patch(PLUGIN_NAME + '._create_dhcp_static_binding'): update = {'port': {'device_owner'}} self.new_update_request('ports', update, port['port']['id']) - _create_dhcp_static_binding_mock.assert_called_once() def test_create_port_public_network_with_ip(self): with self.network(shared=True) as network: @@ -1307,15 +1305,13 @@ class TestExclusiveRouterTestCase(L3NatTest, p1_id = p1['port']['id'] p2_id = p2['port']['id'] with self.floatingip_with_assoc(port_id=p1_id) as fip: - with self._mock_edge_router_update_with_exception() as ( - update_edge): + with self._mock_edge_router_update_with_exception(): self.assertRaises(object, p.update_floatingip, context.get_admin_context(), fip['floatingip']['id'], floatingip={'floatingip': {'port_id': p2_id}}) - update_edge.assert_called_once() res = self._list( 'floatingips', query_params="port_id=%s" % p1_id) self.assertEqual(len(res['floatingips']), 1) @@ -1345,13 +1341,11 @@ class TestExclusiveRouterTestCase(L3NatTest, 'floating_network_id': public_network_id, 'port_id': port_id}} - with self._mock_edge_router_update_with_exception() as ( - update_edge): + with self._mock_edge_router_update_with_exception(): self.assertRaises(object, p.create_floatingip, context.get_admin_context(), floatingip=floatingip) - update_edge.assert_called_once() res = self._list( 'floatingips', query_params="port_id=%s" % port_id) self.assertEqual(len(res['floatingips']), 0) diff --git a/vmware_nsx/neutron/tests/unit/vmware/vshield/fake_vcns.py b/vmware_nsx/neutron/tests/unit/vmware/vshield/fake_vcns.py index 8857b0cba5..8267cfcd62 100644 --- a/vmware_nsx/neutron/tests/unit/vmware/vshield/fake_vcns.py +++ b/vmware_nsx/neutron/tests/unit/vmware/vshield/fake_vcns.py @@ -14,7 +14,7 @@ import copy -from oslo.serialization import jsonutils as json +from oslo_serialization import jsonutils import xml.etree.ElementTree as ET from neutron.openstack.common import uuidutils @@ -100,7 +100,7 @@ class FakeVcns(object): 'moduleName': 'vShield Edge', 'errorData': None } - return (header, json.dumps(response)) + return (header, jsonutils.dumps(response)) self._job_idx = self._job_idx + 1 job_id = "jobdata-%d" % self._job_idx @@ -382,7 +382,8 @@ class FakeVcns(object): # The lswitch is created via VCNS API so the fake nsx_api will not # see it. Added to fake nsx_api here. if self._fake_nsx_api: - lswitch = self._fake_nsx_api._add_lswitch(json.dumps(lsconfig)) + lswitch = self._fake_nsx_api._add_lswitch( + jsonutils.dumps(lsconfig)) else: lswitch = lsconfig lswitch['uuid'] = uuidutils.generate_uuid() diff --git a/vmware_nsx/neutron/tests/unit/vmware/vshield/test_edge_utils.py b/vmware_nsx/neutron/tests/unit/vmware/vshield/test_edge_utils.py index 22b7c2de50..e81896668b 100644 --- a/vmware_nsx/neutron/tests/unit/vmware/vshield/test_edge_utils.py +++ b/vmware_nsx/neutron/tests/unit/vmware/vshield/test_edge_utils.py @@ -14,7 +14,7 @@ # import mock -from oslo.config import cfg +from oslo_config import cfg from neutron.common import exceptions as n_exc from neutron import context