Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions pkg/client/smd/smd.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ type System struct {
UUID string `json:"uuid" yaml:"uuid"`
Name string `json:"name" yaml:"name"`
EthernetInterfaces []schemas.EthernetInterface `json:"ethernet_interfaces" yaml:"ethernet_interfaces"`
Actions []string `json:"actions" yaml:"actions"`
}

// Manager represents data that would be retrieved from BMC Manager data, except
Expand Down
7 changes: 7 additions & 0 deletions pkg/discover/discover.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,13 @@ func DiscoveryInfoV2(baseURI string, nl NodeList) (smd.ComponentSlice, smd.Redfi
s.UUID = sysUUID.String()
}

// Fake discovery as of v0.5.1 does not have a field to indicate supported power actions, and PCS requires
// them. We don't have direct configuration for the System struct that contains this either, so in lieu of
// that, simply add every possible action from from the Redfish Reference 6.5.5.1 ResetType:
// https://www.dmtf.org/sites/default/files/standards/documents/DSP2046_2023.3.html#aggregate-102
s.Actions = []string{"On", "ForceOff", "GracefulShutdown", "GracefulRestart", "ForceRestart", "Nmi",
"ForceOn", "PushPowerButton", "PowerCycle", "Suspend", "Pause", "Resume"}

// Node interfaces
for idx, iface := range node.Ifaces {
newIface := schemas.EthernetInterface{
Expand Down
8 changes: 8 additions & 0 deletions pkg/discover/discover_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"testing"

"github.com/google/uuid"

"github.com/openchami/schemas/schemas"

"github.com/OpenCHAMI/ochami/pkg/client/smd"
Expand Down Expand Up @@ -194,6 +195,13 @@ func TestDiscoveryInfoV2_Success(t *testing.T) {
}); !reflect.DeepEqual(e, want) {
t.Errorf("System.EthernetInterface = %+v, want %+v", e, want)
}
if !reflect.DeepEqual(
sys.Actions,
[]string{"On", "ForceOff", "GracefulShutdown", "GracefulRestart", "ForceRestart", "Nmi", "ForceOn",
"PushPowerButton", "PowerCycle", "Suspend", "Pause", "Resume"},
) {
t.Error("System.Actions does not match the expected value")
}

// Managers
if len(r.Managers) != 1 {
Expand Down
Loading