Skip to content

Commit ea58344

Browse files
authored
feat: Retrieve positional info from GB200 chassis info (#16)
1 parent 60618f5 commit ea58344

5 files changed

Lines changed: 47 additions & 29 deletions

File tree

src/model/oem/mod.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ pub mod dell;
44
pub mod hpe;
55
pub mod lenovo;
66
pub mod nvidia_dpu;
7+
pub mod nvidia_openbmc;
78
pub mod nvidia_viking;
89
pub mod supermicro;
910

@@ -24,5 +25,5 @@ pub struct SystemExtensions {
2425
#[derive(Debug, Serialize, Deserialize, Clone)]
2526
#[serde(rename_all = "PascalCase")]
2627
pub struct ChassisExtensions {
27-
pub nvidia: Option<nvidia_dpu::Chassis>,
28+
pub nvidia: Option<nvidia_openbmc::ChassisExtensions>,
2829
}

src/model/oem/nvidia_dpu.rs

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -63,32 +63,6 @@ impl fmt::Display for HostPrivilegeLevel {
6363
}
6464
}
6565

66-
/// This OEM specific extension is mainly applicable for querying chassis information for the ERoT subsystem
67-
/// odata_type is always present regardless of the subsystem we are querying for (Bluefield_BMC, Bluefield_ERoT, or Card1)
68-
/// the remaining attributes are only present when querying the Bluefield_ERoT
69-
#[derive(Debug, Serialize, Deserialize, Clone)]
70-
#[serde(rename_all = "PascalCase")]
71-
pub struct Chassis {
72-
#[serde(rename = "@odata.type")]
73-
pub odata_type: String,
74-
pub automatic_background_copy_enabled: Option<bool>,
75-
pub background_copy_status: Option<BackgroundCopyStatus>,
76-
pub inband_update_policy_enabled: Option<bool>,
77-
}
78-
79-
#[derive(Debug, Serialize, Deserialize, Copy, Clone, Eq, PartialEq)]
80-
pub enum BackgroundCopyStatus {
81-
InProgress,
82-
Completed,
83-
Pending,
84-
}
85-
86-
impl fmt::Display for BackgroundCopyStatus {
87-
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
88-
fmt::Debug::fmt(self, f)
89-
}
90-
}
91-
9266
#[derive(Copy, Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
9367
#[serde(rename_all = "PascalCase")]
9468
pub enum NicMode {

src/model/oem/nvidia_openbmc.rs

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
use std::fmt;
2+
3+
use serde::{Deserialize, Serialize};
4+
5+
/// This OEM specific extension is mainly applicable for querying chassis information for the ERoT subsystem
6+
/// odata_type is always present regardless of the subsystem we are querying for (Bluefield_BMC, Bluefield_ERoT, or Card1)
7+
/// the remaining attributes are only present when querying the Bluefield_ERoT
8+
/// Due to the indistinguishable names, this is used for DPUs, GB200, and potentially others; comments describe
9+
/// what platforms it may be expected on.
10+
#[derive(Debug, Serialize, Deserialize, Clone)]
11+
#[serde(rename_all = "PascalCase")]
12+
pub struct ChassisExtensions {
13+
#[serde(rename = "@odata.type")]
14+
pub odata_type: String,
15+
pub automatic_background_copy_enabled: Option<bool>, // DPU
16+
pub background_copy_status: Option<BackgroundCopyStatus>, // DPU
17+
pub inband_update_policy_enabled: Option<bool>, // DPU
18+
pub chassis_physical_slot_number: Option<i32>, // GB200
19+
pub compute_tray_index: Option<i32>, // GB200
20+
pub topology_id: Option<i32>, // GB200
21+
pub revision_id: Option<i32>, // GB200
22+
}
23+
24+
#[derive(Debug, Serialize, Deserialize, Copy, Clone, Eq, PartialEq)]
25+
pub enum BackgroundCopyStatus {
26+
InProgress,
27+
Completed,
28+
Pending,
29+
}
30+
31+
impl fmt::Display for BackgroundCopyStatus {
32+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
33+
fmt::Debug::fmt(self, f)
34+
}
35+
}

tests/integration_test.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -471,6 +471,14 @@ async fn run_integration_test(
471471

472472
let firmware = redfish.get_firmware_for_component("ERoT_BMC_0").await;
473473
assert!(firmware.is_err());
474+
475+
let chassis_cbc0 = redfish.get_chassis("CBC_0").await.unwrap();
476+
let vendor = chassis_cbc0.oem.unwrap();
477+
let nvidia = vendor.nvidia.unwrap();
478+
assert_eq!(nvidia.chassis_physical_slot_number.unwrap(), 1);
479+
assert_eq!(nvidia.compute_tray_index.unwrap(), 3);
480+
assert_eq!(nvidia.revision_id.unwrap(), 2);
481+
assert_eq!(nvidia.topology_id.unwrap(), 4);
474482
}
475483

476484
if vendor_dir == "dell" {

tests/mockups/nvidia_gb200/redfish/v1/Chassis/CBC_0/index.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@
3939
"Nvidia": {
4040
"@odata.type": "#NvidiaChassis.v1_4_0.NvidiaCBCChassis",
4141
"ChassisPhysicalSlotNumber": 1,
42-
"ComputeTrayIndex": 0,
42+
"ComputeTrayIndex": 3,
4343
"RevisionId": 2,
44-
"TopologyId": 0
44+
"TopologyId": 4
4545
}
4646
},
4747
"PCIeDevices": {

0 commit comments

Comments
 (0)