Skip to content
Open
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
25 changes: 25 additions & 0 deletions crates/admin-cli/src/redfish/args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,21 @@ Clear the UEFI password (supply the current one):
ClearNvram,
/// Set BIOS options
SetBios(SetBios),
/// Reset BIOS settings to factory defaults. Returns once the BMC accepts
/// the reset request. A system restart is required for the settings to
/// take effect.
#[command(after_long_help = "\
EXAMPLES:

Reset BIOS settings to factory defaults:
$ nico-admin-cli redfish --address 192.0.2.10 --username admin --password mypassword reset-bios

Reset BIOS settings and restart the system to apply the change:
$ nico-admin-cli redfish --address 192.0.2.10 --username admin --password mypassword \
reset-bios --reboot

")]
ResetBios(ResetBiosArgs),
/// Get DPU mode
GetNicMode,
/// Is infinite boot enable
Expand Down Expand Up @@ -524,6 +539,16 @@ pub struct MachineSetupStatusArgs {
pub boot_interface_mac: Option<String>,
}

#[derive(Parser, Debug, PartialEq, Clone)]
pub struct ResetBiosArgs {
#[clap(
short,
long,
help = "Perform a forced restart after the BMC accepts the BIOS reset request"
)]
pub reboot: bool,
}

#[derive(Parser, Debug, PartialEq, Clone)]
pub struct SetBootOrderDpuFirstArgs {
#[clap(long, help = "boot_interface_mac")]
Expand Down
8 changes: 8 additions & 0 deletions crates/admin-cli/src/redfish/cmds.rs
Original file line number Diff line number Diff line change
Expand Up @@ -476,6 +476,14 @@ pub async fn action(action: RedfishAction) -> color_eyre::Result<()> {
redfish.set_bios(attrmap).await?;
println!("success");
}
ResetBios(args) => {
redfish.reset_bios().await?;
if args.reboot {
redfish.power(SystemPowerControl::ForceRestart).await?;
} else {
println!("BIOS changes require a system restart to take effect.");
}
}
GetNicMode => {
let is_dpu_in_nic_mode = redfish.get_nic_mode().await?;
println!("{is_dpu_in_nic_mode:#?}");
Expand Down
27 changes: 27 additions & 0 deletions crates/admin-cli/src/redfish/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,33 @@ fn parse_create_bmc_user() {
);
}

#[test]
fn parse_reset_bios() {
scenarios!(
run = |argv| {
RedfishAction::try_parse_from(argv.iter().copied())
.map(|a| match a.command {
Cmd::ResetBios(args) => args.reboot,
_ => panic!("expected ResetBios variant"),
})
.map_err(drop)
};
"without reboot" {
&["redfish", "--address", "192.0.2.10", "reset-bios"][..] => Yields(false),
}

"with reboot" {
&[
"redfish",
"--address",
"192.0.2.10",
"reset-bios",
"--reboot",
][..] => Yields(true),
}
);
}

// `dpu firmware status` parses through the nested DpuOperations / FwCommand
// subcommands to the Dpu Firmware Status variant.
#[test]
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# `nico-admin-cli redfish reset-bios`

_[Hardware commands](../../hardware.md) › [redfish](./redfish.md) › **reset-bios**_

## NAME

nico-admin-cli-redfish-reset-bios - Reset BIOS settings to factory
defaults

## SYNOPSIS

**nico-admin-cli redfish reset-bios** \[**-r**\|**--reboot**\]
\[**--extended**\] \[**--sort-by** *\<SORT_BY\>*\] \[**-h**\|**--help**\]

## DESCRIPTION

Reset BIOS settings to factory defaults. Returns once the BMC accepts
the reset request. A system restart is required for the settings to take
effect.

## OPTIONS

**-r**, **--reboot**
Perform a forced restart after the BMC accepts the BIOS reset request

**--extended**
Extended result output.

This used by measured boot, where basic output contains just what you

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
This used by measured boot, where basic output contains just what you
This is used by measured boot, where basic output contains just what you

probably care about, and "extended" output also dumps out all the
internal UUIDs that are used to associate instances.

**--sort-by** *\<SORT_BY\>* \[default: primary-id\]
Sort output by specified field\

\
*Possible values:*

- primary-id: Sort by the primary id

- state: Sort by state

**-h**, **--help**
Print help (see a summary with -h)

## Examples

```sh
nico-admin-cli redfish --address 192.0.2.10 --username admin --password mypassword reset-bios
nico-admin-cli redfish --address 192.0.2.10 --username admin --password mypassword reset-bios --reboot
```

---

**See also:** [Hardware commands](../../hardware.md) · [CLI reference index](../../README.md)
1 change: 1 addition & 0 deletions docs/manuals/nico-admin-cli/commands/redfish/redfish.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ nico-admin-cli redfish --address 192.0.2.10 --username admin --password mypasswo
| [`get-base-mac-address`](./redfish-get-base-mac-address.md) | Get Base Mac Address (DPU only) |
| [`clear-nvram`](./redfish-clear-nvram.md) | Clear Nvram (Viking only) |
| [`set-bios`](./redfish-set-bios.md) | Set BIOS options |
| [`reset-bios`](./redfish-reset-bios.md) | Reset BIOS settings to factory defaults |
| [`get-nic-mode`](./redfish-get-nic-mode.md) | Get DPU mode |
| [`is-infinite-boot-enabled`](./redfish-is-infinite-boot-enabled.md) | Is infinite boot enable |
| [`enable-infinite-boot`](./redfish-enable-infinite-boot.md) | Enable infinite boot |
Expand Down