From 75030196085b864416791fab603874a1a40e37ea Mon Sep 17 00:00:00 2001 From: Nils Nieuwejaar Date: Thu, 24 Oct 2024 19:02:17 +0000 Subject: [PATCH] link fec is now an optional setting --- common/src/api/external/mod.rs | 2 +- common/src/api/internal/shared.rs | 2 +- nexus/db-model/src/schema.rs | 2 +- nexus/db-model/src/schema_versions.rs | 4 ++-- nexus/db-model/src/switch_port.rs | 6 +++--- nexus/db-queries/src/db/datastore/switch_port.rs | 2 +- nexus/src/app/background/tasks/networking.rs | 4 ++-- .../background/tasks/sync_switch_configuration.rs | 7 +++---- nexus/src/app/rack.rs | 2 +- nexus/tests/integration_tests/switch_port.rs | 2 +- nexus/types/src/external_api/params.rs | 2 +- openapi/bootstrap-agent.json | 2 +- openapi/nexus-internal.json | 2 +- openapi/nexus.json | 4 ++-- openapi/sled-agent.json | 2 +- openapi/wicketd.json | 8 ++++++-- package-manifest.toml | 12 ++++++------ schema/crdb/dbinit.sql | 10 +++++----- schema/crdb/make-link-settings-non-nullable/up1.sql | 3 +++ schema/rss-sled-plan.json | 6 ++++-- sled-agent/src/bootstrap/early_networking.rs | 4 ++-- sled-agent/src/rack_setup/service.rs | 4 +++- sled-agent/tests/integration_tests/early_network.rs | 2 +- sled-agent/types/src/early_networking.rs | 8 ++++---- tools/dendrite_openapi_version | 4 ++-- tools/dendrite_stub_checksums | 6 +++--- wicket-common/src/example.rs | 4 ++-- wicket-common/src/rack_setup.rs | 2 +- wicket/src/cli/rack_setup/config_toml.rs | 13 ++++++++----- wicket/src/ui/panes/rack_setup.rs | 8 +++++++- wicket/tests/output/example_non_empty.toml | 1 - wicketd/src/preflight_check/uplink.rs | 4 ++-- wicketd/src/rss_config.rs | 4 ++-- 33 files changed, 83 insertions(+), 65 deletions(-) create mode 100644 schema/crdb/make-link-settings-non-nullable/up1.sql diff --git a/common/src/api/external/mod.rs b/common/src/api/external/mod.rs index 18343ac44a..0c0062d227 100644 --- a/common/src/api/external/mod.rs +++ b/common/src/api/external/mod.rs @@ -2514,7 +2514,7 @@ pub struct SwitchPortLinkConfig { pub mtu: u16, /// The forward error correction mode of the link. - pub fec: LinkFec, + pub fec: Option, /// The configured speed of the link. pub speed: LinkSpeed, diff --git a/common/src/api/internal/shared.rs b/common/src/api/internal/shared.rs index 5b1a528b36..e0d6452376 100644 --- a/common/src/api/internal/shared.rs +++ b/common/src/api/internal/shared.rs @@ -489,7 +489,7 @@ pub struct PortConfigV2 { /// Port speed. pub uplink_port_speed: PortSpeed, /// Port forward error correction type. - pub uplink_port_fec: PortFec, + pub uplink_port_fec: Option, /// BGP peers on this port pub bgp_peers: Vec, /// Whether or not to set autonegotiation diff --git a/nexus/db-model/src/schema.rs b/nexus/db-model/src/schema.rs index 8a97e43639..1c73f2101b 100644 --- a/nexus/db-model/src/schema.rs +++ b/nexus/db-model/src/schema.rs @@ -141,7 +141,7 @@ table! { port_settings_id -> Uuid, link_name -> Text, mtu -> Int4, - fec -> crate::SwitchLinkFecEnum, + fec -> Nullable, speed -> crate::SwitchLinkSpeedEnum, autoneg -> Bool, lldp_link_config_id -> Nullable, diff --git a/nexus/db-model/src/schema_versions.rs b/nexus/db-model/src/schema_versions.rs index 14eba1cb1c..87cc213861 100644 --- a/nexus/db-model/src/schema_versions.rs +++ b/nexus/db-model/src/schema_versions.rs @@ -17,8 +17,7 @@ use std::collections::BTreeMap; /// /// This must be updated when you change the database schema. Refer to /// schema/crdb/README.adoc in the root of this repository for details. -pub const SCHEMA_VERSION: SemverVersion = SemverVersion::new(113, 0, 0); - +pub const SCHEMA_VERSION: SemverVersion = SemverVersion::new(114, 0, 0); /// List of all past database schema versions, in *reverse* order /// /// If you want to change the Omicron database schema, you must update this. @@ -29,6 +28,7 @@ static KNOWN_VERSIONS: Lazy> = Lazy::new(|| { // | leaving the first copy as an example for the next person. // v // KnownVersion::new(next_int, "unique-dirname-with-the-sql-files"), + KnownVersion::new(114, "make-link-settings-non-nullable"), KnownVersion::new(113, "add-tx-eq"), KnownVersion::new(112, "blueprint-dataset"), KnownVersion::new(111, "drop-omicron-zone-underlay-address"), diff --git a/nexus/db-model/src/switch_port.rs b/nexus/db-model/src/switch_port.rs index 2db9ef04df..8d44c0fb20 100644 --- a/nexus/db-model/src/switch_port.rs +++ b/nexus/db-model/src/switch_port.rs @@ -385,7 +385,7 @@ pub struct SwitchPortLinkConfig { pub lldp_link_config_id: Option, pub link_name: String, pub mtu: SqlU16, - pub fec: SwitchLinkFec, + pub fec: Option, pub speed: SwitchLinkSpeed, pub autoneg: bool, pub tx_eq_config_id: Option, @@ -398,7 +398,7 @@ impl SwitchPortLinkConfig { lldp_link_config_id: Uuid, link_name: String, mtu: u16, - fec: SwitchLinkFec, + fec: Option, speed: SwitchLinkSpeed, autoneg: bool, tx_eq_config_id: Option, @@ -424,7 +424,7 @@ impl Into for SwitchPortLinkConfig { tx_eq_config_id: self.tx_eq_config_id, link_name: self.link_name.clone(), mtu: self.mtu.into(), - fec: self.fec.into(), + fec: self.fec.map(|fec| fec.into()), speed: self.speed.into(), autoneg: self.autoneg, } diff --git a/nexus/db-queries/src/db/datastore/switch_port.rs b/nexus/db-queries/src/db/datastore/switch_port.rs index e0092459b5..6b282434cd 100644 --- a/nexus/db-queries/src/db/datastore/switch_port.rs +++ b/nexus/db-queries/src/db/datastore/switch_port.rs @@ -1229,7 +1229,7 @@ async fn do_switch_port_settings_create( lldp_config_id, link_name.clone(), c.mtu, - c.fec.into(), + c.fec.map(|fec| fec.into()), c.speed.into(), c.autoneg, tx_eq_config_id, diff --git a/nexus/src/app/background/tasks/networking.rs b/nexus/src/app/background/tasks/networking.rs index ed27409c9b..54eb842550 100644 --- a/nexus/src/app/background/tasks/networking.rs +++ b/nexus/src/app/background/tasks/networking.rs @@ -83,11 +83,11 @@ pub(crate) fn api_to_dpd_port_settings( lane: Some(LinkId(0)), kr: false, tx_eq: tx_eq.clone(), - fec: match l.fec { + fec: l.fec.map(|fec| match fec { SwitchLinkFec::Firecode => PortFec::Firecode, SwitchLinkFec::Rs => PortFec::Rs, SwitchLinkFec::None => PortFec::None, - }, + }), speed: match l.speed { SwitchLinkSpeed::Speed0G => PortSpeed::Speed0G, SwitchLinkSpeed::Speed1G => PortSpeed::Speed1G, diff --git a/nexus/src/app/background/tasks/sync_switch_configuration.rs b/nexus/src/app/background/tasks/sync_switch_configuration.rs index ceacae7645..6a82f1634c 100644 --- a/nexus/src/app/background/tasks/sync_switch_configuration.rs +++ b/nexus/src/app/background/tasks/sync_switch_configuration.rs @@ -19,7 +19,7 @@ use internal_dns_types::names::ServiceName; use ipnetwork::IpNetwork; use nexus_db_model::{ AddressLotBlock, BgpConfig, BootstoreConfig, LoopbackAddress, - SwitchLinkFec, SwitchLinkSpeed, INFRA_LOT, NETWORK_KEY, + SwitchLinkSpeed, INFRA_LOT, NETWORK_KEY, }; use uuid::Uuid; @@ -1002,9 +1002,8 @@ impl BackgroundTask for SwitchPortSettingsManager { uplink_port_fec: info .links .get(0) //TODO https://github.com/oxidecomputer/omicron/issues/3062 - .map(|l| l.fec) - .unwrap_or(SwitchLinkFec::None) - .into(), + .map(|l| l.fec.map(|fec| fec.into())) + .unwrap_or(None), uplink_port_speed: info .links .get(0) //TODO https://github.com/oxidecomputer/omicron/issues/3062 diff --git a/nexus/src/app/rack.rs b/nexus/src/app/rack.rs index a6e38e8dcf..4a6d4217a2 100644 --- a/nexus/src/app/rack.rs +++ b/nexus/src/app/rack.rs @@ -654,7 +654,7 @@ impl super::Nexus { let link = LinkConfigCreate { //TODO https://github.com/oxidecomputer/omicron/issues/2274 mtu: 1500, - fec: uplink_config.uplink_port_fec.into(), + fec: uplink_config.uplink_port_fec.map(|fec| fec.into()), speed: uplink_config.uplink_port_speed.into(), autoneg: uplink_config.autoneg, lldp, diff --git a/nexus/tests/integration_tests/switch_port.rs b/nexus/tests/integration_tests/switch_port.rs index 9ce686db56..89ddfe11ac 100644 --- a/nexus/tests/integration_tests/switch_port.rs +++ b/nexus/tests/integration_tests/switch_port.rs @@ -127,7 +127,7 @@ async fn test_port_settings_basic_crud(ctx: &ControlPlaneTestContext) { system_description: Some("System description".into()), management_ip: None, }, - fec: LinkFec::None, + fec: Some(LinkFec::None), speed: LinkSpeed::Speed100G, autoneg: false, tx_eq: None, diff --git a/nexus/types/src/external_api/params.rs b/nexus/types/src/external_api/params.rs index 9af9d3be1e..152e09275f 100644 --- a/nexus/types/src/external_api/params.rs +++ b/nexus/types/src/external_api/params.rs @@ -1716,7 +1716,7 @@ pub struct LinkConfigCreate { pub lldp: LldpLinkConfigCreate, /// The forward error correction mode of the link. - pub fec: LinkFec, + pub fec: Option, /// The speed of the link. pub speed: LinkSpeed, diff --git a/openapi/bootstrap-agent.json b/openapi/bootstrap-agent.json index 2f3058cd46..32fe2f0d8e 100644 --- a/openapi/bootstrap-agent.json +++ b/openapi/bootstrap-agent.json @@ -866,6 +866,7 @@ ] }, "uplink_port_fec": { + "nullable": true, "description": "Port forward error correction type.", "allOf": [ { @@ -888,7 +889,6 @@ "port", "routes", "switch", - "uplink_port_fec", "uplink_port_speed" ] }, diff --git a/openapi/nexus-internal.json b/openapi/nexus-internal.json index 4392de318d..c6e214e410 100644 --- a/openapi/nexus-internal.json +++ b/openapi/nexus-internal.json @@ -4687,6 +4687,7 @@ ] }, "uplink_port_fec": { + "nullable": true, "description": "Port forward error correction type.", "allOf": [ { @@ -4709,7 +4710,6 @@ "port", "routes", "switch", - "uplink_port_fec", "uplink_port_speed" ] }, diff --git a/openapi/nexus.json b/openapi/nexus.json index f12ff4730c..0f3c4a763a 100644 --- a/openapi/nexus.json +++ b/openapi/nexus.json @@ -17166,6 +17166,7 @@ "type": "boolean" }, "fec": { + "nullable": true, "description": "The forward error correction mode of the link.", "allOf": [ { @@ -17207,7 +17208,6 @@ }, "required": [ "autoneg", - "fec", "lldp", "mtu", "speed" @@ -20410,6 +20410,7 @@ "type": "boolean" }, "fec": { + "nullable": true, "description": "The forward error correction mode of the link.", "allOf": [ { @@ -20455,7 +20456,6 @@ }, "required": [ "autoneg", - "fec", "link_name", "mtu", "port_settings_id", diff --git a/openapi/sled-agent.json b/openapi/sled-agent.json index 9963526ef8..7ca1dc8e3a 100644 --- a/openapi/sled-agent.json +++ b/openapi/sled-agent.json @@ -4644,6 +4644,7 @@ ] }, "uplink_port_fec": { + "nullable": true, "description": "Port forward error correction type.", "allOf": [ { @@ -4666,7 +4667,6 @@ "port", "routes", "switch", - "uplink_port_fec", "uplink_port_speed" ] }, diff --git a/openapi/wicketd.json b/openapi/wicketd.json index 8e20f23d06..0b3c4d7c9e 100644 --- a/openapi/wicketd.json +++ b/openapi/wicketd.json @@ -6676,7 +6676,12 @@ ] }, "uplink_port_fec": { - "$ref": "#/components/schemas/PortFec" + "nullable": true, + "allOf": [ + { + "$ref": "#/components/schemas/PortFec" + } + ] }, "uplink_port_speed": { "$ref": "#/components/schemas/PortSpeed" @@ -6686,7 +6691,6 @@ "addresses", "autoneg", "routes", - "uplink_port_fec", "uplink_port_speed" ], "additionalProperties": false diff --git a/package-manifest.toml b/package-manifest.toml index fffa89640d..3a13c81b3c 100644 --- a/package-manifest.toml +++ b/package-manifest.toml @@ -719,8 +719,8 @@ only_for_targets.image = "standard" # the other `source.*` keys. source.type = "prebuilt" source.repo = "dendrite" -source.commit = "4067d742d832fa434217b95e4b149048d01ef54e" -source.sha256 = "5e9ccc42e5ac31f4be24025d2afd5978aef33d618f3cb7caa260eff73b7e6a79" +source.commit = "4d97f30b61e54c8e14adf582092d89969cb4a66d" +source.sha256 = "5c055b3b065454be1fc0c89d28af99b860742d4ee8ea71864de339427aaad690" output.type = "zone" output.intermediate_only = true @@ -746,8 +746,8 @@ only_for_targets.image = "standard" # the other `source.*` keys. source.type = "prebuilt" source.repo = "dendrite" -source.commit = "4067d742d832fa434217b95e4b149048d01ef54e" -source.sha256 = "9d3156b7895126b9df5460dd0c34668738a7f2d5894a4be0229644820e732895" +source.commit = "4d97f30b61e54c8e14adf582092d89969cb4a66d" +source.sha256 = "b7e0a0828a17dcc134f60451f0d80c50c3ed97cd1d9bf9c27751711a7f5cc028" output.type = "zone" output.intermediate_only = true @@ -766,8 +766,8 @@ only_for_targets.image = "standard" # the other `source.*` keys. source.type = "prebuilt" source.repo = "dendrite" -source.commit = "4067d742d832fa434217b95e4b149048d01ef54e" -source.sha256 = "4eff4f00201ab8373510644693d066dbec2497142d48964be9844f0b30c147e8" +source.commit = "4d97f30b61e54c8e14adf582092d89969cb4a66d" +source.sha256 = "e7753bf199b6a16a92a65864e2ecbb20327fd3717a42de51b6fda88d0f71058c" output.type = "zone" output.intermediate_only = true diff --git a/schema/crdb/dbinit.sql b/schema/crdb/dbinit.sql index b095c4c89a..58f618efa1 100644 --- a/schema/crdb/dbinit.sql +++ b/schema/crdb/dbinit.sql @@ -2840,11 +2840,11 @@ CREATE TYPE IF NOT EXISTS omicron.public.switch_link_speed AS ENUM ( ); CREATE TABLE IF NOT EXISTS omicron.public.switch_port_settings_link_config ( - port_settings_id UUID, - link_name TEXT, - mtu INT4, + port_settings_id UUID NOT NULL, + link_name TEXT NOT NULL, + mtu INT4 NOT NULL, fec omicron.public.switch_link_fec, - speed omicron.public.switch_link_speed, + speed omicron.public.switch_link_speed NOT NULL, autoneg BOOL NOT NULL DEFAULT false, lldp_link_config_id UUID, tx_eq_config_id UUID, @@ -4601,7 +4601,7 @@ INSERT INTO omicron.public.db_metadata ( version, target_version ) VALUES - (TRUE, NOW(), NOW(), '113.0.0', NULL) + (TRUE, NOW(), NOW(), '114.0.0', NULL) ON CONFLICT DO NOTHING; COMMIT; diff --git a/schema/crdb/make-link-settings-non-nullable/up1.sql b/schema/crdb/make-link-settings-non-nullable/up1.sql new file mode 100644 index 0000000000..9fc55b3f98 --- /dev/null +++ b/schema/crdb/make-link-settings-non-nullable/up1.sql @@ -0,0 +1,3 @@ +ALTER TABLE omicron.public.switch_port_settings_link_config ALTER COLUMN speed SET NOT NULL; +ALTER TABLE omicron.public.switch_port_settings_link_config ALTER COLUMN mtu SET NOT NULL; +ALTER TABLE omicron.public.switch_port_settings_link_config ALTER COLUMN port_settings_id SET NOT NULL; diff --git a/schema/rss-sled-plan.json b/schema/rss-sled-plan.json index 56fe35bcde..fbfc92cb7e 100644 --- a/schema/rss-sled-plan.json +++ b/schema/rss-sled-plan.json @@ -698,7 +698,6 @@ "port", "routes", "switch", - "uplink_port_fec", "uplink_port_speed" ], "properties": { @@ -764,9 +763,12 @@ }, "uplink_port_fec": { "description": "Port forward error correction type.", - "allOf": [ + "anyOf": [ { "$ref": "#/definitions/PortFec" + }, + { + "type": "null" } ] }, diff --git a/sled-agent/src/bootstrap/early_networking.rs b/sled-agent/src/bootstrap/early_networking.rs index acfbafe61c..f7440497a4 100644 --- a/sled-agent/src/bootstrap/early_networking.rs +++ b/sled-agent/src/bootstrap/early_networking.rs @@ -699,7 +699,7 @@ impl<'a> EarlyNetworkSetup<'a> { params: LinkCreate { autoneg: port_config.autoneg, kr: false, //NOTE: kr does not apply to user configurable links. - fec: convert_fec(&port_config.uplink_port_fec), + fec: port_config.uplink_port_fec.map(convert_fec), speed: convert_speed(&port_config.uplink_port_speed), lane: Some(LinkId(0)), tx_eq: port_config.tx_eq.map(|x| TxEq { @@ -783,7 +783,7 @@ fn convert_speed(speed: &PortSpeed) -> dpd_client::types::PortSpeed { } } -fn convert_fec(fec: &PortFec) -> dpd_client::types::PortFec { +fn convert_fec(fec: PortFec) -> dpd_client::types::PortFec { match fec { PortFec::Firecode => dpd_client::types::PortFec::Firecode, PortFec::None => dpd_client::types::PortFec::None, diff --git a/sled-agent/src/rack_setup/service.rs b/sled-agent/src/rack_setup/service.rs index 2795422ee2..c6d6324d0c 100644 --- a/sled-agent/src/rack_setup/service.rs +++ b/sled-agent/src/rack_setup/service.rs @@ -791,7 +791,9 @@ impl ServiceInner { .collect(), switch: config.switch.into(), uplink_port_speed: config.uplink_port_speed.into(), - uplink_port_fec: config.uplink_port_fec.into(), + uplink_port_fec: config + .uplink_port_fec + .map(|fec| fec.into()), autoneg: config.autoneg, bgp_peers: config .bgp_peers diff --git a/sled-agent/tests/integration_tests/early_network.rs b/sled-agent/tests/integration_tests/early_network.rs index 420ce493d0..ff1b0ee8ac 100644 --- a/sled-agent/tests/integration_tests/early_network.rs +++ b/sled-agent/tests/integration_tests/early_network.rs @@ -132,7 +132,7 @@ fn current_config_example() -> (&'static str, EarlyNetworkConfig) { switch: SwitchLocation::Switch0, port: "foo".to_owned(), uplink_port_speed: PortSpeed::Speed200G, - uplink_port_fec: PortFec::Firecode, + uplink_port_fec: Some(PortFec::Firecode), bgp_peers: vec![BgpPeerConfig { asn: 65000, port: "bar".to_owned(), diff --git a/sled-agent/types/src/early_networking.rs b/sled-agent/types/src/early_networking.rs index 6faead6fe9..cef692769c 100644 --- a/sled-agent/types/src/early_networking.rs +++ b/sled-agent/types/src/early_networking.rs @@ -296,7 +296,7 @@ pub mod back_compat { switch: v1.switch, port: v1.port, uplink_port_speed: v1.uplink_port_speed, - uplink_port_fec: v1.uplink_port_fec, + uplink_port_fec: Some(v1.uplink_port_fec), bgp_peers: v1.bgp_peers.clone(), autoneg: v1.autoneg, lldp: None, @@ -344,7 +344,7 @@ pub mod back_compat { switch: value.switch, port: value.uplink_port, uplink_port_speed: value.uplink_port_speed, - uplink_port_fec: value.uplink_port_fec, + uplink_port_fec: Some(value.uplink_port_fec), bgp_peers: vec![], autoneg: false, lldp: None, @@ -518,7 +518,7 @@ mod tests { switch: uplink.switch, port: uplink.uplink_port, uplink_port_speed: uplink.uplink_port_speed, - uplink_port_fec: uplink.uplink_port_fec, + uplink_port_fec: Some(uplink.uplink_port_fec), autoneg: false, bgp_peers: vec![], lldp: None, @@ -601,7 +601,7 @@ mod tests { switch: port.switch, port: port.port, uplink_port_speed: port.uplink_port_speed, - uplink_port_fec: port.uplink_port_fec, + uplink_port_fec: Some(port.uplink_port_fec), autoneg: false, bgp_peers: vec![], lldp: None, diff --git a/tools/dendrite_openapi_version b/tools/dendrite_openapi_version index 09378177d7..5662b0f871 100755 --- a/tools/dendrite_openapi_version +++ b/tools/dendrite_openapi_version @@ -1,2 +1,2 @@ -COMMIT="4067d742d832fa434217b95e4b149048d01ef54e" -SHA2="ff41c2a30f67c4ce79fc1c8dd99bce8042e855c51fd15362be4ee833acec58cf" +COMMIT="4d97f30b61e54c8e14adf582092d89969cb4a66d" +SHA2="fc9c5517fe0850e6554bedd95767dd2225110b8cfd297cbe22c2d3f67fed3801" diff --git a/tools/dendrite_stub_checksums b/tools/dendrite_stub_checksums index 40cf08e5c0..d47d3067f3 100644 --- a/tools/dendrite_stub_checksums +++ b/tools/dendrite_stub_checksums @@ -1,3 +1,3 @@ -CIDL_SHA256_ILLUMOS="5e9ccc42e5ac31f4be24025d2afd5978aef33d618f3cb7caa260eff73b7e6a79" -CIDL_SHA256_LINUX_DPD="5738cb74ea2657dd255f5ba094600265f5b10b99eeb70bd0b69cbb987b951b71" -CIDL_SHA256_LINUX_SWADM="30e085b64e33c374ec79d9e0e8cf015547e573b34525d2da228a8c99755557fb" +CIDL_SHA256_ILLUMOS="5c055b3b065454be1fc0c89d28af99b860742d4ee8ea71864de339427aaad690" +CIDL_SHA256_LINUX_DPD="5df365729b16ad485967e965bd6d16b8c009d077375a00741b2d31f34808eba9" +CIDL_SHA256_LINUX_SWADM="6514bd2397e440a22622bd6c19ff17fe0d73c60b6014b9057d67d2c9d13bb037" diff --git a/wicket-common/src/example.rs b/wicket-common/src/example.rs index 8572b791cd..d437945012 100644 --- a/wicket-common/src/example.rs +++ b/wicket-common/src/example.rs @@ -210,7 +210,7 @@ impl ExampleRackSetupData { }], bgp_peers: switch0_port0_bgp_peers, uplink_port_speed: PortSpeed::Speed400G, - uplink_port_fec: PortFec::Firecode, + uplink_port_fec: Some(PortFec::Firecode), lldp: switch0_port0_lldp, tx_eq, autoneg: true, @@ -230,7 +230,7 @@ impl ExampleRackSetupData { }], bgp_peers: switch1_port0_bgp_peers, uplink_port_speed: PortSpeed::Speed400G, - uplink_port_fec: PortFec::Firecode, + uplink_port_fec: None, lldp: switch1_port0_lldp, tx_eq, autoneg: true, diff --git a/wicket-common/src/rack_setup.rs b/wicket-common/src/rack_setup.rs index 7136bc8d96..c33d3a628f 100644 --- a/wicket-common/src/rack_setup.rs +++ b/wicket-common/src/rack_setup.rs @@ -183,7 +183,7 @@ pub struct UserSpecifiedPortConfig { pub routes: Vec, pub addresses: Vec, pub uplink_port_speed: PortSpeed, - pub uplink_port_fec: PortFec, + pub uplink_port_fec: Option, pub autoneg: bool, #[serde(default)] pub bgp_peers: Vec, diff --git a/wicket/src/cli/rack_setup/config_toml.rs b/wicket/src/cli/rack_setup/config_toml.rs index 727f1bbaa8..191a8cb30f 100644 --- a/wicket/src/cli/rack_setup/config_toml.rs +++ b/wicket/src/cli/rack_setup/config_toml.rs @@ -358,11 +358,14 @@ fn populate_uplink_table(cfg: &UserSpecifiedPortConfig) -> Table { uplink.insert("addresses", Item::Value(Value::Array(addresses_out))); // General properties - for (property, value) in [ - ("uplink_port_speed", enum_to_toml_string(&uplink_port_speed)), - ("uplink_port_fec", enum_to_toml_string(&uplink_port_fec)), - ] { - uplink.insert(property, string_item(value)); + uplink.insert( + "uplink_port_speed", + string_item(enum_to_toml_string(&uplink_port_speed)), + ); + + if let Some(fec) = uplink_port_fec { + uplink + .insert("uplink_port_fec", string_item(enum_to_toml_string(&fec))); } uplink.insert("autoneg", bool_item(*autoneg)); diff --git a/wicket/src/ui/panes/rack_setup.rs b/wicket/src/ui/panes/rack_setup.rs index 1828049fc3..422c47b2bd 100644 --- a/wicket/src/ui/panes/rack_setup.rs +++ b/wicket/src/ui/panes/rack_setup.rs @@ -790,7 +790,13 @@ fn rss_config_text<'a>( ], vec![ Span::styled(" • FEC : ", label_style), - Span::styled(uplink_port_fec.to_string(), ok_style), + Span::styled( + match uplink_port_fec { + Some(fec) => fec.to_string(), + None => "unspecified".to_string(), + }, + ok_style, + ), ], vec![ Span::styled(" • Autoneg : ", label_style), diff --git a/wicket/tests/output/example_non_empty.toml b/wicket/tests/output/example_non_empty.toml index d6f5e7c820..1cd4582a43 100644 --- a/wicket/tests/output/example_non_empty.toml +++ b/wicket/tests/output/example_non_empty.toml @@ -130,7 +130,6 @@ post2 = 0 routes = [{ nexthop = "172.33.0.10", destination = "0.0.0.0/0", vlan_id = 1 }] addresses = [{ address = "172.32.0.1/24" }] uplink_port_speed = "speed400_g" -uplink_port_fec = "firecode" autoneg = true [[rack_network_config.switch1.port0.bgp_peers]] diff --git a/wicketd/src/preflight_check/uplink.rs b/wicketd/src/preflight_check/uplink.rs index e70d9db57b..42210d7719 100644 --- a/wicketd/src/preflight_check/uplink.rs +++ b/wicketd/src/preflight_check/uplink.rs @@ -747,11 +747,11 @@ fn build_port_settings( link_id: &LinkId, ) -> PortSettings { // Map from omicron_common types to dpd_client types - let fec = match uplink.uplink_port_fec { + let fec = uplink.uplink_port_fec.map(|fec| match fec { OmicronPortFec::Firecode => DpdPortFec::Firecode, OmicronPortFec::None => DpdPortFec::None, OmicronPortFec::Rs => DpdPortFec::Rs, - }; + }); let speed = match uplink.uplink_port_speed { OmicronPortSpeed::Speed0G => DpdPortSpeed::Speed0G, OmicronPortSpeed::Speed1G => DpdPortSpeed::Speed1G, diff --git a/wicketd/src/rss_config.rs b/wicketd/src/rss_config.rs index 8ee252ef77..badcb24a3f 100644 --- a/wicketd/src/rss_config.rs +++ b/wicketd/src/rss_config.rs @@ -788,11 +788,11 @@ fn build_port_config( PortSpeed::Speed200G => BaPortSpeed::Speed200G, PortSpeed::Speed400G => BaPortSpeed::Speed400G, }, - uplink_port_fec: match config.uplink_port_fec { + uplink_port_fec: config.uplink_port_fec.map(|fec| match fec { PortFec::Firecode => BaPortFec::Firecode, PortFec::None => BaPortFec::None, PortFec::Rs => BaPortFec::Rs, - }, + }), autoneg: config.autoneg, lldp: config.lldp.as_ref().map(|c| BaLldpPortConfig { status: match c.status {