Skip to content

Commit

Permalink
Parse Managers .Actions correctly for Gigabyte and Paradise platforms…
Browse files Browse the repository at this point in the history
… during discovery

CASMHMS-6140
  • Loading branch information
jwlv authored Jul 25, 2024
1 parent 17f8b52 commit 6abbd27
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.27.0
2.28.0
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.28.0] - 2024-07-22

### Fixed

- Parse Managers .Actions correctly for Gigabyte and Paradise platforms during discovery

## [2.27.0] - 2024-07-15

### Fixed
Expand Down
19 changes: 19 additions & 0 deletions pkg/redfish/rfcomponents.go
Original file line number Diff line number Diff line change
Expand Up @@ -649,6 +649,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
Expand Down
34 changes: 33 additions & 1 deletion pkg/redfish/rfcomponents_test.go
Original file line number Diff line number Diff line change
@@ -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"),
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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 = `
Expand Down

0 comments on commit 6abbd27

Please sign in to comment.