From bb055aeabfbab2c77b309b008af2ae4942f04271 Mon Sep 17 00:00:00 2001 From: Joshua Williams Date: Thu, 18 Jul 2024 11:18:05 -0700 Subject: [PATCH 1/2] CASMHMS-6140: Parse Managers .Actions correctly for Gigabyte and Paradise platforms during discovery --- .version | 2 +- CHANGELOG.md | 6 ++++++ pkg/redfish/rfcomponents.go | 19 +++++++++++++++++++ pkg/redfish/rfcomponents_test.go | 32 ++++++++++++++++++++++++++++++++ 4 files changed, 58 insertions(+), 1 deletion(-) diff --git a/.version b/.version index b9ff5a2..2b908d5 100644 --- a/.version +++ b/.version @@ -1 +1 @@ -2.11.16 +2.11.17 diff --git a/CHANGELOG.md b/CHANGELOG.md index d2de9e8..3f1d9d9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [2.11.17] - 2024-07-22 + +### Fixed + +- Parse Managers .Actions correctly for Gigabyte and Paradise platforms during discovery + ## [2.11.16] - 2024-07-15 ### Fixed diff --git a/pkg/redfish/rfcomponents.go b/pkg/redfish/rfcomponents.go index 6442ce6..cc038ad 100644 --- a/pkg/redfish/rfcomponents.go +++ b/pkg/redfish/rfcomponents.go @@ -651,6 +651,25 @@ func (m *EpManager) discoverRemotePhase1() { m.ManagedSystems = m.ManagerRF.Links.ManagerForServers if m.ManagerRF.Actions != nil { m.Actions = m.ManagerRF.Actions + mr := m.Actions.ManagerReset + if mr.RFActionInfo != "" { + actionInfoJSON, err := m.epRF.GETRelative(mr.RFActionInfo) + if err != nil || actionInfoJSON == nil { + m.LastStatus = HTTPsGetFailed + return + } + var actionInfo ResetActionInfo + err = json.Unmarshal(actionInfoJSON, &actionInfo) + if err != nil { + errlog.Printf("Failed to decode %s: %s\n", url, err) + m.LastStatus = EPResponseFailedDecode + } + for _, p := range actionInfo.RAParameters { + if p.Name == "ResetType" { + m.Actions.ManagerReset.AllowableValues = p.AllowableValues + } + } + } } // Get link to Manager's ethernet interfaces diff --git a/pkg/redfish/rfcomponents_test.go b/pkg/redfish/rfcomponents_test.go index 6b2f100..88335ba 100644 --- a/pkg/redfish/rfcomponents_test.go +++ b/pkg/redfish/rfcomponents_test.go @@ -3945,6 +3945,14 @@ func NewRTFuncGBT1() RTFunc { // Header must always be non-nil or it will cause a panic. Header: make(http.Header), } + case "https://" + testFQDN + testPathGBT_managers_self_reset_action_info: + return &http.Response{ + StatusCode: 200, + // Send mock response for rpath + Body: ioutil.NopCloser(bytes.NewBufferString(testPayloadGBT_managers_self_reset_action_info)), + // Header must always be non-nil or it will cause a panic. + Header: make(http.Header), + } case "https://" + testFQDN + testPathGBT_managers_self_ethernet_interfaces: return &http.Response{ StatusCode: 200, @@ -4414,6 +4422,30 @@ const testPayloadGBT_managers_self = ` } ` +const testPathGBT_managers_self_reset_action_info = "/redfish/v1/Managers/Self/ResetActionInfo" + +const testPayloadGBT_managers_self_reset_action_info = ` +{ + "@odata.context": "/redfish/v1/$metadata#ActionInfo.ActionInfo", + "@odata.etag": "W/\"1721044073\"", + "@odata.id": "/redfish/v1/Managers/Self/ResetActionInfo", + "@odata.type": "#ActionInfo.v1_1_1.ActionInfo", + "Description": "This action is used to reset the Managers", + "Id": "ResetAction", + "Name": "ResetAction", + "Parameters": [ + { + "AllowableValues": [ + "ForceRestart" + ], + "DataType": "String", + "Name": "ResetType", + "Required": true + } + ] +} +` + const testPathGBT_managers_self_ethernet_interfaces = "/redfish/v1/Managers/Self/EthernetInterfaces" const testPayloadGBT_managers_self_ethernet_interfaces = ` From 8a56bddff2cf659cdeb72e7aa1cbeca3f6fd4612 Mon Sep 17 00:00:00 2001 From: Joshua Williams Date: Tue, 23 Jul 2024 10:29:21 -0700 Subject: [PATCH 2/2] CASMHMS-6140: Update copyright date --- pkg/redfish/rfcomponents_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/redfish/rfcomponents_test.go b/pkg/redfish/rfcomponents_test.go index 88335ba..a8d4d80 100644 --- a/pkg/redfish/rfcomponents_test.go +++ b/pkg/redfish/rfcomponents_test.go @@ -1,6 +1,6 @@ // MIT License // -// (C) Copyright [2019-2022] Hewlett Packard Enterprise Development LP +// (C) Copyright [2019-2022,2024] Hewlett Packard Enterprise Development LP // // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and associated documentation files (the "Software"),