Add shim extension filter-validation
Neutron patch: https://review.openstack.org/#/c/574907/ Change-Id: Ib361ad3dbb8bf79a67dae7aeedf1fb5c87aec6ab Partial-Bug: #1749820
This commit is contained in:
parent
8cbab5756c
commit
94516d1e7e
|
@ -156,6 +156,12 @@ that have ``device_id`` attribute with empty value (which are unbound ports).
|
||||||
To determine if this feature is supported, a user can check whether the
|
To determine if this feature is supported, a user can check whether the
|
||||||
``empty-string-filtering`` extension API is available.
|
``empty-string-filtering`` extension API is available.
|
||||||
|
|
||||||
|
Starting from Rocky release, the Networking API will perform validation
|
||||||
|
on filtering attributes if the API extension ``filter-validation`` is
|
||||||
|
available. If an API request contains an unknown or unsupported
|
||||||
|
parameter, the server will return a ``400`` response instead of silently
|
||||||
|
ignoring the invalid input.
|
||||||
|
|
||||||
Note
|
Note
|
||||||
----
|
----
|
||||||
|
|
||||||
|
|
|
@ -33,6 +33,7 @@ from neutron_lib.api.definitions import empty_string_filtering
|
||||||
from neutron_lib.api.definitions import external_net
|
from neutron_lib.api.definitions import external_net
|
||||||
from neutron_lib.api.definitions import extra_dhcp_opt
|
from neutron_lib.api.definitions import extra_dhcp_opt
|
||||||
from neutron_lib.api.definitions import extraroute
|
from neutron_lib.api.definitions import extraroute
|
||||||
|
from neutron_lib.api.definitions import filter_validation
|
||||||
from neutron_lib.api.definitions import fip64
|
from neutron_lib.api.definitions import fip64
|
||||||
from neutron_lib.api.definitions import fip_port_details
|
from neutron_lib.api.definitions import fip_port_details
|
||||||
from neutron_lib.api.definitions import firewall
|
from neutron_lib.api.definitions import firewall
|
||||||
|
@ -118,6 +119,7 @@ _ALL_API_DEFINITIONS = {
|
||||||
external_net,
|
external_net,
|
||||||
extra_dhcp_opt,
|
extra_dhcp_opt,
|
||||||
extraroute,
|
extraroute,
|
||||||
|
filter_validation,
|
||||||
fip64,
|
fip64,
|
||||||
firewall,
|
firewall,
|
||||||
firewall_v2,
|
firewall_v2,
|
||||||
|
|
|
@ -91,6 +91,7 @@ KNOWN_EXTENSIONS = (
|
||||||
'external-net',
|
'external-net',
|
||||||
'extra_dhcp_opt',
|
'extra_dhcp_opt',
|
||||||
'extraroute',
|
'extraroute',
|
||||||
|
'filter-validation',
|
||||||
'fip-port-details',
|
'fip-port-details',
|
||||||
'flavors',
|
'flavors',
|
||||||
'floating-ip-port-forwarding',
|
'floating-ip-port-forwarding',
|
||||||
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
# 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.
|
||||||
|
|
||||||
|
|
||||||
|
ALIAS = 'filter-validation'
|
||||||
|
IS_SHIM_EXTENSION = True
|
||||||
|
IS_STANDARD_ATTR_EXTENSION = False
|
||||||
|
NAME = 'Filter parameters validation'
|
||||||
|
DESCRIPTION = 'Provides validation on filter parameters.'
|
||||||
|
UPDATED_TIMESTAMP = '2018-07-04T10:00:00-00:00'
|
||||||
|
RESOURCE_ATTRIBUTE_MAP = {}
|
||||||
|
SUB_RESOURCE_ATTRIBUTE_MAP = {}
|
||||||
|
ACTION_MAP = {}
|
||||||
|
REQUIRED_EXTENSIONS = []
|
||||||
|
OPTIONAL_EXTENSIONS = []
|
||||||
|
ACTION_STATUS = {}
|
|
@ -0,0 +1,18 @@
|
||||||
|
# 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 neutron_lib.api.definitions import filter_validation as apidef
|
||||||
|
from neutron_lib.tests.unit.api.definitions import base
|
||||||
|
|
||||||
|
|
||||||
|
class FilterValidationiDefinitionTestCase(base.DefinitionBaseTestCase):
|
||||||
|
extension_module = apidef
|
|
@ -0,0 +1,12 @@
|
||||||
|
---
|
||||||
|
features:
|
||||||
|
- |
|
||||||
|
Add API extension ``filter-validation``. This extension indicates if the
|
||||||
|
server supports validation on filter parameters of the list requests.
|
||||||
|
other:
|
||||||
|
- |
|
||||||
|
API extension ``filter-validation`` relies on the ``is_filter`` keyword
|
||||||
|
in the ``RESOURCE_ATTRIBUTE_MAP`` to judge if an attribute can be used as
|
||||||
|
filter. Neutron plugins which want to support filter validation
|
||||||
|
needs to set ``is_filter`` to ``True`` for each attribute in their
|
||||||
|
resource attribute map.
|
Loading…
Reference in New Issue