From 7dde4283b7ccbd596c2927ce2799abe4dfbe531d Mon Sep 17 00:00:00 2001 From: Gary Kotton Date: Mon, 29 Feb 2016 00:04:28 -0800 Subject: [PATCH] NSX: make use of neutron_lib constants Commit 87a79256c494c36f2d9597313f430b24c0110161 added neutron_lib for shared constants. This patch moves us to make use of the aforementioned library. Change-Id: I9f541602a2c321c56f4d99c3ddf5a3f4b7e07ffe --- requirements.txt | 1 + vmware_nsx/common/sync.py | 2 +- vmware_nsx/dhcp_meta/combined.py | 3 ++- vmware_nsx/dhcp_meta/constants.py | 2 +- vmware_nsx/dhcp_meta/migration.py | 2 +- vmware_nsx/dhcp_meta/modes.py | 2 +- vmware_nsx/dhcp_meta/nsx.py | 2 +- vmware_nsx/dhcp_meta/rpc.py | 2 +- vmware_nsx/nsxlib/mh/secgroup.py | 2 +- vmware_nsx/nsxlib/mh/switch.py | 2 +- vmware_nsx/nsxlib/v3/security.py | 2 +- vmware_nsx/plugins/nsx_mh/plugin.py | 2 +- vmware_nsx/plugins/nsx_v/md_proxy.py | 2 +- vmware_nsx/plugins/nsx_v/plugin.py | 2 +- vmware_nsx/plugins/nsx_v3/plugin.py | 2 +- vmware_nsx/tests/unit/extensions/test_metadata.py | 2 +- vmware_nsx/tests/unit/nsx_mh/test_agent_scheduler.py | 2 +- vmware_nsx/tests/unit/nsx_mh/test_dhcpmeta.py | 2 +- vmware_nsx/tests/unit/nsx_mh/test_plugin.py | 2 +- vmware_nsx/tests/unit/nsx_mh/test_sync.py | 2 +- vmware_nsx/tests/unit/nsx_v/test_plugin.py | 3 +-- vmware_nsx/tests/unit/nsx_v3/test_plugin.py | 2 +- vmware_nsx/tests/unit/nsxlib/mh/test_secgroup.py | 2 +- vmware_nsx/tests/unit/nsxlib/mh/test_switch.py | 2 +- 24 files changed, 25 insertions(+), 24 deletions(-) diff --git a/requirements.txt b/requirements.txt index d3b0d1e3cc..a7d96f9d38 100644 --- a/requirements.txt +++ b/requirements.txt @@ -11,6 +11,7 @@ retrying!=1.3.0,>=1.2.3 # Apache-2.0 SQLAlchemy<1.1.0,>=1.0.10 # MIT six>=1.9.0 # MIT stevedore>=1.5.0 # Apache-2.0 +neutron-lib>=0.0.1 # Apache-2.0 oslo.concurrency>=3.5.0 # Apache-2.0 oslo.config>=3.7.0 # Apache-2.0 oslo.db>=4.1.0 # Apache-2.0 diff --git a/vmware_nsx/common/sync.py b/vmware_nsx/common/sync.py index 21ad29273e..cf9f3e9915 100644 --- a/vmware_nsx/common/sync.py +++ b/vmware_nsx/common/sync.py @@ -15,13 +15,13 @@ import random +from neutron_lib import constants from oslo_log import log from oslo_serialization import jsonutils from oslo_service import loopingcall from oslo_utils import timeutils import six -from neutron.common import constants from neutron.common import exceptions from neutron import context from neutron.db import external_net_db diff --git a/vmware_nsx/dhcp_meta/combined.py b/vmware_nsx/dhcp_meta/combined.py index 116096c20c..b846bf84b3 100644 --- a/vmware_nsx/dhcp_meta/combined.py +++ b/vmware_nsx/dhcp_meta/combined.py @@ -16,8 +16,9 @@ # from neutron.api.rpc.agentnotifiers import dhcp_rpc_agent_api -from neutron.common import constants as const from neutron.common import topics +from neutron_lib import constants as const + from vmware_nsx.dhcp_meta import nsx as nsx_svc from vmware_nsx.dhcp_meta import rpc as nsx_rpc diff --git a/vmware_nsx/dhcp_meta/constants.py b/vmware_nsx/dhcp_meta/constants.py index 1e9476a5b1..0d697a986e 100644 --- a/vmware_nsx/dhcp_meta/constants.py +++ b/vmware_nsx/dhcp_meta/constants.py @@ -14,8 +14,8 @@ # License for the specific language governing permissions and limitations # under the License. # -from neutron.common import constants as const from neutron.db import l3_db +from neutron_lib import constants as const # A unique MAC to quickly identify the LSN port used for metadata services # when dhcp on the subnet is off. Inspired by leet-speak for 'metadata'. diff --git a/vmware_nsx/dhcp_meta/migration.py b/vmware_nsx/dhcp_meta/migration.py index 1554017ecf..77cf676d96 100644 --- a/vmware_nsx/dhcp_meta/migration.py +++ b/vmware_nsx/dhcp_meta/migration.py @@ -15,9 +15,9 @@ # under the License. # -from neutron.common import constants as const from neutron.common import exceptions as n_exc from neutron.extensions import external_net +from neutron_lib import constants as const from oslo_log import log as logging from vmware_nsx._i18n import _, _LE diff --git a/vmware_nsx/dhcp_meta/modes.py b/vmware_nsx/dhcp_meta/modes.py index e1f78a35ab..0cd3ccb6b2 100644 --- a/vmware_nsx/dhcp_meta/modes.py +++ b/vmware_nsx/dhcp_meta/modes.py @@ -15,6 +15,7 @@ # under the License. # +from neutron_lib import constants as const from oslo_concurrency import lockutils from oslo_config import cfg from oslo_log import log as logging @@ -23,7 +24,6 @@ from oslo_utils import importutils from neutron.api.rpc.agentnotifiers import dhcp_rpc_agent_api from neutron.api.rpc.handlers import dhcp_rpc from neutron.api.rpc.handlers import metadata_rpc -from neutron.common import constants as const from neutron.common import rpc as n_rpc from neutron.common import topics from neutron.db import agents_db diff --git a/vmware_nsx/dhcp_meta/nsx.py b/vmware_nsx/dhcp_meta/nsx.py index a36e42792c..814ee35e02 100644 --- a/vmware_nsx/dhcp_meta/nsx.py +++ b/vmware_nsx/dhcp_meta/nsx.py @@ -15,12 +15,12 @@ # under the License. # +from neutron_lib import constants as const 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 from neutron.db import db_base_plugin_v2 from neutron.db import l3_db diff --git a/vmware_nsx/dhcp_meta/rpc.py b/vmware_nsx/dhcp_meta/rpc.py index cecd7872c9..0f1da2e1c7 100644 --- a/vmware_nsx/dhcp_meta/rpc.py +++ b/vmware_nsx/dhcp_meta/rpc.py @@ -16,12 +16,12 @@ from eventlet import greenthread import netaddr +from neutron_lib import constants as const 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 from neutron.common import exceptions as ntn_exc from neutron.db import db_base_plugin_v2 from neutron.db import models_v2 diff --git a/vmware_nsx/nsxlib/mh/secgroup.py b/vmware_nsx/nsxlib/mh/secgroup.py index 6fa0a045ef..c93bff5a85 100644 --- a/vmware_nsx/nsxlib/mh/secgroup.py +++ b/vmware_nsx/nsxlib/mh/secgroup.py @@ -13,11 +13,11 @@ # License for the specific language governing permissions and limitations # under the License. +from neutron_lib import constants 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 vmware_nsx._i18n import _LW diff --git a/vmware_nsx/nsxlib/mh/switch.py b/vmware_nsx/nsxlib/mh/switch.py index d5dd83b1ef..7ce6823ec3 100644 --- a/vmware_nsx/nsxlib/mh/switch.py +++ b/vmware_nsx/nsxlib/mh/switch.py @@ -14,11 +14,11 @@ # under the License. # +from neutron_lib import constants 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 vmware_nsx._i18n import _, _LE, _LI, _LW diff --git a/vmware_nsx/nsxlib/v3/security.py b/vmware_nsx/nsxlib/v3/security.py index 2eb0f350b7..b1d3c90bc3 100644 --- a/vmware_nsx/nsxlib/v3/security.py +++ b/vmware_nsx/nsxlib/v3/security.py @@ -20,7 +20,7 @@ NSX-V3 Plugin security integration module import uuid -from neutron.common import constants +from neutron_lib import constants from oslo_config import cfg from oslo_log import log diff --git a/vmware_nsx/plugins/nsx_mh/plugin.py b/vmware_nsx/plugins/nsx_mh/plugin.py index b780ca6ea0..21537c7c6b 100644 --- a/vmware_nsx/plugins/nsx_mh/plugin.py +++ b/vmware_nsx/plugins/nsx_mh/plugin.py @@ -15,6 +15,7 @@ import uuid +from neutron_lib import constants from oslo_concurrency import lockutils from oslo_config import cfg from oslo_db import exception as db_exc @@ -28,7 +29,6 @@ import webob.exc from neutron.api import extensions as neutron_extensions from neutron.api.v2 import attributes as attr from neutron.api.v2 import base -from neutron.common import constants from neutron.common import exceptions as n_exc from neutron import context as q_context from neutron.db import agentschedulers_db diff --git a/vmware_nsx/plugins/nsx_v/md_proxy.py b/vmware_nsx/plugins/nsx_v/md_proxy.py index b4a6305288..fe2dff2dbc 100644 --- a/vmware_nsx/plugins/nsx_v/md_proxy.py +++ b/vmware_nsx/plugins/nsx_v/md_proxy.py @@ -19,8 +19,8 @@ import hmac import netaddr from neutron.api.v2 import attributes as attr -from neutron.common import constants from neutron import context as neutron_context +from neutron_lib import constants as constants from oslo_config import cfg from oslo_log import log as logging diff --git a/vmware_nsx/plugins/nsx_v/plugin.py b/vmware_nsx/plugins/nsx_v/plugin.py index c0a70fa834..07d4b395dd 100644 --- a/vmware_nsx/plugins/nsx_v/plugin.py +++ b/vmware_nsx/plugins/nsx_v/plugin.py @@ -18,6 +18,7 @@ import six import uuid import netaddr +from neutron_lib import constants from oslo_config import cfg from oslo_log import log as logging from oslo_utils import excutils @@ -29,7 +30,6 @@ from neutron.api.v2 import attributes as attr from neutron.callbacks import events from neutron.callbacks import registry from neutron.callbacks import resources -from neutron.common import constants from neutron.common import exceptions as n_exc from neutron.db import agents_db from neutron.db import allowedaddresspairs_db as addr_pair_db diff --git a/vmware_nsx/plugins/nsx_v3/plugin.py b/vmware_nsx/plugins/nsx_v3/plugin.py index 2f74481ef8..16900dd08d 100644 --- a/vmware_nsx/plugins/nsx_v3/plugin.py +++ b/vmware_nsx/plugins/nsx_v3/plugin.py @@ -23,7 +23,6 @@ from neutron.callbacks import events from neutron.callbacks import exceptions as callback_exc from neutron.callbacks import registry from neutron.callbacks import resources -from neutron.common import constants as const from neutron.common import exceptions as n_exc from neutron.common import rpc as n_rpc from neutron.common import topics @@ -53,6 +52,7 @@ from neutron.extensions import providernet as pnet from neutron.extensions import securitygroup as ext_sg from neutron.plugins.common import constants as plugin_const from neutron.plugins.common import utils as n_utils +from neutron_lib import constants as const from oslo_config import cfg from oslo_log import log from oslo_utils import excutils diff --git a/vmware_nsx/tests/unit/extensions/test_metadata.py b/vmware_nsx/tests/unit/extensions/test_metadata.py index bf408a45cf..39aea5e564 100644 --- a/vmware_nsx/tests/unit/extensions/test_metadata.py +++ b/vmware_nsx/tests/unit/extensions/test_metadata.py @@ -15,10 +15,10 @@ import mock import netaddr +from neutron_lib import constants from oslo_config import cfg import webob.exc -from neutron.common import constants from neutron.common import exceptions as n_exc from neutron import manager diff --git a/vmware_nsx/tests/unit/nsx_mh/test_agent_scheduler.py b/vmware_nsx/tests/unit/nsx_mh/test_agent_scheduler.py index 77964e004e..23e5b06eee 100644 --- a/vmware_nsx/tests/unit/nsx_mh/test_agent_scheduler.py +++ b/vmware_nsx/tests/unit/nsx_mh/test_agent_scheduler.py @@ -14,9 +14,9 @@ # under the License. import mock +from neutron_lib import constants from oslo_config import cfg -from neutron.common import constants from neutron.tests.unit.db import test_agentschedulers_db # noqa from vmware_nsx.common import sync diff --git a/vmware_nsx/tests/unit/nsx_mh/test_dhcpmeta.py b/vmware_nsx/tests/unit/nsx_mh/test_dhcpmeta.py index 426a097292..9a7f64b1ad 100644 --- a/vmware_nsx/tests/unit/nsx_mh/test_dhcpmeta.py +++ b/vmware_nsx/tests/unit/nsx_mh/test_dhcpmeta.py @@ -14,9 +14,9 @@ # limitations under the License. import mock +from neutron_lib import constants as n_consts 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 diff --git a/vmware_nsx/tests/unit/nsx_mh/test_plugin.py b/vmware_nsx/tests/unit/nsx_mh/test_plugin.py index bbe956690c..95021b0b86 100644 --- a/vmware_nsx/tests/unit/nsx_mh/test_plugin.py +++ b/vmware_nsx/tests/unit/nsx_mh/test_plugin.py @@ -17,7 +17,6 @@ import uuid import mock from neutron.api.v2 import attributes -from neutron.common import constants from neutron.common import exceptions as ntn_exc from neutron import context from neutron.extensions import dvr @@ -35,6 +34,7 @@ import neutron.tests.unit.extensions.test_l3 as test_l3_plugin import neutron.tests.unit.extensions.test_l3_ext_gw_mode as test_ext_gw_mode import neutron.tests.unit.extensions.test_securitygroup as ext_sg from neutron.tests.unit import testlib_api +from neutron_lib import constants from oslo_config import cfg from oslo_db import exception as db_exc from oslo_log import log diff --git a/vmware_nsx/tests/unit/nsx_mh/test_sync.py b/vmware_nsx/tests/unit/nsx_mh/test_sync.py index a698c3b5b5..c5cb2105ef 100644 --- a/vmware_nsx/tests/unit/nsx_mh/test_sync.py +++ b/vmware_nsx/tests/unit/nsx_mh/test_sync.py @@ -18,12 +18,12 @@ import contextlib import time import mock +from neutron_lib import constants 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 from neutron.common import exceptions as n_exc from neutron import context from neutron.extensions import l3 diff --git a/vmware_nsx/tests/unit/nsx_v/test_plugin.py b/vmware_nsx/tests/unit/nsx_v/test_plugin.py index 5e9720a1f2..85b1274136 100644 --- a/vmware_nsx/tests/unit/nsx_v/test_plugin.py +++ b/vmware_nsx/tests/unit/nsx_v/test_plugin.py @@ -18,7 +18,6 @@ from eventlet import greenthread import mock import netaddr from neutron.api.v2 import attributes -from neutron.common import constants from neutron.common import exceptions as n_exc from neutron import context from neutron.extensions import dvr as dist_router @@ -30,7 +29,6 @@ from neutron.extensions import portsecurity as psec from neutron.extensions import providernet as pnet from neutron.extensions import securitygroup as secgrp from neutron import manager - from neutron.tests.unit import _test_extension_portbindings as test_bindings import neutron.tests.unit.db.test_allowedaddresspairs_db as test_addr_pair import neutron.tests.unit.db.test_db_base_plugin_v2 as test_plugin @@ -39,6 +37,7 @@ import neutron.tests.unit.extensions.test_l3_ext_gw_mode as test_ext_gw_mode import neutron.tests.unit.extensions.test_portsecurity as test_psec import neutron.tests.unit.extensions.test_securitygroup as ext_sg from neutron.tests.unit import testlib_api +from neutron_lib import constants from oslo_config import cfg from oslo_db import exception as db_exc from oslo_utils import uuidutils diff --git a/vmware_nsx/tests/unit/nsx_v3/test_plugin.py b/vmware_nsx/tests/unit/nsx_v3/test_plugin.py index b54c881060..cb8fca138b 100644 --- a/vmware_nsx/tests/unit/nsx_v3/test_plugin.py +++ b/vmware_nsx/tests/unit/nsx_v3/test_plugin.py @@ -16,7 +16,6 @@ import mock import six from neutron.api.v2 import attributes -from neutron.common import constants from neutron.common import exceptions as n_exc from neutron import context from neutron.db import models_v2 @@ -40,6 +39,7 @@ from neutron.tests.unit.scheduler \ import test_dhcp_agent_scheduler as test_dhcpagent from neutron import version +from neutron_lib import constants from oslo_config import cfg from oslo_serialization import jsonutils from oslo_utils import uuidutils diff --git a/vmware_nsx/tests/unit/nsxlib/mh/test_secgroup.py b/vmware_nsx/tests/unit/nsxlib/mh/test_secgroup.py index 9b592559b7..83b081b251 100644 --- a/vmware_nsx/tests/unit/nsxlib/mh/test_secgroup.py +++ b/vmware_nsx/tests/unit/nsxlib/mh/test_secgroup.py @@ -14,9 +14,9 @@ # limitations under the License. # -from neutron.common import constants from neutron.common import exceptions from neutron.tests.unit.api.v2 import test_base +from neutron_lib import constants from vmware_nsx.nsxlib import mh as nsxlib from vmware_nsx.nsxlib.mh import secgroup as secgrouplib diff --git a/vmware_nsx/tests/unit/nsxlib/mh/test_switch.py b/vmware_nsx/tests/unit/nsxlib/mh/test_switch.py index 6e153feac5..7efefb7e0e 100644 --- a/vmware_nsx/tests/unit/nsxlib/mh/test_switch.py +++ b/vmware_nsx/tests/unit/nsxlib/mh/test_switch.py @@ -17,9 +17,9 @@ import hashlib import mock -from neutron.common import constants from neutron.common import exceptions from neutron.tests.unit.api.v2 import test_base +from neutron_lib import constants from vmware_nsx.common import utils from vmware_nsx.nsxlib.mh import switch as switchlib