From 61bf68de3185c48363a6c6c9187773368152ffdd Mon Sep 17 00:00:00 2001 From: Flavio Fernandes Date: Tue, 14 Jul 2020 10:53:54 -0400 Subject: [PATCH] [ovn]: port forwarding -- extend support for OVN usage (cont.) This is a follow up from commit eb46081150a4ca4e2007cabfcadd134cbc85435e 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 --- neutron/services/portforwarding/pf_plugin.py | 5 +++- .../services/portforwarding/test_pf_plugin.py | 25 ++++++++++++------- 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/neutron/services/portforwarding/pf_plugin.py b/neutron/services/portforwarding/pf_plugin.py index a8e9b7747c6..890aaf2109e 100644 --- a/neutron/services/portforwarding/pf_plugin.py +++ b/neutron/services/portforwarding/pf_plugin.py @@ -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: diff --git a/neutron/tests/unit/services/portforwarding/test_pf_plugin.py b/neutron/tests/unit/services/portforwarding/test_pf_plugin.py index e943de664f5..7db910c8eed 100644 --- a/neutron/tests/unit/services/portforwarding/test_pf_plugin.py +++ b/neutron/tests/unit/services/portforwarding/test_pf_plugin.py @@ -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)