Merge "Add port trusted vif extension"
This commit is contained in:
commit
90fa9948fd
@ -5461,6 +5461,24 @@ port_security_enabled-request:
|
||||
in: body
|
||||
required: false
|
||||
type: boolean
|
||||
port_trusted_vif-request:
|
||||
description: |
|
||||
The port's trusted VIF status. A valid value is
|
||||
``true`` or ``false``.
|
||||
Value of this field is included in the ``binding:profile`` dict of
|
||||
the port.
|
||||
in: body
|
||||
required: false
|
||||
type: boolean
|
||||
port_trusted_vif-response:
|
||||
description: |
|
||||
The port's trusted VIF status. A valid value is
|
||||
``true`` or ``false``.
|
||||
Value of this field is included in the ``binding:profile`` dict of
|
||||
the port.
|
||||
in: body
|
||||
required: true
|
||||
type: boolean
|
||||
ports:
|
||||
description: |
|
||||
A list of ``port`` objects.
|
||||
|
@ -179,6 +179,14 @@ attribute to ports. If a ``port-security`` value is not specified during
|
||||
port creation, a port will inherit the ``port_security_enabled`` from the
|
||||
network its connected to.
|
||||
|
||||
Trusted VIF
|
||||
===========
|
||||
|
||||
The ``port-trusted-vif`` extension adds ``trusted`` attribute to the port
|
||||
resource. This attribute stores information about if SR-IOV port should be
|
||||
trusted. It will be populated in the port binding profile information as the
|
||||
``trusted`` field.
|
||||
|
||||
Tag Ports During Bulk Creation
|
||||
==============================
|
||||
|
||||
@ -303,6 +311,7 @@ Response Parameters
|
||||
- updated_at: updated_at_resource
|
||||
- propagate_uplink_status: propagate_uplink_status
|
||||
- mac_learning_enabled: mac_learning_enabled
|
||||
- port_trusted_vif: port_trusted_vif-response
|
||||
|
||||
Response Example
|
||||
----------------
|
||||
@ -383,6 +392,7 @@ Request
|
||||
- qos_policy_id: qos_policy_id-port-request
|
||||
- security_groups: port-security_groups-request
|
||||
- mac_learning_enabled: mac_learning_enabled-request
|
||||
- port_trusted_vif: port_trusted_vif-request
|
||||
|
||||
Request Example
|
||||
---------------
|
||||
@ -439,6 +449,7 @@ Response Parameters
|
||||
- updated_at: updated_at_resource
|
||||
- propagate_uplink_status: propagate_uplink_status
|
||||
- mac_learning_enabled: mac_learning_enabled
|
||||
- port_trusted_vif: port_trusted_vif-response
|
||||
|
||||
Response Example
|
||||
----------------
|
||||
@ -573,6 +584,7 @@ Response Parameters
|
||||
- updated_at: updated_at_resource
|
||||
- propagate_uplink_status: propagate_uplink_status
|
||||
- mac_learning_enabled: mac_learning_enabled
|
||||
- port_trusted_vif: port_trusted_vif-response
|
||||
|
||||
Response Example
|
||||
----------------
|
||||
@ -630,6 +642,7 @@ Request
|
||||
- tenant_id: project_id-request
|
||||
- propagate_uplink_status: propagate_uplink_status-request
|
||||
- mac_learning_enabled: mac_learning_enabled-request
|
||||
- port_trusted_vif: port_trusted_vif-request
|
||||
|
||||
Request Example
|
||||
---------------
|
||||
@ -686,6 +699,7 @@ Response Parameters
|
||||
- updated_at: updated_at_resource
|
||||
- propagate_uplink_status: propagate_uplink_status
|
||||
- mac_learning_enabled: mac_learning_enabled
|
||||
- port_trusted_vif: port_trusted_vif-response
|
||||
|
||||
Response Example
|
||||
----------------
|
||||
|
@ -46,6 +46,7 @@
|
||||
"qos_network_policy_id": null,
|
||||
"qos_policy_id": null,
|
||||
"resource_request": null,
|
||||
"propagate_uplink_status": false
|
||||
"propagate_uplink_status": false,
|
||||
"trusted": true
|
||||
}
|
||||
}
|
||||
|
@ -17,6 +17,7 @@
|
||||
"dns_name": "myport",
|
||||
"hints": {"openvswitch": {"other_config": {"tx-steering": "hash"}}},
|
||||
"qos_policy_id": "29d5e02e-d5ab-4929-bee4-4a9fc12e22ae",
|
||||
"propagate_uplink_status": false
|
||||
"propagate_uplink_status": false,
|
||||
"trusted": true
|
||||
}
|
||||
}
|
||||
|
@ -89,6 +89,7 @@
|
||||
]
|
||||
},
|
||||
"propagate_uplink_status": false,
|
||||
"hardware_offload_type": "switchdev"
|
||||
"hardware_offload_type": "switchdev",
|
||||
"trusted": true
|
||||
}
|
||||
}
|
||||
|
@ -77,6 +77,7 @@
|
||||
]
|
||||
},
|
||||
"propagate_uplink_status": false,
|
||||
"hardware_offload_type": ""
|
||||
"hardware_offload_type": "",
|
||||
"trusted": true
|
||||
}
|
||||
}
|
||||
|
@ -75,6 +75,7 @@
|
||||
]
|
||||
},
|
||||
"propagate_uplink_status": false,
|
||||
"hardware_offload_type": ""
|
||||
"hardware_offload_type": "",
|
||||
"trusted": true
|
||||
}
|
||||
}
|
||||
|
@ -14,6 +14,7 @@
|
||||
}
|
||||
],
|
||||
"propagate_uplink_status": false,
|
||||
"hardware_offload_type": ""
|
||||
"hardware_offload_type": "",
|
||||
"trusted": true
|
||||
}
|
||||
}
|
||||
|
@ -52,6 +52,7 @@
|
||||
"qos_network_policy_id": "174dd0c1-a4eb-49d4-a807-ae80246d82f4",
|
||||
"qos_policy_id": "29d5e02e-d5ab-4929-bee4-4a9fc12e22ae",
|
||||
"propagate_uplink_status": false,
|
||||
"hardware_offload_type": ""
|
||||
"hardware_offload_type": "",
|
||||
"trusted": true
|
||||
}
|
||||
}
|
||||
|
@ -42,6 +42,7 @@
|
||||
"qos_policy_id": null,
|
||||
"resource_request": null,
|
||||
"propagate_uplink_status": false,
|
||||
"hardware_offload_type": ""
|
||||
"hardware_offload_type": "",
|
||||
"trusted": true
|
||||
}
|
||||
}
|
||||
|
@ -52,6 +52,7 @@
|
||||
"qos_policy_id": "29d5e02e-d5ab-4929-bee4-4a9fc12e22ae",
|
||||
"port_security_enabled": false,
|
||||
"propagate_uplink_status": false,
|
||||
"hardware_offload_type": ""
|
||||
"hardware_offload_type": "",
|
||||
"trusted": true
|
||||
}
|
||||
}
|
||||
|
@ -71,7 +71,8 @@
|
||||
"tags": ["tag1,tag2"],
|
||||
"tenant_id": "",
|
||||
"propagate_uplink_status": false,
|
||||
"hardware_offload_type": ""
|
||||
"hardware_offload_type": "",
|
||||
"trusted": true
|
||||
},
|
||||
{
|
||||
"admin_state_up": true,
|
||||
@ -121,7 +122,8 @@
|
||||
"tags": ["tag1,tag2"],
|
||||
"tenant_id": "d397de8a63f341818f198abb0966f6f3",
|
||||
"propagate_uplink_status": false,
|
||||
"hardware_offload_type": ""
|
||||
"hardware_offload_type": "",
|
||||
"trusted": false
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -41,7 +41,8 @@
|
||||
"qos_policy_id": "29d5e02e-d5ab-4929-bee4-4a9fc12e22ae",
|
||||
"port_security_enabled": false,
|
||||
"propagate_uplink_status": false,
|
||||
"hardware_offload_type": ""
|
||||
"hardware_offload_type": "",
|
||||
"trusted": null
|
||||
},
|
||||
{
|
||||
"admin_state_up": false,
|
||||
@ -85,7 +86,8 @@
|
||||
"qos_policy_id": null,
|
||||
"port_security_enabled": false,
|
||||
"propagate_uplink_status": false,
|
||||
"hardware_offload_type": "switchdev"
|
||||
"hardware_offload_type": "switchdev",
|
||||
"trusted": null
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -100,6 +100,7 @@ from neutron_lib.api.definitions import port_numa_affinity_policy_socket
|
||||
from neutron_lib.api.definitions import port_resource_request
|
||||
from neutron_lib.api.definitions import port_resource_request_groups
|
||||
from neutron_lib.api.definitions import port_security
|
||||
from neutron_lib.api.definitions import port_trusted_vif
|
||||
from neutron_lib.api.definitions import portbindings
|
||||
from neutron_lib.api.definitions import portbindings_extended
|
||||
from neutron_lib.api.definitions import project_default_networks
|
||||
@ -260,6 +261,7 @@ _ALL_API_DEFINITIONS = {
|
||||
port_resource_request,
|
||||
port_resource_request_groups,
|
||||
port_security,
|
||||
port_trusted_vif,
|
||||
portbindings,
|
||||
portbindings_extended,
|
||||
project_default_networks,
|
||||
|
50
neutron_lib/api/definitions/port_trusted_vif.py
Normal file
50
neutron_lib/api/definitions/port_trusted_vif.py
Normal file
@ -0,0 +1,50 @@
|
||||
# Copyright (c) 2024 Red Hat, Inc.
|
||||
#
|
||||
# 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 port
|
||||
from neutron_lib.api.definitions import portbindings
|
||||
from neutron_lib import constants
|
||||
|
||||
|
||||
ALIAS = 'port-trusted-vif'
|
||||
IS_SHIM_EXTENSION = False
|
||||
IS_STANDARD_ATTR_EXTENSION = False
|
||||
NAME = "Port trusted vif"
|
||||
DESCRIPTION = "Expose port 'trusted' attribute in the API"
|
||||
UPDATED_TIMESTAMP = "2024-07-10T10:00:00-00:00"
|
||||
RESOURCE_NAME = port.RESOURCE_NAME
|
||||
COLLECTION_NAME = port.COLLECTION_NAME
|
||||
TRUSTED_VIF = 'trusted'
|
||||
|
||||
RESOURCE_ATTRIBUTE_MAP = {
|
||||
COLLECTION_NAME: {
|
||||
TRUSTED_VIF: {
|
||||
'allow_post': True,
|
||||
'allow_put': True,
|
||||
'convert_to': converters.convert_to_boolean,
|
||||
'enforce_policy': True,
|
||||
'required_by_policy': False,
|
||||
'default': constants.ATTR_NOT_SPECIFIED,
|
||||
'is_visible': True,
|
||||
'validate': {'type:boolean': None}
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
SUB_RESOURCE_ATTRIBUTE_MAP = None
|
||||
ACTION_MAP = {}
|
||||
ACTION_STATUS = {}
|
||||
REQUIRED_EXTENSIONS = [portbindings.ALIAS]
|
||||
OPTIONAL_EXTENSIONS = []
|
@ -0,0 +1,22 @@
|
||||
# Copyright 2024 Red Hat, Inc.
|
||||
#
|
||||
# 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_trusted_vif
|
||||
from neutron_lib.tests.unit.api.definitions import base
|
||||
|
||||
|
||||
class PortTrustedVifDefinitionTestCase(base.DefinitionBaseTestCase):
|
||||
extension_module = port_trusted_vif
|
||||
extension_resources = (port_trusted_vif.COLLECTION_NAME,)
|
||||
extension_attributes = (port_trusted_vif.TRUSTED_VIF,)
|
@ -0,0 +1,9 @@
|
||||
---
|
||||
features:
|
||||
- |
|
||||
The ``port-trusted-vif`` extension adds ``trusted`` attribute to the port
|
||||
resource. This new attribute allows to set through the API ``SR-IOV`` port
|
||||
to be ``trusted``. This was previosly only possible through the
|
||||
``binding:profile`` attribute of the port resource but that was invalid and
|
||||
now is not possible.
|
||||
Value of that new field will be populated in the port's ``binding:profile``.
|
Loading…
x
Reference in New Issue
Block a user