Skip to content

Commit fad6bbc

Browse files
authored
bootstore type reorg PR 1/?: Move sled-agent-only types out of common and into sled-agent-types (#9904)
Moves `SwitchPorts` and `HostPortConfig`, both of which are only used by sled-agent's `uplink_ensure()` endpoint and therefore don't need to be in `common`. Part of #9801.
1 parent 7526048 commit fad6bbc

21 files changed

Lines changed: 130 additions & 87 deletions

File tree

common/src/api/internal/shared/mod.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ pub use rack_init::BfdPeerConfig;
5454
pub use rack_init::BgpConfig;
5555
pub use rack_init::BgpPeerConfig;
5656
pub use rack_init::ExternalPortDiscovery;
57-
pub use rack_init::HostPortConfig;
5857
pub use rack_init::LldpAdminStatus;
5958
pub use rack_init::LldpPortConfig;
6059
pub use rack_init::ParseLldpAdminStatusError;
@@ -65,7 +64,6 @@ pub use rack_init::PortSpeed;
6564
pub use rack_init::RackNetworkConfig;
6665
pub use rack_init::RouteConfig;
6766
pub use rack_init::SwitchLocation;
68-
pub use rack_init::SwitchPorts;
6967
pub use rack_init::TxEqConfig;
7068
pub use rack_init::UplinkAddressConfig;
7169
pub use rack_init::UplinkAddressConfigError;

common/src/api/internal/shared/rack_init/impls.rs

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,11 @@
33
// file, You can obtain one at https://mozilla.org/MPL/2.0/.
44

55
use super::BgpPeerConfig;
6-
use super::HostPortConfig;
76
use super::LldpAdminStatus;
87
use super::MaxPathConfig;
98
use super::MaxPathConfigError;
109
use super::ParseLldpAdminStatusError;
1110
use super::ParseSwitchLocationError;
12-
use super::PortConfig;
1311
use super::PortFec;
1412
use super::PortSpeed;
1513
use super::RouterLifetimeConfig;
@@ -196,17 +194,6 @@ impl FromStr for LldpAdminStatus {
196194
}
197195
}
198196

