Add "qos_network_policy_id" field to "port" definition

DocImpact

Change-Id: Ic1d555ef957124c866a2baf788564b3c200583eb
Related-Bug: #1851362
This commit is contained in:
Rodolfo Alonso Hernandez 2019-11-06 17:56:46 +00:00
parent d800a41f66
commit c5cb36903f
17 changed files with 111 additions and 5 deletions

View File

@ -5054,6 +5054,12 @@ qos_minimum_bandwidth_rule-id:
in: body
required: true
type: string
qos_network_policy_id-port-response:
description: |
The ID of the QoS policy of the network where this port is plugged.
in: body
required: true
type: string
qos_policy-name:
description: |
Human-readable name of the resource.

View File

@ -117,6 +117,13 @@ define QoS policies and associate these to the ports by introducing the
``qos_policy_id`` attribute. The policies should be created before they are
associated to the ports.
QoS network policy
==================
The ``qos-port-network-policy`` extension adds the read only parameter
``qos_network_policy_id`` to the port responses. This parameter contains the
QoS policy ID of the network where this port is plugged.
Regenerate mac address extension
================================
@ -201,8 +208,9 @@ Response Parameters
- network_id: network_id
- port_security_enabled: port_security_enabled
- project_id: project_id
- revision_number: revision_number
- qos_network_policy_id: qos_network_policy_id-port-response
- qos_policy_id: qos_policy_id-port-response
- revision_number: revision_number
- resource_request: port-resource
- security_groups: port-security_groups
- status: port-status
@ -325,8 +333,9 @@ Response Parameters
- network_id: network_id
- port_security_enabled: port_security_enabled
- project_id: project_id
- revision_number: revision_number
- qos_network_policy_id: qos_network_policy_id-port-response
- qos_policy_id: qos_policy_id-port-response
- revision_number: revision_number
- resource_request: port-resource
- security_groups: port-security_groups
- status: port-status
@ -460,8 +469,9 @@ Response Parameters
- network_id: network_id
- port_security_enabled: port_security_enabled
- project_id: project_id
- revision_number: revision_number
- qos_network_policy_id: qos_network_policy_id-port-response
- qos_policy_id: qos_policy_id-port-response
- revision_number: revision_number
- resource_request: port-resource
- security_groups: port-security_groups
- status: port-status
@ -568,8 +578,9 @@ Response Parameters
- network_id: network_id
- port_security_enabled: port_security_enabled
- project_id: project_id
- revision_number: revision_number
- qos_network_policy_id: qos_network_policy_id-port-response
- qos_policy_id: qos_policy_id-port-response
- revision_number: revision_number
- resource_request: port-resource
- security_groups: port-security_groups
- status: port-status
@ -669,8 +680,9 @@ Response Parameters
- network_id: network_id
- port_security_enabled: port_security_enabled
- project_id: project_id
- revision_number: revision_number
- qos_network_policy_id: qos_network_policy_id-port-response
- qos_policy_id: qos_policy_id-port-response
- revision_number: revision_number
- security_groups: port-security_groups
- status: port-status
- tags: tags

View File

