From 85eb37c3c88c459a73efbf9ddeccab83a9f11468 Mon Sep 17 00:00:00 2001 From: Cedric Brandily Date: Sat, 22 Aug 2015 00:00:27 +0200 Subject: [PATCH] Define VIF_TYPE_DVS in vmware-nsx repo VIF_TYPE_DVS is only used by vmware-nsx. That's why this change defines it in order to allow its removal from neutron code. Related-Bug: #1486279 Change-Id: I6d4a62399e21204038145363445d356dfb1bfe89 --- vmware_nsx/neutron/plugins/vmware/common/nsx_constants.py | 3 +++ vmware_nsx/neutron/plugins/vmware/plugins/dvs.py | 3 ++- vmware_nsx/neutron/plugins/vmware/plugins/nsx_v.py | 3 ++- vmware_nsx/neutron/tests/unit/vmware/test_nsx_v_plugin.py | 3 ++- 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/vmware_nsx/neutron/plugins/vmware/common/nsx_constants.py b/vmware_nsx/neutron/plugins/vmware/common/nsx_constants.py index e37793ce6e..b9d37527ad 100644 --- a/vmware_nsx/neutron/plugins/vmware/common/nsx_constants.py +++ b/vmware_nsx/neutron/plugins/vmware/common/nsx_constants.py @@ -36,3 +36,6 @@ ROUTER_TYPE_TIER0 = "TIER0" ROUTER_TYPE_TIER1 = "TIER1" ROUTER_TYPES = [ROUTER_TYPE_TIER0, ROUTER_TYPE_TIER1] + +# L2 agent vif type +VIF_TYPE_DVS = 'dvs' diff --git a/vmware_nsx/neutron/plugins/vmware/plugins/dvs.py b/vmware_nsx/neutron/plugins/vmware/plugins/dvs.py index b855d8845e..cfd58ac8f4 100644 --- a/vmware_nsx/neutron/plugins/vmware/plugins/dvs.py +++ b/vmware_nsx/neutron/plugins/vmware/plugins/dvs.py @@ -42,6 +42,7 @@ from neutron.plugins.common import utils 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 +from vmware_nsx.neutron.plugins.vmware.common import nsx_constants from vmware_nsx.neutron.plugins.vmware.common import utils as c_utils from vmware_nsx.neutron.plugins.vmware.dbexts import db as nsx_db from vmware_nsx.neutron.plugins.vmware import dhcpmeta_modes @@ -84,7 +85,7 @@ class NsxDvsV2(addr_pair_db.AllowedAddressPairsMixin, # Common driver code self.base_binding_dict = { - pbin.VIF_TYPE: pbin.VIF_TYPE_DVS, + pbin.VIF_TYPE: nsx_constants.VIF_TYPE_DVS, pbin.VIF_DETAILS: { # TODO(rkukura): Replace with new VIF security details pbin.CAP_PORT_FILTER: diff --git a/vmware_nsx/neutron/plugins/vmware/plugins/nsx_v.py b/vmware_nsx/neutron/plugins/vmware/plugins/nsx_v.py index afd015b700..072925e30c 100644 --- a/vmware_nsx/neutron/plugins/vmware/plugins/nsx_v.py +++ b/vmware_nsx/neutron/plugins/vmware/plugins/nsx_v.py @@ -54,6 +54,7 @@ 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 from vmware_nsx.neutron.plugins.vmware.common import locking +from vmware_nsx.neutron.plugins.vmware.common import nsx_constants from vmware_nsx.neutron.plugins.vmware.common import utils as c_utils from vmware_nsx.neutron.plugins.vmware.dbexts import ( routertype as rt_rtr) @@ -117,7 +118,7 @@ class NsxVPluginV2(agents_db.AgentDbMixin, self.base_binding_dict = { pbin.VNIC_TYPE: pbin.VNIC_NORMAL, - pbin.VIF_TYPE: pbin.VIF_TYPE_DVS, + pbin.VIF_TYPE: nsx_constants.VIF_TYPE_DVS, pbin.VIF_DETAILS: { # TODO(rkukura): Replace with new VIF security details pbin.CAP_PORT_FILTER: 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 60feb2a459..4182fa8058 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 @@ -45,6 +45,7 @@ from oslo_utils import uuidutils import six import webob.exc +from vmware_nsx.neutron.plugins.vmware.common import nsx_constants from vmware_nsx.neutron.plugins.vmware.dbexts import nsxv_db from vmware_nsx.neutron.plugins.vmware.extensions import ( routertype as router_type) @@ -317,7 +318,7 @@ class TestPortsV2(NsxVPluginV2TestCase, test_bindings.PortBindingsHostTestCaseMixin, test_bindings.PortBindingsVnicTestCaseMixin): - VIF_TYPE = portbindings.VIF_TYPE_DVS + VIF_TYPE = nsx_constants.VIF_TYPE_DVS HAS_PORT_FILTER = True def test_create_port_json(self):