diff --git a/Cargo.lock b/Cargo.lock index 11dd1839a5..78429df028 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4900,6 +4900,7 @@ dependencies = [ "chrono", "clap", "dns-service-client", + "dpd-client", "futures", "gateway-client", "humantime", @@ -5219,7 +5220,6 @@ dependencies = [ "camino", "camino-tempfile", "chrono", - "dpd-client", "dropshot", "expectorate", "futures", @@ -5845,6 +5845,8 @@ dependencies = [ "tokio-stream", "tokio-util", "toml 0.7.8", + "toml_datetime", + "toml_edit 0.19.15", "toml_edit 0.22.12", "tracing", "trust-dns-proto", diff --git a/common/Cargo.toml b/common/Cargo.toml index 39508ac6f0..04010af4be 100644 --- a/common/Cargo.toml +++ b/common/Cargo.toml @@ -27,7 +27,6 @@ http.workspace = true ipnetwork.workspace = true macaddr.workspace = true mg-admin-client.workspace = true -dpd-client.workspace = true omicron-uuid-kinds.workspace = true proptest = { workspace = true, optional = true } rand.workspace = true diff --git a/common/src/api/external/mod.rs b/common/src/api/external/mod.rs index 9e0966f949..4ad61fa711 100644 --- a/common/src/api/external/mod.rs +++ b/common/src/api/external/mod.rs @@ -2894,39 +2894,6 @@ pub struct SwitchPortAddressConfig { pub interface_name: String, } -/// Opaque object representing link state. The contents of this object are not -/// yet stable. -#[derive(Clone, Debug, Deserialize, Serialize)] -pub struct SwitchLinkState { - link: dpd_client::types::Link, - monitors: Option, -} - -impl SwitchLinkState { - pub fn new( - link: dpd_client::types::Link, - monitors: Option, - ) -> Self { - Self { link, monitors } - } -} - -impl JsonSchema for SwitchLinkState { - fn json_schema( - gen: &mut schemars::gen::SchemaGenerator, - ) -> schemars::schema::Schema { - let obj = schemars::schema::Schema::Object( - schemars::schema::SchemaObject::default(), - ); - gen.definitions_mut().insert(Self::schema_name(), obj.clone()); - obj - } - - fn schema_name() -> String { - "SwitchLinkState".to_owned() - } -} - /// The current state of a BGP peer. #[derive(Clone, Debug, Deserialize, JsonSchema, Serialize, PartialEq)] #[serde(rename_all = "snake_case")] diff --git a/nexus/src/app/switch_port.rs b/nexus/src/app/switch_port.rs index e5f01ec13d..9be3840c79 100644 --- a/nexus/src/app/switch_port.rs +++ b/nexus/src/app/switch_port.rs @@ -3,6 +3,7 @@ // file, You can obtain one at https://mozilla.org/MPL/2.0/. use crate::external_api::params; +use crate::external_api::shared::SwitchLinkState; use db::datastore::SwitchPortSettingsCombinedResult; use dpd_client::types::LinkId; use dpd_client::types::PortId; @@ -14,7 +15,6 @@ use nexus_db_queries::db::datastore::UpdatePrecondition; use nexus_db_queries::db::model::{SwitchPort, SwitchPortSettings}; use nexus_db_queries::db::DataStore; use omicron_common::api::external::http_pagination::PaginatedBy; -use omicron_common::api::external::SwitchLinkState; use omicron_common::api::external::SwitchLocation; use omicron_common::api::external::{ self, CreateResult, DataPageParams, DeleteResult, Error, ListResultVec, diff --git a/nexus/src/external_api/http_entrypoints.rs b/nexus/src/external_api/http_entrypoints.rs index 5283d2b30e..0b09e2c9ab 100644 --- a/nexus/src/external_api/http_entrypoints.rs +++ b/nexus/src/external_api/http_entrypoints.rs @@ -42,6 +42,7 @@ use nexus_db_queries::db::lookup::ImageParentLookup; use nexus_db_queries::db::model::Name; use nexus_db_queries::{authz, db::datastore::ProbeInfo}; use nexus_types::external_api::shared::BfdStatus; +use omicron_common::api::external::http_pagination::marker_for_name; use omicron_common::api::external::http_pagination::marker_for_name_or_id; use omicron_common::api::external::http_pagination::name_or_id_pagination; use omicron_common::api::external::http_pagination::PaginatedBy; @@ -81,9 +82,6 @@ use omicron_common::api::external::VpcFirewallRules; use omicron_common::api::external::{ http_pagination::data_page_params_for, AggregateBgpMessageHistory, }; -use omicron_common::api::external::{ - http_pagination::marker_for_name, SwitchLinkState, -}; use omicron_common::bail_unless; use omicron_uuid_kinds::GenericUuid; use parse_display::Display; @@ -3438,7 +3436,7 @@ async fn networking_switch_port_status( rqctx: RequestContext>, path_params: Path, query_params: Query, -) -> Result, HttpError> { +) -> Result, HttpError> { let apictx = rqctx.context(); let handler = async { let nexus = &apictx.nexus; diff --git a/nexus/types/Cargo.toml b/nexus/types/Cargo.toml index 372cee858a..771c8cf9d1 100644 --- a/nexus/types/Cargo.toml +++ b/nexus/types/Cargo.toml @@ -12,6 +12,7 @@ anyhow.workspace = true chrono.workspace = true clap.workspace = true base64.workspace = true +dpd-client.workspace = true futures.workspace = true humantime.workspace = true ipnetwork.workspace = true diff --git a/nexus/types/src/external_api/shared.rs b/nexus/types/src/external_api/shared.rs index 2f65f09c29..77787b07d1 100644 --- a/nexus/types/src/external_api/shared.rs +++ b/nexus/types/src/external_api/shared.rs @@ -335,6 +335,39 @@ pub struct BfdStatus { pub mode: BfdMode, } +/// Opaque object representing link state. The contents of this object are not +/// yet stable. +#[derive(Clone, Debug, Deserialize, Serialize)] +pub struct SwitchLinkState { + link: dpd_client::types::Link, + monitors: Option, +} + +impl SwitchLinkState { + pub fn new( + link: dpd_client::types::Link, + monitors: Option, + ) -> Self { + Self { link, monitors } + } +} + +impl JsonSchema for SwitchLinkState { + fn json_schema( + gen: &mut schemars::gen::SchemaGenerator, + ) -> schemars::schema::Schema { + let obj = schemars::schema::Schema::Object( + schemars::schema::SchemaObject::default(), + ); + gen.definitions_mut().insert(Self::schema_name(), obj.clone()); + obj + } + + fn schema_name() -> String { + "SwitchLinkState".to_owned() + } +} + #[cfg(test)] mod test { use super::Policy; diff --git a/workspace-hack/Cargo.toml b/workspace-hack/Cargo.toml index 2fecfa3a75..a82e50487a 100644 --- a/workspace-hack/Cargo.toml +++ b/workspace-hack/Cargo.toml @@ -110,7 +110,7 @@ tokio-postgres = { version = "0.7.10", features = ["with-chrono-0_4", "with-serd tokio-stream = { version = "0.1.15", features = ["net"] } tokio-util = { version = "0.7.10", features = ["codec", "io-util"] } toml = { version = "0.7.8" } -toml_edit = { version = "0.22.12", features = ["serde"] } +toml_edit-3c51e837cfc5589a = { package = "toml_edit", version = "0.22.12", features = ["serde"] } tracing = { version = "0.1.40", features = ["log"] } trust-dns-proto = { version = "0.22.0" } unicode-bidi = { version = "0.3.15" } @@ -218,7 +218,7 @@ tokio-postgres = { version = "0.7.10", features = ["with-chrono-0_4", "with-serd tokio-stream = { version = "0.1.15", features = ["net"] } tokio-util = { version = "0.7.10", features = ["codec", "io-util"] } toml = { version = "0.7.8" } -toml_edit = { version = "0.22.12", features = ["serde"] } +toml_edit-3c51e837cfc5589a = { package = "toml_edit", version = "0.22.12", features = ["serde"] } tracing = { version = "0.1.40", features = ["log"] } trust-dns-proto = { version = "0.22.0" } unicode-bidi = { version = "0.3.15" } @@ -275,6 +275,8 @@ dof = { version = "0.3.0", default-features = false, features = ["des"] } mio = { version = "0.8.11", features = ["net", "os-ext"] } once_cell = { version = "1.19.0" } rustix = { version = "0.38.31", features = ["fs", "termios"] } +toml_datetime = { version = "0.6.5", default-features = false, features = ["serde"] } +toml_edit-cdcf2f9584511fe6 = { package = "toml_edit", version = "0.19.15", features = ["serde"] } [target.x86_64-unknown-illumos.build-dependencies] bitflags-f595c2ba2a3f28df = { package = "bitflags", version = "2.4.2", default-features = false, features = ["std"] } @@ -282,5 +284,7 @@ dof = { version = "0.3.0", default-features = false, features = ["des"] } mio = { version = "0.8.11", features = ["net", "os-ext"] } once_cell = { version = "1.19.0" } rustix = { version = "0.38.31", features = ["fs", "termios"] } +toml_datetime = { version = "0.6.5", default-features = false, features = ["serde"] } +toml_edit-cdcf2f9584511fe6 = { package = "toml_edit", version = "0.19.15", features = ["serde"] } ### END HAKARI SECTION