@ -59,6 +59,7 @@
"tags": ["tag1,tag2"],
"tenant_id": "d6700c0c9ffa4f1cb322cd4a1f3906fa",
"updated_at": "2016-03-08T20:19:41",
"qos_network_policy_id": "174dd0c1-a4eb-49d4-a807-ae80246d82f4",
"qos_policy_id": "29d5e02e-d5ab-4929-bee4-4a9fc12e22ae",
"port_security_enabled": true,
"resource_request": {

View File

@ -49,6 +49,7 @@
"tags": ["tag1,tag2"],
"tenant_id": "7e02058126cc4950b75f9970368ba177",
"updated_at": "2016-03-08T20:19:41",
"qos_network_policy_id": "174dd0c1-a4eb-49d4-a807-ae80246d82f4",
"qos_policy_id": "29d5e02e-d5ab-4929-bee4-4a9fc12e22ae",
"resource_request": {
"required": ["CUSTOM_PHYSNET_PUBLIC", "CUSTOM_VNIC_TYPE_NORMAL"],

View File

@ -46,6 +46,7 @@
"tags": ["tag1,tag2"],
"tenant_id": "522eda8d23124b25bf03fe44f1986b74",
"updated_at": "2016-03-08T20:19:41",
"qos_network_policy_id": "174dd0c1-a4eb-49d4-a807-ae80246d82f4",
"qos_policy_id": "29d5e02e-d5ab-4929-bee4-4a9fc12e22ae",
"port_security_enabled": false,
"resource_request": {

View File

@ -47,6 +47,7 @@
"tags": ["tag1,tag2"],
"tenant_id": "d6700c0c9ffa4f1cb322cd4a1f3906fa",
"updated_at": "2016-03-08T20:19:41",
"qos_network_policy_id": "174dd0c1-a4eb-49d4-a807-ae80246d82f4",
"qos_policy_id": "29d5e02e-d5ab-4929-bee4-4a9fc12e22ae",
"uplink_status_propagation": false
}

View File

@ -40,6 +40,7 @@
"tags": ["tag1,tag2"],
"tenant_id": "7e02058126cc4950b75f9970368ba177",
"updated_at": "2016-03-08T20:19:41",
"qos_network_policy_id": "174dd0c1-a4eb-49d4-a807-ae80246d82f4",
"qos_policy_id": "29d5e02e-d5ab-4929-bee4-4a9fc12e22ae",
"uplink_status_propagation": false
}

View File

@ -46,6 +46,7 @@
"tags": ["tag1,tag2"],
"tenant_id": "522eda8d23124b25bf03fe44f1986b74",
"updated_at": "2016-03-08T20:19:41",
"qos_network_policy_id": "174dd0c1-a4eb-49d4-a807-ae80246d82f4",
"qos_policy_id": "29d5e02e-d5ab-4929-bee4-4a9fc12e22ae",
"port_security_enabled": false,
"uplink_status_propagation": false

View File

@ -42,6 +42,7 @@
"status": "ACTIVE",
"tenant_id": "",
"updated_at": "2016-03-08T20:19:41",
"qos_network_policy_id": null,
"qos_policy_id": "29d5e02e-d5ab-4929-bee4-4a9fc12e22ae",
"resource_request": {
"required": ["CUSTOM_PHYSNET_PUBLIC", "CUSTOM_VNIC_TYPE_NORMAL"],
@ -93,6 +94,7 @@
"status": "ACTIVE",
"tenant_id": "d397de8a63f341818f198abb0966f6f3",
"updated_at": "2016-03-08T20:19:41",
"qos_network_policy_id": "174dd0c1-a4eb-49d4-a807-ae80246d82f4",
"qos_policy_id": null,
"tags": ["tag1,tag2"],
"tenant_id": "d397de8a63f341818f198abb0966f6f3",

View File

@ -37,6 +37,7 @@
"tags": ["tag1,tag2"],
"tenant_id": "d6700c0c9ffa4f1cb322cd4a1f3906fa",
"updated_at": "2016-03-08T20:19:41",
"qos_network_policy_id": null,
"qos_policy_id": "29d5e02e-d5ab-4929-bee4-4a9fc12e22ae",
"port_security_enabled": false,
"uplink_status_propagation": false
@ -79,6 +80,7 @@
"tags": ["tag1,tag2"],
"tenant_id": "d6700c0c9ffa4f1cb322cd4a1f3906fa",
"updated_at": "2016-03-08T20:19:41",
"qos_network_policy_id": "174dd0c1-a4eb-49d4-a807-ae80246d82f4",
"qos_policy_id": null,
"port_security_enabled": false,
"uplink_status_propagation": false

View File

@ -40,6 +40,7 @@
"tags": ["tag1,tag2"],
"tenant_id": "",
"updated_at": "2016-03-08T20:19:41",
"qos_network_policy_id": "174dd0c1-a4eb-49d4-a807-ae80246d82f4",
"qos_policy_id": "29d5e02e-d5ab-4929-bee4-4a9fc12e22ae",
"port_security_enabled": false,
"uplink_status_propagation": false
@ -84,6 +85,7 @@
"tags": ["tag1,tag2"],
"tenant_id": "d397de8a63f341818f198abb0966f6f3",
"updated_at": "2016-03-08T20:19:41",
"qos_network_policy_id": null,
"qos_policy_id": null,
"port_security_enabled": false,
"uplink_status_propagation": false

View File

@ -83,6 +83,7 @@ from neutron_lib.api.definitions import qos_bw_limit_direction
from neutron_lib.api.definitions import qos_bw_minimum_ingress
from neutron_lib.api.definitions import qos_default
from neutron_lib.api.definitions import qos_gateway_ip
from neutron_lib.api.definitions import qos_port_network_policy
from neutron_lib.api.definitions import qos_rule_type_details
from neutron_lib.api.definitions import qos_rules_alias
from neutron_lib.api.definitions import rbac_security_groups
@ -190,6 +191,7 @@ _ALL_API_DEFINITIONS = {
qos_bw_minimum_ingress,
qos_default,
qos_gateway_ip,
qos_port_network_policy,
qos_rule_type_details,
qos_rules_alias,
rbac_security_groups,

View File

@ -124,6 +124,7 @@ KNOWN_EXTENSIONS = (
'qos',
'qos-bw-limit-direction',
'qos-gateway-ip',
'qos-port-network-policy',
'qos-rules-alias',
'quotas',
'rbac-policies',

View File

@ -0,0 +1,41 @@
# Copyright (c) 2019 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 port as port_apidef
from neutron_lib.api.definitions import qos as qos_apidef
from neutron_lib.services.qos import constants as qos_const
ALIAS = 'qos-port-network-policy'
IS_SHIM_EXTENSION = False
IS_STANDARD_ATTR_EXTENSION = False
NAME = 'QoS port network policy ID'
DESCRIPTION = 'Adds a the QoS network ID to the port definition'
UPDATED_TIMESTAMP = '2019-11-01T10:00:00-00:00'
RESOURCE_ATTRIBUTE_MAP = {
port_apidef.COLLECTION_NAME: {
qos_const.QOS_POLICY_ID: {
'allow_post': False,
'allow_put': False,
'is_visible': True,
'default': None,
'validate': {'type:uuid_or_none': None}
}
}
}
SUB_RESOURCE_ATTRIBUTE_MAP = {}
ACTION_MAP = {}
REQUIRED_EXTENSIONS = [qos_apidef.ALIAS]
OPTIONAL_EXTENSIONS = []
ACTION_STATUS = {}

View File

@ -29,6 +29,7 @@ DIRECTION = "direction"
DSCP_MARK = "dscp_mark"
QOS_POLICY_ID = 'qos_policy_id'
QOS_NETWORK_POLICY_ID = 'qos_network_policy_id'
QOS_PLUGIN = 'qos_plugin'

View File

@ -0,0 +1,25 @@
# Copyright (c) 2019 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 port
from neutron_lib.api.definitions import qos_port_network_policy
from neutron_lib.services.qos import constants as qos_const
from neutron_lib.tests.unit.api.definitions import base
class QosPortNetworkPolicyTestCase(base.DefinitionBaseTestCase):
extension_module = qos_port_network_policy
extension_resources = (port.RESOURCE_NAME,)
extension_attributes = (qos_const.QOS_NETWORK_POLICY_ID,)

View File

@ -0,0 +1,6 @@
---
features:
- |
Add field ``qos_port_network_policy_id`` to the ``port`` definition. This
read only parameter contains the QoS policy of the network where the port
is plugged.