From: Cedric Brandily Date: Fri, 21 Aug 2015 20:48:42 +0000 (+0200) Subject: Move in-tree vendor AGENT_TYPE_* constants X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=e394b04e5c339e08435e9635a58c6d4689b6545b;p=openstack-build%2Fneutron-build.git Move in-tree vendor AGENT_TYPE_* constants AGENT_TYPE_* constants[1] define all agent types BUT vendor ones are only used by in-tree vendor code. This changes moves in-tree AGENT_TYPE_* constants[2] to vendor modules to ensure they will be removed from neutron code on decomposition. [1] in neutron.common.constants [2] AGENT_TYPE_HYPERV/MLNX/SDNVE Change-Id: Id03fb147e11541be309c1cd22ce27e70fadc28b5 Partial-Bug: #1487598 --- diff --git a/neutron/common/constants.py b/neutron/common/constants.py index e9424b237..b8277dbaf 100644 --- a/neutron/common/constants.py +++ b/neutron/common/constants.py @@ -90,15 +90,12 @@ FLOODING_ENTRY = ('00:00:00:00:00:00', '0.0.0.0') AGENT_TYPE_DHCP = 'DHCP agent' AGENT_TYPE_OVS = 'Open vSwitch agent' AGENT_TYPE_LINUXBRIDGE = 'Linux bridge agent' -AGENT_TYPE_HYPERV = 'HyperV agent' AGENT_TYPE_NEC = 'NEC plugin agent' AGENT_TYPE_OFA = 'OFA driver agent' AGENT_TYPE_L3 = 'L3 agent' AGENT_TYPE_LOADBALANCER = 'Loadbalancer agent' -AGENT_TYPE_MLNX = 'Mellanox plugin agent' AGENT_TYPE_METERING = 'Metering agent' AGENT_TYPE_METADATA = 'Metadata agent' -AGENT_TYPE_SDNVE = 'IBM SDN-VE agent' AGENT_TYPE_NIC_SWITCH = 'NIC Switch agent' L2_AGENT_TOPIC = 'N/A' diff --git a/neutron/plugins/hyperv/agent/l2_agent.py b/neutron/plugins/hyperv/agent/l2_agent.py index 5b6a8f31d..956e1ec38 100644 --- a/neutron/plugins/hyperv/agent/l2_agent.py +++ b/neutron/plugins/hyperv/agent/l2_agent.py @@ -29,6 +29,7 @@ from neutron.common import rpc as n_rpc from neutron.common import topics from neutron import context from neutron.i18n import _LE +from neutron.plugins.ml2.drivers.hyperv import constants as h_const LOG = logging.getLogger(__name__) CONF = cfg.CONF @@ -82,7 +83,7 @@ class HyperVNeutronAgent(hyperv_neutron_agent.HyperVNeutronAgentMixin): 'host': CONF.host, 'topic': n_const.L2_AGENT_TOPIC, 'configurations': configurations, - 'agent_type': n_const.AGENT_TYPE_HYPERV, + 'agent_type': h_const.AGENT_TYPE_HYPERV, 'start_flag': True} def _report_state(self): diff --git a/neutron/plugins/ibm/agent/sdnve_neutron_agent.py b/neutron/plugins/ibm/agent/sdnve_neutron_agent.py index a9827c52e..d0a4df61b 100644 --- a/neutron/plugins/ibm/agent/sdnve_neutron_agent.py +++ b/neutron/plugins/ibm/agent/sdnve_neutron_agent.py @@ -44,6 +44,8 @@ LOG = logging.getLogger(__name__) cfg.CONF.import_group('SDNVE', 'neutron.plugins.ibm.common.config') cfg.CONF.import_group('SDNVE_AGENT', 'neutron.plugins.ibm.common.config') +AGENT_TYPE_SDNVE = 'IBM SDN-VE agent' + class SdnvePluginApi(agent_rpc.PluginApi): @@ -87,7 +89,7 @@ class SdnveNeutronAgent(object): 'reset_br': self.reset_br, 'out_of_band': self.out_of_band, 'controller_ip': self.controller_ip}, - 'agent_type': n_const.AGENT_TYPE_SDNVE, + 'agent_type': AGENT_TYPE_SDNVE, 'start_flag': True} if self.int_bridge_name: diff --git a/neutron/plugins/ml2/drivers/hyperv/constants.py b/neutron/plugins/ml2/drivers/hyperv/constants.py index 18697f231..1eaa1001e 100644 --- a/neutron/plugins/ml2/drivers/hyperv/constants.py +++ b/neutron/plugins/ml2/drivers/hyperv/constants.py @@ -13,4 +13,5 @@ # License for the specific language governing permissions and limitations # under the License. +AGENT_TYPE_HYPERV = 'hyperv' VIF_TYPE_HYPERV = 'hyperv' diff --git a/neutron/plugins/ml2/drivers/hyperv/mech_hyperv.py b/neutron/plugins/ml2/drivers/hyperv/mech_hyperv.py index d11877226..704d91829 100644 --- a/neutron/plugins/ml2/drivers/hyperv/mech_hyperv.py +++ b/neutron/plugins/ml2/drivers/hyperv/mech_hyperv.py @@ -15,9 +15,8 @@ from hyperv.neutron.ml2 import mech_hyperv -from neutron.common import constants from neutron.extensions import portbindings -from neutron.plugins.ml2.drivers.hyperv import constants as h_constants +from neutron.plugins.ml2.drivers.hyperv import constants as constants from neutron.plugins.ml2.drivers import mech_agent @@ -34,5 +33,5 @@ class HypervMechanismDriver(mech_hyperv.HypervMechanismDriver, def __init__(self): super(HypervMechanismDriver, self).__init__( constants.AGENT_TYPE_HYPERV, - h_constants.VIF_TYPE_HYPERV, + constants.VIF_TYPE_HYPERV, {portbindings.CAP_PORT_FILTER: False}) diff --git a/neutron/plugins/ml2/drivers/mlnx/mech_mlnx.py b/neutron/plugins/ml2/drivers/mlnx/mech_mlnx.py index 90d1d2194..024a6411b 100644 --- a/neutron/plugins/ml2/drivers/mlnx/mech_mlnx.py +++ b/neutron/plugins/ml2/drivers/mlnx/mech_mlnx.py @@ -16,13 +16,13 @@ from oslo_log import log -from neutron.common import constants as n_const from neutron.extensions import portbindings from neutron.plugins.common import constants as p_constants from neutron.plugins.ml2 import driver_api as api from neutron.plugins.ml2.drivers import mech_agent LOG = log.getLogger(__name__) +AGENT_TYPE_MLNX = 'Mellanox plugin agent' VIF_TYPE_IB_HOSTDEV = 'ib_hostdev' @@ -38,7 +38,7 @@ class MlnxMechanismDriver(mech_agent.SimpleAgentMechanismDriverBase): def __init__(self): super(MlnxMechanismDriver, self).__init__( - agent_type=n_const.AGENT_TYPE_MLNX, + agent_type=AGENT_TYPE_MLNX, vif_type=VIF_TYPE_IB_HOSTDEV, vif_details={portbindings.CAP_PORT_FILTER: False}, supported_vnic_types=[portbindings.VNIC_DIRECT]) diff --git a/neutron/tests/unit/plugins/ml2/drivers/mlnx/test_mech_mlnx.py b/neutron/tests/unit/plugins/ml2/drivers/mlnx/test_mech_mlnx.py index 4f3b0320b..7c18ff593 100644 --- a/neutron/tests/unit/plugins/ml2/drivers/mlnx/test_mech_mlnx.py +++ b/neutron/tests/unit/plugins/ml2/drivers/mlnx/test_mech_mlnx.py @@ -15,7 +15,6 @@ import sys import mock -from neutron.common import constants from neutron.extensions import portbindings from neutron.plugins.ml2 import driver_api as api from neutron.tests.unit.plugins.ml2 import _test_mech_agent as base @@ -35,7 +34,7 @@ with mock.patch.dict(sys.modules, class MlnxMechanismBaseTestCase(base.AgentMechanismBaseTestCase): VIF_TYPE = mech_mlnx.VIF_TYPE_IB_HOSTDEV CAP_PORT_FILTER = False - AGENT_TYPE = constants.AGENT_TYPE_MLNX + AGENT_TYPE = mech_mlnx.AGENT_TYPE_MLNX VNIC_TYPE = portbindings.VNIC_DIRECT GOOD_MAPPINGS = {'fake_physical_network': 'fake_bridge'}