Skip to content
8 changes: 8 additions & 0 deletions crates/rpc/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -557,6 +557,14 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
"forge.BmcInfo",
"#[derive(serde::Serialize, serde::Deserialize)]",
)
.type_attribute(
"forge.BmcEndpoint",
"#[derive(serde::Serialize, serde::Deserialize)]",
)
.type_attribute(
"forge.BmcStatus",
"#[derive(serde::Serialize, serde::Deserialize)]",
)
.type_attribute(
"forge.bmc_meta_data_update_request.DataItem",
"#[derive(serde::Deserialize, serde::Serialize)]",
Expand Down
28 changes: 26 additions & 2 deletions crates/rpc/proto/forge.proto
Original file line number Diff line number Diff line change
Expand Up @@ -3648,7 +3648,10 @@ enum MachineType {
POWER_SHELF = 3;
}

// Deprecated: use BmcEndpoint (ingestion-time fields, on Machine) and
// BmcStatus (observed fields, on MachineStatus) instead.
message BmcInfo {
option deprecated = true;
optional string ip = 1;
optional string mac = 2;
optional string version = 3;
Expand All @@ -3657,6 +3660,20 @@ message BmcInfo {
optional common.MachineInterfaceId machine_interface_id = 6;
}

// BMC connection details established at ingestion; not operator-mutable.
message BmcEndpoint {
optional string ip = 1;
optional string mac = 2;
optional uint32 port = 3;
optional common.MachineInterfaceId machine_interface_id = 4;
}

// BMC observed/runtime state.
message BmcStatus {
optional string version = 2;
optional string firmware_version = 3;
}

message SwitchNvosInfo {
optional string ip = 1;
optional string mac = 2;
Expand Down Expand Up @@ -3708,6 +3725,9 @@ message MachineStatus {
optional string last_scout_observed_version = 22;
optional InstanceNetworkRestrictions instance_network_restrictions = 23;
LifecycleStatus lifecycle = 24;

// BMC observed/runtime state.
optional BmcStatus bmc_status = 25;
}

message Machine {
Expand Down Expand Up @@ -3748,8 +3768,9 @@ message Machine {
// Machine type (DPU or HOST). Set at ingestion time; not operator-mutable.
MachineType machine_type = 11;

// BMC connection details. Discovered at ingestion time; not operator-mutable.
BmcInfo bmc_info = 12;
// Deprecated: use bmc (BmcEndpoint) instead.
// TODO: change to reserved once rest-api uses BmcEndpoint
BmcInfo bmc_info = 12 [deprecated = true];

// Deprecated: use status.last_reboot_time
// TODO: change to reserved once rest-api uses MachineStatus
Expand Down Expand Up @@ -3887,6 +3908,9 @@ message Machine {

MachineConfig config = 50;
MachineStatus status = 51;

// BMC connection details established at ingestion; not operator-mutable.
BmcEndpoint bmc = 52;
}

message DpfMachineState {
Expand Down
20 changes: 20 additions & 0 deletions crates/rpc/src/model/bmc_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,26 @@ impl From<BmcInfo> for rpc::BmcInfo {
}
}

impl From<BmcInfo> for rpc::BmcEndpoint {
fn from(value: BmcInfo) -> Self {
rpc::BmcEndpoint {
machine_interface_id: value.machine_interface_id,
ip: value.ip.map(|ip| ip.to_string()),
port: value.port.map(|p| p as u32),
mac: value.mac.map(|mac| mac.to_string()),
}
}
}

impl From<BmcInfo> for rpc::BmcStatus {
fn from(value: BmcInfo) -> Self {
rpc::BmcStatus {
version: value.version,
firmware_version: value.firmware_version,
}
}
}

impl From<rpc::UserRoles> for UserRoles {
fn from(action: rpc::UserRoles) -> Self {
match action {
Expand Down
4 changes: 3 additions & 1 deletion crates/rpc/src/model/machine/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,7 @@ impl From<Machine> for rpc::forge::Machine {
let status_msg = rpc::forge::MachineStatus {
interfaces: interfaces_rpc.clone(),
discovery_info: discovery_info.clone(),
bmc_status: Some(machine.status.bmc_info.clone().into()),
last_reboot_time: machine.status.last_reboot_time.map(|t| t.into()),
last_observation_time,
associated_host_machine_id: None, // Gets filled in the `ManagedHostStateSnapshot` conversion
Expand Down Expand Up @@ -411,7 +412,8 @@ impl From<Machine> for rpc::forge::Machine {
.collect(),
interfaces: interfaces_rpc,
discovery_info,
bmc_info: Some(machine.status.bmc_info.into()),
bmc_info: Some(machine.status.bmc_info.clone().into()),
bmc: Some(machine.status.bmc_info.clone().into()),
last_reboot_time: machine.status.last_reboot_time.map(|t| t.into()),
last_observation_time,
dpu_agent_version,
Expand Down
Loading