From 1326d1bf75046740a542d1313ef2180ceb5e0903 Mon Sep 17 00:00:00 2001 From: Steve Baker Date: Fri, 20 Oct 2023 13:40:51 +1300 Subject: [PATCH] [baremetal] port add shard, is_smartnic, name Change-Id: Iead7d129479a850c60f08b366f0f9e4f02a53b83 --- openstack/baremetal/v1/port.py | 10 +++++++++- openstack/tests/unit/baremetal/v1/test_port.py | 4 ++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/openstack/baremetal/v1/port.py b/openstack/baremetal/v1/port.py index 1435d7c13..fa2511865 100644 --- a/openstack/baremetal/v1/port.py +++ b/openstack/baremetal/v1/port.py @@ -32,12 +32,16 @@ class Port(_common.ListMixin, resource.Resource): 'address', 'node', 'portgroup', + 'shard', fields={'type': _common.fields_type}, node_id='node_uuid', ) # The physical_network field introduced in 1.34 - _max_microversion = '1.34' + # The is_smartnic field added in 1.53 + # Query filter by shard added in 1.82 + # The name field added in 1.88 + _max_microversion = '1.88' #: The physical hardware address of the network port, typically the #: hardware MAC address. @@ -53,6 +57,8 @@ class Port(_common.ListMixin, resource.Resource): internal_info = resource.Body('internal_info') #: Whether PXE is enabled on the port. Added in API microversion 1.19. is_pxe_enabled = resource.Body('pxe_enabled', type=bool) + #: Whether the port is a Smart NIC port. Added in API microversion 1.53. + is_smartnic = resource.Body('is_smartnic', type=bool) #: A list of relative links, including the self and bookmark links. links = resource.Body('links', type=list) #: The port bindig profile. If specified, must contain ``switch_id`` and @@ -60,6 +66,8 @@ class Port(_common.ListMixin, resource.Resource): #: to be used to store vendor specific information. Added in API #: microversion 1.19. local_link_connection = resource.Body('local_link_connection') + #: The name of the port + name = resource.Body('name') #: The UUID of node this port belongs to node_id = resource.Body('node_uuid') #: The name of physical network this port is attached to. diff --git a/openstack/tests/unit/baremetal/v1/test_port.py b/openstack/tests/unit/baremetal/v1/test_port.py index ed98f090e..d688d7fbe 100644 --- a/openstack/tests/unit/baremetal/v1/test_port.py +++ b/openstack/tests/unit/baremetal/v1/test_port.py @@ -19,6 +19,7 @@ FAKE = { "created_at": "2016-08-18T22:28:49.946416+00:00", "extra": {}, "internal_info": {}, + "is_smartnic": True, "links": [ {"href": "http://127.0.0.1:6385/v1/ports/", "rel": "self"}, {"href": "http://127.0.0.1:6385/ports/", "rel": "bookmark"}, @@ -28,6 +29,7 @@ FAKE = { "switch_id": "0a:1b:2c:3d:4e:5f", "switch_info": "switch1", }, + "name": "port_name", "node_uuid": "6d85703a-565d-469a-96ce-30b6de53079d", "portgroup_uuid": "e43c722c-248e-4c6e-8ce8-0d8ff129387a", "pxe_enabled": True, @@ -56,10 +58,12 @@ class TestPort(base.TestCase): self.assertEqual(FAKE['created_at'], sot.created_at) self.assertEqual(FAKE['extra'], sot.extra) self.assertEqual(FAKE['internal_info'], sot.internal_info) + self.assertEqual(FAKE['is_smartnic'], sot.is_smartnic) self.assertEqual(FAKE['links'], sot.links) self.assertEqual( FAKE['local_link_connection'], sot.local_link_connection ) + self.assertEqual(FAKE['name'], sot.name) self.assertEqual(FAKE['node_uuid'], sot.node_id) self.assertEqual(FAKE['portgroup_uuid'], sot.port_group_id) self.assertEqual(FAKE['pxe_enabled'], sot.is_pxe_enabled)