Skip to content

Commit 722f81f

Browse files
author
Laura Abbott
committed
Add constants
1 parent 983d80a commit 722f81f

File tree

5 files changed

+13
-6
lines changed

5 files changed

+13
-6
lines changed

nexus/reconfigurator/planning/src/mgs_updates/mod.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -680,6 +680,7 @@ mod test {
680680
use std::collections::BTreeSet;
681681
use std::sync::Arc;
682682
use strum::IntoEnumIterator;
683+
use sled_hardware_types::GIMLET_SLED_MODEL;
683684

684685
// Confirm our behaviour for skipped updates
685686
#[test]
@@ -868,7 +869,7 @@ mod test {
868869
// each of the sled boards, and report no pending updates
869870
let mut expected_blocked_updates = Vec::new();
870871
for baseboard_id in &collection.baseboards {
871-
if baseboard_id.part_number == "913-0000019" {
872+
if baseboard_id.part_number == GIMLET_SLED_MODEL {
872873
expected_blocked_updates.push(BlockedMgsUpdate {
873874
baseboard_id: baseboard_id.clone(),
874875
reason: FailedMgsUpdateReason::HostOs(

nexus/reconfigurator/planning/src/mgs_updates/test_helpers.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ use tufaceous_artifact::ArtifactHash;
5252
use tufaceous_artifact::ArtifactKind;
5353
use tufaceous_artifact::ArtifactVersion;
5454
use tufaceous_artifact::KnownArtifactKind;
55+
use sled_hardware_types::GIMLET_SLED_MODEL;
5556

5657
use crate::mgs_updates::PendingHostPhase2Changes;
5758

@@ -966,7 +967,7 @@ impl<'a> TestBoardCollectionBuilder<'a> {
966967
let sp_state = SpState {
967968
// We assume a valid model ID for sleds
968969
model: match sp_id.type_ {
969-
SpType::Sled => "913-0000019".to_string(),
970+
SpType::Sled => GIMLET_SLED_MODEL.to_string(),
970971
_ => format!("dummy_{}", sp_id.type_),
971972
},
972973
serial_number: serial.to_string(),

nexus/reconfigurator/planning/src/system.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ use std::time::Duration;
8282
use tufaceous_artifact::ArtifactHash;
8383
use tufaceous_artifact::ArtifactVersion;
8484
use tufaceous_artifact::KnownArtifactKind;
85+
use sled_hardware_types::GIMLET_SLED_MODEL;
8586

8687
/// Describes an actual or synthetic Oxide rack for planning and testing
8788
///
@@ -1271,7 +1272,7 @@ impl Sled {
12711272
) -> Sled {
12721273
use typed_rng::TypedUuidRng;
12731274
let unique = unique.unwrap_or_else(|| hardware_slot.to_string());
1274-
let model = "913-0000019".to_string();
1275+
let model = GIMLET_SLED_MODEL.to_string();
12751276
let serial = format!("serial{}", unique);
12761277
let revision = 0;
12771278
let mut zpool_rng = TypedUuidRng::from_seed(

nexus/types/src/deployment.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2413,6 +2413,7 @@ mod test {
24132413
use super::PendingMgsUpdates;
24142414
use crate::inventory::BaseboardId;
24152415
use gateway_types::component::SpType;
2416+
use sled_hardware_types::GIMLET_SLED_MODEL;
24162417

24172418
#[test]
24182419
fn test_serialize_pending_mgs_updates() {
@@ -2429,7 +2430,7 @@ mod test {
24292430
let mut pending_mgs_updates = PendingMgsUpdates::new();
24302431
let update = PendingMgsUpdate {
24312432
baseboard_id: Arc::new(BaseboardId {
2432-
part_number: String::from("913-0000019"),
2433+
part_number: String::from(GIMLET_SLED_MODEL),
24332434
serial_number: String::from("BRM27230037"),
24342435
}),
24352436
sp_type: SpType::Sled,

sled-hardware/types/src/lib.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ use std::ops::RangeInclusive;
88

99
pub mod underlay;
1010

11+
pub const GIMLET_SLED_MODEL: &str = "913-0000019";
12+
pub const COSMO_SLED_MODEL: &str = "913-0000023";
13+
1114
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
1215
pub enum OxideSled {
1316
Gimlet,
@@ -27,8 +30,8 @@ impl OxideSled {
2730

2831
pub fn try_from_model(model: &str) -> Option<Self> {
2932
match model {
30-
"913-0000023" => Some(Self::Cosmo),
31-
"913-0000019" | "913-0000006" => Some(Self::Gimlet),
33+
COSMO_SLED_MODEL => Some(Self::Cosmo),
34+
GIMLET_SLED_MODEL | "913-0000006" => Some(Self::Gimlet),
3235
_ => None,
3336
}
3437
}

0 commit comments

Comments
 (0)