]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Move in-tree vendor AGENT_TYPE_* constants
authorCedric Brandily <zzelle@gmail.com>
Fri, 21 Aug 2015 20:48:42 +0000 (22:48 +0200)
committerCedric Brandily <zzelle@gmail.com>
Mon, 24 Aug 2015 20:16:05 +0000 (20:16 +0000)
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

neutron/common/constants.py
neutron/plugins/hyperv/agent/l2_agent.py
neutron/plugins/ibm/agent/sdnve_neutron_agent.py
neutron/plugins/ml2/drivers/hyperv/constants.py
neutron/plugins/ml2/drivers/hyperv/mech_hyperv.py
neutron/plugins/ml2/drivers/mlnx/mech_mlnx.py
neutron/tests/unit/plugins/ml2/drivers/mlnx/test_mech_mlnx.py

index e9424b2378b477b1394e10605a36db6b303b41fe..b8277dbafe5f5545af72876017c4e16a0c470e1b 100644 (file)
@@ -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'
 
index 5b6a8f31dec8b6a634d57a4eb731e9b339ccd0d2..956e1ec38fae9f5ec40246b84e6ce6c5b1b50f8e 100644 (file)
@@ -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):
index a9827c52e145de575803267ac0dc1967fc6b72f9..d0a4df61bc66c824cdd1835408661ea8ce1b5171 100644 (file)
@@ -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:
index 18697f2317731c3f1950a28bbd3647b3352693f9..1eaa1001e0fea2a2c14d760aaf423eb01f9bd2a0 100644 (file)
@@ -13,4 +13,5 @@
 #    License for the specific language governing permissions and limitations
 #    under the License.
 
+AGENT_TYPE_HYPERV = 'hyperv'
 VIF_TYPE_HYPERV = 'hyperv'
index d11877226d0088df88a850e0d09fd5e4ce837a3e..704d91829da5dc84001a1b8086f47455121ffc71 100644 (file)
@@ -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})
index 90d1d21944e8b8a9d97cf4c1eb67d3faea5f404f..024a6411bc0ace82777f51b3258e2dc4aff055dd 100644 (file)
 
 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])
index 4f3b0320beda87180e1d5116996880ca85f13c82..7c18ff593ab8bf62b4e4cd2317f607aa20e12747 100644 (file)
@@ -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'}