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

This is a follow up from commit eb46081150

In order to be used by functional tests -- or anything that does not use
stevedore that can map from "ovn-router" value -- pf_plugin also needs to
recognize "neutron.services.ovn_l3.plugin.OVNL3RouterPlugin" as a way for
specifying the OVN L3 service plugin.

Change-Id: I4227cc3ceb2a17f40df86dadd71d99198b6b26e9
Related-Bug: #1877447
This commit is contained in:
Flavio Fernandes 2020-07-14 10:53:54 -04:00
parent 73557abefc
commit 61bf68de31
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():
SvcPlugin = collections.namedtuple('SvcPlugin', 'plugin uses_rpc')
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 = []
rpc_required = False
try:

View File

@ -396,7 +396,8 @@ class TestPortForwardingPlugin(testlib_api.SqlTestCase):
def test_service_plugins_values(self):
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'
TC = namedtuple('TC', 'input exp_plugins exp_uses_rpc description')
test_cases = [
@ -408,17 +409,23 @@ class TestPortForwardingPlugin(testlib_api.SqlTestCase):
TC(['foo', 'router'], exp_default_plugins, True,
"default from valid cfg"),
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', 'router'], supported_plugins, True,
"valid cfg 3"),
TC(['router', 'ovn-router'], supported_plugins, True,
TC([ovn_rtr_full], same_as_input, False, "valid cfg 3"),
TC(['ovn-router', ovn_rtr_full, 'router'], supported_plugins, True,
"valid cfg 4"),
TC(['bar', 'router', 'foo'], ['router'], True, "valid cfg 5"),
TC(['bar', 'ovn-router', 'foo'], ['ovn-router'], False,
TC(['router', 'ovn-router'], same_as_input, True,
"valid cfg 5"),
TC(['router', ovn_rtr_full], same_as_input, True,
"valid cfg 6"),
TC(['bar', 'router', 123, 'ovn-router', 'foo', 'kitchen', 'sink'],
supported_plugins, True, "valid cfg 7"),
TC([ovn_rtr_full, 'ovn-router'], ['ovn-router', ovn_rtr_full],
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:
cfg.CONF.set_override("service_plugins", tc.input)