Skip to content
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
2 changes: 0 additions & 2 deletions common/src/api/internal/shared/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ pub use rack_init::BfdPeerConfig;
pub use rack_init::BgpConfig;
pub use rack_init::BgpPeerConfig;
pub use rack_init::ExternalPortDiscovery;
pub use rack_init::HostPortConfig;
pub use rack_init::LldpAdminStatus;
pub use rack_init::LldpPortConfig;
pub use rack_init::ParseLldpAdminStatusError;
Expand All @@ -65,7 +64,6 @@ pub use rack_init::PortSpeed;
pub use rack_init::RackNetworkConfig;
pub use rack_init::RouteConfig;
pub use rack_init::SwitchLocation;
pub use rack_init::SwitchPorts;
pub use rack_init::TxEqConfig;
pub use rack_init::UplinkAddressConfig;
pub use rack_init::UplinkAddressConfigError;
Expand Down
13 changes: 0 additions & 13 deletions common/src/api/internal/shared/rack_init/impls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,11 @@
// file, You can obtain one at https://mozilla.org/MPL/2.0/.

use super::BgpPeerConfig;
use super::HostPortConfig;
use super::LldpAdminStatus;
use super::MaxPathConfig;
use super::MaxPathConfigError;
use super::ParseLldpAdminStatusError;
use super::ParseSwitchLocationError;
use super::PortConfig;
use super::PortFec;
use super::PortSpeed;
use super::RouterLifetimeConfig;
Expand Down Expand Up @@ -196,17 +194,6 @@ impl FromStr for LldpAdminStatus {
}
}

impl From<PortConfig> for HostPortConfig {
fn from(x: PortConfig) -> Self {
Self {
port: x.port,
addrs: x.addresses,
lldp: x.lldp.clone(),
tx_eq: x.tx_eq,
}
}
}

