Merge "tests: stop using ml2 plugin full import paths in tests"

This commit is contained in:
Jenkins 2016-07-27 15:35:02 +00:00 committed by Gerrit Code Review
commit 15196c4280
17 changed files with 24 additions and 45 deletions

@ -65,7 +65,7 @@ class NeutronConfigFixture(ConfigFixture):
'lock_path': '$state_path/lock',
'api_paste_config': self._generate_api_paste(),
'policy_file': self._generate_policy_json(),
'core_plugin': 'neutron.plugins.ml2.plugin.Ml2Plugin',
'core_plugin': 'ml2',
'service_plugins': ','.join(service_plugins),
'auth_strategy': 'noauth',
'debug': 'True',

@ -37,8 +37,6 @@ from neutron.tests.unit import testlib_api
cfg.CONF.import_opt('core_plugin', 'neutron.common.config')
CORE_PLUGIN = 'neutron.plugins.ml2.plugin.Ml2Plugin'
CREATION_OPERATIONS = {
'sqla': (sqla_ddl.CreateIndex,
sqla_ddl.CreateTable,
@ -128,7 +126,7 @@ class _TestModelsMigrations(test_migrations.ModelsMigrationsSync):
def setUp(self):
super(_TestModelsMigrations, self).setUp()
self.cfg = self.useFixture(config_fixture.Config())
self.cfg.config(core_plugin=CORE_PLUGIN)
self.cfg.config(core_plugin='ml2')
self.alembic_config = migration.get_neutron_config()
self.alembic_config.neutron_config = cfg.CONF

@ -30,7 +30,7 @@ from neutron.tests.unit import testlib_api
class PecanFunctionalTest(testlib_api.SqlTestCase):
def setUp(self, service_plugins=None, extensions=None):
self.setup_coreplugin('neutron.plugins.ml2.plugin.Ml2Plugin')
self.setup_coreplugin('ml2')
super(PecanFunctionalTest, self).setUp()
self.addCleanup(exts.PluginAwareExtensionManager.clear_instance)
self.addCleanup(set_config, {}, overwrite=True)

@ -280,8 +280,7 @@ class L3LeastRoutersSchedulerTestCase(L3SchedulerBaseTest):
class L3AZSchedulerBaseTest(test_db_base_plugin_v2.NeutronDbPluginV2TestCase):
def setUp(self):
core_plugin = 'neutron.plugins.ml2.plugin.Ml2Plugin'
super(L3AZSchedulerBaseTest, self).setUp(plugin=core_plugin)
super(L3AZSchedulerBaseTest, self).setUp(plugin='ml2')
self.l3_plugin = l3_router_plugin.L3RouterPlugin()
self.l3_plugin.router_scheduler = None

@ -223,7 +223,7 @@ class TestRPCServer(TestNeutronServer):
def setUp(self):
super(TestRPCServer, self).setUp()
self.setup_coreplugin(TARGET_PLUGIN)
self.setup_coreplugin('ml2')
self._plugin_patcher = mock.patch(TARGET_PLUGIN, autospec=True)
self.plugin = self._plugin_patcher.start()
self.plugin.return_value.rpc_workers_supported = True
@ -257,7 +257,7 @@ class TestPluginWorker(TestNeutronServer):
def setUp(self):
super(TestPluginWorker, self).setUp()
self.setup_coreplugin(TARGET_PLUGIN)
self.setup_coreplugin('ml2')
self._plugin_patcher = mock.patch(TARGET_PLUGIN, autospec=True)
self.plugin = self._plugin_patcher.start()

@ -225,7 +225,6 @@ class OvsAgentSchedulerTestCaseBase(test_l3.L3NatTestCaseMixin,
AgentSchedulerTestMixIn,
test_plugin.NeutronDbPluginV2TestCase):
fmt = 'json'
plugin_str = 'neutron.plugins.ml2.plugin.Ml2Plugin'
l3_plugin = ('neutron.tests.unit.extensions.test_l3.'
'TestL3NatAgentSchedulingServicePlugin')
@ -241,7 +240,7 @@ class OvsAgentSchedulerTestCaseBase(test_l3.L3NatTestCaseMixin,
mock.patch('neutron.common.rpc.get_client'
).start().return_value = self.client_mock
super(OvsAgentSchedulerTestCaseBase, self).setUp(
self.plugin_str, service_plugins=service_plugins)
'ml2', service_plugins=service_plugins)
mock.patch.object(
self.plugin, 'filter_hosts_with_network_access',
side_effect=lambda context, network_id, hosts: hosts).start()
@ -1292,11 +1291,9 @@ class OvsAgentSchedulerTestCase(OvsAgentSchedulerTestCaseBase):
class OvsDhcpAgentNotifierTestCase(test_agent.AgentDBTestMixIn,
AgentSchedulerTestMixIn,
test_plugin.NeutronDbPluginV2TestCase):
plugin_str = 'neutron.plugins.ml2.plugin.Ml2Plugin'
def setUp(self):
self.useFixture(tools.AttributeMapMemento())
super(OvsDhcpAgentNotifierTestCase, self).setUp(self.plugin_str)
super(OvsDhcpAgentNotifierTestCase, self).setUp('ml2')
mock.patch.object(
self.plugin, 'filter_hosts_with_network_access',
side_effect=lambda context, network_id, hosts: hosts).start()
@ -1437,7 +1434,6 @@ class OvsL3AgentNotifierTestCase(test_l3.L3NatTestCaseMixin,
test_agent.AgentDBTestMixIn,
AgentSchedulerTestMixIn,
test_plugin.NeutronDbPluginV2TestCase):
plugin_str = 'neutron.plugins.ml2.plugin.Ml2Plugin'
l3_plugin = ('neutron.tests.unit.extensions.test_l3.'
'TestL3NatAgentSchedulingServicePlugin')
@ -1456,7 +1452,7 @@ class OvsL3AgentNotifierTestCase(test_l3.L3NatTestCaseMixin,
else:
service_plugins = None
super(OvsL3AgentNotifierTestCase, self).setUp(
self.plugin_str, service_plugins=service_plugins)
'ml2', service_plugins=service_plugins)
ext_mgr = extensions.PluginAwareExtensionManager.get_instance()
self.ext_api = test_extensions.setup_extensions_middleware(ext_mgr)
self.adminContext = context.get_admin_context()

@ -260,5 +260,4 @@ class TestPortUpdateIpam(test_db_base_plugin_v2.NeutronDbPluginV2TestCase):
class TestPortUpdateIpamML2(TestPortUpdateIpam):
def setUp(self):
super(TestPortUpdateIpamML2, self).setUp(
plugin='neutron.plugins.ml2.plugin.Ml2Plugin')
super(TestPortUpdateIpamML2, self).setUp(plugin='ml2')

@ -42,8 +42,7 @@ class FakeL3Plugin(common_db_mixin.CommonDbMixin,
class L3DvrTestCase(test_db_base_plugin_v2.NeutronDbPluginV2TestCase):
def setUp(self):
core_plugin = 'neutron.plugins.ml2.plugin.Ml2Plugin'
super(L3DvrTestCase, self).setUp(plugin=core_plugin)
super(L3DvrTestCase, self).setUp(plugin='ml2')
self.core_plugin = manager.NeutronManager.get_plugin()
self.ctx = context.get_admin_context()
self.mixin = FakeL3Plugin()

@ -54,7 +54,7 @@ class L3HATestFramework(testlib_api.SqlTestCase):
super(L3HATestFramework, self).setUp()
self.admin_ctx = context.get_admin_context()
self.setup_coreplugin('neutron.plugins.ml2.plugin.Ml2Plugin')
self.setup_coreplugin('ml2')
self.core_plugin = manager.NeutronManager.get_plugin()
notif_p = mock.patch.object(l3_hamode_db.L3_HA_NAT_db_mixin,
'_notify_ha_interfaces_updated')

@ -94,9 +94,8 @@ class TestAZAgentCase(AZTestCommon):
class TestAZNetworkCase(AZTestCommon):
def setUp(self):
plugin = 'neutron.plugins.ml2.plugin.Ml2Plugin'
ext_mgr = AZExtensionManager()
super(TestAZNetworkCase, self).setUp(plugin=plugin, ext_mgr=ext_mgr)
super(TestAZNetworkCase, self).setUp(plugin='ml2', ext_mgr=ext_mgr)
def test_availability_zones_in_create_response(self):
with self.network() as net:

@ -54,7 +54,7 @@ class QuotaExtensionTestCase(testlib_api.WebTestCase):
self.config_parse()
# Update the plugin and extensions path
self.setup_coreplugin(TARGET_PLUGIN)
self.setup_coreplugin('ml2')
quota.QUOTAS = quota.QuotaEngine()
self._plugin_patcher = mock.patch(TARGET_PLUGIN, autospec=True)
self.plugin = self._plugin_patcher.start()

@ -217,8 +217,7 @@ class TestSegment(SegmentTestCase):
class TestSegmentML2(SegmentTestCase):
def setUp(self):
super(TestSegmentML2, self).setUp(
plugin='neutron.plugins.ml2.plugin.Ml2Plugin')
super(TestSegmentML2, self).setUp(plugin='ml2')
def test_segment_notification_on_create_network(self):
with mock.patch.object(registry, 'notify') as notify:
@ -323,7 +322,7 @@ class HostSegmentMappingTestCase(SegmentTestCase):
self._mechanism_drivers,
group='ml2')
if not plugin:
plugin = 'neutron.plugins.ml2.plugin.Ml2Plugin'
plugin = 'ml2'
super(HostSegmentMappingTestCase, self).setUp(plugin=plugin)
db.subscribe()
@ -1143,8 +1142,7 @@ class TestSegmentAwareIpam(SegmentTestCase):
class TestSegmentAwareIpamML2(TestSegmentAwareIpam):
def setUp(self):
super(TestSegmentAwareIpamML2, self).setUp(
plugin='neutron.plugins.ml2.plugin.Ml2Plugin')
super(TestSegmentAwareIpamML2, self).setUp(plugin='ml2')
class TestDhcpAgentSegmentScheduling(HostSegmentMappingTestCase):

@ -77,7 +77,7 @@ config.cfg.CONF.import_opt('network_vlan_ranges',
group='ml2_type_vlan')
PLUGIN_NAME = 'neutron.plugins.ml2.plugin.Ml2Plugin'
PLUGIN_NAME = 'ml2'
DEVICE_OWNER_COMPUTE = constants.DEVICE_OWNER_COMPUTE_PREFIX + 'fake'
HOST = 'fake_host'

@ -25,13 +25,8 @@ from neutron.plugins.ml2 import models as ml2_models
from neutron.tests.unit.db import test_db_base_plugin_v2 as test_plugin
PLUGIN_NAME = 'neutron.plugins.ml2.plugin.Ml2Plugin'
class PortBindingTestCase(test_plugin.NeutronDbPluginV2TestCase):
_plugin_name = PLUGIN_NAME
def setUp(self):
# Enable the test mechanism driver to ensure that
# we can successfully call through to all mechanism
@ -42,7 +37,7 @@ class PortBindingTestCase(test_plugin.NeutronDbPluginV2TestCase):
config.cfg.CONF.set_override('network_vlan_ranges',
['physnet1:1000:1099'],
group='ml2_type_vlan')
super(PortBindingTestCase, self).setUp(PLUGIN_NAME)
super(PortBindingTestCase, self).setUp('ml2')
self.port_create_status = 'DOWN'
self.plugin = manager.NeutronManager.get_plugin()
self.plugin.start_rpc_listeners()

@ -27,12 +27,10 @@ from neutron.tests.unit.agent import test_securitygroups_rpc as test_sg_rpc
from neutron.tests.unit.api.v2 import test_base
from neutron.tests.unit.extensions import test_securitygroup as test_sg
PLUGIN_NAME = 'neutron.plugins.ml2.plugin.Ml2Plugin'
NOTIFIER = 'neutron.plugins.ml2.rpc.AgentNotifierApi'
class Ml2SecurityGroupsTestCase(test_sg.SecurityGroupDBTestCase):
_plugin_name = PLUGIN_NAME
def setUp(self, plugin=None):
test_sg_rpc.set_firewall_driver(test_sg_rpc.FIREWALL_HYBRID_DRIVER)
@ -41,7 +39,7 @@ class Ml2SecurityGroupsTestCase(test_sg.SecurityGroupDBTestCase):
self.notifier = mock.Mock()
notifier_cls.return_value = self.notifier
self.useFixture(tools.AttributeMapMemento())
super(Ml2SecurityGroupsTestCase, self).setUp(PLUGIN_NAME)
super(Ml2SecurityGroupsTestCase, self).setUp('ml2')
def tearDown(self):
super(Ml2SecurityGroupsTestCase, self).tearDown()

@ -618,8 +618,7 @@ class DHCPAgentAZAwareWeightSchedulerTestCase(TestDhcpSchedulerBaseTestCase):
def setUp(self):
super(DHCPAgentAZAwareWeightSchedulerTestCase, self).setUp()
DB_PLUGIN_KLASS = 'neutron.plugins.ml2.plugin.Ml2Plugin'
self.setup_coreplugin(DB_PLUGIN_KLASS)
self.setup_coreplugin('ml2')
cfg.CONF.set_override("network_scheduler_driver",
'neutron.scheduler.dhcp_agent_scheduler.AZAwareWeightScheduler')
self.plugin = importutils.import_object('neutron.plugins.ml2.plugin.'

@ -863,8 +863,7 @@ class L3DvrScheduler(l3_db.L3_NAT_db_mixin,
class L3DvrSchedulerTestCase(testlib_api.SqlTestCase):
def setUp(self):
plugin = 'neutron.plugins.ml2.plugin.Ml2Plugin'
self.setup_coreplugin(plugin)
self.setup_coreplugin('ml2')
super(L3DvrSchedulerTestCase, self).setUp()
self.adminContext = n_context.get_admin_context()
self.dut = L3DvrScheduler()
@ -1418,7 +1417,7 @@ class L3HATestCaseMixin(testlib_api.SqlTestCase,
mock.patch('neutron.common.rpc.get_client').start()
self.plugin = L3HAPlugin()
self.setup_coreplugin('neutron.plugins.ml2.plugin.Ml2Plugin')
self.setup_coreplugin('ml2')
cfg.CONF.set_override('service_plugins',
['neutron.services.l3_router.'
'l3_router_plugin.L3RouterPlugin'])
@ -1849,7 +1848,7 @@ class TestGetL3AgentsWithAgentModeFilter(testlib_api.SqlTestCase,
def setUp(self):
super(TestGetL3AgentsWithAgentModeFilter, self).setUp()
self.plugin = L3HAPlugin()
self.setup_coreplugin('neutron.plugins.ml2.plugin.Ml2Plugin')
self.setup_coreplugin('ml2')
self.adminContext = n_context.get_admin_context()
hosts = ['host_1', 'host_2', 'host_3', 'host_4', 'host_5']
agent_modes = ['legacy', 'dvr_snat', 'dvr', 'fake_mode', 'legacy']