Merge "Fix QoS alias api definition"

This commit is contained in:
Zuul 2018-11-29 15:05:22 +00:00 committed by Gerrit Code Review
commit 4dce802fc3
4 changed files with 38 additions and 22 deletions

View File

@ -991,7 +991,7 @@ available in this API extension are:
Show bandwidth limit rule details alias Show bandwidth limit rule details alias
======================================= =======================================
.. rest_method:: GET /v2.0/qos/bandwidth_limit_rules/{rule_id} .. rest_method:: GET /v2.0/qos/alias_bandwidth_limit_rules/{rule_id}
Please refer to Please refer to
`Show bandwidth limit rule details <#show-bandwidth-limit-rule-details>`__ `Show bandwidth limit rule details <#show-bandwidth-limit-rule-details>`__
@ -1000,7 +1000,7 @@ for more information on the request, response and return codes.
Update bandwidth limit rule alias Update bandwidth limit rule alias
================================= =================================
.. rest_method:: PUT /v2.0/qos/bandwidth_limit_rules/{rule_id} .. rest_method:: PUT /v2.0/qos/alias_bandwidth_limit_rules/{rule_id}
Please refer to Please refer to
`Update bandwidth limit rule <#update-bandwidth-limit-rule>`__ `Update bandwidth limit rule <#update-bandwidth-limit-rule>`__
@ -1009,7 +1009,7 @@ for more information on the request, response and return codes.
Delete bandwidth limit rule alias Delete bandwidth limit rule alias
================================= =================================
.. rest_method:: DELETE /v2.0/qos/bandwidth_limit_rules/{rule_id} .. rest_method:: DELETE /v2.0/qos/alias_bandwidth_limit_rules/{rule_id}
Please refer to Please refer to
`Delete bandwidth limit rule <#delete-bandwidth-limit-rule>`__ `Delete bandwidth limit rule <#delete-bandwidth-limit-rule>`__
@ -1018,7 +1018,7 @@ for more information on the request, response and return codes.
Show DSCP marking rule details alias Show DSCP marking rule details alias
==================================== ====================================
.. rest_method:: GET /v2.0/qos/dscp_marking_rules/{dscp_rule_id} .. rest_method:: GET /v2.0/qos/alias_dscp_marking_rules/{dscp_rule_id}
Please refer to Please refer to
`Show DSCP marking rule details <#show-dscp-marking-rule-details>`__ `Show DSCP marking rule details <#show-dscp-marking-rule-details>`__
@ -1027,7 +1027,7 @@ for more information on the request, response and return codes.
Update DSCP marking rule alias Update DSCP marking rule alias
============================== ==============================
.. rest_method:: PUT /v2.0/qos/dscp_marking_rules/{dscp_rule_id} .. rest_method:: PUT /v2.0/qos/alias_dscp_marking_rules/{dscp_rule_id}
Please refer to Please refer to
`Update DSCP marking rule <#update-dscp-marking-rule>`__ `Update DSCP marking rule <#update-dscp-marking-rule>`__
@ -1036,7 +1036,7 @@ for more information on the request, response and return codes.
Delete DSCP marking rule alias Delete DSCP marking rule alias
============================== ==============================
.. rest_method:: DELETE /v2.0/qos/dscp_marking_rules/{dscp_rule_id} .. rest_method:: DELETE /v2.0/qos/alias_dscp_marking_rules/{dscp_rule_id}
Please refer to Please refer to
`Delete DSCP marking rule <#delete-dscp-marking-rule>`__ `Delete DSCP marking rule <#delete-dscp-marking-rule>`__
@ -1045,7 +1045,7 @@ for more information on the request, response and return codes.
Show minimum bandwidth rule details alias Show minimum bandwidth rule details alias
========================================= =========================================
.. rest_method:: GET /v2.0/qos/minimum_bandwidth_rules/{rule_id} .. rest_method:: GET /v2.0/qos/alias_minimum_bandwidth_rules/{rule_id}
Please refer to Please refer to
`Show minimum bandwidth rule details <#show-minimum-bandwidth-rule-details>`__ `Show minimum bandwidth rule details <#show-minimum-bandwidth-rule-details>`__
@ -1054,7 +1054,7 @@ for more information on the request, response and return codes.
Update minimum bandwidth rule alias Update minimum bandwidth rule alias
=================================== ===================================
.. rest_method:: PUT /v2.0/qos/minimum_bandwidth_rules/{rule_id} .. rest_method:: PUT /v2.0/qos/alias_minimum_bandwidth_rules/{rule_id}
Please refer to Please refer to
`Update minimum bandwidth rule <#update-minimum-bandwidth-rule>`__ `Update minimum bandwidth rule <#update-minimum-bandwidth-rule>`__
@ -1063,7 +1063,7 @@ for more information on the request, response and return codes.
Delete minimum bandwidth rule alias Delete minimum bandwidth rule alias
=================================== ===================================
.. rest_method:: DELETE /v2.0/qos/minimum_bandwidth_rules/{rule_id} .. rest_method:: DELETE /v2.0/qos/alias_minimum_bandwidth_rules/{rule_id}
Please refer to Please refer to
`Delete minimum bandwidth rule <#delete-minimum-bandwidth-rule>`__ `Delete minimum bandwidth rule <#delete-minimum-bandwidth-rule>`__

View File

