Allow BGP DB test to run with non ml2 core plugins

The DB tests are located under BgpTest class which inherits
Ml2PluginV2TestCase, thus makes it harder to reuse existing DB tests to
run in the context of different core plugins.

Change-Id: I320e0124719cb03632fa86fbc49812c0fea35e4f
This commit is contained in:
Roey Chen 2017-05-22 08:08:37 -07:00
parent de97bbe5d0
commit 239d7001f8
1 changed files with 17 additions and 15 deletions

View File

@ -155,21 +155,7 @@ class BgpEntityCreationMixin(object):
yield router, ext_net, int_net
class BgpTests(test_plugin.Ml2PluginV2TestCase,
BgpEntityCreationMixin):
fmt = 'json'
def setup_parent(self):
self.l3_plugin = ('neutron_dynamic_routing.tests.unit.db.test_bgp_db.'
'TestL3Plugin')
super(BgpTests, self).setup_parent()
def setUp(self):
super(BgpTests, self).setUp()
self.l3plugin = directory.get_plugin(n_const.L3)
self.bgp_plugin = bgp_plugin.BgpPlugin()
self.plugin = directory.get_plugin()
class BgpTests(BgpEntityCreationMixin):
@contextlib.contextmanager
def subnetpool_with_address_scope(self, ip_version, prefixes=None,
shared=False, admin=True,
@ -1314,3 +1300,19 @@ class BgpTests(test_plugin.Ml2PluginV2TestCase,
def test__get_fip_next_hop_dvr(self):
self._test__get_fip_next_hop(distributed=True)
class Ml2BgpTests(test_plugin.Ml2PluginV2TestCase,
BgpTests):
fmt = 'json'
def setup_parent(self):
self.l3_plugin = ('neutron_dynamic_routing.tests.unit.db.test_bgp_db.'
'TestL3Plugin')
super(Ml2BgpTests, self).setup_parent()
def setUp(self):
super(Ml2BgpTests, self).setUp()
self.l3plugin = directory.get_plugin(n_const.L3)
self.bgp_plugin = bgp_plugin.BgpPlugin()
self.plugin = directory.get_plugin()