Skip to content

Commit

Permalink
Remove sprockets
Browse files Browse the repository at this point in the history
The approach in the existing sprockets code was never fully
implemented. We're going to replace it with something else.
Just remove the old code.
  • Loading branch information
labbott committed Jul 16, 2024
1 parent 76dc293 commit cffca38
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 210 deletions.
104 changes: 8 additions & 96 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 0 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -483,9 +483,6 @@ slog-term = "2.9.1"
smf = "0.2"
socket2 = { version = "0.5", features = ["all"] }
sp-sim = { path = "sp-sim" }
sprockets-common = { git = "https://github.com/oxidecomputer/sprockets", rev = "77df31efa5619d0767ffc837ef7468101608aee9" }
sprockets-host = { git = "https://github.com/oxidecomputer/sprockets", rev = "77df31efa5619d0767ffc837ef7468101608aee9" }
sprockets-rot = { git = "https://github.com/oxidecomputer/sprockets", rev = "77df31efa5619d0767ffc837ef7468101608aee9" }
sqlformat = "0.2.4"
sqlparser = { version = "0.45.0", features = [ "visitor" ] }
static_assertions = "1.1.0"
Expand Down Expand Up @@ -683,8 +680,6 @@ opt-level = 3
opt-level = 3
[profile.dev.package.rsa]
opt-level = 3
[profile.dev.package.salty]
opt-level = 3
[profile.dev.package.signature]
opt-level = 3
[profile.dev.package.subtle]
Expand Down
1 change: 0 additions & 1 deletion sp-sim/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ omicron-common.workspace = true
serde.workspace = true
slog.workspace = true
slog-dtrace.workspace = true
sprockets-rot.workspace = true
thiserror.workspace = true
tokio = { workspace = true, features = [ "full" ] }
toml.workspace = true
Expand Down
24 changes: 0 additions & 24 deletions sp-sim/src/gimlet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ use crate::config::GimletConfig;
use crate::config::SpComponentConfig;
use crate::helpers::rot_slot_id_from_u16;
use crate::helpers::rot_slot_id_to_u16;
use crate::rot::RotSprocketExt;
use crate::serial_number_padded;
use crate::server;
use crate::server::SimSpHandler;
Expand Down Expand Up @@ -38,9 +37,6 @@ use gateway_messages::{version, MessageKind};
use gateway_messages::{ComponentDetails, Message, MgsError, StartupOptions};
use gateway_messages::{DiscoverResponse, IgnitionState, PowerState};
use slog::{debug, error, info, warn, Logger};
use sprockets_rot::common::msgs::{RotRequestV1, RotResponseV1};
use sprockets_rot::common::Ed25519PublicKey;
use sprockets_rot::{RotSprocket, RotSprocketError};
use std::cell::Cell;
use std::collections::HashMap;
use std::iter;
Expand Down Expand Up @@ -88,8 +84,6 @@ pub enum SimSpHandledRequest {
}

pub struct Gimlet {
rot: Mutex<RotSprocket>,
manufacturing_public_key: Ed25519PublicKey,
local_addrs: Option<[SocketAddrV6; 2]>,
handler: Option<Arc<TokioMutex<Handler>>>,
serial_console_addrs: HashMap<String, SocketAddrV6>,
Expand All @@ -116,10 +110,6 @@ impl SimulatedSp for Gimlet {
)
}

fn manufacturing_public_key(&self) -> Ed25519PublicKey {
self.manufacturing_public_key
}

fn local_addr(&self, port: SpPort) -> Option<SocketAddrV6> {
let i = match port {
SpPort::One => 0,
Expand All @@ -135,13 +125,6 @@ impl SimulatedSp for Gimlet {
}
}

fn rot_request(
&self,
request: RotRequestV1,
) -> Result<RotResponseV1, RotSprocketError> {
self.rot.lock().unwrap().handle_deserialized(request)
}

async fn last_sp_update_data(&self) -> Option<Box<[u8]>> {
let handler = self.handler.as_ref()?;
let handler = handler.lock().await;
Expand Down Expand Up @@ -201,16 +184,11 @@ impl Gimlet {
let (commands, commands_rx) = mpsc::unbounded_channel();
let last_request_handled = Arc::default();

let (manufacturing_public_key, rot) =
RotSprocket::bootstrap_from_config(&gimlet.common);

// Weird case - if we don't have any bind addresses, we're only being
// created to simulate an RoT, so go ahead and return without actually
// starting a simulated SP.
let Some(bind_addrs) = gimlet.common.bind_addrs else {
return Ok(Self {
rot: Mutex::new(rot),
manufacturing_public_key,
local_addrs: None,
handler: None,
serial_console_addrs,
Expand Down Expand Up @@ -299,8 +277,6 @@ impl Gimlet {
.push(task::spawn(async move { inner.run().await.unwrap() }));

Ok(Self {
rot: Mutex::new(rot),
manufacturing_public_key,
local_addrs: Some(local_addrs),
handler: Some(handler),
serial_console_addrs,
Expand Down
14 changes: 0 additions & 14 deletions sp-sim/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
pub mod config;
mod gimlet;
mod helpers;
mod rot;
mod server;
mod sidecar;
mod update;
Expand All @@ -21,10 +20,6 @@ pub use server::logger;
pub use sidecar::Sidecar;
pub use sidecar::SIM_SIDECAR_BOARD;
pub use slog::Logger;
pub use sprockets_rot::common::msgs::RotRequestV1;
pub use sprockets_rot::common::msgs::RotResponseV1;
use sprockets_rot::common::Ed25519PublicKey;
pub use sprockets_rot::RotSprocketError;
use std::net::SocketAddrV6;
use tokio::sync::mpsc;
use tokio::sync::watch;
Expand All @@ -43,9 +38,6 @@ pub trait SimulatedSp {
/// Serial number.
async fn state(&self) -> omicron_gateway::http_entrypoints::SpState;

/// Public key for the manufacturing cert used to sign this SP's RoT certs.
fn manufacturing_public_key(&self) -> Ed25519PublicKey;

/// Listening UDP address of the given port of this simulated SP, if it was
/// configured to listen.
fn local_addr(&self, port: SpPort) -> Option<SocketAddrV6>;
Expand All @@ -54,12 +46,6 @@ pub trait SimulatedSp {
/// messages.
async fn set_responsiveness(&self, r: Responsiveness);

/// Send a request to the (simulated) RoT.
fn rot_request(
&self,
request: RotRequestV1,
) -> Result<RotResponseV1, RotSprocketError>;

/// Get the last completed update delivered to this simulated SP.
///
/// Only returns data after a simulated reset of the SP.
Expand Down
Loading

0 comments on commit cffca38

Please sign in to comment.