Skip to content

Commit 416d889

Browse files
committed
Populate Ironic baremetal port "local_link_connection" field on enroll
1 parent e52affe commit 416d889

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

python/understack-workflows/understack_workflows/port_configuration.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@ class PortConfiguration(BaseModel):
1212
node_uuid: str # using a str here due to ironicclient Port attribute
1313
name: str # port name
1414
pxe_enabled: bool
15+
local_link_connection: dict

python/understack-workflows/understack_workflows/sync_interfaces.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,12 +81,22 @@ def port_configuration(
8181
name = f"{interface.id} {interface.name}"
8282
pxe_enabled = interface.name == pxe_interface
8383

84+
if interface.neighbor_chassis_mac:
85+
local_link_connection = {
86+
"switch_id": interface.neighbor_chassis_mac.lower(),
87+
"port_id": interface.neighbor_interface_name,
88+
"switch_info": interface.neighbor_device_name,
89+
}
90+
else:
91+
local_link_connection = {}
92+
8493
return PortConfiguration(
8594
node_uuid=device_id,
8695
address=interface.mac_address.lower(),
8796
uuid=interface.id,
8897
name=name,
8998
pxe_enabled=pxe_enabled,
99+
local_link_connection=local_link_connection,
90100
)
91101

92102

0 commit comments

Comments
 (0)