Merge "[ovn]: port forwarding -- extend support for OVN usage (cont.)"

This commit is contained in:
Zuul 2020-07-27 17:20:46 +00:00 committed by Gerrit Code Review
commit b90cb02799
2 changed files with 20 additions and 10 deletions

View File

@ -58,7 +58,10 @@ PORT_FORWARDING_FLOATINGIP_KEY = '_pf_floatingips'
def _required_service_plugins(): def _required_service_plugins():
SvcPlugin = collections.namedtuple('SvcPlugin', 'plugin uses_rpc') SvcPlugin = collections.namedtuple('SvcPlugin', 'plugin uses_rpc')
l3_router = SvcPlugin(l3.ROUTER, True) l3_router = SvcPlugin(l3.ROUTER, True)
supported_svc_plugins = [l3_router, SvcPlugin('ovn-router', False)] supported_svc_plugins = [
l3_router,
SvcPlugin('ovn-router', False),
SvcPlugin('neutron.services.ovn_l3.plugin.OVNL3RouterPlugin', False)]
plugins = [] plugins = []
rpc_required = False rpc_required = False
try: try:

View File

@ -396,7 +396,8 @@ class TestPortForwardingPlugin(testlib_api.SqlTestCase):
def test_service_plugins_values(self): def test_service_plugins_values(self):
exp_default_plugins = ['router'] exp_default_plugins = ['router']
supported_plugins = ['router', 'ovn-router'] ovn_rtr_full = 'neutron.services.ovn_l3.plugin.OVNL3RouterPlugin'
supported_plugins = ['router', 'ovn-router', ovn_rtr_full]
same_as_input = 'same_as_input' same_as_input = 'same_as_input'
TC = namedtuple('TC', 'input exp_plugins exp_uses_rpc description') TC = namedtuple('TC', 'input exp_plugins exp_uses_rpc description')
test_cases = [ test_cases = [
@ -408,17 +409,23 @@ class TestPortForwardingPlugin(testlib_api.SqlTestCase):
TC(['foo', 'router'], exp_default_plugins, True, TC(['foo', 'router'], exp_default_plugins, True,
"default from valid cfg"), "default from valid cfg"),
TC(['router'], same_as_input, True, "valid cfg 1"), TC(['router'], same_as_input, True, "valid cfg 1"),
TC(['router'], same_as_input, True, "valid cfg 1"),
TC(['ovn-router'], same_as_input, False, "valid cfg 2"), TC(['ovn-router'], same_as_input, False, "valid cfg 2"),
TC(['ovn-router', 'router'], supported_plugins, True, TC([ovn_rtr_full], same_as_input, False, "valid cfg 3"),
"valid cfg 3"), TC(['ovn-router', ovn_rtr_full, 'router'], supported_plugins, True,
TC(['router', 'ovn-router'], supported_plugins, True,
"valid cfg 4"), "valid cfg 4"),
TC(['bar', 'router', 'foo'], ['router'], True, "valid cfg 5"), TC(['router', 'ovn-router'], same_as_input, True,
TC(['bar', 'ovn-router', 'foo'], ['ovn-router'], False, "valid cfg 5"),
TC(['router', ovn_rtr_full], same_as_input, True,
"valid cfg 6"), "valid cfg 6"),
TC(['bar', 'router', 123, 'ovn-router', 'foo', 'kitchen', 'sink'], TC([ovn_rtr_full, 'ovn-router'], ['ovn-router', ovn_rtr_full],
supported_plugins, True, "valid cfg 7"), False, "valid cfg 7"),
TC(['bar', 'router', 'foo'], ['router'], True, "valid cfg 8"),
TC(['bar', 'ovn-router', 'foo'], ['ovn-router'], False,
"valid cfg 9"),
TC(['bar', ovn_rtr_full, 'foo'], [ovn_rtr_full], False,
"valid cfg 10"),
TC(['bar', 'router', 123, 'ovn-router', 'foo', 'kitchen', 'sink',
ovn_rtr_full], supported_plugins, True, "valid cfg 11"),
] ]
for tc in test_cases: for tc in test_cases:
cfg.CONF.set_override("service_plugins", tc.input) cfg.CONF.set_override("service_plugins", tc.input)