Merge "Add filter flags for QoS rule types"

This commit is contained in:
Zuul 2022-02-14 13:11:28 +00:00 committed by Gerrit Code Review
commit 6dfa4f5dd6
7 changed files with 113 additions and 0 deletions

View File

@ -5615,6 +5615,20 @@ qos-rule-type:
in: body
required: true
type: string
qos-rule-type-all-rules:
description: |
Set to ``true`` to return all QoS rule types implemented in the Neutron
server.
in: body
required: false
type: boolean
qos-rule-type-all-supported:
description: |
Set to ``true`` to return all QoS rule types supported by any loaded
driver.
in: body
required: false
type: boolean
qos-rule-types:
description: |
A list of QoS ``rule_type`` objects.

View File

@ -34,6 +34,14 @@ Normal response codes: 200
Error response codes: 401
Request
-------
.. rest_parameters:: parameters.yaml
- all_supported: qos-rule-type-all-supported
- all_rules: qos-rule-type-all-rules
Response Parameters
-------------------

View File

@ -107,6 +107,7 @@ from neutron_lib.api.definitions import qos_pps_minimum_rule
from neutron_lib.api.definitions import qos_pps_minimum_rule_alias
from neutron_lib.api.definitions import qos_pps_rule
from neutron_lib.api.definitions import qos_rule_type_details
from neutron_lib.api.definitions import qos_rule_type_filter
from neutron_lib.api.definitions import qos_rules_alias
from neutron_lib.api.definitions import quota_check_limit
from neutron_lib.api.definitions import rbac_address_groups
@ -249,6 +250,7 @@ _ALL_API_DEFINITIONS = {
qos_pps_minimum_rule_alias,
qos_pps_rule,
qos_rule_type_details,
qos_rule_type_filter,
qos_rules_alias,
quota_check_limit,
rbac_address_groups,

View File

@ -147,6 +147,7 @@ KNOWN_EXTENSIONS = (
'qos-port-network-policy',
'qos-pps-minimum',
'qos-pps-minimum-rule-alias',
'qos-rule-type-filter',
'qos-rules-alias',
'quotas',
'quota-check-limit',

View File

@ -0,0 +1,55 @@
# Copyright 2022 Red Hat, Inc.
# 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 neutron_lib.api import converters
from neutron_lib.api.definitions import qos as qos_apidef
from neutron_lib import constants
ALIAS = 'qos-rule-type-filter'
IS_SHIM_EXTENSION = False
IS_STANDARD_ATTR_EXTENSION = False
NAME = 'Allow to filter the list of QoS rule types'
API_PREFIX = ''
DESCRIPTION = ('Allows to filter the QoS rule type list adding two new flags. '
'"all_rules" prints all implemented QoS rule types.'
'"all_supported" prints all supported QoS rule types by the '
'loaded mechanism drivers')
UPDATED_TIMESTAMP = '2022-02-02T10:00:00-00:00'
QOS_RULE_TYPE_ALL_SUPPORTED = 'all_supported'
QOS_RULE_TYPE_ALL_RULES = 'all_rules'
RESOURCE_ATTRIBUTE_MAP = {
qos_apidef.RULE_TYPES: {
QOS_RULE_TYPE_ALL_RULES: {
'allow_post': True, 'allow_put': True,
'convert_to': converters.convert_to_boolean_if_not_none,
'default': constants.ATTR_NOT_SPECIFIED,
'is_filter': True,
'is_visible': False
},
QOS_RULE_TYPE_ALL_SUPPORTED: {
'allow_post': True, 'allow_put': True,
'convert_to': converters.convert_to_boolean_if_not_none,
'default': constants.ATTR_NOT_SPECIFIED,
'is_filter': True,
'is_visible': False
}
}
}
SUB_RESOURCE_ATTRIBUTE_MAP = {}
ACTION_MAP = {}
REQUIRED_EXTENSIONS = [qos_apidef.ALIAS]
OPTIONAL_EXTENSIONS = []
ACTION_STATUS = {}

View File

@ -0,0 +1,25 @@
# Copyright 2022 Red Hat, Inc.
# 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 neutron_lib.api.definitions import qos_rule_type_filter
from neutron_lib.tests.unit.api.definitions import base
from neutron_lib.tests.unit.api.definitions import test_qos
class QoSRuleTypeFilterTestCase(base.DefinitionBaseTestCase):
extension_module = qos_rule_type_filter
extension_resources = test_qos.QoSDefinitionTestCase.extension_resources
extension_attributes = (qos_rule_type_filter.QOS_RULE_TYPE_ALL_SUPPORTED,
qos_rule_type_filter.QOS_RULE_TYPE_ALL_RULES)

View File

@ -0,0 +1,8 @@
---
features:
- |
Added API definition for ``qos-rule-type-filter`` extension that adds two
new parameters to QoS rule type API: "all_supported" that is a flag to
filter all supported QoS rule types by at least one loaded mechanism
driver; "all_rules" that is a flag to filter all implemented QoS rule
types in the Neutron server.