Added API extensions to detect sorting/pagination features
Those features are available only when allow_sorting and
allow_pagination options are enabled (the current default is False).
They don't depend on plugin support, because when plugins don't
implement them natively, emulated mode is applied by API router itself.
So to make it plugin agnostic, we introduce a way to register custom
per-extension checks to override support detection for cases like that
one.
Now that we have a way to detect support for those features via API,
there is little reason to keep tempest configuration options to enable
those features. Instead, just inspect [network-feature-enabled]
api_extensions option in tempest.conf.
Now that DEFAULT_ALLOW_SORTING/DEFAULT_ALLOW_PAGINATION constants are
used in a single place only (in allow_sorting/allow_pagination
definitions), removed them and replaced with a literal.
Added first in-tree API tests for /extensions entry point.
DocImpact Update API documentation to cover new extensions.
APIImpact Document the new extensions.
Related-Bug: #1566514
Change-Id: I0aaaa037a8ad52060a68dd75c0a1accc6add238e
diff --git a/neutron/tests/tempest/api/test_extensions.py b/neutron/tests/tempest/api/test_extensions.py
new file mode 100644
index 0000000..1defb33
--- /dev/null
+++ b/neutron/tests/tempest/api/test_extensions.py
@@ -0,0 +1,39 @@
+# 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 tempest import test
+
+from neutron.tests.tempest.api import base
+from neutron.tests.tempest import config
+
+CONF = config.CONF
+
+
+class ExtensionsTest(base.BaseNetworkTest):
+
+ def _test_list_extensions_includes(self, ext):
+ body = self.client.list_extensions()
+ extensions = {ext_['alias'] for ext_ in body['extensions']}
+ self.assertNotEmpty(extensions, "Extension list returned is empty")
+ ext_enabled = test.is_extension_enabled(ext, "network")
+ if ext_enabled:
+ self.assertIn(ext, extensions)
+ else:
+ self.assertNotIn(ext, extensions)
+
+ @test.idempotent_id('262420b7-a4bb-4a3e-b4b5-e73bad18df8c')
+ def test_list_extensions_sorting(self):
+ self._test_list_extensions_includes('sorting')
+
+ @test.idempotent_id('19db409e-a23f-445d-8bc8-ca3d64c84706')
+ def test_list_extensions_pagination(self):
+ self._test_list_extensions_includes('pagination')