199-
impl From<PortConfig> for HostPortConfig {
200-
fn from(x: PortConfig) -> Self {
201-
Self {
202-
port: x.port,
203-
addrs: x.addresses,
204-
lldp: x.lldp.clone(),
205-
tx_eq: x.tx_eq,
206-
}
207-
}
208-
}
209-
210197
impl SwitchLocation {
211198
/// Return the location of the other switch, not ourself.
212199
pub const fn other(&self) -> Self {

common/src/api/internal/shared/rack_init/mod.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,11 @@ pub use v1::TxEqConfig;
2525

2626
pub use v2::BgpConfig;
2727
pub use v2::BgpPeerConfig;
28-
pub use v2::HostPortConfig;
2928
pub use v2::MaxPathConfig;
3029
pub use v2::MaxPathConfigError;
3130
pub use v2::PortConfig;
3231
pub use v2::RackNetworkConfig;
3332
pub use v2::RouterLifetimeConfig;
3433
pub use v2::RouterLifetimeConfigError;
35-
pub use v2::SwitchPorts;
3634
pub use v2::UplinkAddressConfig;
3735
pub use v2::UplinkAddressConfigError;

common/src/api/internal/shared/rack_init/v1.rs

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -225,25 +225,6 @@ pub struct PortConfig {
225225
pub tx_eq: Option<TxEqConfig>,
226226
}
227227

228-
/// A set of switch uplinks.
229-
#[derive(Clone, Debug, Serialize, Deserialize, JsonSchema)]
230-
pub struct SwitchPorts {
231-
pub uplinks: Vec<HostPortConfig>,
232-
}
233-
234-
#[derive(Clone, Debug, Deserialize, Serialize, PartialEq, JsonSchema)]
235-
pub struct HostPortConfig {
236-
/// Switchport to use for external connectivity
237-
pub port: String,
238-
239-
/// IP Address and prefix (e.g., `192.168.0.1/16`) to apply to switchport
240-
/// (must be in infra_ip pool). May also include an optional VLAN ID.
241-
pub addrs: Vec<UplinkAddressConfig>,
242-
243-
pub lldp: Option<LldpPortConfig>,
244-
pub tx_eq: Option<TxEqConfig>,
245-
}
246-
247228
/// Identifies switch physical location
248229
#[derive(
249230
Clone,

common/src/api/internal/shared/rack_init/v2.rs

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -337,40 +337,3 @@ pub enum RouterLifetimeConfigError {
337337
)]
338338
ParseIntError(#[from] std::num::ParseIntError),
339339
}
340-
341-
/// A set of switch uplinks.
342-
#[derive(Clone, Debug, Serialize, Deserialize, JsonSchema)]
343-
pub struct SwitchPorts {
344-
pub uplinks: Vec<HostPortConfig>,
345-
}
346-
347-
impl From<super::v1::SwitchPorts> for SwitchPorts {
348-
fn from(value: super::v1::SwitchPorts) -> Self {
349-
Self { uplinks: value.uplinks.into_iter().map(From::from).collect() }
350-
}
351-
}
352-
353-
#[derive(Clone, Debug, Deserialize, Serialize, PartialEq, JsonSchema)]
354-
pub struct HostPortConfig {
355-
/// Switchport to use for external connectivity
356-
pub port: String,
357-
358-
/// IP Address and prefix (e.g., `192.168.0.1/16`) to apply to switchport
359-
/// (must be in infra_ip pool). May also include an optional VLAN ID.
360-
pub addrs: Vec<UplinkAddressConfig>,
361-
362-
pub lldp: Option<LldpPortConfig>,
363-
364-
pub tx_eq: Option<TxEqConfig>,
365-
}
366-
367-
impl From<super::v1::HostPortConfig> for HostPortConfig {
368-
fn from(value: super::v1::HostPortConfig) -> Self {
369-
Self {
370-
port: value.port,
371-
addrs: value.addrs.into_iter().map(From::from).collect(),
372-
lldp: value.lldp,
373-
tx_eq: value.tx_eq,
374-
}
375-
}
376-
}

nexus/mgs-updates/src/test_util/host_phase_2_test_state.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ mod api_impl {
205205
use omicron_common::api::internal::shared::SledIdentifiers;
206206
use omicron_common::api::internal::shared::VirtualNetworkInterfaceHost;
207207
use omicron_common::api::internal::shared::{
208-
ResolvedVpcRouteSet, ResolvedVpcRouteState, SwitchPorts,
208+
ResolvedVpcRouteSet, ResolvedVpcRouteState,
209209
};
210210
use sled_agent_types::artifact::ArtifactConfig;
211211
use sled_agent_types::artifact::ArtifactCopyFromDepotBody;
@@ -260,6 +260,7 @@ mod api_impl {
260260
use sled_agent_types::support_bundle::SupportBundleMetadata;
261261
use sled_agent_types::support_bundle::SupportBundlePathParam;
262262
use sled_agent_types::support_bundle::SupportBundleTransferQueryParams;
263+
use sled_agent_types::uplink::SwitchPorts;
263264
use sled_agent_types::zone_bundle::BundleUtilization;
264265
use sled_agent_types::zone_bundle::CleanupContext;
265266
use sled_agent_types::zone_bundle::CleanupContextUpdate;

sled-agent/api/src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ use omicron_common::api::internal::{
1616
nexus::{DiskRuntimeState, SledVmmState},
1717
shared::{
1818
ExternalIpGatewayMap, ResolvedVpcRouteSet, ResolvedVpcRouteState,
19-
SledIdentifiers, SwitchPorts, VirtualNetworkInterfaceHost,
19+
SledIdentifiers, VirtualNetworkInterfaceHost,
2020
},
2121
};
2222
use sled_agent_types_versions::{
@@ -740,7 +740,7 @@ pub trait SledAgentApi {
740740
}]
741741
async fn uplink_ensure(
742742
rqctx: RequestContext<Self::Context>,
743-
body: TypedBody<SwitchPorts>,
743+
body: TypedBody<latest::uplink::SwitchPorts>,
744744
) -> Result<HttpResponseUpdatedNoContent, HttpError>;
745745

746746
#[endpoint {
@@ -750,7 +750,7 @@ pub trait SledAgentApi {
750750
}]
751751
async fn uplink_ensure_v1(
752752
rqctx: RequestContext<Self::Context>,
753-
body: TypedBody<v1::rack_init::SwitchPorts>,
753+
body: TypedBody<v1::uplink::SwitchPorts>,
754754
) -> Result<HttpResponseUpdatedNoContent, HttpError> {
755755
Self::uplink_ensure(rqctx, body.map(From::from)).await
756756
}

sled-agent/src/http_entrypoints.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ use omicron_common::api::external::Error;
2020
use omicron_common::api::internal::nexus::{DiskRuntimeState, SledVmmState};
2121
use omicron_common::api::internal::shared::{
2222
ExternalIpGatewayMap, ResolvedVpcRouteSet, ResolvedVpcRouteState,
23-
SledIdentifiers, SwitchPorts, VirtualNetworkInterfaceHost,
23+
SledIdentifiers, VirtualNetworkInterfaceHost,
2424
};
2525
use range_requests::PotentialRange;
2626
use sled_agent_api::*;
@@ -64,6 +64,7 @@ use sled_agent_types::support_bundle::{
6464
use sled_agent_types::trust_quorum::{
6565
ProxyCommitRequest, ProxyPrepareAndCommitRequest, TrustQuorumNetworkConfig,
6666
};
67+
use sled_agent_types::uplink::SwitchPorts;
6768
use sled_agent_types::zone_bundle::{
6869
BundleUtilization, CleanupContext, CleanupContextUpdate, CleanupCount,
6970
CleanupPeriod, StorageLimit, ZoneBundleFilter, ZoneBundleId,

sled-agent/src/services.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,8 @@ use omicron_common::address::{
8181
use omicron_common::address::{Ipv6Subnet, NEXUS_TECHPORT_EXTERNAL_PORT};
8282
use omicron_common::api::external::Generation;
8383
use omicron_common::api::internal::shared::{
84-
ExternalIpConfig, ExternalIpConfigBuilder, ExternalIps, HostPortConfig,
85-
PrivateIpConfig, RackNetworkConfig, SledIdentifiers,
84+
ExternalIpConfig, ExternalIpConfigBuilder, ExternalIps, PrivateIpConfig,
85+
RackNetworkConfig, SledIdentifiers,
8686
};
8787
use omicron_common::backoff::{
8888
BackoffError, retry_notify, retry_policy_internal_service_aggressive,
@@ -100,6 +100,7 @@ use sled_agent_types::resolvable_files::{
100100
MupdateOverrideReadError, PreparedOmicronZone,
101101
};
102102
use sled_agent_types::sled::SWITCH_ZONE_BASEBOARD_FILE;
103+
use sled_agent_types::uplink::HostPortConfig;
103104
use sled_hardware::DendriteAsic;
104105
use sled_hardware::SledMode;
105106
use sled_hardware::is_oxide_sled;

sled-agent/src/sim/http_entrypoints.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ use omicron_common::api::internal::shared::ExternalIpGatewayMap;
3030
use omicron_common::api::internal::shared::SledIdentifiers;
3131
use omicron_common::api::internal::shared::VirtualNetworkInterfaceHost;
3232
use omicron_common::api::internal::shared::{
33-
ResolvedVpcRouteSet, ResolvedVpcRouteState, SwitchPorts,
33+
ResolvedVpcRouteSet, ResolvedVpcRouteState,
3434
};
3535
use omicron_uuid_kinds::GenericUuid;
3636
use omicron_uuid_kinds::ZpoolUuid;
@@ -76,6 +76,7 @@ use sled_agent_types::support_bundle::{
7676
use sled_agent_types::trust_quorum::{
7777
ProxyCommitRequest, ProxyPrepareAndCommitRequest, TrustQuorumNetworkConfig,
7878
};
79+
use sled_agent_types::uplink::SwitchPorts;
7980
use sled_agent_types::zone_bundle::{
8081
BundleUtilization, CleanupContext, CleanupContextUpdate, CleanupCount,
8182
ZoneBundleFilter, ZoneBundleId, ZoneBundleMetadata, ZonePathParam,

0 commit comments

Comments
 (0)