Add port property: port-resource-request

With the introduction of port-resource-request some ports have a new
attribute: resource_request, make openstacksdk know about it.

Details: https://developer.openstack.org/api-ref/network/v2/ \
index.html?expanded=show-port-details-detail#ports

Change-Id: I47494ddc7df9308f8eead8bd36a194e59b781199
Partial-Bug: #1578989
See-Also: https://review.openstack.org/502306 (nova spec)
See-Also: https://review.openstack.org/508149 (neutron spec)
This commit is contained in:
Lajos Katona 2019-01-10 15:53:29 +01:00
parent 72bceaf405
commit 642c0fc937
2 changed files with 11 additions and 0 deletions

View File

@ -107,6 +107,10 @@ class Port(resource.Resource, resource.TagMixin):
type=bool)
#: The ID of the QoS policy attached to the port.
qos_policy_id = resource.Body('qos_policy_id')
#: Read-only. The port-resource-request exposes Placement resources
# (i.e.: minimum-bandwidth) and traits (i.e.: vnic-type, physnet)
# requested by a port to Nova and Placement.
resource_request = resource.Body('resource_request', type=dict)
#: Revision number of the port. *Type: int*
revision_number = resource.Body('revision_number', type=int)
#: The IDs of any attached security groups.

View File

@ -40,6 +40,12 @@ EXAMPLE = {
'port_security_enabled': True,
'qos_policy_id': '21',
'propagate_uplink_status': False,
'resource_request': {
'required': [
'CUSTOM_PHYSNET_PUBLIC', 'CUSTOM_VNIC_TYPE_NORMAL'],
'resources': {
'NET_BW_EGR_KILOBIT_PER_SEC': 1,
'NET_BW_IGR_KILOBIT_PER_SEC': 2}},
'revision_number': 22,
'security_groups': ['23'],
'status': '25',
@ -124,6 +130,7 @@ class TestPort(base.TestCase):
self.assertEqual(EXAMPLE['qos_policy_id'], sot.qos_policy_id)
self.assertEqual(EXAMPLE['propagate_uplink_status'],
sot.propagate_uplink_status)
self.assertEqual(EXAMPLE['resource_request'], sot.resource_request)
self.assertEqual(EXAMPLE['revision_number'], sot.revision_number)
self.assertEqual(EXAMPLE['security_groups'], sot.security_group_ids)
self.assertEqual(EXAMPLE['status'], sot.status)