Add the IP substring filter extension

Change-Id: I97259b85a2dce5a54bb6ea2cb9d9779ec0a25504
Related-Bug: #1718605
This commit is contained in:
Hongbin Lu 2017-12-04 19:18:09 +00:00
parent e0cc5efb74
commit 7b43461c7a
6 changed files with 98 additions and 0 deletions

View File

@ -64,6 +64,12 @@ that the port can use when sending packets if ``port_security_enabled`` is
``ip_address`` is required in each allowed address pair, the ``mac_address``
is optional and will be taken from the port if not specified.
IP Substring Filtering
======================
The ``ip-substring-filtering`` extension adds support for filtering ports by
using part of an IP address.
Show port details
=================
@ -295,6 +301,12 @@ by using query string parameters. For information, see `Filtering
and Column Selection <https://wiki.openstack.org/wiki/Neutron/APIv2
-specification#Filtering_and_Column_Selection>`__.
If the ``ip-substring-filtering`` extension is enabled, the Neutron API
supports IP address substring filtering on the ``fixed_ips`` attribute.
If you specify an IP address substring (``ip_address_substr``) in
an entry of the ``fixed_ips`` attribute, the Neutron API will list all
ports that have an IP address matching the substring.
Normal response codes: 200
Error response codes: 401

View File

@ -32,6 +32,7 @@ from neutron_lib.api.definitions import firewall_v2
from neutron_lib.api.definitions import firewallrouterinsertion
from neutron_lib.api.definitions import flavors
from neutron_lib.api.definitions import ip_allocation
from neutron_lib.api.definitions import ip_substring_port_filtering
from neutron_lib.api.definitions import l2_adjacency
from neutron_lib.api.definitions import l3
from neutron_lib.api.definitions import l3_ext_gw_mode
@ -86,6 +87,7 @@ _ALL_API_DEFINITIONS = {
firewallrouterinsertion,
flavors,
ip_allocation,
ip_substring_port_filtering,
l2_adjacency,
l3,
l3_ext_gw_mode,

View File

@ -88,6 +88,7 @@ KNOWN_EXTENSIONS = (
'extra_dhcp_opt',
'extraroute',
'flavors',
'ip-substring-filtering',
'l3-ha',
'l3_agent_scheduler',
'logging',

View File

@ -0,0 +1,60 @@
# 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.
# The alias of the extension.
ALIAS = 'ip-substring-filtering'
# Whether or not this extension is simply signaling behavior to the user
# or it actively modifies the attribute map.
IS_SHIM_EXTENSION = True
# Whether the extension is marking the adoption of standardattr model for
# legacy resources, or introducing new standardattr attributes. False or
# None if the standardattr model is adopted since the introduction of
# resource extension.
# If this is True, the alias for the extension should be prefixed with
# 'standard-attr-'.
IS_STANDARD_ATTR_EXTENSION = False
# The name of the extension.
NAME = 'IP address substring filtering'
# The description of the extension.
DESCRIPTION = "Provides IP address substring filtering when listing ports"
# A timestamp of when the extension was introduced.
UPDATED_TIMESTAMP = "2017-11-28T09:00:00-00:00"
# The resource attribute map for the extension.
RESOURCE_ATTRIBUTE_MAP = {
}
# The subresource attribute map for the extension.
SUB_RESOURCE_ATTRIBUTE_MAP = {
}
# The action map.
ACTION_MAP = {
}
# The action status.
ACTION_STATUS = {
}
# The list of required extensions.
REQUIRED_EXTENSIONS = [
]
# The list of optional extensions.
OPTIONAL_EXTENSIONS = [
]

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

View File

@ -0,0 +1,5 @@
---
features:
- |
Add ``ip-substring-filtering`` API extension. This extension provides
the ability to filter ports with an IP address substring.