Skip to content

Commit

Permalink
Bump gateway-messages and incorporate new RoT info
Browse files Browse the repository at this point in the history
The new RoT information includes details about stage0 (RoT bootloader)
  • Loading branch information
labbott committed Jun 4, 2024
1 parent 450f906 commit 4d6a35f
Show file tree
Hide file tree
Showing 38 changed files with 1,949 additions and 363 deletions.
208 changes: 41 additions & 167 deletions Cargo.lock

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -275,8 +275,8 @@ foreign-types = "0.3.2"
fs-err = "2.11.0"
futures = "0.3.30"
gateway-client = { path = "clients/gateway-client" }
gateway-messages = { git = "https://github.com/oxidecomputer/management-gateway-service", rev = "2739c18e80697aa6bc235c935176d14b4d757ee9", default-features = false, features = ["std"] }
gateway-sp-comms = { git = "https://github.com/oxidecomputer/management-gateway-service", rev = "2739c18e80697aa6bc235c935176d14b4d757ee9" }
gateway-messages = { git = "https://github.com/oxidecomputer/management-gateway-service", rev = "c85a4ca043aaa389df12aac5348d8a3feda28762", default-features = false, features = ["std"] }
gateway-sp-comms = { git = "https://github.com/oxidecomputer/management-gateway-service", rev = "c85a4ca043aaa389df12aac5348d8a3feda28762" }
gateway-test-utils = { path = "gateway-test-utils" }
gethostname = "0.4.3"
glob = "0.3.1"
Expand Down
1 change: 1 addition & 0 deletions clients/gateway-client/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ progenitor::generate_api!(
HostPhase2RecoveryImageId = { derives = [PartialEq, Eq, PartialOrd, Ord] },
ImageVersion = { derives = [PartialEq, Eq, PartialOrd, Ord] },
RotImageDetails = { derives = [PartialEq, Eq, PartialOrd, Ord] },
RotImageError = { derives = [ PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize] },
RotSlot = { derives = [PartialEq, Eq, PartialOrd, Ord] },
RotState = { derives = [PartialEq, Eq, PartialOrd, Ord] },
SpIdentifier = { derives = [Copy, PartialEq, Hash, Eq] },
Expand Down
91 changes: 88 additions & 3 deletions dev-tools/omdb/src/bin/omdb/mgs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -294,10 +294,16 @@ fn show_sp_states(
RotState::CommunicationFailed { message } => {
format!("error: {}", message)
}
RotState::Enabled { active: RotSlot::A, .. } => {
RotState::V2 { active: RotSlot::A, .. } => {
"slot A".to_string()
}
RotState::Enabled { active: RotSlot::B, .. } => {
RotState::V2 { active: RotSlot::B, .. } => {
"slot B".to_string()
}
RotState::V3 { active: RotSlot::A, .. } => {
"slot A".to_string()
}
RotState::V3 { active: RotSlot::B, .. } => {
"slot B".to_string()
}
},
Expand Down Expand Up @@ -332,7 +338,7 @@ async fn show_sp_details(
RotState::CommunicationFailed { message } => {
println!(" error: {}", message);
}
RotState::Enabled {
RotState::V2 {
active,
pending_persistent_boot_preference,
persistent_boot_preference,
Expand Down Expand Up @@ -382,6 +388,85 @@ async fn show_sp_details(
},
];

let table = tabled::Table::new(rows)
.with(tabled::settings::Style::empty())
.with(tabled::settings::Padding::new(0, 1, 0, 0))
.to_string();
println!("{}", textwrap::indent(&table.to_string(), " "));
println!("");
}
RotState::V3 {
active,
pending_persistent_boot_preference,
persistent_boot_preference,
slot_a_fwid,
slot_b_fwid,
transient_boot_preference,
stage0_fwid,
stage0next_fwid,
slot_a_error,
slot_b_error,
stage0_error,
stage0next_error,
} => {
#[derive(Tabled)]
#[tabled(rename_all = "SCREAMING_SNAKE_CASE")]
struct Row {
name: &'static str,
value: String,
}

let rows = vec![
Row {
name: "active slot",
value: format!("slot {:?}", active),
},
Row {
name: "persistent boot preference",
value: format!("slot {:?}", persistent_boot_preference),
},
Row {
name: "pending persistent boot preference",
value: pending_persistent_boot_preference
.map(|s| format!("slot {:?}", s))
.unwrap_or_else(|| "-".to_string()),
},
Row {
name: "transient boot preference",
value: transient_boot_preference
.map(|s| format!("slot {:?}", s))
.unwrap_or_else(|| "-".to_string()),
},
Row { name: "slot A FWID", value: slot_a_fwid.clone() },
Row { name: "slot B FWID", value: slot_b_fwid.clone() },
Row { name: "Stage0 FWID", value: stage0_fwid.clone() },
Row { name: "Stage0Next FWID", value: stage0next_fwid.clone() },
Row {
name: "Slot A status",
value: (*slot_a_error)
.map(|x| format!("error: {:?}", x))
.unwrap_or_else(|| "VALID".to_string()),
},
Row {
name: "Slot B status",
value: (*slot_b_error)
.map(|x| format!("error: {:?}", x))
.unwrap_or_else(|| "VALID".to_string()),
},
Row {
name: "Stage0 status",
value: (*stage0_error)
.map(|x| format!("error: {:?}", x))
.unwrap_or_else(|| "VALID".to_string()),
},
Row {
name: "stage0next status",
value: (*stage0next_error)
.map(|x| format!("error: {:?}", x))
.unwrap_or_else(|| "VALID".to_string()),
},
];

let table = tabled::Table::new(rows)
.with(tabled::settings::Style::empty())
.with(tabled::settings::Padding::new(0, 1, 0, 0))
Expand Down
80 changes: 52 additions & 28 deletions dev-tools/omdb/tests/successes.out
Original file line number Diff line number Diff line change
Expand Up @@ -125,13 +125,19 @@ SP DETAILS: type "Sled" slot 0

ROOT OF TRUST

NAME VALUE
active slot slot A
persistent boot preference slot A
pending persistent boot preference -
transient boot preference -
slot A SHA3 256 digest -
slot B SHA3 256 digest -
NAME VALUE
active slot slot A
persistent boot preference slot A
pending persistent boot preference -
transient boot preference -
slot A FWID aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
slot B FWID bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
Stage0 FWID cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
Stage0Next FWID dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd
Slot A status VALID
Slot B status VALID
Stage0 status VALID
stage0next status VALID

COMPONENTS

Expand All @@ -145,13 +151,19 @@ SP DETAILS: type "Sled" slot 1

ROOT OF TRUST

NAME VALUE
active slot slot A
persistent boot preference slot A
pending persistent boot preference -
transient boot preference -
slot A SHA3 256 digest -
slot B SHA3 256 digest -
NAME VALUE
active slot slot A
persistent boot preference slot A
pending persistent boot preference -
transient boot preference -
slot A FWID aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
slot B FWID bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
Stage0 FWID cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
Stage0Next FWID dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd
Slot A status VALID
Slot B status VALID
Stage0 status VALID
stage0next status VALID

COMPONENTS

Expand All @@ -164,13 +176,19 @@ SP DETAILS: type "Switch" slot 0

ROOT OF TRUST

NAME VALUE
active slot slot A
persistent boot preference slot A
pending persistent boot preference -
transient boot preference -
slot A SHA3 256 digest -
slot B SHA3 256 digest -
NAME VALUE
active slot slot A
persistent boot preference slot A
pending persistent boot preference -
transient boot preference -
slot A FWID aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
slot B FWID bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
Stage0 FWID cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
Stage0Next FWID dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd
Slot A status VALID
Slot B status VALID
Stage0 status VALID
stage0next status VALID

COMPONENTS

Expand All @@ -184,13 +202,19 @@ SP DETAILS: type "Switch" slot 1

ROOT OF TRUST

NAME VALUE
active slot slot A
persistent boot preference slot A
pending persistent boot preference -
transient boot preference -
slot A SHA3 256 digest -
slot B SHA3 256 digest -
NAME VALUE
active slot slot A
persistent boot preference slot A
pending persistent boot preference -
transient boot preference -
slot A FWID aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
slot B FWID bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
Stage0 FWID cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
Stage0Next FWID dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd
Slot A status VALID
Slot B status VALID
Stage0 status VALID
stage0next status VALID

COMPONENTS: none found

Expand Down
10 changes: 5 additions & 5 deletions gateway-test-utils/configs/sp_sim_config.test.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ device_id_cert_seed = "01de00000000000000000000000000000000000000000000000000000
id = "dev-0"
device = "fake-tmp-sensor"
description = "FAKE temperature sensor 1"
capabilities.bits = 0x2
capabilities = 0x2
presence = "Present"

[[simulated_sps.sidecar.components]]
id = "dev-1"
device = "fake-tmp-sensor"
description = "FAKE temperature sensor 2"
capabilities.bits = 0x2
capabilities = 0x2
presence = "Failed"

[[simulated_sps.sidecar]]
Expand All @@ -46,15 +46,15 @@ device_id_cert_seed = "01de00000000000000000000000000000000000000000000000000000
id = "sp3-host-cpu"
device = "sp3-host-cpu"
description = "FAKE host cpu"
capabilities.bits = 0
capabilities = 0
presence = "Present"
serial_console = "[::1]:0"

[[simulated_sps.gimlet.components]]
id = "dev-0"
device = "fake-tmp-sensor"
description = "FAKE temperature sensor"
capabilities.bits = 0x2
capabilities = 0x2
presence = "Failed"

[[simulated_sps.gimlet]]
Expand All @@ -68,7 +68,7 @@ device_id_cert_seed = "01de00000000000000000000000000000000000000000000000000000
id = "sp3-host-cpu"
device = "sp3-host-cpu"
description = "FAKE host cpu"
capabilities.bits = 0
capabilities = 0
presence = "Present"
serial_console = "[::1]:0"

Expand Down
Loading

0 comments on commit 4d6a35f

Please sign in to comment.