Skip to content

Commit

Permalink
make getting Chassis collection work with DPU BMCs (#323)
Browse files Browse the repository at this point in the history
Fix incorrect Chassis.Controls link definition.
  • Loading branch information
iamsli authored Apr 30, 2024
1 parent cf61634 commit 2d5d848
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
3 changes: 2 additions & 1 deletion redfish/chassis.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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()
Expand Down
7 changes: 7 additions & 0 deletions redfish/chassis_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand Down Expand Up @@ -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)
}
Expand Down

0 comments on commit 2d5d848

Please sign in to comment.