Skip to content

Commit

Permalink
Merge pull request #392 from bmc-toolbox/supermicro-bios-FS-1123
Browse files Browse the repository at this point in the history
FS-1123: Supermicro (SMC) BIOS config Get, Set and Reset support via SUM
  • Loading branch information
splaspood authored Aug 7, 2024
2 parents 77eee83 + 00ac9db commit ca7c588
Show file tree
Hide file tree
Showing 20 changed files with 4,585 additions and 21 deletions.
2 changes: 1 addition & 1 deletion .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM mcr.microsoft.com/devcontainers/go:1-1.21-bullseye
FROM mcr.microsoft.com/devcontainers/go:1-1.22-bullseye
RUN apt update
RUN apt install ipmitool -y

37 changes: 35 additions & 2 deletions examples/bios/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,19 @@ func main() {
// Logger configuration
l := logrus.New()
l.Level = logrus.DebugLevel
// l.Level = logrus.TraceLevel
logger := logrusr.New(l)
logger.V(9)

// bmclib client abstraction
clientOpts := []bmclib.Option{bmclib.WithLogger(logger)}

client := bmclib.NewClient(*host, *user, *pass, clientOpts...)
client.Registry.Drivers = client.Registry.Supports(providers.FeatureGetBiosConfiguration, providers.FeatureSetBiosConfiguration, providers.FeatureResetBiosConfiguration)
client.Registry.Drivers = client.Registry.Supports(
providers.FeatureGetBiosConfiguration,
providers.FeatureSetBiosConfiguration,
providers.FeatureResetBiosConfiguration,
providers.FeatureSetBiosConfigurationFromFile)

err := client.Open(ctx)
if err != nil {
Expand All @@ -57,7 +63,7 @@ func main() {
l.Fatal(err)
}

fmt.Printf("biosConfig: %+v\n", biosConfig)
fmt.Printf("biosConfig: %#v\n", biosConfig)
case "set":
exampleConfig := make(map[string]string)

Expand All @@ -82,6 +88,33 @@ func main() {
fmt.Println("Attempting to set BIOS configuration:")
fmt.Printf("exampleConfig: %+v\n", exampleConfig)

err := client.SetBiosConfiguration(ctx, exampleConfig)
if err != nil {
l.Error(err)
}
case "setfile":
exampleConfig := make(map[string]string)

if *dfile != "" {
cfgFile, err := os.Open(*dfile)
if err != nil {
l.Fatal(err)
}

defer cfgFile.Close()

jsonData, _ := io.ReadAll(cfgFile)
err = json.Unmarshal(jsonData, &exampleConfig)
if err != nil {
l.Error(err)
}
} else {
exampleConfig["TpmSecurity"] = "Off"
}

fmt.Println("Attempting to set BIOS configuration:")
fmt.Printf("exampleConfig: %+v\n", exampleConfig)

err := client.SetBiosConfiguration(ctx, exampleConfig)
if err != nil {
l.Error(err)
Expand Down
11 changes: 11 additions & 0 deletions fixtures/internal/sum/ChangeBiosConfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Supermicro Update Manager (for UEFI BIOS) 2.14.0 (2024/02/15) (ARM64)
Copyright(C) 2013-2024 Super Micro Computer, Inc. All rights reserved.
.................


Note: No BIOS setting has been changed.

Status: The BIOS configuration is updated for 10.145.129.168

Note: You have to reboot or power up the system for the changes to take effect.

7 changes: 7 additions & 0 deletions fixtures/internal/sum/ChangeBiosConfig-Changed
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Supermicro Update Manager (for UEFI BIOS) 2.14.0 (2024/02/15) (ARM64)
Copyright(C) 2013-2024 Super Micro Computer, Inc. All rights reserved.
..................
Status: The BIOS configuration is updated for 10.145.129.168

Note: You have to reboot or power up the system for the changes to take effect.

16 changes: 16 additions & 0 deletions fixtures/internal/sum/ChangeBiosConfig-Changed-Reboot
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
Supermicro Update Manager (for UEFI BIOS) 2.14.0 (2024/02/15) (ARM64)
Copyright(C) 2013-2024 Super Micro Computer, Inc. All rights reserved.
.................
Status: The managed system 10.145.129.168 is rebooting.

.............................Done
....
.................


Note: No BIOS setting has been changed.

Status: The BIOS configuration is updated for 10.145.129.168

WARNING: Without option --post_complete, please manually confirm the managed system is POST complete before executing next action.

7 changes: 7 additions & 0 deletions fixtures/internal/sum/GetBIOSInfo
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Supermicro Update Manager (for UEFI BIOS) 2.14.0 (2024/02/15) (ARM64)
Copyright(C) 2013-2024 Super Micro Computer, Inc. All rights reserved.
....
Managed system..........................10.145.129.168
Board ID............................1B0F
BIOS build date.....................2022/09/16
BIOS version........................1.9
Loading

0 comments on commit ca7c588

Please sign in to comment.