From 5106963756f5b6572fb8153f40001a86d0b5bb4d Mon Sep 17 00:00:00 2001 From: Boden R Date: Thu, 1 Mar 2018 15:51:12 -0700 Subject: [PATCH] remove SHARED constant that now lives in neutron-lib The SHARED constant was rehomed into neutron-lib with commit If123044496b54a8bfc115ab41b8506ec5d7ba5a3 This patch removes the SHARED constant from vmware-nsx and switches all uses to neutron-lib's version. Change-Id: I8ab75021399b5a85f5bfe8de858d8c4309b741dc --- vmware_nsx/common/nsxv_constants.py | 1 - vmware_nsx/db/routertype.py | 5 +++-- vmware_nsx/plugins/nsx_mh/plugin.py | 3 +-- vmware_nsx/plugins/nsx_v/plugin.py | 2 +- vmware_nsx/services/vpnaas/nsxv/ipsec_validator.py | 3 ++- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/vmware_nsx/common/nsxv_constants.py b/vmware_nsx/common/nsxv_constants.py index c878d68b39..c3c91e972c 100644 --- a/vmware_nsx/common/nsxv_constants.py +++ b/vmware_nsx/common/nsxv_constants.py @@ -20,7 +20,6 @@ XLARGE = 'xlarge' QUADLARGE = 'quadlarge' -SHARED = "shared" EXCLUSIVE = "exclusive" # Edge type diff --git a/vmware_nsx/db/routertype.py b/vmware_nsx/db/routertype.py index 5dfdff8e9c..671dedbce3 100644 --- a/vmware_nsx/db/routertype.py +++ b/vmware_nsx/db/routertype.py @@ -14,7 +14,8 @@ # under the License. # -from vmware_nsx.common import nsxv_constants +from neutron_lib import constants + from vmware_nsx.db import ( distributedrouter as dist_rtr) from vmware_nsx.extensions import routertype as rt_rtr @@ -26,5 +27,5 @@ class RouterType_mixin(dist_rtr.DistributedRouter_mixin): nsx_attributes = ( dist_rtr.DistributedRouter_mixin.nsx_attributes + [{ 'name': rt_rtr.ROUTER_TYPE, - 'default': nsxv_constants.SHARED + 'default': constants.SHARED }]) diff --git a/vmware_nsx/plugins/nsx_mh/plugin.py b/vmware_nsx/plugins/nsx_mh/plugin.py index 2f43e28357..2633a3e72a 100644 --- a/vmware_nsx/plugins/nsx_mh/plugin.py +++ b/vmware_nsx/plugins/nsx_mh/plugin.py @@ -37,7 +37,6 @@ from sqlalchemy.orm import exc as sa_exc import webob.exc from neutron.api import extensions as neutron_extensions -from neutron.api.v2 import attributes as attr from neutron.db import _model_query as model_query from neutron.db import _resource_extend as resource_extend from neutron.db import _utils as db_utils @@ -963,7 +962,7 @@ class NsxPluginV2(addr_pair_db.AllowedAddressPairsMixin, self.cluster, net_data['id'], tenant_id, net_data.get('name'), transport_zone_config, - shared=net_data.get(attr.SHARED)) + shared=net_data.get(constants.SHARED)) with db_api.context_manager.writer.using(context): new_net = super(NsxPluginV2, self).create_network(context, diff --git a/vmware_nsx/plugins/nsx_v/plugin.py b/vmware_nsx/plugins/nsx_v/plugin.py index 0be7f31b74..499c3faebf 100644 --- a/vmware_nsx/plugins/nsx_v/plugin.py +++ b/vmware_nsx/plugins/nsx_v/plugin.py @@ -3067,7 +3067,7 @@ class NsxVPluginV2(addr_pair_db.AllowedAddressPairsMixin, # exception. r = router['router'] if validators.is_attr_set(r.get(ROUTER_SIZE)): - if r.get('router_type') == nsxv_constants.SHARED: + if r.get('router_type') == constants.SHARED: msg = _("Cannot specify router-size for shared router") raise n_exc.BadRequest(resource="router", msg=msg) elif r.get('distributed') is True: diff --git a/vmware_nsx/services/vpnaas/nsxv/ipsec_validator.py b/vmware_nsx/services/vpnaas/nsxv/ipsec_validator.py index 259cca161f..7c04cc2fe1 100644 --- a/vmware_nsx/services/vpnaas/nsxv/ipsec_validator.py +++ b/vmware_nsx/services/vpnaas/nsxv/ipsec_validator.py @@ -13,6 +13,7 @@ # License for the specific language governing permissions and limitations # under the License. +from neutron_lib import constants from neutron_vpnaas.db.vpn import vpn_validator from oslo_log import log as logging @@ -80,7 +81,7 @@ class IPsecValidator(vpn_validator.VpnReferenceValidator): break def _is_shared_router(self, router): - return router.get('router_type') == nsxv_constants.SHARED + return router.get('router_type') == constants.SHARED def _validate_router(self, context, router_id): # Only support distributed and exclusive router type