Add empty-string-filtering API extension

Neutron patch: https://review.openstack.org/#/c/545490/

Change-Id: Ia69a57ad8374cba164fd080ee9e1143cb020f3ed
Related-Bug: #1749304
This commit is contained in:
Hongbin Lu 2018-04-30 21:12:16 +00:00
parent eadc2a90a6
commit 47fed0ed4a
6 changed files with 61 additions and 0 deletions

View File

@ -145,6 +145,16 @@ admin_state_up=True and shared=True and named ``foobar`` or ``bizbaz``:
GET /v2.0/networks?name=foobar&name=bizbaz&admin_state_up=True&shared=True
Starting from Rocky release, the Networking API might support filtering
attributes with empty value. For example, the request below lists all ports
that have ``device_id`` attribute with empty value (which are unbound ports).
.. code::
GET /v2.0/networks?device_id=
To determine if this feature is supported, a user can check whether the
``empty-string-filtering`` extension API is available.
Note
----

View File

@ -24,6 +24,7 @@ from neutron_lib.api.definitions import dhcpagentscheduler
from neutron_lib.api.definitions import dns
from neutron_lib.api.definitions import dns_domain_ports
from neutron_lib.api.definitions import dvr
from neutron_lib.api.definitions import empty_string_filtering
from neutron_lib.api.definitions import external_net
from neutron_lib.api.definitions import extra_dhcp_opt
from neutron_lib.api.definitions import extraroute
@ -96,6 +97,7 @@ _ALL_API_DEFINITIONS = {
dns,
dns_domain_ports,
dvr,
empty_string_filtering,
external_net,
extra_dhcp_opt,
extraroute,

View File

@ -86,6 +86,7 @@ KNOWN_EXTENSIONS = (
'dns-domain-ports',
'dns-integration',
'dvr',
'empty-string-filtering',
'ext-gw-mode',
'external-net',
'extra_dhcp_opt',

View File

@ -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 = 'empty-string-filtering'
IS_SHIM_EXTENSION = True
IS_STANDARD_ATTR_EXTENSION = False
NAME = 'Empty String Filtering Extension'
DESCRIPTION = 'Allow filtering by attributes with empty string value'
UPDATED_TIMESTAMP = '2018-05-01T10:00:00-00:00'
RESOURCE_ATTRIBUTE_MAP = {}
SUB_RESOURCE_ATTRIBUTE_MAP = {}
ACTION_MAP = {}
REQUIRED_EXTENSIONS = []
OPTIONAL_EXTENSIONS = []
ACTION_STATUS = {}

View File

@ -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 empty_string_filtering
from neutron_lib.tests.unit.api.definitions import base
class EmptyStringFilteringDefinitionTestCase(base.DefinitionBaseTestCase):
extension_module = empty_string_filtering

View File

@ -0,0 +1,5 @@
---
features:
- |
Add ``empty-string-filtering`` API extension. This extension indicates
if the server supports filtering attributes with empty value.