da8d5b4770
A lot of clouds using the router service plugin don't configure for DVR, but the service plugin still loads the extension, and exposes it via API. Which will break if api consumers (admins with default policy.json) attempt to create new style routers based on the information passed through /extensions/ api. This change introduces a new config option that allows to avoid loading the extension. For complatibility sake, it requires an opt-in from ops side to disable it, otherwise the extension is still loaded as before. This is helpful for automation matters. It may also be useful when preparing tempest.conf api_extensions=, when you could actually pass the result of /extensions/ request into tempest and expect the test suite to pass without yanking dvr off the list for non-dvr setups. We could go further and try to check if the controller is configured properly. That is complicated by the fact that f.e. such validation may require talking to ml2 drivers, or even agents, which is not feasible during api startup. Change-Id: I84be9be93862fe71a2d5b5322d7ebd476c784163 Related-Bug: #1450067
34 lines
1.2 KiB
Python
34 lines
1.2 KiB
Python
# All Rights Reserved.
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
|
# not use this file except in compliance with the License. You may obtain
|
|
# a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
# License for the specific language governing permissions and limitations
|
|
# under the License.
|
|
|
|
from oslo_config import cfg
|
|
|
|
from neutron.services.l3_router import l3_router_plugin as lrp
|
|
from neutron.tests import base
|
|
|
|
|
|
class TestL3PluginDvrConditional(base.BaseTestCase):
|
|
|
|
def _test_dvr_alias_exposed(self, enabled):
|
|
cfg.CONF.set_override('enable_dvr', enabled)
|
|
plugin = lrp.L3RouterPlugin()
|
|
exposed = 'dvr' in plugin.supported_extension_aliases
|
|
self.assertEqual(enabled, exposed)
|
|
|
|
def test_dvr_alias_exposed_enabled(self):
|
|
self._test_dvr_alias_exposed(enabled=True)
|
|
|
|
def test_dvr_alias_exposed_disabled(self):
|
|
self._test_dvr_alias_exposed(enabled=False)
|