@ -18,6 +18,10 @@ from neutron_lib.db import constants as db_const
from neutron_lib.services.qos import constants as q_const from neutron_lib.services.qos import constants as q_const
BANDWIDTH_LIMIT_RULES_ALIAS = "alias_bandwidth_limit_rules"
DSCP_MARKING_RULES_ALIAS = 'alias_dscp_marking_rules'
MIN_BANDWIDTH_RULES_ALIAS = 'alias_minimum_bandwidth_rules'
_QOS_RULE_COMMON_FIELDS = { _QOS_RULE_COMMON_FIELDS = {
'id': { 'id': {
'allow_post': False, 'allow_put': False, 'allow_post': False, 'allow_put': False,
@ -43,7 +47,7 @@ DESCRIPTION = ('API to enable GET, PUT and DELETE operations on QoS policy '
'rules without specifying policy ID') 'rules without specifying policy ID')
UPDATED_TIMESTAMP = '2018-10-07T10:00:00-00:00' UPDATED_TIMESTAMP = '2018-10-07T10:00:00-00:00'
RESOURCE_ATTRIBUTE_MAP = { RESOURCE_ATTRIBUTE_MAP = {
qos.BANDWIDTH_LIMIT_RULES: dict( BANDWIDTH_LIMIT_RULES_ALIAS: dict(
_QOS_RULE_COMMON_FIELDS, _QOS_RULE_COMMON_FIELDS,
**{q_const.MAX_KBPS: { **{q_const.MAX_KBPS: {
'allow_post': False, 'allow_put': True, 'allow_post': False, 'allow_put': True,
@ -76,7 +80,7 @@ RESOURCE_ATTRIBUTE_MAP = {
'type:range': [0, db_const.DB_INTEGER_MAX_VALUE] 'type:range': [0, db_const.DB_INTEGER_MAX_VALUE]
} }
}}), }}),
qos.DSCP_MARKING_RULES: dict( DSCP_MARKING_RULES_ALIAS: dict(
_QOS_RULE_COMMON_FIELDS, _QOS_RULE_COMMON_FIELDS,
**{q_const.DSCP_MARK: { **{q_const.DSCP_MARK: {
'allow_post': False, 'allow_put': True, 'allow_post': False, 'allow_put': True,
@ -88,7 +92,7 @@ RESOURCE_ATTRIBUTE_MAP = {
'type:values': constants.VALID_DSCP_MARKS 'type:values': constants.VALID_DSCP_MARKS
} }
}}), }}),
qos.MIN_BANDWIDTH_RULES: dict( MIN_BANDWIDTH_RULES_ALIAS: dict(
_QOS_RULE_COMMON_FIELDS, _QOS_RULE_COMMON_FIELDS,
**{q_const.MIN_KBPS: { **{q_const.MIN_KBPS: {
'allow_post': False, 'allow_put': True, 'allow_post': False, 'allow_put': True,
@ -108,7 +112,9 @@ RESOURCE_ATTRIBUTE_MAP = {
'validate': { 'validate': {
'type:values': constants.VALID_DIRECTIONS 'type:values': constants.VALID_DIRECTIONS
} }
}}) }
}
)
} }
SUB_RESOURCE_ATTRIBUTE_MAP = {} SUB_RESOURCE_ATTRIBUTE_MAP = {}
ACTION_MAP = {} ACTION_MAP = {}

View File

@ -10,7 +10,6 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
from neutron_lib.api.definitions import qos
from neutron_lib.api.definitions import qos_rules_alias from neutron_lib.api.definitions import qos_rules_alias
from neutron_lib.services.qos import constants as q_const from neutron_lib.services.qos import constants as q_const
from neutron_lib.tests.unit.api.definitions import base from neutron_lib.tests.unit.api.definitions import base
@ -18,9 +17,9 @@ from neutron_lib.tests.unit.api.definitions import base
class QoSRulesAliasDefinitionTestCase(base.DefinitionBaseTestCase): class QoSRulesAliasDefinitionTestCase(base.DefinitionBaseTestCase):
extension_module = qos_rules_alias extension_module = qos_rules_alias
extension_resources = (qos.BANDWIDTH_LIMIT_RULES, extension_resources = (qos_rules_alias.BANDWIDTH_LIMIT_RULES_ALIAS,
qos.DSCP_MARKING_RULES, qos_rules_alias.DSCP_MARKING_RULES_ALIAS,
qos.MIN_BANDWIDTH_RULES) qos_rules_alias.MIN_BANDWIDTH_RULES_ALIAS)
extension_attributes = (q_const.DIRECTION, extension_attributes = (q_const.DIRECTION,
q_const.MAX_BURST, q_const.MAX_BURST,
q_const.DSCP_MARK, q_const.DSCP_MARK,

View File

@ -0,0 +1,11 @@
---
fixes:
- |
The ``qos-rules-alias`` API extension wrongly attempted to re-define
``bandwidth_limit_rules``, ``dscp_marking_rules`` and
``minimum_bandwidth_rules`` as first level API resources, leading to
conflicts in the QoS API. We now define ``alias_bandwidth_limit_rules``,
``alias_dscp_marking_rules`` and ``alias_minimum_bandwidth_rules`` that
will enable users to perform ``GET``, ``PUT`` and ``DELETE`` operations
on the corresponding QoS rules without having to specify the associated
policy ID.