From 2d5d848d77ab27ea3ca4ec109ce631d6f681ffc9 Mon Sep 17 00:00:00 2001 From: Sandy Li <47486464+iamsli@users.noreply.github.com> Date: Tue, 30 Apr 2024 16:48:13 -0400 Subject: [PATCH] make getting Chassis collection work with DPU BMCs (#323) Fix incorrect Chassis.Controls link definition. --- redfish/chassis.go | 3 ++- redfish/chassis_test.go | 7 +++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/redfish/chassis.go b/redfish/chassis.go index 00c93b47..d2c0d7fb 100644 --- a/redfish/chassis.go +++ b/redfish/chassis.go @@ -473,7 +473,7 @@ func (chassis *Chassis) UnmarshalJSON(b []byte) error { temp Assembly common.Link Certificates common.Link - Controls common.Links + Controls common.Link Drives common.Link EnvironmentMetrics common.Link FabricAdapters common.Link @@ -504,6 +504,7 @@ func (chassis *Chassis) UnmarshalJSON(b []byte) error { // Extract the links to other entities for later chassis.assembly = t.Assembly.String() chassis.certificates = t.Certificates.String() + chassis.controls = t.Controls.String() chassis.drives = t.Drives.String() chassis.environmentMetrics = t.EnvironmentMetrics.String() chassis.fabricAdapters = t.FabricAdapters.String() diff --git a/redfish/chassis_test.go b/redfish/chassis_test.go index 3a523d7e..bd57459b 100644 --- a/redfish/chassis_test.go +++ b/redfish/chassis_test.go @@ -39,6 +39,9 @@ var chassisBody = `{ "Assembly": { "@odata.id": "/redfish/v1/Chassis/Chassis-1/Assembly" }, + "Controls": { + "@odata.id": "/redfish/v1/Chassis/Chassis-1/Controls" + }, "Drives": { "@odata.id": "/redfish/v1/Chassis/Chassis-1/Drives" }, @@ -155,6 +158,10 @@ func TestChassis(t *testing.T) { t.Errorf("Received invalid assembly reference: %s", result.assembly) } + if result.controls != "/redfish/v1/Chassis/Chassis-1/Controls" { + t.Errorf("Received invalid controls reference: %s", result.controls) + } + if result.drives != "/redfish/v1/Chassis/Chassis-1/Drives" { t.Errorf("Received invalid drive reference: %s", result.drives) }