impl SwitchLocation {
/// Return the location of the other switch, not ourself.
pub const fn other(&self) -> Self {
Expand Down
2 changes: 0 additions & 2 deletions common/src/api/internal/shared/rack_init/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,11 @@ pub use v1::TxEqConfig;

pub use v2::BgpConfig;
pub use v2::BgpPeerConfig;
pub use v2::HostPortConfig;
pub use v2::MaxPathConfig;
pub use v2::MaxPathConfigError;
pub use v2::PortConfig;
pub use v2::RackNetworkConfig;
pub use v2::RouterLifetimeConfig;
pub use v2::RouterLifetimeConfigError;
pub use v2::SwitchPorts;
pub use v2::UplinkAddressConfig;
pub use v2::UplinkAddressConfigError;
19 changes: 0 additions & 19 deletions common/src/api/internal/shared/rack_init/v1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -225,25 +225,6 @@ pub struct PortConfig {
pub tx_eq: Option<TxEqConfig>,
}

/// A set of switch uplinks.
#[derive(Clone, Debug, Serialize, Deserialize, JsonSchema)]
pub struct SwitchPorts {
pub uplinks: Vec<HostPortConfig>,
}

#[derive(Clone, Debug, Deserialize, Serialize, PartialEq, JsonSchema)]
pub struct HostPortConfig {
/// Switchport to use for external connectivity
pub port: String,

/// IP Address and prefix (e.g., `192.168.0.1/16`) to apply to switchport
/// (must be in infra_ip pool). May also include an optional VLAN ID.
pub addrs: Vec<UplinkAddressConfig>,

pub lldp: Option<LldpPortConfig>,
pub tx_eq: Option<TxEqConfig>,
}

/// Identifies switch physical location
#[derive(
Clone,
Expand Down
37 changes: 0 additions & 37 deletions common/src/api/internal/shared/rack_init/v2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -337,40 +337,3 @@ pub enum RouterLifetimeConfigError {
)]
ParseIntError(#[from] std::num::ParseIntError),
}

/// A set of switch uplinks.
#[derive(Clone, Debug, Serialize, Deserialize, JsonSchema)]
pub struct SwitchPorts {
pub uplinks: Vec<HostPortConfig>,
}

impl From<super::v1::SwitchPorts> for SwitchPorts {
fn from(value: super::v1::SwitchPorts) -> Self {
Self { uplinks: value.uplinks.into_iter().map(From::from).collect() }
}
}

#[derive(Clone, Debug, Deserialize, Serialize, PartialEq, JsonSchema)]
pub struct HostPortConfig {
/// Switchport to use for external connectivity
pub port: String,

/// IP Address and prefix (e.g., `192.168.0.1/16`) to apply to switchport
/// (must be in infra_ip pool). May also include an optional VLAN ID.
pub addrs: Vec<UplinkAddressConfig>,

pub lldp: Option<LldpPortConfig>,

pub tx_eq: Option<TxEqConfig>,
}

impl From<super::v1::HostPortConfig> for HostPortConfig {
fn from(value: super::v1::HostPortConfig) -> Self {
Self {
port: value.port,
addrs: value.addrs.into_iter().map(From::from).collect(),
lldp: value.lldp,
tx_eq: value.tx_eq,
}
}
}
3 changes: 2 additions & 1 deletion nexus/mgs-updates/src/test_util/host_phase_2_test_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ mod api_impl {
use omicron_common::api::internal::shared::SledIdentifiers;
use omicron_common::api::internal::shared::VirtualNetworkInterfaceHost;
use omicron_common::api::internal::shared::{
ResolvedVpcRouteSet, ResolvedVpcRouteState, SwitchPorts,
ResolvedVpcRouteSet, ResolvedVpcRouteState,
};
use sled_agent_types::artifact::ArtifactConfig;
use sled_agent_types::artifact::ArtifactCopyFromDepotBody;
Expand Down Expand Up @@ -260,6 +260,7 @@ mod api_impl {
use sled_agent_types::support_bundle::SupportBundleMetadata;
use sled_agent_types::support_bundle::SupportBundlePathParam;
use sled_agent_types::support_bundle::SupportBundleTransferQueryParams;
use sled_agent_types::uplink::SwitchPorts;
use sled_agent_types::zone_bundle::BundleUtilization;
use sled_agent_types::zone_bundle::CleanupContext;
use sled_agent_types::zone_bundle::CleanupContextUpdate;
Expand Down
6 changes: 3 additions & 3 deletions sled-agent/api/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use omicron_common::api::internal::{
nexus::{DiskRuntimeState, SledVmmState},
shared::{
ExternalIpGatewayMap, ResolvedVpcRouteSet, ResolvedVpcRouteState,
SledIdentifiers, SwitchPorts, VirtualNetworkInterfaceHost,
SledIdentifiers, VirtualNetworkInterfaceHost,
},
};
use sled_agent_types_versions::{
Expand Down Expand Up @@ -740,7 +740,7 @@ pub trait SledAgentApi {
}]
async fn uplink_ensure(
rqctx: RequestContext<Self::Context>,
body: TypedBody<SwitchPorts>,
body: TypedBody<latest::uplink::SwitchPorts>,
) -> Result<HttpResponseUpdatedNoContent, HttpError>;

#[endpoint {
Expand All @@ -750,7 +750,7 @@ pub trait SledAgentApi {
}]
async fn uplink_ensure_v1(
rqctx: RequestContext<Self::Context>,
body: TypedBody<v1::rack_init::SwitchPorts>,
body: TypedBody<v1::uplink::SwitchPorts>,
) -> Result<HttpResponseUpdatedNoContent, HttpError> {
Self::uplink_ensure(rqctx, body.map(From::from)).await
}
Expand Down
3 changes: 2 additions & 1 deletion sled-agent/src/http_entrypoints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ use omicron_common::api::external::Error;
use omicron_common::api::internal::nexus::{DiskRuntimeState, SledVmmState};
use omicron_common::api::internal::shared::{
ExternalIpGatewayMap, ResolvedVpcRouteSet, ResolvedVpcRouteState,
SledIdentifiers, SwitchPorts, VirtualNetworkInterfaceHost,
SledIdentifiers, VirtualNetworkInterfaceHost,
};
use range_requests::PotentialRange;
use sled_agent_api::*;
Expand Down Expand Up @@ -64,6 +64,7 @@ use sled_agent_types::support_bundle::{
use sled_agent_types::trust_quorum::{
ProxyCommitRequest, ProxyPrepareAndCommitRequest, TrustQuorumNetworkConfig,
};
use sled_agent_types::uplink::SwitchPorts;
use sled_agent_types::zone_bundle::{
BundleUtilization, CleanupContext, CleanupContextUpdate, CleanupCount,
CleanupPeriod, StorageLimit, ZoneBundleFilter, ZoneBundleId,
Expand Down
5 changes: 3 additions & 2 deletions sled-agent/src/services.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ use omicron_common::address::{
use omicron_common::address::{Ipv6Subnet, NEXUS_TECHPORT_EXTERNAL_PORT};
use omicron_common::api::external::Generation;
use omicron_common::api::internal::shared::{
ExternalIpConfig, ExternalIpConfigBuilder, ExternalIps, HostPortConfig,
PrivateIpConfig, RackNetworkConfig, SledIdentifiers,
ExternalIpConfig, ExternalIpConfigBuilder, ExternalIps, PrivateIpConfig,
RackNetworkConfig, SledIdentifiers,
};
use omicron_common::backoff::{
BackoffError, retry_notify, retry_policy_internal_service_aggressive,
Expand All @@ -100,6 +100,7 @@ use sled_agent_types::resolvable_files::{
MupdateOverrideReadError, PreparedOmicronZone,
};
use sled_agent_types::sled::SWITCH_ZONE_BASEBOARD_FILE;
use sled_agent_types::uplink::HostPortConfig;
use sled_hardware::DendriteAsic;
use sled_hardware::SledMode;
use sled_hardware::is_oxide_sled;
Expand Down
3 changes: 2 additions & 1 deletion sled-agent/src/sim/http_entrypoints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ use omicron_common::api::internal::shared::ExternalIpGatewayMap;
use omicron_common::api::internal::shared::SledIdentifiers;
use omicron_common::api::internal::shared::VirtualNetworkInterfaceHost;
use omicron_common::api::internal::shared::{
ResolvedVpcRouteSet, ResolvedVpcRouteState, SwitchPorts,
ResolvedVpcRouteSet, ResolvedVpcRouteState,
};
use omicron_uuid_kinds::GenericUuid;
use omicron_uuid_kinds::ZpoolUuid;
Expand Down Expand Up @@ -76,6 +76,7 @@ use sled_agent_types::support_bundle::{
use sled_agent_types::trust_quorum::{
ProxyCommitRequest, ProxyPrepareAndCommitRequest, TrustQuorumNetworkConfig,
};
use sled_agent_types::uplink::SwitchPorts;
use sled_agent_types::zone_bundle::{
BundleUtilization, CleanupContext, CleanupContextUpdate, CleanupCount,
ZoneBundleFilter, ZoneBundleId, ZoneBundleMetadata, ZonePathParam,
Expand Down
7 changes: 4 additions & 3 deletions sled-agent/src/sled_agent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ use omicron_common::api::external::{ByteCount, ByteCountRangeError, Vni};
use omicron_common::api::internal::nexus::{DiskRuntimeState, SledVmmState};
use omicron_common::api::internal::shared::DelegatedZvol;
use omicron_common::api::internal::shared::{
ExternalIpGatewayMap, HostPortConfig, RackNetworkConfig,
ResolvedVpcFirewallRule, ResolvedVpcRouteSet, ResolvedVpcRouteState,
SledIdentifiers, VirtualNetworkInterfaceHost,
ExternalIpGatewayMap, RackNetworkConfig, ResolvedVpcFirewallRule,
ResolvedVpcRouteSet, ResolvedVpcRouteState, SledIdentifiers,
VirtualNetworkInterfaceHost,
};
use omicron_common::backoff::{
BackoffError, retry_notify, retry_policy_internal_service_aggressive,
Expand Down Expand Up @@ -88,6 +88,7 @@ use sled_agent_types::resolvable_files::{
};
use sled_agent_types::rot::Rot;
use sled_agent_types::sled::StartSledAgentRequest;
use sled_agent_types::uplink::HostPortConfig;
use sled_agent_types::zone_bundle::{
BundleUtilization, CleanupContext, CleanupCount, CleanupPeriod,
PriorityOrder, StorageLimit, ZoneBundleMetadata,
Expand Down
1 change: 1 addition & 0 deletions sled-agent/types/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,5 @@ pub mod rot;
pub mod sled;
pub mod support_bundle;
pub mod trust_quorum;
pub mod uplink;
pub mod zone_bundle;
7 changes: 7 additions & 0 deletions sled-agent/types/src/uplink.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// 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/.

//! Uplink types for sled-agent.

pub use sled_agent_types_versions::latest::uplink::*;
1 change: 1 addition & 0 deletions sled-agent/types/versions/src/bgp_v6/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@

pub mod early_networking;
pub mod rack_init;
pub mod uplink;
49 changes: 49 additions & 0 deletions sled-agent/types/versions/src/bgp_v6/uplink.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
// 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/.

//! Uplink-related types for the Sled Agent API.

use crate::v1;
use omicron_common::api::internal::shared::rack_init::v1::LldpPortConfig;
use omicron_common::api::internal::shared::rack_init::v1::TxEqConfig;
use omicron_common::api::internal::shared::rack_init::v2::UplinkAddressConfig;
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};

/// A set of switch uplinks.
#[derive(Clone, Debug, Serialize, Deserialize, JsonSchema)]
pub struct SwitchPorts {
pub uplinks: Vec<HostPortConfig>,
}

impl From<v1::uplink::SwitchPorts> for SwitchPorts {
fn from(value: v1::uplink::SwitchPorts) -> Self {
Self { uplinks: value.uplinks.into_iter().map(From::from).collect() }
}
}

#[derive(Clone, Debug, Deserialize, Serialize, PartialEq, JsonSchema)]
pub struct HostPortConfig {
/// Switchport to use for external connectivity
pub port: String,

/// IP Address and prefix (e.g., `192.168.0.1/16`) to apply to switchport
/// (must be in infra_ip pool). May also include an optional VLAN ID.
pub addrs: Vec<UplinkAddressConfig>,

pub lldp: Option<LldpPortConfig>,

pub tx_eq: Option<TxEqConfig>,
}

impl From<v1::uplink::HostPortConfig> for HostPortConfig {
fn from(value: v1::uplink::HostPortConfig) -> Self {
Self {
port: value.port,
addrs: value.addrs.into_iter().map(From::from).collect(),
lldp: value.lldp,
tx_eq: value.tx_eq,
}
}
}
1 change: 1 addition & 0 deletions sled-agent/types/versions/src/impls/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ mod instance;
pub(crate) mod inventory;
pub(crate) mod rack_init;
mod sled;
mod uplink;
mod zone_bundle;
19 changes: 19 additions & 0 deletions sled-agent/types/versions/src/impls/uplink.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// 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/.

//! Implementations for uplink types.

use crate::latest::uplink::HostPortConfig;
use omicron_common::api::internal::shared::rack_init::PortConfig;

impl From<PortConfig> for HostPortConfig {
fn from(x: PortConfig) -> Self {
Self {
port: x.port,
addrs: x.addresses,
lldp: x.lldp.clone(),
tx_eq: x.tx_eq,
}
}
}
1 change: 1 addition & 0 deletions sled-agent/types/versions/src/initial/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@ pub mod inventory;
pub mod rack_init;
pub mod sled;
pub mod support_bundle;
pub mod uplink;
pub mod zone_bundle;
1 change: 0 additions & 1 deletion sled-agent/types/versions/src/initial/rack_init.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ use crate::impls::rack_init::default_allowed_source_ips;
use crate::impls::rack_init::validate_external_dns;
use anyhow::Result;
use camino::Utf8PathBuf;
pub use omicron_common::api::internal::shared::rack_init::v1::SwitchPorts;
use omicron_common::{
address::IpRange,
api::{
Expand Down
30 changes: 30 additions & 0 deletions sled-agent/types/versions/src/initial/uplink.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// 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/.

//! Uplink-related types for the Sled Agent API.

use omicron_common::api::internal::shared::rack_init::v1::LldpPortConfig;
use omicron_common::api::internal::shared::rack_init::v1::TxEqConfig;
use omicron_common::api::internal::shared::rack_init::v1::UplinkAddressConfig;
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};

/// A set of switch uplinks.
#[derive(Clone, Debug, Serialize, Deserialize, JsonSchema)]
pub struct SwitchPorts {
pub uplinks: Vec<HostPortConfig>,
}

#[derive(Clone, Debug, Deserialize, Serialize, PartialEq, JsonSchema)]
pub struct HostPortConfig {
/// Switchport to use for external connectivity
pub port: String,

/// IP Address and prefix (e.g., `192.168.0.1/16`) to apply to switchport
/// (must be in infra_ip pool). May also include an optional VLAN ID.
pub addrs: Vec<UplinkAddressConfig>,

pub lldp: Option<LldpPortConfig>,
pub tx_eq: Option<TxEqConfig>,
}
Loading
Loading