Skip to content

MGS: Start gateway-sp-comms crate with a ManagementSwitch #777

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Mar 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ members = [
"gateway",
"gateway-client",
"gateway-messages",
"gateway-sp-comms",
"nexus",
"nexus/src/db/db-macros",
"nexus/test-utils",
Expand Down
25 changes: 25 additions & 0 deletions gateway-sp-comms/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
[package]
name = "gateway-sp-comms"
version = "0.1.0"
edition = "2018"
license = "MPL-2.0"

[dependencies]
futures = "0.3.21"
ringbuffer = "0.8"
serde = { version = "1.0", features = ["derive"] }
thiserror = "1.0.30"
uuid = "0.8"

gateway-messages = { path = "../gateway-messages", features = ["std"] }

[dependencies.slog]
version = "2.7"
features = [ "max_level_trace", "release_max_level_debug" ]

[dependencies.tokio]
version = "1.16"
features = [ "full" ]

[dev-dependencies]
omicron-test-utils = { path = "../test-utils" }
15 changes: 15 additions & 0 deletions gateway-sp-comms/src/error.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at https://mozilla.org/MPL/2.0/.

// Copyright 2022 Oxide Computer Company

use std::io;
use std::net::SocketAddr;
use thiserror::Error;

#[derive(Debug, Error)]
pub enum StartupError {
#[error("error binding to UDP address {addr}: {err}")]
UdpBind { addr: SocketAddr, err: io::Error },
}
24 changes: 24 additions & 0 deletions gateway-sp-comms/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at https://mozilla.org/MPL/2.0/.

// Copyright 2022 Oxide Computer Company

pub mod error;
mod management_switch;

pub use management_switch::SpIdentifier;
pub use management_switch::SpType;

// TODO the following should probably not be pub once this crate is more
// complete; for now make them pub so `gateway` can use them directly
pub use management_switch::ManagementSwitch;
pub use management_switch::ManagementSwitchDiscovery;
pub use management_switch::SpSocket;
pub use management_switch::SwitchPort;

// TODO these will remain public for a while, but eventually will be removed
// altogther; currently these provide a way to hard-code the rack topology,
// which is not what we want.
pub use management_switch::KnownSp;
pub use management_switch::KnownSps;
Loading