Merge "Add new API extension `uplink-status-propagation-updatable`"

This commit is contained in:
Zuul 2024-10-04 15:53:55 +00:00 committed by Gerrit Code Review
commit be03db0bf1
9 changed files with 81 additions and 3 deletions

View File

@ -389,6 +389,7 @@ Request
- name: name-request
- numa_affinity_policy: numa_affinity_policy-request
- port_security_enabled: port_security_enabled-request
- propagate_uplink_status: propagate_uplink_status
- qos_policy_id: qos_policy_id-port-request
- security_groups: port-security_groups-request
- mac_learning_enabled: mac_learning_enabled-request

View File

@ -4,6 +4,7 @@
"device_id": "d90a13da-be41-461f-9f99-1dbcf438fdf2",
"device_owner": "compute:nova",
"name": "test-for-port-update",
"qos_policy_id": "29d5e02e-d5ab-4929-bee4-4a9fc12e22ae"
"qos_policy_id": "29d5e02e-d5ab-4929-bee4-4a9fc12e22ae",
"propagate_uplink_status": true
}
}

View File

@ -51,8 +51,8 @@
"qos_network_policy_id": "174dd0c1-a4eb-49d4-a807-ae80246d82f4",
"qos_policy_id": "29d5e02e-d5ab-4929-bee4-4a9fc12e22ae",
"port_security_enabled": false,
"propagate_uplink_status": false,
"hardware_offload_type": "",
"trusted": true
"trusted": true,
"propagate_uplink_status": true
}
}

View File

@ -162,6 +162,7 @@ from neutron_lib.api.definitions import tap_mirror
from neutron_lib.api.definitions import trunk
from neutron_lib.api.definitions import trunk_details
from neutron_lib.api.definitions import uplink_status_propagation
from neutron_lib.api.definitions import uplink_status_propagation_updatable
from neutron_lib.api.definitions import vlan_filter
from neutron_lib.api.definitions import vlantransparent
from neutron_lib.api.definitions import vpn
@ -322,6 +323,7 @@ _ALL_API_DEFINITIONS = {
trunk,
trunk_details,
uplink_status_propagation,
uplink_status_propagation_updatable,
vlan_filter,
vlantransparent,
vpn,

View File

@ -179,6 +179,8 @@ KNOWN_EXTENSIONS = (
'tag-creation',
'trunk',
'trunk-details',
'uplink-status-propagation',
'uplink-status-propagation-updatable',
# Add here list of extensions with pointers to the project repo, e.g.
'bgp', # https://opendev.org/openstack/neutron-dynamic-routing

View File

@ -0,0 +1,40 @@
# 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.
import copy
from neutron_lib.api.definitions import uplink_status_propagation as usp
ALIAS = 'uplink-status-propagation-updatable'
IS_SHIM_EXTENSION = False
IS_STANDARD_ATTR_EXTENSION = False
NAME = 'Uplink status propagation updatable extension'
API_PREFIX = ''
DESCRIPTION = 'Provides ability to update the port uplink status.'
UPDATED_TIMESTAMP = '2024-09-03T18:00:00-00:00'
PROPAGATE_UPLINK_STATUS = usp.PROPAGATE_UPLINK_STATUS
propagate_uplink_status = copy.deepcopy(
usp.RESOURCE_ATTRIBUTE_MAP[usp.COLLECTION_NAME][PROPAGATE_UPLINK_STATUS])
propagate_uplink_status['allow_put'] = True
RESOURCE_ATTRIBUTE_MAP = {
usp.COLLECTION_NAME: {PROPAGATE_UPLINK_STATUS: propagate_uplink_status},
}
SUB_RESOURCE_ATTRIBUTE_MAP = {}
ACTION_MAP = {}
REQUIRED_EXTENSIONS = [usp.ALIAS]
OPTIONAL_EXTENSIONS = []
ACTION_STATUS = {}

View File

@ -16,4 +16,5 @@ from neutron_lib.tests.unit.api.definitions import base
class UplinkStatusPropagationDefinitionTestCase(base.DefinitionBaseTestCase):
extension_module = apidef
extension_resources = (apidef.COLLECTION_NAME,)
extension_attributes = (apidef.PROPAGATE_UPLINK_STATUS,)

View File

@ -0,0 +1,23 @@
# 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 uplink_status_propagation as usp
from neutron_lib.api.definitions import uplink_status_propagation_updatable \
as apidef
from neutron_lib.tests.unit.api.definitions import base
class UplinkStatusPropagationUpdatableDefinitionTestCase(
base.DefinitionBaseTestCase):
extension_module = apidef
extension_resources = (usp.COLLECTION_NAME,)
extension_attributes = (apidef.PROPAGATE_UPLINK_STATUS,)

View File

@ -0,0 +1,8 @@
---
features:
- |
Add the API extension ``uplink-status-propagation-updatable`` to make the
port field ``propagate_uplink_status`` updatable. Now it is possible to send
a port PUT request to update the value defined during the creation. This
change will have an effect in the ML2/SR-IOV agent that will need to update
the VF status accordingly.