Merge "[baremetal] port add shard, is_smartnic, name"

This commit is contained in:
Zuul 2024-01-30 09:31:36 +00:00 committed by Gerrit Code Review
commit 460e87a91f
2 changed files with 13 additions and 1 deletions

View File

@ -32,12 +32,16 @@ class Port(_common.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.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.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.

View File

@ -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/<PORT_ID>", "rel": "self"},
{"href": "http://127.0.0.1:6385/ports/<PORT_ID>", "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)