Skip to content
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

update schemars; address duplicate type names #4737

Merged
merged 2 commits into from
Dec 30, 2023
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
8 changes: 4 additions & 4 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ rustfmt-wrapper = "0.2"
rustls = "0.21.9"
rustyline = "12.0.0"
samael = { git = "https://github.com/njaremko/samael", features = ["xmlsec"], branch = "master" }
schemars = "0.8.12"
schemars = "0.8.16"
secrecy = "0.8.0"
semver = { version = "1.0.20", features = ["std", "serde"] }
serde = { version = "1.0", default-features = false, features = [ "derive" ] }
Expand Down
4 changes: 2 additions & 2 deletions nexus/db-queries/src/db/datastore/switch_port.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1196,7 +1196,7 @@ mod test {
use nexus_test_utils::db::test_setup_database;
use nexus_types::external_api::params::{
BgpAnnounceSetCreate, BgpConfigCreate, BgpPeer, BgpPeerConfig,
SwitchPortConfig, SwitchPortGeometry, SwitchPortSettingsCreate,
SwitchPortConfigCreate, SwitchPortGeometry, SwitchPortSettingsCreate,
};
use omicron_common::api::external::{
IdentityMetadataCreateParams, Name, NameOrId,
Expand Down Expand Up @@ -1250,7 +1250,7 @@ mod test {
name: "test-settings".parse().unwrap(),
description: "test settings".into(),
},
port_config: SwitchPortConfig {
port_config: SwitchPortConfigCreate {
geometry: SwitchPortGeometry::Qsfp28x1,
},
groups: Vec::new(),
Expand Down
12 changes: 6 additions & 6 deletions nexus/src/app/rack.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ use nexus_types::external_api::params::BgpAnnounceSetCreate;
use nexus_types::external_api::params::BgpAnnouncementCreate;
use nexus_types::external_api::params::BgpConfigCreate;
use nexus_types::external_api::params::BgpPeer;
use nexus_types::external_api::params::LinkConfig;
use nexus_types::external_api::params::LldpServiceConfig;
use nexus_types::external_api::params::LinkConfigCreate;
use nexus_types::external_api::params::LldpServiceConfigCreate;
use nexus_types::external_api::params::RouteConfig;
use nexus_types::external_api::params::SwitchPortConfig;
use nexus_types::external_api::params::SwitchPortConfigCreate;
use nexus_types::external_api::params::UninitializedSledId;
use nexus_types::external_api::params::{
AddressLotCreate, BgpPeerConfig, LoopbackAddressCreate, Route, SiloCreate,
Expand Down Expand Up @@ -587,7 +587,7 @@ impl super::Nexus {
description: "initial uplink configuration".to_string(),
};

let port_config = SwitchPortConfig {
let port_config = SwitchPortConfigCreate {
geometry: nexus_types::external_api::params::SwitchPortGeometry::Qsfp28x1,
};

Expand Down Expand Up @@ -653,9 +653,9 @@ impl super::Nexus {
.bgp_peers
.insert("phy0".to_string(), BgpPeerConfig { peers });

let link = LinkConfig {
let link = LinkConfigCreate {
mtu: 1500, //TODO https://github.com/oxidecomputer/omicron/issues/2274
lldp: LldpServiceConfig {
lldp: LldpServiceConfigCreate {
enabled: false,
lldp_config: None,
},
Expand Down
12 changes: 6 additions & 6 deletions nexus/tests/integration_tests/switch_port.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ use nexus_test_utils_macros::nexus_test;
use nexus_types::external_api::params::{
Address, AddressConfig, AddressLotBlockCreate, AddressLotCreate,
BgpAnnounceSetCreate, BgpAnnouncementCreate, BgpConfigCreate, BgpPeer,
BgpPeerConfig, LinkConfig, LinkFec, LinkSpeed, LldpServiceConfig, Route,
RouteConfig, SwitchInterfaceConfig, SwitchInterfaceKind,
SwitchPortApplySettings, SwitchPortSettingsCreate,
BgpPeerConfig, LinkConfigCreate, LinkFec, LinkSpeed,
LldpServiceConfigCreate, Route, RouteConfig, SwitchInterfaceConfigCreate,
SwitchInterfaceKind, SwitchPortApplySettings, SwitchPortSettingsCreate,
};
use nexus_types::external_api::views::Rack;
use omicron_common::api::external::{
Expand Down Expand Up @@ -113,9 +113,9 @@ async fn test_port_settings_basic_crud(ctx: &ControlPlaneTestContext) {
// links
settings.links.insert(
"phy0".into(),
LinkConfig {
LinkConfigCreate {
mtu: 4700,
lldp: LldpServiceConfig { enabled: false, lldp_config: None },
lldp: LldpServiceConfigCreate { enabled: false, lldp_config: None },
fec: LinkFec::None,
speed: LinkSpeed::Speed100G,
autoneg: false,
Expand All @@ -124,7 +124,7 @@ async fn test_port_settings_basic_crud(ctx: &ControlPlaneTestContext) {
// interfaces
settings.interfaces.insert(
"phy0".into(),
SwitchInterfaceConfig {
SwitchInterfaceConfigCreate {
v6_enabled: true,
kind: SwitchInterfaceKind::Primary,
},
Expand Down
18 changes: 9 additions & 9 deletions nexus/types/src/external_api/params.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1387,14 +1387,14 @@ pub struct SwtichPortSettingsGroupCreate {
pub struct SwitchPortSettingsCreate {
#[serde(flatten)]
pub identity: IdentityMetadataCreateParams,
pub port_config: SwitchPortConfig,
pub port_config: SwitchPortConfigCreate,
pub groups: Vec<NameOrId>,
/// Links indexed by phy name. On ports that are not broken out, this is
/// always phy0. On a 2x breakout the options are phy0 and phy1, on 4x
/// phy0-phy3, etc.
pub links: HashMap<String, LinkConfig>,
pub links: HashMap<String, LinkConfigCreate>,
/// Interfaces indexed by link name.
pub interfaces: HashMap<String, SwitchInterfaceConfig>,
pub interfaces: HashMap<String, SwitchInterfaceConfigCreate>,
/// Routes indexed by interface name.
pub routes: HashMap<String, RouteConfig>,
/// BGP peers indexed by interface name.
Expand All @@ -1407,7 +1407,7 @@ impl SwitchPortSettingsCreate {
pub fn new(identity: IdentityMetadataCreateParams) -> Self {
Self {
identity,
port_config: SwitchPortConfig {
port_config: SwitchPortConfigCreate {
geometry: SwitchPortGeometry::Qsfp28x1,
},
groups: Vec::new(),
Expand All @@ -1423,7 +1423,7 @@ impl SwitchPortSettingsCreate {
/// Physical switch port configuration.
#[derive(Clone, Debug, Deserialize, Serialize, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub struct SwitchPortConfig {
pub struct SwitchPortConfigCreate {
/// Link geometry for the switch port.
pub geometry: SwitchPortGeometry,
}
Expand Down Expand Up @@ -1526,12 +1526,12 @@ impl From<omicron_common::api::internal::shared::PortSpeed> for LinkSpeed {

/// Switch link configuration.
#[derive(Clone, Debug, Deserialize, Serialize, JsonSchema)]
pub struct LinkConfig {
pub struct LinkConfigCreate {
/// Maximum transmission unit for the link.
pub mtu: u16,

/// The link-layer discovery protocol (LLDP) configuration for the link.
pub lldp: LldpServiceConfig,
pub lldp: LldpServiceConfigCreate,

/// The forward error correction mode of the link.
pub fec: LinkFec,
Expand All @@ -1546,7 +1546,7 @@ pub struct LinkConfig {
/// The LLDP configuration associated with a port. LLDP may be either enabled or
/// disabled, if enabled, an LLDP configuration must be provided by name or id.
#[derive(Clone, Debug, Deserialize, Serialize, JsonSchema)]
pub struct LldpServiceConfig {
pub struct LldpServiceConfigCreate {
/// Whether or not LLDP is enabled.
pub enabled: bool,

Expand All @@ -1558,7 +1558,7 @@ pub struct LldpServiceConfig {
/// A layer-3 switch interface configuration. When IPv6 is enabled, a link local
/// address will be created for the interface.
#[derive(Clone, Debug, Deserialize, Serialize, JsonSchema)]
pub struct SwitchInterfaceConfig {
pub struct SwitchInterfaceConfigCreate {
/// Whether or not IPv6 is enabled.
pub v6_enabled: bool,

Expand Down
Loading
Loading