Add filter flags for QoS rule types
Added two filter flags for the QoS rule type API definition: - all_supported: if True, the listing call will print all QoS rule types supported by at least one loaded mechanism driver. - all_rules: if True, the listing call will print all QoS rule types supported by the Neutron server. Both flags are exclusive and not required. Change-Id: I8836de91fb5f47f64b44035bfe3fbb4f8a9f63a0 Related-Bug: #1959749
This commit is contained in:
@@ -5532,6 +5532,20 @@ qos-rule-type:
|
|||||||
in: body
|
in: body
|
||||||
required: true
|
required: true
|
||||||
type: string
|
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:
|
qos-rule-types:
|
||||||
description: |
|
description: |
|
||||||
A list of QoS ``rule_type`` objects.
|
A list of QoS ``rule_type`` objects.
|
||||||
|
@@ -34,6 +34,14 @@ Normal response codes: 200
|
|||||||
|
|
||||||
Error response codes: 401
|
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
|
Response Parameters
|
||||||
-------------------
|
-------------------
|
||||||
|
|
||||||
|
@@ -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_minimum_rule_alias
|
||||||
from neutron_lib.api.definitions import qos_pps_rule
|
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_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 qos_rules_alias
|
||||||
from neutron_lib.api.definitions import quota_check_limit
|
from neutron_lib.api.definitions import quota_check_limit
|
||||||
from neutron_lib.api.definitions import rbac_address_groups
|
from neutron_lib.api.definitions import rbac_address_groups
|
||||||
@@ -249,6 +250,7 @@ _ALL_API_DEFINITIONS = {
|
|||||||
qos_pps_minimum_rule_alias,
|
qos_pps_minimum_rule_alias,
|
||||||
qos_pps_rule,
|
qos_pps_rule,
|
||||||
qos_rule_type_details,
|
qos_rule_type_details,
|
||||||
|
qos_rule_type_filter,
|
||||||
qos_rules_alias,
|
qos_rules_alias,
|
||||||
quota_check_limit,
|
quota_check_limit,
|
||||||
rbac_address_groups,
|
rbac_address_groups,
|
||||||
|
@@ -147,6 +147,7 @@ KNOWN_EXTENSIONS = (
|
|||||||
'qos-port-network-policy',
|
'qos-port-network-policy',
|
||||||
'qos-pps-minimum',
|
'qos-pps-minimum',
|
||||||
'qos-pps-minimum-rule-alias',
|
'qos-pps-minimum-rule-alias',
|
||||||
|
'qos-rule-type-filter',
|
||||||
'qos-rules-alias',
|
'qos-rules-alias',
|
||||||
'quotas',
|
'quotas',
|
||||||
'quota-check-limit',
|
'quota-check-limit',
|
||||||
|
55
neutron_lib/api/definitions/qos_rule_type_filter.py
Normal file
55
neutron_lib/api/definitions/qos_rule_type_filter.py
Normal 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 = {}
|
@@ -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)
|
@@ -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.
|
Reference in New Issue
Block a user