Added AAS Registry Middleware#17
Merged
Merged
Conversation
hofermo
approved these changes
Jun 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
MR Overview: AAS Registry Middleware
Summary
This MR adds
AasRegistryServiceMiddlewareso repository writes to/repoare mirrored to the AAS Registry. When anAssetAdministrationShellis created, updated, or deleted through the repository, the middleware creates, updates, or removes the corresponding shell descriptor in the registry without blocking the proxied repository request.Files Added
mnestix-proxy/Configuration/RegistryServiceOptions.csConfiguration binding class for the AAS Registry cluster address. Reads from
ReverseProxy:Clusters:aasRegistryCluster:Destinations:destination1.mnestix-proxy/Services/Clients/IRegistryClient.csInterface for the registry client exposing:
RegisterOrUpdateShellDescriptor(aasId, shellDescriptorJson)DeleteShellDescriptor(aasIdentifier)mnestix-proxy/Services/Clients/RegistryClient.csRestSharp-based implementation of the AAS Registry Part 2 calls:
POST /shell-descriptorswith the full descriptor JSON. On409 Conflict, falls back toPUT /shell-descriptors/{base64Id}.DELETE /shell-descriptors/{base64Id}mnestix-proxy/Middleware/AasRegistryServiceMiddleware.csMiddleware registered in the YARP pipeline when
Features:AasRegistryMiddlewareis enabled./repo: reads and rewinds the request body before the proxy continues, checks formodelType == "AssetAdministrationShell", converts the repository body into a registryAssetAdministrationShellDescriptor, and fires a non-blocking registry call./repo/shells/{base64AasId}: extracts the shell id from the URL and fires a non-blocking delete against the registry.mnestix-proxy.Tests/TestMockService/RegistryMockService.csIn-process Kestrel mock used by integration tests. Records all received requests and supports overriding the response status code via
ForcedStatusCodeto simulate registry failures.mnestix-proxy.Tests/MiddlewareTests/AasRegistryServiceMiddlewareTests.cs12 integration tests covering both invocation and payload behavior:
Should_Call_Registry_When_POST_To_Repo_With_AAS_BodyShould_Call_Registry_When_PUT_To_Repo_With_AAS_BodyShould_Call_Registry_When_DELETE_To_RepoShould_Not_Call_Registry_When_POST_To_Repo_With_Non_AAS_BodyShould_Not_Call_Registry_When_Feature_Flag_Is_DisabledShould_POST_Full_Descriptor_With_All_Fields_Mapped_CorrectlyShould_POST_Descriptor_With_Only_Required_Fields_When_AAS_Body_Is_MinimalShould_Not_Call_Registry_When_AAS_Body_Is_Missing_IdShould_Not_Call_Registry_When_AAS_Body_Is_Missing_AssetInformationassetInformationskips registry registrationShould_Not_Call_Registry_When_AAS_Body_Is_Missing_GlobalAssetIdglobalAssetIdskips registry registrationShould_Not_Call_Registry_When_Body_Is_Not_Valid_JsonProxy_Should_Return_Success_When_Registry_Returns_Server_ErrorTests use polling to account for the fire-and-forget side calls and now assert both payload content and resilience behavior.
Files Modified
mnestix-proxy/Program.csIRegistryClient/RegistryClientRegistryServiceOptionsAasRegistryServiceMiddlewareto the YARP pipeline behindFeatures:AasRegistryMiddlewaremnestix-proxy/appsettings.json"AasRegistryMiddleware": "true"underFeaturesmnestix-proxy.Tests/IntegrationTestBase.csaasRegistryClusterdestination used by registry middleware testsDescriptor Mapping
BuildShellDescriptorconverts the repositoryAssetAdministrationShellpayload into an AAS Registry shell descriptor:id->idassetInformation.globalAssetId->globalAssetIdidShort,description,displayName,administration-> copied through when presentassetInformation.assetKind,assetType,specificAssetIds-> flattened to descriptor top-levelmodelType-> intentionally omittedassetInformation-> not copied as a nested objectendpoints-> generated to point back to this proxy at/repo/shells/{base64AasId}Design Notes
/repo/shells/{base64AasId}instead of a request body.