diff --git a/Cargo.lock b/Cargo.lock index b27115b42a..089a8cf991 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1614,7 +1614,7 @@ dependencies = [ [[package]] name = "ddm-admin-client" version = "0.1.0" -source = "git+https://github.com/oxidecomputer/maghemite?rev=6e0a232fd0b443c19f61f94bf02b7695505aa8e3#6e0a232fd0b443c19f61f94bf02b7695505aa8e3" +source = "git+https://github.com/oxidecomputer/maghemite?rev=8c5806d0bb3ac38efec716e22fe7cdcd424de09c#8c5806d0bb3ac38efec716e22fe7cdcd424de09c" dependencies = [ "oxnet", "percent-encoding", @@ -4313,7 +4313,7 @@ dependencies = [ [[package]] name = "mg-admin-client" version = "0.1.0" -source = "git+https://github.com/oxidecomputer/maghemite?rev=6e0a232fd0b443c19f61f94bf02b7695505aa8e3#6e0a232fd0b443c19f61f94bf02b7695505aa8e3" +source = "git+https://github.com/oxidecomputer/maghemite?rev=8c5806d0bb3ac38efec716e22fe7cdcd424de09c#8c5806d0bb3ac38efec716e22fe7cdcd424de09c" dependencies = [ "anyhow", "chrono", @@ -8492,9 +8492,9 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.203" +version = "1.0.204" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7253ab4de971e72fb7be983802300c30b5a7f0c2e56fab8abfc6a214307c0094" +checksum = "bc76f558e0cbb2a839d37354c575f1dc3fdc6546b5be373ba43d95f231bf7c12" dependencies = [ "serde_derive", ] @@ -8539,9 +8539,9 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.203" +version = "1.0.204" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "500cbc0ebeb6f46627f50f3f5811ccf6bf00643be300b4c3eabc0ef55dc5b5ba" +checksum = "e0cd7e117be63d3c3678776753929474f3b04a43a080c744d6b0ae2a8c28e222" dependencies = [ "proc-macro2", "quote", diff --git a/Cargo.toml b/Cargo.toml index 06d3ef3130..189d3e87f9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -333,8 +333,8 @@ macaddr = { version = "1.0.1", features = ["serde_std"] } maplit = "1.0.2" mockall = "0.12" newtype_derive = "0.1.6" -mg-admin-client = { git = "https://github.com/oxidecomputer/maghemite", rev = "6e0a232fd0b443c19f61f94bf02b7695505aa8e3" } -ddm-admin-client = { git = "https://github.com/oxidecomputer/maghemite", rev = "6e0a232fd0b443c19f61f94bf02b7695505aa8e3" } +mg-admin-client = { git = "https://github.com/oxidecomputer/maghemite", rev = "8c5806d0bb3ac38efec716e22fe7cdcd424de09c" } +ddm-admin-client = { git = "https://github.com/oxidecomputer/maghemite", rev = "8c5806d0bb3ac38efec716e22fe7cdcd424de09c" } multimap = "0.10.0" nexus-auth = { path = "nexus/auth" } nexus-client = { path = "clients/nexus-client" } diff --git a/nexus/src/app/bgp.rs b/nexus/src/app/bgp.rs index 190e46347f..118011500a 100644 --- a/nexus/src/app/bgp.rs +++ b/nexus/src/app/bgp.rs @@ -53,17 +53,6 @@ impl super::Nexus { Ok(result) } - pub async fn bgp_create_announce_set( - &self, - opctx: &OpContext, - announce: ¶ms::BgpAnnounceSetCreate, - ) -> CreateResult<(BgpAnnounceSet, Vec)> { - opctx.authorize(authz::Action::Modify, &authz::FLEET).await?; - let result = - self.db_datastore.bgp_create_announce_set(opctx, announce).await?; - Ok(result) - } - pub async fn bgp_update_announce_set( &self, opctx: &OpContext, diff --git a/nexus/src/external_api/http_entrypoints.rs b/nexus/src/external_api/http_entrypoints.rs index fec35d2f48..ddb063ab9f 100644 --- a/nexus/src/external_api/http_entrypoints.rs +++ b/nexus/src/external_api/http_entrypoints.rs @@ -278,7 +278,6 @@ pub(crate) fn external_api() -> NexusApiDescription { api.register(networking_bgp_status)?; api.register(networking_bgp_imported_routes_ipv4)?; api.register(networking_bgp_config_delete)?; - api.register(networking_bgp_announce_set_create)?; api.register(networking_bgp_announce_set_update)?; api.register(networking_bgp_announce_set_list)?; api.register(networking_bgp_announce_set_delete)?; @@ -4060,32 +4059,8 @@ async fn networking_bgp_config_delete( .await } -/// Create new BGP announce set -#[endpoint { - method = POST, - path = "/v1/system/networking/bgp-announce", - tags = ["system/networking"], -}] -async fn networking_bgp_announce_set_create( - rqctx: RequestContext, - config: TypedBody, -) -> Result, HttpError> { - let apictx = rqctx.context(); - let handler = async { - let nexus = &apictx.context.nexus; - let config = config.into_inner(); - let opctx = crate::context::op_context_for_external_api(&rqctx).await?; - let result = nexus.bgp_create_announce_set(&opctx, &config).await?; - Ok(HttpResponseCreated::(result.0.into())) - }; - apictx - .context - .external_latencies - .instrument_dropshot_handler(&rqctx, handler) - .await -} - -/// Update a BGP announce set +/// Update a BGP announce set. If the announce set exists this endpoint replaces +/// the existing announce set with the one specified. #[endpoint { method = PUT, path = "/v1/system/networking/bgp-announce", diff --git a/nexus/tests/integration_tests/endpoints.rs b/nexus/tests/integration_tests/endpoints.rs index 3f2f79e1f8..52d9e14e35 100644 --- a/nexus/tests/integration_tests/endpoints.rs +++ b/nexus/tests/integration_tests/endpoints.rs @@ -2307,9 +2307,6 @@ pub static VERIFY_ENDPOINTS: Lazy> = Lazy::new(|| { visibility: Visibility::Public, unprivileged_access: UnprivilegedAccess::None, allowed_methods: vec![ - AllowedMethod::Post( - serde_json::to_value(&*DEMO_BGP_ANNOUNCE).unwrap(), - ), AllowedMethod::Put( serde_json::to_value(&*DEMO_BGP_ANNOUNCE).unwrap(), ), diff --git a/nexus/tests/output/nexus_tags.txt b/nexus/tests/output/nexus_tags.txt index 1bdb6fdc25..4af018c5af 100644 --- a/nexus/tests/output/nexus_tags.txt +++ b/nexus/tests/output/nexus_tags.txt @@ -179,7 +179,6 @@ networking_allow_list_view GET /v1/system/networking/allow-li networking_bfd_disable POST /v1/system/networking/bfd-disable networking_bfd_enable POST /v1/system/networking/bfd-enable networking_bfd_status GET /v1/system/networking/bfd-status -networking_bgp_announce_set_create POST /v1/system/networking/bgp-announce networking_bgp_announce_set_delete DELETE /v1/system/networking/bgp-announce networking_bgp_announce_set_list GET /v1/system/networking/bgp-announce networking_bgp_announce_set_update PUT /v1/system/networking/bgp-announce diff --git a/openapi/nexus.json b/openapi/nexus.json index 6c150bbb11..1453da461d 100644 --- a/openapi/nexus.json +++ b/openapi/nexus.json @@ -6634,7 +6634,8 @@ "tags": [ "system/networking" ], - "summary": "Update a BGP announce set", + "summary": "Update a BGP announce set. If the announce set exists this endpoint replaces", + "description": "the existing announce set with the one specified.", "operationId": "networking_bgp_announce_set_update", "requestBody": { "content": { @@ -6665,41 +6666,6 @@ } } }, - "post": { - "tags": [ - "system/networking" - ], - "summary": "Create new BGP announce set", - "operationId": "networking_bgp_announce_set_create", - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/BgpAnnounceSetCreate" - } - } - }, - "required": true - }, - "responses": { - "201": { - "description": "successful creation", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/BgpAnnounceSet" - } - } - } - }, - "4XX": { - "$ref": "#/components/responses/Error" - }, - "5XX": { - "$ref": "#/components/responses/Error" - } - } - }, "delete": { "tags": [ "system/networking" diff --git a/package-manifest.toml b/package-manifest.toml index 1c39dcb151..dc56d54714 100644 --- a/package-manifest.toml +++ b/package-manifest.toml @@ -563,10 +563,10 @@ source.repo = "maghemite" # `tools/maghemite_openapi_version`. Failing to do so will cause a failure when # building `ddm-admin-client` (which will instruct you to update # `tools/maghemite_openapi_version`). -source.commit = "6e0a232fd0b443c19f61f94bf02b7695505aa8e3" +source.commit = "8c5806d0bb3ac38efec716e22fe7cdcd424de09c" # The SHA256 digest is automatically posted to: # https://buildomat.eng.oxide.computer/public/file/oxidecomputer/maghemite/image//mg-ddm-gz.sha256.txt -source.sha256 = "01b63e4b2b9537b223a417b9283cefb998ae8a3180108b7fbd7710adcf49bbf0" +source.sha256 = "280bd6e5c30d8f1076bac9b8dbbdbc45379e76259aa6319da257192fcbf64a54" output.type = "tarball" [package.mg-ddm] @@ -579,10 +579,10 @@ source.repo = "maghemite" # `tools/maghemite_openapi_version`. Failing to do so will cause a failure when # building `ddm-admin-client` (which will instruct you to update # `tools/maghemite_openapi_version`). -source.commit = "6e0a232fd0b443c19f61f94bf02b7695505aa8e3" +source.commit = "8c5806d0bb3ac38efec716e22fe7cdcd424de09c" # The SHA256 digest is automatically posted to: # https://buildomat.eng.oxide.computer/public/file/oxidecomputer/maghemite/image//mg-ddm.sha256.txt -source.sha256 = "29ac6f5f61795795a2b1026606ac43d48435f1d685d2db2ab097aaaa9c5d6e6c" +source.sha256 = "f15f8bb0e13b1a9372c895775dae96b68ff1cc5e395e6bad4389c2a97957354e" output.type = "zone" output.intermediate_only = true @@ -594,10 +594,10 @@ source.repo = "maghemite" # `tools/maghemite_openapi_version`. Failing to do so will cause a failure when # building `ddm-admin-client` (which will instruct you to update # `tools/maghemite_openapi_version`). -source.commit = "6e0a232fd0b443c19f61f94bf02b7695505aa8e3" +source.commit = "8c5806d0bb3ac38efec716e22fe7cdcd424de09c" # The SHA256 digest is automatically posted to: # https://buildomat.eng.oxide.computer/public/file/oxidecomputer/maghemite/image//mgd.sha256.txt -source.sha256 = "49f5224ea5f5078c11d71098fea29db9aafe9575876825f4e0216d9c64361f55" +source.sha256 = "b0223e0aad4c22bf980da17084caf6704d0428bad1b3e5daf54e7d415ce82d3e" output.type = "zone" output.intermediate_only = true diff --git a/tools/maghemite_ddm_openapi_version b/tools/maghemite_ddm_openapi_version index 001b707f25..39e8ef5e1e 100644 --- a/tools/maghemite_ddm_openapi_version +++ b/tools/maghemite_ddm_openapi_version @@ -1,2 +1,2 @@ -COMMIT="6e0a232fd0b443c19f61f94bf02b7695505aa8e3" +COMMIT="8c5806d0bb3ac38efec716e22fe7cdcd424de09c" SHA2="007bfb717ccbc077c0250dee3121aeb0c5bb0d1c16795429a514fa4f8635a5ef" diff --git a/tools/maghemite_mg_openapi_version b/tools/maghemite_mg_openapi_version index 61901b1562..3232cf6473 100644 --- a/tools/maghemite_mg_openapi_version +++ b/tools/maghemite_mg_openapi_version @@ -1,2 +1,2 @@ -COMMIT="6e0a232fd0b443c19f61f94bf02b7695505aa8e3" +COMMIT="8c5806d0bb3ac38efec716e22fe7cdcd424de09c" SHA2="e4b42ab9daad90f0c561a830b62a9d17e294b4d0da0a6d44b4030929b0c37b7e" diff --git a/tools/maghemite_mgd_checksums b/tools/maghemite_mgd_checksums index 7c62e15a73..2e7d8a863c 100644 --- a/tools/maghemite_mgd_checksums +++ b/tools/maghemite_mgd_checksums @@ -1,2 +1,2 @@ -CIDL_SHA256="49f5224ea5f5078c11d71098fea29db9aafe9575876825f4e0216d9c64361f55" -MGD_LINUX_SHA256="48aa39bb2d68a81be5ad49986d9ebd3cbad64eee0bd6b4556c91b089760265ec" +CIDL_SHA256="b0223e0aad4c22bf980da17084caf6704d0428bad1b3e5daf54e7d415ce82d3e" +MGD_LINUX_SHA256="776f18e9e7fc905d5a2f33d1a1bdd8863ed988bb2965a222217ec06790a3f452" \ No newline at end of file diff --git a/tools/update_maghemite.sh b/tools/update_maghemite.sh index b2b31ca58a..77f5d80a0c 100755 --- a/tools/update_maghemite.sh +++ b/tools/update_maghemite.sh @@ -23,6 +23,45 @@ PACKAGES=( REPO="oxidecomputer/maghemite" . "$SOURCE_DIR/update_helpers.sh" +function update_openapi { + TARGET_COMMIT="$1" + DRY_RUN="$2" + DAEMON="$3" + SHA=$(get_sha "$REPO" "$TARGET_COMMIT" "${DAEMON}-admin.json" "openapi") + OUTPUT=$(printf "COMMIT=\"%s\"\nSHA2=\"%s\"\n" "$TARGET_COMMIT" "$SHA") + + if [ -n "$DRY_RUN" ]; then + OPENAPI_PATH="/dev/null" + else + OPENAPI_PATH="$SOURCE_DIR/maghemite_${DAEMON}_openapi_version" + fi + echo "Updating Maghemite OpenAPI from: $TARGET_COMMIT" + set -x + echo "$OUTPUT" > "$OPENAPI_PATH" + set +x +} + +function update_mgd { + TARGET_COMMIT="$1" + DRY_RUN="$2" + DAEMON="$3" + SHA=$(get_sha "$REPO" "$TARGET_COMMIT" "mgd" "image") + OUTPUT=$(printf "CIDL_SHA256=\"%s\"\n" "$SHA") + + SHA_LINUX=$(get_sha "$REPO" "$TARGET_COMMIT" "mgd" "linux") + OUTPUT_LINUX=$(printf "MGD_LINUX_SHA256=\"%s\"\n" "$SHA_LINUX") + + if [ -n "$DRY_RUN" ]; then + MGD_PATH="/dev/null" + else + MGD_PATH="$SOURCE_DIR/maghemite_mgd_checksums" + fi + echo "Updating Maghemite mgd from: $TARGET_COMMIT" + set -x + printf "$OUTPUT\n$OUTPUT_LINUX" > $MGD_PATH + set +x +} + function main { TARGET_COMMIT="" DRY_RUN="" @@ -47,6 +86,9 @@ function main { TARGET_COMMIT=$(get_latest_commit_from_gh "$REPO" "$TARGET_BRANCH") fi install_toml2json + update_mgd "$TARGET_COMMIT" "$DRY_RUN" + update_openapi "$TARGET_COMMIT" "$DRY_RUN" ddm + update_openapi "$TARGET_COMMIT" "$DRY_RUN" mg do_update_packages "$TARGET_COMMIT" "$DRY_RUN" "$REPO" "${PACKAGES[@]}" }