Merge "Use correct base class for unit tests for ML2 drivers"
This commit is contained in:
@@ -20,14 +20,14 @@ from neutron.openstack.common import log as logging
|
||||
from neutron.plugins.ml2 import config as ml2_config
|
||||
from neutron.plugins.ml2.drivers.brocade import (mechanism_brocade
|
||||
as brocademechanism)
|
||||
from neutron.tests.unit import test_db_plugin
|
||||
from neutron.tests.unit.ml2 import test_ml2_plugin
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
MECHANISM_NAME = ('neutron.plugins.ml2.'
|
||||
'drivers.brocade.mechanism_brocade.BrocadeMechanism')
|
||||
|
||||
|
||||
class TestBrocadeMechDriverV2(test_db_plugin.NeutronDbPluginV2TestCase):
|
||||
class TestBrocadeMechDriverV2(test_ml2_plugin.Ml2PluginV2TestCase):
|
||||
"""Test Brocade VCS/VDX mechanism driver.
|
||||
"""
|
||||
|
||||
@@ -53,17 +53,17 @@ class TestBrocadeMechDriverV2(test_db_plugin.NeutronDbPluginV2TestCase):
|
||||
self.mechanism_driver = importutils.import_object(_mechanism_name)
|
||||
|
||||
|
||||
class TestBrocadeMechDriverNetworksV2(test_db_plugin.TestNetworksV2,
|
||||
class TestBrocadeMechDriverNetworksV2(test_ml2_plugin.TestMl2NetworksV2,
|
||||
TestBrocadeMechDriverV2):
|
||||
pass
|
||||
|
||||
|
||||
class TestBrocadeMechDriverPortsV2(test_db_plugin.TestPortsV2,
|
||||
class TestBrocadeMechDriverPortsV2(test_ml2_plugin.TestMl2PortsV2,
|
||||
TestBrocadeMechDriverV2):
|
||||
pass
|
||||
|
||||
|
||||
class TestBrocadeMechDriverSubnetsV2(test_db_plugin.TestSubnetsV2,
|
||||
class TestBrocadeMechDriverSubnetsV2(test_ml2_plugin.TestMl2SubnetsV2,
|
||||
TestBrocadeMechDriverV2):
|
||||
pass
|
||||
|
||||
|
||||
@@ -24,7 +24,6 @@ from neutron.extensions import portbindings
|
||||
from neutron import manager
|
||||
from neutron.openstack.common import log as logging
|
||||
from neutron.plugins.common import constants as p_const
|
||||
from neutron.plugins.ml2 import config as ml2_config
|
||||
from neutron.plugins.ml2 import driver_api as api
|
||||
from neutron.plugins.ml2 import driver_context
|
||||
from neutron.plugins.ml2.drivers.cisco.nexus import config as cisco_config
|
||||
@@ -32,12 +31,10 @@ from neutron.plugins.ml2.drivers.cisco.nexus import exceptions as c_exc
|
||||
from neutron.plugins.ml2.drivers.cisco.nexus import mech_cisco_nexus
|
||||
from neutron.plugins.ml2.drivers.cisco.nexus import nexus_db_v2
|
||||
from neutron.plugins.ml2.drivers.cisco.nexus import nexus_network_driver
|
||||
from neutron.plugins.ml2.drivers import type_vlan as vlan_config
|
||||
from neutron.tests.unit import test_db_plugin
|
||||
from neutron.tests.unit.ml2 import test_ml2_plugin
|
||||
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
ML2_PLUGIN = 'neutron.plugins.ml2.plugin.Ml2Plugin'
|
||||
PHYS_NET = 'physnet1'
|
||||
COMP_HOST_NAME = 'testhost'
|
||||
COMP_HOST_NAME_2 = 'testhost_2'
|
||||
@@ -61,7 +58,8 @@ BOUND_SEGMENT2 = {api.NETWORK_TYPE: p_const.TYPE_VLAN,
|
||||
api.SEGMENTATION_ID: VLAN_START + 1}
|
||||
|
||||
|
||||
class CiscoML2MechanismTestCase(test_db_plugin.NeutronDbPluginV2TestCase):
|
||||
class CiscoML2MechanismTestCase(test_ml2_plugin.Ml2PluginV2TestCase):
|
||||
_mechanism_drivers = ['cisco_nexus']
|
||||
|
||||
def setUp(self):
|
||||
"""Configure for end-to-end neutron testing using a mock ncclient.
|
||||
@@ -75,20 +73,6 @@ class CiscoML2MechanismTestCase(test_db_plugin.NeutronDbPluginV2TestCase):
|
||||
|
||||
"""
|
||||
|
||||
# Configure the ML2 mechanism drivers and network types
|
||||
ml2_opts = {
|
||||
'mechanism_drivers': ['cisco_nexus'],
|
||||
'tenant_network_types': ['vlan'],
|
||||
}
|
||||
for opt, val in ml2_opts.items():
|
||||
ml2_config.cfg.CONF.set_override(opt, val, 'ml2')
|
||||
|
||||
# Configure the ML2 VLAN parameters
|
||||
phys_vrange = ':'.join([PHYS_NET, str(VLAN_START), str(VLAN_END)])
|
||||
vlan_config.cfg.CONF.set_override('network_vlan_ranges',
|
||||
[phys_vrange],
|
||||
'ml2_type_vlan')
|
||||
|
||||
# Configure the Cisco Nexus mechanism driver
|
||||
nexus_config = {
|
||||
(NEXUS_IP_ADDR, 'username'): 'admin',
|
||||
@@ -135,7 +119,7 @@ class CiscoML2MechanismTestCase(test_db_plugin.NeutronDbPluginV2TestCase):
|
||||
'_is_status_active').start()
|
||||
self.mock_status.side_effect = _mock_check_bind_state
|
||||
|
||||
super(CiscoML2MechanismTestCase, self).setUp(ML2_PLUGIN)
|
||||
super(CiscoML2MechanismTestCase, self).setUp()
|
||||
|
||||
self.port_create_status = 'DOWN'
|
||||
|
||||
@@ -228,19 +212,19 @@ class CiscoML2MechanismTestCase(test_db_plugin.NeutronDbPluginV2TestCase):
|
||||
|
||||
|
||||
class TestCiscoBasicGet(CiscoML2MechanismTestCase,
|
||||
test_db_plugin.TestBasicGet):
|
||||
test_ml2_plugin.TestMl2BasicGet):
|
||||
|
||||
pass
|
||||
|
||||
|
||||
class TestCiscoV2HTTPResponse(CiscoML2MechanismTestCase,
|
||||
test_db_plugin.TestV2HTTPResponse):
|
||||
test_ml2_plugin.TestMl2V2HTTPResponse):
|
||||
|
||||
pass
|
||||
|
||||
|
||||
class TestCiscoPortsV2(CiscoML2MechanismTestCase,
|
||||
test_db_plugin.TestPortsV2):
|
||||
test_ml2_plugin.TestMl2PortsV2):
|
||||
|
||||
@contextlib.contextmanager
|
||||
def _create_resources(self, name=NETWORK_NAME, cidr=CIDR_1,
|
||||
@@ -718,7 +702,7 @@ class TestCiscoPortsV2(CiscoML2MechanismTestCase,
|
||||
|
||||
|
||||
class TestCiscoNetworksV2(CiscoML2MechanismTestCase,
|
||||
test_db_plugin.TestNetworksV2):
|
||||
test_ml2_plugin.TestMl2NetworksV2):
|
||||
|
||||
def test_create_networks_bulk_emulated_plugin_failure(self):
|
||||
real_has_attr = hasattr
|
||||
@@ -769,7 +753,7 @@ class TestCiscoNetworksV2(CiscoML2MechanismTestCase,
|
||||
|
||||
|
||||
class TestCiscoSubnetsV2(CiscoML2MechanismTestCase,
|
||||
test_db_plugin.TestSubnetsV2):
|
||||
test_ml2_plugin.TestMl2SubnetsV2):
|
||||
|
||||
def test_create_subnets_bulk_emulated_plugin_failure(self):
|
||||
real_has_attr = hasattr
|
||||
|
||||
@@ -19,18 +19,18 @@ from oslo.config import cfg
|
||||
from neutron.extensions import portbindings
|
||||
from neutron.plugins.ml2.drivers.freescale import mechanism_fslsdn
|
||||
from neutron.tests import base
|
||||
from neutron.tests.unit import test_db_plugin
|
||||
from neutron.tests.unit.ml2 import test_ml2_plugin
|
||||
|
||||
|
||||
"""Unit testing for Freescale SDN mechanism driver."""
|
||||
|
||||
|
||||
class TestFslSdnMechDriverV2(test_db_plugin.NeutronDbPluginV2TestCase):
|
||||
class TestFslSdnMechDriverV2(test_ml2_plugin.Ml2PluginV2TestCase):
|
||||
_mechanism_drivers = ['fslsdn']
|
||||
|
||||
"""Testing mechanism driver with ML2 plugin."""
|
||||
|
||||
def setUp(self):
|
||||
cfg.CONF.set_override('mechanism_drivers', ['fslsdn'], 'ml2')
|
||||
|
||||
def mocked_fslsdn_init(self):
|
||||
# Mock CRD client, since it requires CRD service running.
|
||||
@@ -41,18 +41,18 @@ class TestFslSdnMechDriverV2(test_db_plugin.NeutronDbPluginV2TestCase):
|
||||
super(TestFslSdnMechDriverV2, self).setUp()
|
||||
|
||||
|
||||
class TestFslSdnMechDriverNetworksV2(test_db_plugin.TestNetworksV2,
|
||||
class TestFslSdnMechDriverNetworksV2(test_ml2_plugin.TestMl2NetworksV2,
|
||||
TestFslSdnMechDriverV2):
|
||||
pass
|
||||
|
||||
|
||||
class TestFslSdnMechDriverPortsV2(test_db_plugin.TestPortsV2,
|
||||
class TestFslSdnMechDriverPortsV2(test_ml2_plugin.TestMl2PortsV2,
|
||||
TestFslSdnMechDriverV2):
|
||||
VIF_TYPE = portbindings.VIF_TYPE_OVS
|
||||
CAP_PORT_FILTER = True
|
||||
|
||||
|
||||
class TestFslSdnMechDriverSubnetsV2(test_db_plugin.TestSubnetsV2,
|
||||
class TestFslSdnMechDriverSubnetsV2(test_ml2_plugin.TestMl2SubnetsV2,
|
||||
TestFslSdnMechDriverV2):
|
||||
pass
|
||||
|
||||
|
||||
@@ -24,11 +24,10 @@ from neutron.extensions import portbindings
|
||||
from neutron.extensions import providernet as pnet
|
||||
from neutron import manager
|
||||
from neutron.openstack.common import timeutils
|
||||
from neutron.plugins.ml2 import config as config
|
||||
from neutron.plugins.ml2.drivers.l2pop import mech_driver as l2pop_mech_driver
|
||||
from neutron.plugins.ml2 import managers
|
||||
from neutron.plugins.ml2 import rpc
|
||||
from neutron.tests.unit import test_db_plugin as test_plugin
|
||||
from neutron.tests.unit.ml2 import test_ml2_plugin as test_plugin
|
||||
|
||||
HOST = 'my_l2_host'
|
||||
L2_AGENT = {
|
||||
@@ -81,32 +80,23 @@ L2_AGENT_5 = {
|
||||
'topic': constants.L2_AGENT_TOPIC,
|
||||
'configurations': {'tunneling_ip': '20.0.0.5',
|
||||
'tunnel_types': [],
|
||||
'bridge_mappings': {'phys1': 'br'},
|
||||
'bridge_mappings': {'physnet1': 'br'},
|
||||
'l2pop_network_types': ['vlan']},
|
||||
'agent_type': constants.AGENT_TYPE_OFA,
|
||||
'tunnel_type': [],
|
||||
'start_flag': True
|
||||
}
|
||||
|
||||
PLUGIN_NAME = 'neutron.plugins.ml2.plugin.Ml2Plugin'
|
||||
NOTIFIER = 'neutron.plugins.ml2.rpc.AgentNotifierApi'
|
||||
DEVICE_OWNER_COMPUTE = 'compute:None'
|
||||
|
||||
|
||||
class TestL2PopulationRpcTestCase(test_plugin.NeutronDbPluginV2TestCase):
|
||||
class TestL2PopulationRpcTestCase(test_plugin.Ml2PluginV2TestCase):
|
||||
_mechanism_drivers = ['openvswitch', 'linuxbridge',
|
||||
'ofagent', 'l2population']
|
||||
|
||||
def setUp(self):
|
||||
# Enable the test mechanism driver to ensure that
|
||||
# we can successfully call through to all mechanism
|
||||
# driver apis.
|
||||
config.cfg.CONF.set_override('mechanism_drivers',
|
||||
['openvswitch', 'linuxbridge',
|
||||
'ofagent', 'l2population'],
|
||||
'ml2')
|
||||
config.cfg.CONF.set_override('network_vlan_ranges',
|
||||
['phys1:1:100'],
|
||||
'ml2_type_vlan')
|
||||
super(TestL2PopulationRpcTestCase, self).setUp(PLUGIN_NAME)
|
||||
super(TestL2PopulationRpcTestCase, self).setUp()
|
||||
|
||||
self.adminContext = context.get_admin_context()
|
||||
|
||||
@@ -122,7 +112,7 @@ class TestL2PopulationRpcTestCase(test_plugin.NeutronDbPluginV2TestCase):
|
||||
**net_arg)
|
||||
|
||||
net_arg = {pnet.NETWORK_TYPE: 'vlan',
|
||||
pnet.PHYSICAL_NETWORK: 'phys1',
|
||||
pnet.PHYSICAL_NETWORK: 'physnet1',
|
||||
pnet.SEGMENTATION_ID: '2'}
|
||||
self._network2 = self._make_network(self.fmt, 'net2', True,
|
||||
arg_list=(pnet.NETWORK_TYPE,
|
||||
|
||||
@@ -13,23 +13,18 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from neutron.plugins.ml2 import config as config
|
||||
from neutron.plugins.ml2.drivers import mechanism_ncs
|
||||
from neutron.tests.unit import test_db_plugin as test_plugin
|
||||
|
||||
PLUGIN_NAME = 'neutron.plugins.ml2.plugin.Ml2Plugin'
|
||||
from neutron.tests.unit.ml2 import test_ml2_plugin as test_plugin
|
||||
|
||||
|
||||
class NCSTestCase(test_plugin.NeutronDbPluginV2TestCase):
|
||||
class NCSTestCase(test_plugin.Ml2PluginV2TestCase):
|
||||
_mechanism_drivers = ['logger', 'ncs']
|
||||
|
||||
def setUp(self):
|
||||
# Enable the test mechanism driver to ensure that
|
||||
# we can successfully call through to all mechanism
|
||||
# driver apis.
|
||||
config.cfg.CONF.set_override('mechanism_drivers',
|
||||
['logger', 'ncs'],
|
||||
'ml2')
|
||||
super(NCSTestCase, self).setUp(PLUGIN_NAME)
|
||||
super(NCSTestCase, self).setUp()
|
||||
self.port_create_status = 'DOWN'
|
||||
mechanism_ncs.NCSMechanismDriver.sendjson = self.check_sendjson
|
||||
|
||||
@@ -38,13 +33,13 @@ class NCSTestCase(test_plugin.NeutronDbPluginV2TestCase):
|
||||
self.assertFalse(urlpath.startswith("http://"))
|
||||
|
||||
|
||||
class NCSMechanismTestBasicGet(test_plugin.TestBasicGet, NCSTestCase):
|
||||
class NCSMechanismTestBasicGet(test_plugin.TestMl2BasicGet, NCSTestCase):
|
||||
pass
|
||||
|
||||
|
||||
class NCSMechanismTestNetworksV2(test_plugin.TestNetworksV2, NCSTestCase):
|
||||
class NCSMechanismTestNetworksV2(test_plugin.TestMl2NetworksV2, NCSTestCase):
|
||||
pass
|
||||
|
||||
|
||||
class NCSMechanismTestPortsV2(test_plugin.TestPortsV2, NCSTestCase):
|
||||
class NCSMechanismTestPortsV2(test_plugin.TestMl2PortsV2, NCSTestCase):
|
||||
pass
|
||||
|
||||
@@ -23,28 +23,23 @@ from neutron.plugins.ml2 import driver_api as api
|
||||
from neutron.plugins.ml2.drivers import mechanism_odl
|
||||
from neutron.plugins.ml2 import plugin
|
||||
from neutron.tests import base
|
||||
from neutron.tests.unit import test_db_plugin as test_plugin
|
||||
from neutron.tests.unit.ml2 import test_ml2_plugin as test_plugin
|
||||
from neutron.tests.unit import testlib_api
|
||||
|
||||
PLUGIN_NAME = 'neutron.plugins.ml2.plugin.Ml2Plugin'
|
||||
|
||||
|
||||
class OpenDaylightTestCase(test_plugin.NeutronDbPluginV2TestCase):
|
||||
class OpenDaylightTestCase(test_plugin.Ml2PluginV2TestCase):
|
||||
_mechanism_drivers = ['logger', 'opendaylight']
|
||||
|
||||
def setUp(self):
|
||||
# Enable the test mechanism driver to ensure that
|
||||
# we can successfully call through to all mechanism
|
||||
# driver apis.
|
||||
config.cfg.CONF.set_override('mechanism_drivers',
|
||||
['logger', 'opendaylight'],
|
||||
'ml2')
|
||||
# Set URL/user/pass so init doesn't throw a cfg required error.
|
||||
# They are not used in these tests since sendjson is overwritten.
|
||||
config.cfg.CONF.set_override('url', 'http://127.0.0.1:9999', 'ml2_odl')
|
||||
config.cfg.CONF.set_override('username', 'someuser', 'ml2_odl')
|
||||
config.cfg.CONF.set_override('password', 'somepass', 'ml2_odl')
|
||||
|
||||
super(OpenDaylightTestCase, self).setUp(PLUGIN_NAME)
|
||||
super(OpenDaylightTestCase, self).setUp()
|
||||
self.port_create_status = 'DOWN'
|
||||
self.mech = mechanism_odl.OpenDaylightMechanismDriver()
|
||||
mechanism_odl.OpenDaylightMechanismDriver.sendjson = (
|
||||
@@ -84,22 +79,22 @@ class OpenDayLightMechanismConfigTests(testlib_api.SqlTestCase):
|
||||
self._test_missing_config(password=None)
|
||||
|
||||
|
||||
class OpenDaylightMechanismTestBasicGet(test_plugin.TestBasicGet,
|
||||
class OpenDaylightMechanismTestBasicGet(test_plugin.TestMl2BasicGet,
|
||||
OpenDaylightTestCase):
|
||||
pass
|
||||
|
||||
|
||||
class OpenDaylightMechanismTestNetworksV2(test_plugin.TestNetworksV2,
|
||||
class OpenDaylightMechanismTestNetworksV2(test_plugin.TestMl2NetworksV2,
|
||||
OpenDaylightTestCase):
|
||||
pass
|
||||
|
||||
|
||||
class OpenDaylightMechanismTestSubnetsV2(test_plugin.TestSubnetsV2,
|
||||
class OpenDaylightMechanismTestSubnetsV2(test_plugin.TestMl2SubnetsV2,
|
||||
OpenDaylightTestCase):
|
||||
pass
|
||||
|
||||
|
||||
class OpenDaylightMechanismTestPortsV2(test_plugin.TestPortsV2,
|
||||
class OpenDaylightMechanismTestPortsV2(test_plugin.TestMl2PortsV2,
|
||||
OpenDaylightTestCase):
|
||||
pass
|
||||
|
||||
|
||||
Reference in New Issue
Block a user