From cfb550e9dff7b65a2536563097a0138855f7f555 Mon Sep 17 00:00:00 2001 From: Marc Schier Date: Wed, 31 Jul 2024 11:31:57 +0200 Subject: [PATCH] Allow specifying a publisher for discovery (#2309) Fixes #2302 - support specifying a publisher to use for discovery via query string. --- docs/web-api/api.md | 8 +++ docs/web-api/definitions.md | 1 + docs/web-api/openapi.json | 52 +++++++++++++++++++ .../src/Controllers/DiscoveryController.cs | 16 +++--- .../cli/Program.cs | 12 +++-- .../src/Clients/RegistryServiceClient.cs | 43 ++++++++++----- .../src/IRegistryServiceApi.cs | 12 +++-- .../src/Controllers/ApplicationsController.cs | 31 +++++++---- .../src/Controllers/EndpointsController.cs | 12 +++-- .../tests/Clients/RegistryWebApiAdapter.cs | 46 +++++++++------- .../TestData/Binary/BrwoseTests.cs | 2 +- .../TestData/Binary/ReadArrayTests.cs | 2 +- .../TestData/Binary/ReadScalarTests.cs | 2 +- .../Controllers/TestData/Json/BrowseTestEx.cs | 2 +- .../TestData/Json/ReadArrayTests.cs | 2 +- .../TestData/Json/ReadScalarTests.cs | 2 +- .../tests/Extensions/EndpointManagerEx.cs | 7 +-- .../Sdk/Alarms/Json/NodeServicesTests.cs | 2 +- .../Sdk/Alarms/MsgPack/NodeServicesTests.cs | 2 +- .../Json/NodeServicesTests1.cs | 2 +- .../Json/NodeServicesTests2.cs | 2 +- .../MsgPack/NodeServicesTests1.cs | 2 +- .../MsgPack/NodeServicesTests2.cs | 2 +- .../Json/NodeServicesTests.cs | 2 +- .../HistoricalAccess/Json/ReadAtTimesTests.cs | 2 +- .../Json/ReadModifiedTests.cs | 2 +- .../Json/ReadProcessedTests.cs | 2 +- .../HistoricalAccess/Json/ReadValuesTests.cs | 2 +- .../Json/UpdateValuesTests.cs | 2 +- .../MsgPack/NodeServicesTests.cs | 2 +- .../MsgPack/ReadAtTimesTests.cs | 2 +- .../MsgPack/ReadModifiedTests.cs | 2 +- .../MsgPack/ReadProcessedTests.cs | 2 +- .../MsgPack/ReadValuesTests.cs | 2 +- .../MsgPack/UpdateValuesTests.cs | 2 +- .../Json/NodeServicesTests.cs | 2 +- .../MsgPack/NodeServicesTests.cs | 2 +- .../tests/Sdk/Plc/Json/NodeServicesTests1.cs | 2 +- .../tests/Sdk/Plc/Json/NodeServicesTests2.cs | 2 +- .../Sdk/Plc/MsgPack/NodeServicesTests1.cs | 2 +- .../Sdk/Plc/MsgPack/NodeServicesTests2.cs | 2 +- .../Sdk/TestData/Json/BrowsePathTests.cs | 2 +- .../Sdk/TestData/Json/BrowseStreamTests.cs | 2 +- .../tests/Sdk/TestData/Json/BrowseTest.cs | 2 +- .../tests/Sdk/TestData/Json/CallArrayTests.cs | 2 +- .../Sdk/TestData/Json/CallScalarTests.cs | 2 +- .../Sdk/TestData/Json/MetadataArrayTests.cs | 2 +- .../Sdk/TestData/Json/MetadataScalarTests.cs | 2 +- .../tests/Sdk/TestData/Json/MetadataTests.cs | 2 +- .../tests/Sdk/TestData/Json/ReadArrayTests.cs | 2 +- .../Sdk/TestData/Json/ReadScalarTests.cs | 2 +- .../Sdk/TestData/Json/WriteArrayTests.cs | 2 +- .../Sdk/TestData/Json/WriteScalarTests.cs | 2 +- .../Sdk/TestData/MsgPack/BrowsePathTests.cs | 2 +- .../Sdk/TestData/MsgPack/BrowseStreamTests.cs | 2 +- .../tests/Sdk/TestData/MsgPack/BrowseTest.cs | 2 +- .../Sdk/TestData/MsgPack/CallArrayTests.cs | 2 +- .../Sdk/TestData/MsgPack/CallScalarTests.cs | 2 +- .../TestData/MsgPack/MetadataArrayTests.cs | 2 +- .../TestData/MsgPack/MetadataScalarTests.cs | 2 +- .../Sdk/TestData/MsgPack/MetadataTests.cs | 2 +- .../Sdk/TestData/MsgPack/ReadArrayTests.cs | 2 +- .../Sdk/TestData/MsgPack/ReadScalarTests.cs | 2 +- .../Sdk/TestData/MsgPack/WriteArrayTests.cs | 2 +- .../Sdk/TestData/MsgPack/WriteScalarTests.cs | 2 +- .../Clients/Adapters/DiscoveryApiAdapter.cs | 11 ++-- .../src/Clients/DiscoveryServicesClient.cs | 52 +++++++++++-------- .../src/IEndpointManager.cs | 6 ++- .../src/Services/EndpointManager.cs | 10 ++-- .../src/Discovery/NetworkDiscovery.cs | 13 +++-- .../src/Discovery/ServerDiscovery.cs | 4 +- .../src/Publisher/INetworkDiscovery.cs | 12 +++-- .../src/Publisher/IServerDiscovery.cs | 7 ++- 73 files changed, 301 insertions(+), 162 deletions(-) diff --git a/docs/web-api/api.md b/docs/web-api/api.md index 3cf7295fce..2480236cb1 100644 --- a/docs/web-api/api.md +++ b/docs/web-api/api.md @@ -22,6 +22,7 @@ Registers a server solely using a discovery url. Requires that the onboarding ag |Type|Name|Description|Schema| |---|---|---|---| +|**Query**|**discovererId**
*optional*|Scope the registration to a specific OPC Publisher using the publisher id|string| |**Body**|**body**
*required*|Server registration request|[ServerRegistrationRequestModel](definitions.md#serverregistrationrequestmodel)| @@ -31,6 +32,7 @@ Registers a server solely using a discovery url. Requires that the onboarding ag |---|---|---| |**200**|The operation was successful.|No Content| |**400**|The passed in information is invalid|[ProblemDetails](definitions.md#problemdetails)| +|**404**|The publisher specified was not found.|[ProblemDetails](definitions.md#problemdetails)| |**500**|An internal error ocurred.|[ProblemDetails](definitions.md#problemdetails)| @@ -167,6 +169,7 @@ Registers servers by running a discovery scan in a supervisor's network. Require |Type|Name|Description|Schema| |---|---|---|---| +|**Query**|**discovererId**
*optional*|Scope the discovery to a specific OPC Publisher using the publisher id|string| |**Body**|**body**
*required*|Discovery request|[DiscoveryRequestModel](definitions.md#discoveryrequestmodel)| @@ -176,6 +179,7 @@ Registers servers by running a discovery scan in a supervisor's network. Require |---|---|---| |**200**|The operation was successful.|No Content| |**400**|The passed in information is invalid|[ProblemDetails](definitions.md#problemdetails)| +|**404**|The publisher specified was not found.|[ProblemDetails](definitions.md#problemdetails)| |**500**|An internal error ocurred.|[ProblemDetails](definitions.md#problemdetails)| @@ -207,6 +211,7 @@ Cancels a discovery request using the request identifier. |Type|Name|Description|Schema| |---|---|---|---| |**Path**|**requestId**
*required*|Discovery request|string| +|**Query**|**discovererId**
*optional*|Scope the cancellation to a specific OPC Publisher using the publisher id|string| ##### Responses @@ -215,6 +220,7 @@ Cancels a discovery request using the request identifier. |---|---|---| |**200**|The operation was successful.|No Content| |**400**|The passed in information is invalid|[ProblemDetails](definitions.md#problemdetails)| +|**404**|The publisher specified was not found.|[ProblemDetails](definitions.md#problemdetails)| |**500**|An internal error ocurred.|[ProblemDetails](definitions.md#problemdetails)| @@ -749,6 +755,7 @@ Adds an endpoint. This will onboard the endpoint and the associated application |Type|Name|Description|Schema| |---|---|---|---| +|**Query**|**discovererId**
*optional*|Scope the registration to a specific OPC Publisher using the publisher id|string| |**Body**|**body**
*optional*|Query for the endpoint to register. This must have at least the discovery url. If more information is specified it is used to validate that the application has such endpoint and if not the call will fail.|[ServerEndpointQueryModel](definitions.md#serverendpointquerymodel)| @@ -758,6 +765,7 @@ Adds an endpoint. This will onboard the endpoint and the associated application |---|---|---| |**200**|The operation was successful.|string| |**400**|The passed in information is invalid|[ProblemDetails](definitions.md#problemdetails)| +|**404**|The publisher specified was not found.|[ProblemDetails](definitions.md#problemdetails)| |**500**|An internal error ocurred.|[ProblemDetails](definitions.md#problemdetails)| diff --git a/docs/web-api/definitions.md b/docs/web-api/definitions.md index 4998bdb87a..2b8b8bd4f7 100644 --- a/docs/web-api/definitions.md +++ b/docs/web-api/definitions.md @@ -1504,6 +1504,7 @@ Contains the nodes which should be published |**DataSetWriterId**
*optional*|Name of the data set writer.|string| |**DataSetWriterWatchdogBehavior**
*optional*||[SubscriptionWatchdogBehavior](definitions.md#subscriptionwatchdogbehavior)| |**DisableSubscriptionTransfer**
*optional*|Disable subscription transfer on reconnect|boolean| +|**DumpConnectionDiagnostics**
*optional*|Dump server diagnostics for the connection to enable
advanced troubleshooting scenarios.|boolean| |**EncryptedAuthPassword**
*optional*|encrypted password|string| |**EncryptedAuthUsername**
*optional*|encrypted username|string| |**EndpointSecurityMode**
*optional*||[SecurityMode](definitions.md#securitymode)| diff --git a/docs/web-api/openapi.json b/docs/web-api/openapi.json index a2a1239226..7dd9d03d83 100644 --- a/docs/web-api/openapi.json +++ b/docs/web-api/openapi.json @@ -35,6 +35,12 @@ "application/x-msgpack" ], "parameters": [ + { + "in": "query", + "name": "discovererId", + "description": "Scope the registration to a specific OPC Publisher using the publisher id", + "type": "string" + }, { "in": "body", "name": "body", @@ -55,6 +61,12 @@ "$ref": "#/definitions/ProblemDetails" } }, + "404": { + "description": "The publisher specified was not found.", + "schema": { + "$ref": "#/definitions/ProblemDetails" + } + }, "500": { "description": "An internal error ocurred.", "schema": { @@ -296,6 +308,12 @@ "application/x-msgpack" ], "parameters": [ + { + "in": "query", + "name": "discovererId", + "description": "Scope the discovery to a specific OPC Publisher using the publisher id", + "type": "string" + }, { "in": "body", "name": "body", @@ -316,6 +334,12 @@ "$ref": "#/definitions/ProblemDetails" } }, + "404": { + "description": "The publisher specified was not found.", + "schema": { + "$ref": "#/definitions/ProblemDetails" + } + }, "500": { "description": "An internal error ocurred.", "schema": { @@ -344,6 +368,12 @@ "description": "Discovery request", "required": true, "type": "string" + }, + { + "in": "query", + "name": "discovererId", + "description": "Scope the cancellation to a specific OPC Publisher using the publisher id", + "type": "string" } ], "responses": { @@ -356,6 +386,12 @@ "$ref": "#/definitions/ProblemDetails" } }, + "404": { + "description": "The publisher specified was not found.", + "schema": { + "$ref": "#/definitions/ProblemDetails" + } + }, "500": { "description": "An internal error ocurred.", "schema": { @@ -947,6 +983,12 @@ "application/x-msgpack" ], "parameters": [ + { + "in": "query", + "name": "discovererId", + "description": "Scope the registration to a specific OPC Publisher using the publisher id", + "type": "string" + }, { "in": "body", "name": "body", @@ -969,6 +1011,12 @@ "$ref": "#/definitions/ProblemDetails" } }, + "404": { + "description": "The publisher specified was not found.", + "schema": { + "$ref": "#/definitions/ProblemDetails" + } + }, "500": { "description": "An internal error ocurred.", "schema": { @@ -8261,6 +8309,10 @@ "description": "Message retention setting for messages sent by\r\nthe writer if the transport supports it.", "type": "boolean" }, + "DumpConnectionDiagnostics": { + "description": "Dump server diagnostics for the connection to enable\r\nadvanced troubleshooting scenarios.", + "type": "boolean" + }, "NodeId": { "$ref": "#/definitions/NodeIdModel" } diff --git a/src/Azure.IIoT.OpcUa.Publisher.Module/src/Controllers/DiscoveryController.cs b/src/Azure.IIoT.OpcUa.Publisher.Module/src/Controllers/DiscoveryController.cs index 321779ae25..3a2bb9d4dd 100644 --- a/src/Azure.IIoT.OpcUa.Publisher.Module/src/Controllers/DiscoveryController.cs +++ b/src/Azure.IIoT.OpcUa.Publisher.Module/src/Controllers/DiscoveryController.cs @@ -46,8 +46,8 @@ public class DiscoveryController : ControllerBase, IMethodController /// /// /// - public DiscoveryController(INetworkDiscovery discover, - IServerDiscovery servers) + public DiscoveryController(INetworkDiscovery discover, + IServerDiscovery servers) { _discover = discover ?? throw new ArgumentNullException(nameof(discover)); _servers = servers ?? throw new ArgumentNullException(nameof(servers)); @@ -83,7 +83,7 @@ public async Task FindServerAsync( [FromBody][Required] ServerEndpointQueryModel endpoint, CancellationToken ct = default) { ArgumentNullException.ThrowIfNull(endpoint); - return await _servers.FindServerAsync(endpoint, ct).ConfigureAwait(false); + return await _servers.FindServerAsync(endpoint, ct: ct).ConfigureAwait(false); } /// @@ -115,7 +115,7 @@ public async Task RegisterAsync( CancellationToken ct = default) { ArgumentNullException.ThrowIfNull(request); - await _discover.RegisterAsync(request, ct).ConfigureAwait(false); + await _discover.RegisterAsync(request, ct: ct).ConfigureAwait(false); return true; } @@ -149,7 +149,7 @@ public async Task DiscoverAsync( CancellationToken ct = default) { ArgumentNullException.ThrowIfNull(request); - await _discover.DiscoverAsync(request, ct).ConfigureAwait(false); + await _discover.DiscoverAsync(request, ct: ct).ConfigureAwait(false); return true; } @@ -182,11 +182,11 @@ public async Task CancelAsync( CancellationToken ct = default) { ArgumentNullException.ThrowIfNull(request); - await _discover.CancelAsync(request, ct).ConfigureAwait(false); + await _discover.CancelAsync(request, ct: ct).ConfigureAwait(false); return true; } - private readonly INetworkDiscovery _discover; - private readonly IServerDiscovery _servers; + private readonly INetworkDiscovery _discover; + private readonly IServerDiscovery _servers; } } diff --git a/src/Azure.IIoT.OpcUa.Publisher.Service.Sdk/cli/Program.cs b/src/Azure.IIoT.OpcUa.Publisher.Service.Sdk/cli/Program.cs index 5e9dab9b0e..5c179d2458 100644 --- a/src/Azure.IIoT.OpcUa.Publisher.Service.Sdk/cli/Program.cs +++ b/src/Azure.IIoT.OpcUa.Publisher.Service.Sdk/cli/Program.cs @@ -1663,7 +1663,7 @@ await _client.Registry.DiscoverAsync( Discovery = options.GetValueOrDefault(DiscoveryMode.Fast, "-d", "--discovery"), Configuration = BuildDiscoveryConfig(options) - }).ConfigureAwait(false); + }, options.GetValueOrNull("-D", "--discovererId")).ConfigureAwait(false); } /// @@ -1676,7 +1676,7 @@ await _client.Registry.CancelAsync( new DiscoveryCancelRequestModel { Id = options.GetValueOrThrow("-i", "--id") - }).ConfigureAwait(false); + }, options.GetValueOrNull("-D", "--discovererId")).ConfigureAwait(false); } /// @@ -2065,7 +2065,7 @@ private async Task RegisterEndpointAsync(CliOptions options) SecurityMode = options.GetValueOrNull("-m", "--mode"), SecurityPolicy = options.GetValueOrNull("-l", "--policy"), Certificate = options.GetValueOrNull("-c", "--certificate") - }).ConfigureAwait(false); + }, options.GetValueOrNull("-D", "--discovererId")).ConfigureAwait(false); PrintResult(options, result); } @@ -2423,6 +2423,8 @@ discover Discover applications and endpoints. with ... -i, --id Request id for the discovery request. -d, --discovery Set discovery mode to use + -D --discovererId + Discover using specified discoverer. -I, --idle-time Idle time between scans in seconds -p, --port-ranges Port ranges to scan. @@ -2441,6 +2443,8 @@ Port probe timeout in milliseconds cancel Cancel application discovery. with ... -i, --id Request id of the discovery request (mandatory). + -D --discovererId + Discovery was started using this discoverer. register Manually register Application with ... @@ -2535,6 +2539,8 @@ with ... -e, --endpoint The endpoint url to match against -c, --certificate The certificate thumbprint to match + -D --discovererId + Onboard using specified discoverer. -m, --mode The security mode to match -l, --policy The security policy to match diff --git a/src/Azure.IIoT.OpcUa.Publisher.Service.Sdk/src/Clients/RegistryServiceClient.cs b/src/Azure.IIoT.OpcUa.Publisher.Service.Sdk/src/Clients/RegistryServiceClient.cs index 8c5f846f21..5640037b89 100644 --- a/src/Azure.IIoT.OpcUa.Publisher.Service.Sdk/src/Clients/RegistryServiceClient.cs +++ b/src/Azure.IIoT.OpcUa.Publisher.Service.Sdk/src/Clients/RegistryServiceClient.cs @@ -229,38 +229,53 @@ public async Task GetSupervisorAsync( /// public async Task RegisterAsync(ServerRegistrationRequestModel request, - CancellationToken ct) + string? discovererId, CancellationToken ct) { ArgumentNullException.ThrowIfNull(request); if (request.DiscoveryUrl == null) { throw new ArgumentException("Discovery Url missing.", nameof(request)); } - var uri = new Uri($"{_serviceUri}/v2/applications"); - await _httpClient.PostAsync(uri, request, _serializer, + var uri = new UriBuilder($"{_serviceUri}/v2/applications"); + if (discovererId != null) + { + uri.Query = "discovererId=" + discovererId; + } + await _httpClient.PostAsync(uri.Uri, request, _serializer, request => request.SetTimeout(TimeSpan.FromMinutes(3)), authorization: _authorization, ct: ct).ConfigureAwait(false); } /// - public async Task DiscoverAsync(DiscoveryRequestModel request, CancellationToken ct) + public async Task DiscoverAsync(DiscoveryRequestModel request, + string? discovererId, CancellationToken ct) { ArgumentNullException.ThrowIfNull(request); - var uri = new Uri($"{_serviceUri}/v2/applications/discover"); - await _httpClient.PostAsync(uri, request, _serializer, + var uri = new UriBuilder($"{_serviceUri}/v2/applications/discover"); + if (discovererId != null) + { + uri.Query = "discovererId=" + discovererId; + } + await _httpClient.PostAsync(uri.Uri, request, _serializer, request => request.SetTimeout(TimeSpan.FromMinutes(3)), authorization: _authorization, ct: ct).ConfigureAwait(false); } /// - public async Task CancelAsync(DiscoveryCancelRequestModel request, CancellationToken ct) + public async Task CancelAsync(DiscoveryCancelRequestModel request, + string? discovererId, CancellationToken ct) { if (request?.Id == null) { throw new ArgumentNullException(nameof(request)); } - var uri = new Uri($"{_serviceUri}/v2/applications/discover/${Uri.EscapeDataString(request.Id)}"); - await _httpClient.DeleteAsync(uri, + var uri = new UriBuilder( + $"{_serviceUri}/v2/applications/discover/${Uri.EscapeDataString(request.Id)}"); + if (discovererId != null) + { + uri.Query = "discovererId=" + discovererId; + } + await _httpClient.DeleteAsync(uri.Uri, authorization: _authorization, ct: ct).ConfigureAwait(false); } @@ -408,10 +423,14 @@ await _httpClient.DeleteAsync(uri, authorization: _authorization, /// public async Task RegisterEndpointAsync(ServerEndpointQueryModel query, - CancellationToken ct) + string? discovererId, CancellationToken ct) { - var uri = new Uri($"{_serviceUri}/v2/endpoints"); - return await _httpClient.PutAsync(uri, query, + var uri = new UriBuilder($"{_serviceUri}/v2/endpoints"); + if (discovererId != null) + { + uri.Query = "discovererId=" + discovererId; + } + return await _httpClient.PutAsync(uri.Uri, query, _serializer, authorization: _authorization, ct: ct).ConfigureAwait(false); } diff --git a/src/Azure.IIoT.OpcUa.Publisher.Service.Sdk/src/IRegistryServiceApi.cs b/src/Azure.IIoT.OpcUa.Publisher.Service.Sdk/src/IRegistryServiceApi.cs index 7784572cb4..ed87ab6457 100644 --- a/src/Azure.IIoT.OpcUa.Publisher.Service.Sdk/src/IRegistryServiceApi.cs +++ b/src/Azure.IIoT.OpcUa.Publisher.Service.Sdk/src/IRegistryServiceApi.cs @@ -27,28 +27,31 @@ public interface IRegistryServiceApi /// Kick off onboarding of new server /// /// + /// /// /// Task RegisterAsync(ServerRegistrationRequestModel request, - CancellationToken ct = default); + string? discovererId = null, CancellationToken ct = default); /// /// Kick off a one time discovery on all supervisors /// /// + /// /// /// Task DiscoverAsync(DiscoveryRequestModel request, - CancellationToken ct = default); + string? discovererId = null, CancellationToken ct = default); /// /// Cancel a discovery request with a particular id /// /// + /// /// /// Task CancelAsync(DiscoveryCancelRequestModel request, - CancellationToken ct = default); + string? discovererId = null, CancellationToken ct = default); /// /// Register new application. @@ -158,10 +161,11 @@ Task PurgeDisabledApplicationsAsync(TimeSpan notSeenSince, /// matches the endpoint query and register it in the registry. /// /// + /// /// /// New Endpoint identifier Task RegisterEndpointAsync(ServerEndpointQueryModel query, - CancellationToken ct = default); + string? discovererId = null, CancellationToken ct = default); /// /// Get endpoint diff --git a/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/src/Controllers/ApplicationsController.cs b/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/src/Controllers/ApplicationsController.cs index 566e57a289..49a5028b1b 100644 --- a/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/src/Controllers/ApplicationsController.cs +++ b/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/src/Controllers/ApplicationsController.cs @@ -39,7 +39,7 @@ public class ApplicationsController : ControllerBase /// /// public ApplicationsController(IApplicationRegistry applications, - INetworkDiscovery onboarding) + INetworkDiscovery onboarding) { _applications = applications; _onboarding = onboarding; @@ -54,24 +54,28 @@ public ApplicationsController(IApplicationRegistry applications, /// located by a supervisor in its network using the discovery url. /// /// Server registration request + /// Scope the registration to a specific + /// OPC Publisher using the publisher id /// /// /// /// is null. /// The operation was successful. /// The passed in information is invalid + /// The publisher specified was not found. /// An internal error ocurred. [ProducesResponseType(StatusCodes.Status200OK)] [ProducesResponseType(typeof(ProblemDetails), StatusCodes.Status400BadRequest)] + [ProducesResponseType(typeof(ProblemDetails), StatusCodes.Status404NotFound)] [ProducesResponseType(typeof(ProblemDetails), StatusCodes.Status500InternalServerError)] [HttpPost] [Authorize(Policy = Policies.CanWrite)] public async Task RegisterServerAsync( [FromBody][Required] ServerRegistrationRequestModel request, - CancellationToken ct) + [FromQuery] string? discovererId, CancellationToken ct) { ArgumentNullException.ThrowIfNull(request); - await _onboarding.RegisterAsync(request, ct).ConfigureAwait(false); + await _onboarding.RegisterAsync(request, discovererId, ct).ConfigureAwait(false); } /// @@ -130,24 +134,27 @@ await _applications.EnableApplicationAsync(applicationId, /// network. Requires that the onboarding agent service is running. /// /// Discovery request + /// Scope the discovery to a specific + /// OPC Publisher using the publisher id /// /// /// /// is null. /// The operation was successful. /// The passed in information is invalid + /// The publisher specified was not found. /// An internal error ocurred. [ProducesResponseType(StatusCodes.Status200OK)] [ProducesResponseType(typeof(ProblemDetails), StatusCodes.Status400BadRequest)] + [ProducesResponseType(typeof(ProblemDetails), StatusCodes.Status404NotFound)] [ProducesResponseType(typeof(ProblemDetails), StatusCodes.Status500InternalServerError)] [HttpPost("discover")] [Authorize(Policy = Policies.CanWrite)] - public async Task DiscoverServerAsync( - [FromBody][Required] DiscoveryRequestModel request, - CancellationToken ct) + public async Task DiscoverServerAsync([FromBody][Required] DiscoveryRequestModel request, + [FromQuery] string? discovererId, CancellationToken ct) { ArgumentNullException.ThrowIfNull(request); - await _onboarding.DiscoverAsync(request, ct).ConfigureAwait(false); + await _onboarding.DiscoverAsync(request, discovererId, ct).ConfigureAwait(false); } /// @@ -157,18 +164,22 @@ public async Task DiscoverServerAsync( /// Cancels a discovery request using the request identifier. /// /// Discovery request + /// Scope the cancellation to a specific + /// OPC Publisher using the publisher id /// /// /// /// The operation was successful. /// The passed in information is invalid + /// The publisher specified was not found. /// An internal error ocurred. [ProducesResponseType(StatusCodes.Status200OK)] [ProducesResponseType(typeof(ProblemDetails), StatusCodes.Status400BadRequest)] + [ProducesResponseType(typeof(ProblemDetails), StatusCodes.Status404NotFound)] [ProducesResponseType(typeof(ProblemDetails), StatusCodes.Status500InternalServerError)] [HttpDelete("discover/{requestId}")] [Authorize(Policy = Policies.CanWrite)] - public async Task CancelAsync(string requestId, + public async Task CancelAsync(string requestId, [FromQuery] string? discovererId, CancellationToken ct) { if (string.IsNullOrEmpty(requestId)) @@ -179,7 +190,7 @@ await _onboarding.CancelAsync(new DiscoveryCancelRequestModel { Id = requestId // TODO: AuthorityId = User.Identity.Name; - }, ct).ConfigureAwait(false); + }, discovererId, ct).ConfigureAwait(false); } /// @@ -469,6 +480,6 @@ public async Task GetFilteredListOfApplicationsAsync( } private readonly IApplicationRegistry _applications; - private readonly INetworkDiscovery _onboarding; + private readonly INetworkDiscovery _onboarding; } } diff --git a/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/src/Controllers/EndpointsController.cs b/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/src/Controllers/EndpointsController.cs index 8bd357664e..32be97f9a3 100644 --- a/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/src/Controllers/EndpointsController.cs +++ b/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/src/Controllers/EndpointsController.cs @@ -41,7 +41,7 @@ public class EndpointsController : ControllerBase /// /// public EndpointsController(IEndpointRegistry endpoints, - IEndpointManager manager, IConnectionServices activation, + IEndpointManager manager, IConnectionServices activation, ICertificateServices certificates) { _manager = manager; @@ -63,19 +63,23 @@ public EndpointsController(IEndpointRegistry endpoints, /// have at least the discovery url. If more information is specified it /// is used to validate that the application has such endpoint and if /// not the call will fail. + /// Scope the registration to a specific + /// OPC Publisher using the publisher id /// /// Endpoint identifier /// The operation was successful. /// The passed in information is invalid + /// The publisher specified was not found. /// An internal error ocurred. [ProducesResponseType(StatusCodes.Status200OK)] [ProducesResponseType(typeof(ProblemDetails), StatusCodes.Status400BadRequest)] + [ProducesResponseType(typeof(ProblemDetails), StatusCodes.Status404NotFound)] [ProducesResponseType(typeof(ProblemDetails), StatusCodes.Status500InternalServerError)] [HttpPut] public async Task RegisterEndpointAsync(ServerEndpointQueryModel query, - CancellationToken ct) + [FromQuery] string? discovererId, CancellationToken ct) { - return await _manager.RegisterEndpointAsync(query, ct).ConfigureAwait(false); + return await _manager.RegisterEndpointAsync(query, discovererId, ct).ConfigureAwait(false); } /// @@ -273,8 +277,8 @@ public async Task GetEndpointCertificateAsync( ct).ConfigureAwait(false); } - private readonly IEndpointManager _manager; private readonly IEndpointRegistry _endpoints; + private readonly IEndpointManager _manager; private readonly IConnectionServices _connections; private readonly ICertificateServices _certificates; } diff --git a/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Clients/RegistryWebApiAdapter.cs b/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Clients/RegistryWebApiAdapter.cs index 5e654ee079..fe52771679 100644 --- a/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Clients/RegistryWebApiAdapter.cs +++ b/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Clients/RegistryWebApiAdapter.cs @@ -11,12 +11,13 @@ namespace Azure.IIoT.OpcUa.Publisher.Service.WebApi.Tests.Clients using System; using System.Threading; using System.Threading.Tasks; + using Google.Api; /// /// Registry services adapter to run dependent services outside of cloud. /// public sealed class RegistryWebApiAdapter : IEndpointRegistry, ISupervisorRegistry, - IApplicationRegistry, IPublisherRegistry, INetworkDiscovery, IEndpointManager + IApplicationRegistry, IPublisherRegistry, INetworkDiscovery, IEndpointManager { /// /// Create registry services @@ -29,16 +30,18 @@ public RegistryWebApiAdapter(IRegistryServiceApi client) /// public async Task RegisterEndpointAsync(ServerEndpointQueryModel query, - CancellationToken ct) + string context, CancellationToken ct) { - return await _client.RegisterEndpointAsync(query, ct).ConfigureAwait(false); + return await _client.RegisterEndpointAsync(query, context, + ct).ConfigureAwait(false); } /// - public async Task GetEndpointAsync(string endpointId, bool onlyServerState, - CancellationToken ct) + public async Task GetEndpointAsync(string endpointId, + bool onlyServerState, CancellationToken ct) { - return await _client.GetEndpointAsync(endpointId, onlyServerState, ct).ConfigureAwait(false); + return await _client.GetEndpointAsync(endpointId, onlyServerState, + ct).ConfigureAwait(false); } /// @@ -79,7 +82,8 @@ public async Task QuerySupervisorsAsync( public async Task GetSupervisorAsync(string supervisorId, bool onlyServerState, CancellationToken ct) { - return await _client.GetSupervisorAsync(supervisorId, onlyServerState, ct).ConfigureAwait(false); + return await _client.GetSupervisorAsync(supervisorId, onlyServerState, + ct).ConfigureAwait(false); } /// @@ -110,14 +114,16 @@ public async Task QueryPublishersAsync( public async Task GetPublisherAsync(string publisherId, bool onlyServerState, CancellationToken ct) { - return await _client.GetPublisherAsync(publisherId, onlyServerState, ct).ConfigureAwait(false); + return await _client.GetPublisherAsync(publisherId, onlyServerState, + ct).ConfigureAwait(false); } /// public async Task UpdatePublisherAsync(string publisherId, PublisherUpdateModel request, CancellationToken ct) { - await _client.UpdatePublisherAsync(publisherId, request, ct).ConfigureAwait(false); + await _client.UpdatePublisherAsync(publisherId, request, + ct).ConfigureAwait(false); } /// @@ -146,21 +152,24 @@ public Task UpdateApplicationAsync(string applicationId, public async Task ListSitesAsync( string continuation, int? pageSize, CancellationToken ct) { - return await _client.ListSitesAsync(continuation, pageSize, ct).ConfigureAwait(false); + return await _client.ListSitesAsync(continuation, pageSize, + ct).ConfigureAwait(false); } /// public async Task ListApplicationsAsync( string continuation, int? pageSize, CancellationToken ct) { - return await _client.ListApplicationsAsync(continuation, pageSize, ct).ConfigureAwait(false); + return await _client.ListApplicationsAsync(continuation, pageSize, + ct).ConfigureAwait(false); } /// public async Task QueryApplicationsAsync( ApplicationRegistrationQueryModel query, int? pageSize, CancellationToken ct) { - return await _client.QueryApplicationsAsync(query, pageSize, ct).ConfigureAwait(false); + return await _client.QueryApplicationsAsync(query, pageSize, + ct).ConfigureAwait(false); } /// @@ -193,22 +202,23 @@ public Task PurgeDisabledApplicationsAsync(TimeSpan notSeenFor, /// public Task DiscoverAsync(DiscoveryRequestModel request, - CancellationToken ct) + string context, CancellationToken ct) { - return _client.DiscoverAsync(request, ct); + return _client.DiscoverAsync(request, context, ct); } /// - public Task CancelAsync(DiscoveryCancelRequestModel request, CancellationToken ct) + public Task CancelAsync(DiscoveryCancelRequestModel request, + string context, CancellationToken ct) { - return _client.CancelAsync(request, ct); + return _client.CancelAsync(request, context, ct); } /// public Task RegisterAsync(ServerRegistrationRequestModel request, - CancellationToken ct = default) + string context, CancellationToken ct = default) { - return _client.RegisterAsync(request, ct); + return _client.RegisterAsync(request, context, ct); } private readonly IRegistryServiceApi _client; diff --git a/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Controllers/TestData/Binary/BrwoseTests.cs b/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Controllers/TestData/Binary/BrwoseTests.cs index b9bbf96c32..575af08702 100644 --- a/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Controllers/TestData/Binary/BrwoseTests.cs +++ b/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Controllers/TestData/Binary/BrwoseTests.cs @@ -32,7 +32,7 @@ public void Dispose() private BrowseServicesTests GetTests() { var client = _factory.CreateClient(); // Call to create server - var registry = _factory.Resolve(); + var registry = _factory.Resolve>(); var endpointId = registry.RegisterEndpointAsync(_server.GetConnection().Endpoint).Result; return new BrowseServicesTests(() => // Create an adapter over the api new TwinWebApiAdapter(_client.Resolve()), endpointId); diff --git a/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Controllers/TestData/Binary/ReadArrayTests.cs b/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Controllers/TestData/Binary/ReadArrayTests.cs index 635b1cfdc7..d8e34d7598 100644 --- a/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Controllers/TestData/Binary/ReadArrayTests.cs +++ b/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Controllers/TestData/Binary/ReadArrayTests.cs @@ -33,7 +33,7 @@ public void Dispose() private ReadArrayValueTests GetTests() { var client = _factory.CreateClient(); // Call to create server - var registry = _factory.Resolve(); + var registry = _factory.Resolve>(); var endpointId = registry.RegisterEndpointAsync(_server.GetConnection().Endpoint).Result; return new ReadArrayValueTests(() => // Create an adapter over the api new TwinWebApiAdapter(_client.Resolve()), endpointId, diff --git a/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Controllers/TestData/Binary/ReadScalarTests.cs b/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Controllers/TestData/Binary/ReadScalarTests.cs index 55f2d8cd8f..847a655c1a 100644 --- a/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Controllers/TestData/Binary/ReadScalarTests.cs +++ b/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Controllers/TestData/Binary/ReadScalarTests.cs @@ -33,7 +33,7 @@ public void Dispose() private ReadScalarValueTests GetTests() { var client = _factory.CreateClient(); // Call to create server - var registry = _factory.Resolve(); + var registry = _factory.Resolve>(); var endpointId = registry.RegisterEndpointAsync(_server.GetConnection().Endpoint).Result; return new ReadScalarValueTests(() => // Create an adapter over the api new TwinWebApiAdapter(_client.Resolve()), endpointId, diff --git a/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Controllers/TestData/Json/BrowseTestEx.cs b/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Controllers/TestData/Json/BrowseTestEx.cs index 284f3c5133..dfa0dfcb33 100644 --- a/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Controllers/TestData/Json/BrowseTestEx.cs +++ b/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Controllers/TestData/Json/BrowseTestEx.cs @@ -32,7 +32,7 @@ public void Dispose() private BrowseServicesTests GetTests() { var client = _factory.CreateClient(); // Call to create server - var registry = _factory.Resolve(); + var registry = _factory.Resolve>(); var endpointId = registry.RegisterEndpointAsync(_server.GetConnection().Endpoint).Result; return new BrowseServicesTests(() => // Create an adapter over the api new TwinWebApiAdapter(_client.Resolve()), endpointId); diff --git a/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Controllers/TestData/Json/ReadArrayTests.cs b/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Controllers/TestData/Json/ReadArrayTests.cs index 8c186a30a6..f5b54ffe15 100644 --- a/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Controllers/TestData/Json/ReadArrayTests.cs +++ b/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Controllers/TestData/Json/ReadArrayTests.cs @@ -33,7 +33,7 @@ public void Dispose() private ReadArrayValueTests GetTests() { var client = _factory.CreateClient(); // Call to create server - var registry = _factory.Resolve(); + var registry = _factory.Resolve>(); var endpointId = registry.RegisterEndpointAsync(_server.GetConnection().Endpoint).Result; return new ReadArrayValueTests(() => // Create an adapter over the api new TwinWebApiAdapter(_client.Resolve()), endpointId, diff --git a/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Controllers/TestData/Json/ReadScalarTests.cs b/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Controllers/TestData/Json/ReadScalarTests.cs index 573f7e8936..30991aa286 100644 --- a/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Controllers/TestData/Json/ReadScalarTests.cs +++ b/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Controllers/TestData/Json/ReadScalarTests.cs @@ -33,7 +33,7 @@ public void Dispose() private ReadScalarValueTests GetTests() { var client = _factory.CreateClient(); // Call to create server - var registry = _factory.Resolve(); + var registry = _factory.Resolve>(); var endpointId = registry.RegisterEndpointAsync(_server.GetConnection().Endpoint).Result; return new ReadScalarValueTests(() => // Create an adapter over the api new TwinWebApiAdapter(_client.Resolve()), endpointId, diff --git a/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Extensions/EndpointManagerEx.cs b/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Extensions/EndpointManagerEx.cs index ffe07660cf..c74da6ad50 100644 --- a/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Extensions/EndpointManagerEx.cs +++ b/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Extensions/EndpointManagerEx.cs @@ -17,12 +17,13 @@ internal static class EndpointManagerEx /// /// Register endpoint /// + /// /// /// /// /// - public static Task RegisterEndpointAsync(this IEndpointManager manager, - EndpointModel endpoint, CancellationToken ct = default) + public static Task RegisterEndpointAsync(this IEndpointManager manager, + EndpointModel endpoint, T context = null, CancellationToken ct = default) where T : class { return manager.RegisterEndpointAsync(new ServerEndpointQueryModel { @@ -30,7 +31,7 @@ public static Task RegisterEndpointAsync(this IEndpointManager manager, SecurityPolicy = endpoint.SecurityPolicy, SecurityMode = endpoint.SecurityMode, Certificate = endpoint.Certificate - }, ct); + }, context, ct); } } } diff --git a/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/Alarms/Json/NodeServicesTests.cs b/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/Alarms/Json/NodeServicesTests.cs index 585cffb473..69038b176c 100644 --- a/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/Alarms/Json/NodeServicesTests.cs +++ b/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/Alarms/Json/NodeServicesTests.cs @@ -32,7 +32,7 @@ public void Dispose() private AlarmServerTests GetTests() { var client = _factory.CreateClient(); // Call to create server - var registry = _factory.Resolve(); + var registry = _factory.Resolve>(); var endpointId = registry.RegisterEndpointAsync(_server.GetConnection().Endpoint).Result; return new AlarmServerTests(() => // Create an adapter over the api new TwinWebApiAdapter(_client.Resolve()), endpointId); diff --git a/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/Alarms/MsgPack/NodeServicesTests.cs b/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/Alarms/MsgPack/NodeServicesTests.cs index d717855aca..a99d6cdb62 100644 --- a/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/Alarms/MsgPack/NodeServicesTests.cs +++ b/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/Alarms/MsgPack/NodeServicesTests.cs @@ -32,7 +32,7 @@ public void Dispose() private AlarmServerTests GetTests() { var client = _factory.CreateClient(); // Call to create server - var registry = _factory.Resolve(); + var registry = _factory.Resolve>(); var endpointId = registry.RegisterEndpointAsync(_server.GetConnection().Endpoint).Result; return new AlarmServerTests(() => // Create an adapter over the api new TwinWebApiAdapter(_client.Resolve()), endpointId); diff --git a/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/DeterministicAlarms/Json/NodeServicesTests1.cs b/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/DeterministicAlarms/Json/NodeServicesTests1.cs index c63f593a9c..124a98d076 100644 --- a/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/DeterministicAlarms/Json/NodeServicesTests1.cs +++ b/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/DeterministicAlarms/Json/NodeServicesTests1.cs @@ -34,7 +34,7 @@ public void Dispose() private DeterministicAlarmsTests1 GetTests() { var client = _factory.CreateClient(); // Call to create server - var registry = _factory.Resolve(); + var registry = _factory.Resolve>(); var endpointId = registry.RegisterEndpointAsync(_server.GetConnection().Endpoint).Result; return new DeterministicAlarmsTests1(() => // Create an adapter over the api new TwinWebApiAdapter(_client.Resolve()), endpointId); diff --git a/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/DeterministicAlarms/Json/NodeServicesTests2.cs b/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/DeterministicAlarms/Json/NodeServicesTests2.cs index bf696d28b8..cb6b7b1253 100644 --- a/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/DeterministicAlarms/Json/NodeServicesTests2.cs +++ b/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/DeterministicAlarms/Json/NodeServicesTests2.cs @@ -33,7 +33,7 @@ public void Dispose() private DeterministicAlarmsTests2 GetTests() { var client = _factory.CreateClient(); // Call to create server - var registry = _factory.Resolve(); + var registry = _factory.Resolve>(); var endpointId = registry.RegisterEndpointAsync(_server.GetConnection().Endpoint).Result; return new DeterministicAlarmsTests2(() => // Create an adapter over the api new TwinWebApiAdapter(_client.Resolve()), endpointId); diff --git a/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/DeterministicAlarms/MsgPack/NodeServicesTests1.cs b/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/DeterministicAlarms/MsgPack/NodeServicesTests1.cs index 0c72d8ad6c..16bafdf595 100644 --- a/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/DeterministicAlarms/MsgPack/NodeServicesTests1.cs +++ b/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/DeterministicAlarms/MsgPack/NodeServicesTests1.cs @@ -34,7 +34,7 @@ public void Dispose() private DeterministicAlarmsTests1 GetTests() { var client = _factory.CreateClient(); // Call to create server - var registry = _factory.Resolve(); + var registry = _factory.Resolve>(); var endpointId = registry.RegisterEndpointAsync(_server.GetConnection().Endpoint).Result; return new DeterministicAlarmsTests1(() => // Create an adapter over the api new TwinWebApiAdapter(_client.Resolve()), endpointId); diff --git a/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/DeterministicAlarms/MsgPack/NodeServicesTests2.cs b/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/DeterministicAlarms/MsgPack/NodeServicesTests2.cs index 5b3b132c37..27606b5590 100644 --- a/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/DeterministicAlarms/MsgPack/NodeServicesTests2.cs +++ b/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/DeterministicAlarms/MsgPack/NodeServicesTests2.cs @@ -33,7 +33,7 @@ public void Dispose() private DeterministicAlarmsTests2 GetTests() { var client = _factory.CreateClient(); // Call to create server - var registry = _factory.Resolve(); + var registry = _factory.Resolve>(); var endpointId = registry.RegisterEndpointAsync(_server.GetConnection().Endpoint).Result; return new DeterministicAlarmsTests2(() => // Create an adapter over the api new TwinWebApiAdapter(_client.Resolve()), endpointId); diff --git a/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/HistoricalAccess/Json/NodeServicesTests.cs b/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/HistoricalAccess/Json/NodeServicesTests.cs index 2eec983c86..20d82e67bd 100644 --- a/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/HistoricalAccess/Json/NodeServicesTests.cs +++ b/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/HistoricalAccess/Json/NodeServicesTests.cs @@ -33,7 +33,7 @@ public void Dispose() private NodeHistoricalAccessTests GetTests() { var client = _factory.CreateClient(); // Call to create server - var registry = _factory.Resolve(); + var registry = _factory.Resolve>(); var endpointId = registry.RegisterEndpointAsync(_server.GetConnection().Endpoint).Result; return new NodeHistoricalAccessTests(() => // Create an adapter over the api new TwinWebApiAdapter(_client.Resolve()), endpointId); diff --git a/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/HistoricalAccess/Json/ReadAtTimesTests.cs b/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/HistoricalAccess/Json/ReadAtTimesTests.cs index 1fbb7fb9f8..b022c14abf 100644 --- a/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/HistoricalAccess/Json/ReadAtTimesTests.cs +++ b/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/HistoricalAccess/Json/ReadAtTimesTests.cs @@ -33,7 +33,7 @@ public void Dispose() private HistoryReadValuesAtTimesTests GetTests() { var client = _factory.CreateClient(); // Call to create server - var registry = _factory.Resolve(); + var registry = _factory.Resolve>(); var endpointId = registry.RegisterEndpointAsync(_server.GetConnection().Endpoint).Result; return new HistoryReadValuesAtTimesTests(_server, () => // Create an adapter over the api new HistoryWebApiAdapter(_client.Resolve()), endpointId); diff --git a/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/HistoricalAccess/Json/ReadModifiedTests.cs b/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/HistoricalAccess/Json/ReadModifiedTests.cs index 0a80329ac3..52a38c6b27 100644 --- a/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/HistoricalAccess/Json/ReadModifiedTests.cs +++ b/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/HistoricalAccess/Json/ReadModifiedTests.cs @@ -33,7 +33,7 @@ public void Dispose() private HistoryReadValuesModifiedTests GetTests() { var client = _factory.CreateClient(); // Call to create server - var registry = _factory.Resolve(); + var registry = _factory.Resolve>(); var endpointId = registry.RegisterEndpointAsync(_server.GetConnection().Endpoint).Result; return new HistoryReadValuesModifiedTests(_server, () => // Create an adapter over the api new HistoryWebApiAdapter(_client.Resolve()), endpointId); diff --git a/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/HistoricalAccess/Json/ReadProcessedTests.cs b/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/HistoricalAccess/Json/ReadProcessedTests.cs index 7eddd30749..fd1d7f3b48 100644 --- a/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/HistoricalAccess/Json/ReadProcessedTests.cs +++ b/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/HistoricalAccess/Json/ReadProcessedTests.cs @@ -33,7 +33,7 @@ public void Dispose() private HistoryReadValuesProcessedTests GetTests() { var client = _factory.CreateClient(); // Call to create server - var registry = _factory.Resolve(); + var registry = _factory.Resolve>(); var endpointId = registry.RegisterEndpointAsync(_server.GetConnection().Endpoint).Result; return new HistoryReadValuesProcessedTests(_server, () => // Create an adapter over the api new HistoryWebApiAdapter(_client.Resolve()), endpointId); diff --git a/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/HistoricalAccess/Json/ReadValuesTests.cs b/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/HistoricalAccess/Json/ReadValuesTests.cs index b91652e74a..6d097189a1 100644 --- a/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/HistoricalAccess/Json/ReadValuesTests.cs +++ b/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/HistoricalAccess/Json/ReadValuesTests.cs @@ -33,7 +33,7 @@ public void Dispose() private HistoryReadValuesTests GetTests() { var client = _factory.CreateClient(); // Call to create server - var registry = _factory.Resolve(); + var registry = _factory.Resolve>(); var endpointId = registry.RegisterEndpointAsync(_server.GetConnection().Endpoint).Result; return new HistoryReadValuesTests(_server, () => // Create an adapter over the api new HistoryWebApiAdapter(_client.Resolve()), endpointId); diff --git a/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/HistoricalAccess/Json/UpdateValuesTests.cs b/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/HistoricalAccess/Json/UpdateValuesTests.cs index 053ee53ff3..b99bc1c762 100644 --- a/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/HistoricalAccess/Json/UpdateValuesTests.cs +++ b/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/HistoricalAccess/Json/UpdateValuesTests.cs @@ -33,7 +33,7 @@ public void Dispose() private HistoryUpdateValuesTests GetTests() { var client = _factory.CreateClient(); // Call to create server - var registry = _factory.Resolve(); + var registry = _factory.Resolve>(); var endpointId = registry.RegisterEndpointAsync(_server.GetConnection().Endpoint).Result; return new HistoryUpdateValuesTests(() => // Create an adapter over the api new HistoryWebApiAdapter(_client.Resolve()), endpointId); diff --git a/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/HistoricalAccess/MsgPack/NodeServicesTests.cs b/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/HistoricalAccess/MsgPack/NodeServicesTests.cs index 025d1f4a61..c2310b9c98 100644 --- a/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/HistoricalAccess/MsgPack/NodeServicesTests.cs +++ b/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/HistoricalAccess/MsgPack/NodeServicesTests.cs @@ -33,7 +33,7 @@ public void Dispose() private NodeHistoricalAccessTests GetTests() { var client = _factory.CreateClient(); // Call to create server - var registry = _factory.Resolve(); + var registry = _factory.Resolve>(); var endpointId = registry.RegisterEndpointAsync(_server.GetConnection().Endpoint).Result; return new NodeHistoricalAccessTests(() => // Create an adapter over the api new TwinWebApiAdapter(_client.Resolve()), endpointId); diff --git a/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/HistoricalAccess/MsgPack/ReadAtTimesTests.cs b/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/HistoricalAccess/MsgPack/ReadAtTimesTests.cs index 9f6fa587c2..1bd9ff087d 100644 --- a/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/HistoricalAccess/MsgPack/ReadAtTimesTests.cs +++ b/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/HistoricalAccess/MsgPack/ReadAtTimesTests.cs @@ -33,7 +33,7 @@ public void Dispose() private HistoryReadValuesAtTimesTests GetTests() { var client = _factory.CreateClient(); // Call to create server - var registry = _factory.Resolve(); + var registry = _factory.Resolve>(); var endpointId = registry.RegisterEndpointAsync(_server.GetConnection().Endpoint).Result; return new HistoryReadValuesAtTimesTests(_server, () => // Create an adapter over the api new HistoryWebApiAdapter(_client.Resolve()), endpointId); diff --git a/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/HistoricalAccess/MsgPack/ReadModifiedTests.cs b/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/HistoricalAccess/MsgPack/ReadModifiedTests.cs index e27e4b5f5c..9ecbf0f686 100644 --- a/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/HistoricalAccess/MsgPack/ReadModifiedTests.cs +++ b/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/HistoricalAccess/MsgPack/ReadModifiedTests.cs @@ -33,7 +33,7 @@ public void Dispose() private HistoryReadValuesModifiedTests GetTests() { var client = _factory.CreateClient(); // Call to create server - var registry = _factory.Resolve(); + var registry = _factory.Resolve>(); var endpointId = registry.RegisterEndpointAsync(_server.GetConnection().Endpoint).Result; return new HistoryReadValuesModifiedTests(_server, () => // Create an adapter over the api new HistoryWebApiAdapter(_client.Resolve()), endpointId); diff --git a/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/HistoricalAccess/MsgPack/ReadProcessedTests.cs b/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/HistoricalAccess/MsgPack/ReadProcessedTests.cs index ca85b5ecea..390ff828cd 100644 --- a/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/HistoricalAccess/MsgPack/ReadProcessedTests.cs +++ b/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/HistoricalAccess/MsgPack/ReadProcessedTests.cs @@ -33,7 +33,7 @@ public void Dispose() private HistoryReadValuesProcessedTests GetTests() { var client = _factory.CreateClient(); // Call to create server - var registry = _factory.Resolve(); + var registry = _factory.Resolve>(); var endpointId = registry.RegisterEndpointAsync(_server.GetConnection().Endpoint).Result; return new HistoryReadValuesProcessedTests(_server, () => // Create an adapter over the api new HistoryWebApiAdapter(_client.Resolve()), endpointId); diff --git a/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/HistoricalAccess/MsgPack/ReadValuesTests.cs b/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/HistoricalAccess/MsgPack/ReadValuesTests.cs index 170cd44a8a..bc5d4f9320 100644 --- a/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/HistoricalAccess/MsgPack/ReadValuesTests.cs +++ b/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/HistoricalAccess/MsgPack/ReadValuesTests.cs @@ -33,7 +33,7 @@ public void Dispose() private HistoryReadValuesTests GetTests() { var client = _factory.CreateClient(); // Call to create server - var registry = _factory.Resolve(); + var registry = _factory.Resolve>(); var endpointId = registry.RegisterEndpointAsync(_server.GetConnection().Endpoint).Result; return new HistoryReadValuesTests(_server, () => // Create an adapter over the api new HistoryWebApiAdapter(_client.Resolve()), endpointId); diff --git a/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/HistoricalAccess/MsgPack/UpdateValuesTests.cs b/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/HistoricalAccess/MsgPack/UpdateValuesTests.cs index 6c98ca724c..e84dd9185b 100644 --- a/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/HistoricalAccess/MsgPack/UpdateValuesTests.cs +++ b/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/HistoricalAccess/MsgPack/UpdateValuesTests.cs @@ -33,7 +33,7 @@ public void Dispose() private HistoryUpdateValuesTests GetTests() { var client = _factory.CreateClient(); // Call to create server - var registry = _factory.Resolve(); + var registry = _factory.Resolve>(); var endpointId = registry.RegisterEndpointAsync(_server.GetConnection().Endpoint).Result; return new HistoryUpdateValuesTests(() => // Create an adapter over the api new HistoryWebApiAdapter(_client.Resolve()), endpointId); diff --git a/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/HistoricalEvents/Json/NodeServicesTests.cs b/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/HistoricalEvents/Json/NodeServicesTests.cs index 92dd16694c..3e60df1a35 100644 --- a/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/HistoricalEvents/Json/NodeServicesTests.cs +++ b/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/HistoricalEvents/Json/NodeServicesTests.cs @@ -33,7 +33,7 @@ public void Dispose() private NodeHistoricalEventsTests GetTests() { var client = _factory.CreateClient(); // Call to create server - var registry = _factory.Resolve(); + var registry = _factory.Resolve>(); var endpointId = registry.RegisterEndpointAsync(_server.GetConnection().Endpoint).Result; return new NodeHistoricalEventsTests(() => // Create an adapter over the api new TwinWebApiAdapter(_client.Resolve()), endpointId); diff --git a/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/HistoricalEvents/MsgPack/NodeServicesTests.cs b/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/HistoricalEvents/MsgPack/NodeServicesTests.cs index f04d161996..88cdb65ff9 100644 --- a/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/HistoricalEvents/MsgPack/NodeServicesTests.cs +++ b/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/HistoricalEvents/MsgPack/NodeServicesTests.cs @@ -33,7 +33,7 @@ public void Dispose() private NodeHistoricalEventsTests GetTests() { var client = _factory.CreateClient(); // Call to create server - var registry = _factory.Resolve(); + var registry = _factory.Resolve>(); var endpointId = registry.RegisterEndpointAsync(_server.GetConnection().Endpoint).Result; return new NodeHistoricalEventsTests(() => // Create an adapter over the api new TwinWebApiAdapter(_client.Resolve()), endpointId); diff --git a/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/Plc/Json/NodeServicesTests1.cs b/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/Plc/Json/NodeServicesTests1.cs index 03570ddd43..7268771bd7 100644 --- a/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/Plc/Json/NodeServicesTests1.cs +++ b/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/Plc/Json/NodeServicesTests1.cs @@ -32,7 +32,7 @@ public void Dispose() private SimulatorNodesTests GetTests() { var client = _factory.CreateClient(); // Call to create server - var registry = _factory.Resolve(); + var registry = _factory.Resolve>(); var endpointId = registry.RegisterEndpointAsync(_server.GetConnection().Endpoint).Result; return new SimulatorNodesTests(_server, () => // Create an adapter over the api new TwinWebApiAdapter(_client.Resolve()), endpointId); diff --git a/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/Plc/Json/NodeServicesTests2.cs b/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/Plc/Json/NodeServicesTests2.cs index 373bb959e9..cfae970a90 100644 --- a/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/Plc/Json/NodeServicesTests2.cs +++ b/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/Plc/Json/NodeServicesTests2.cs @@ -32,7 +32,7 @@ public void Dispose() private PlcModelComplexTypeTests GetTests() { var client = _factory.CreateClient(); // Call to create server - var registry = _factory.Resolve(); + var registry = _factory.Resolve>(); var endpointId = registry.RegisterEndpointAsync(_server.GetConnection().Endpoint).Result; return new PlcModelComplexTypeTests(_server, () => // Create an adapter over the api new TwinWebApiAdapter(_client.Resolve()), endpointId); diff --git a/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/Plc/MsgPack/NodeServicesTests1.cs b/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/Plc/MsgPack/NodeServicesTests1.cs index c7f84432ba..dc7c81b410 100644 --- a/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/Plc/MsgPack/NodeServicesTests1.cs +++ b/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/Plc/MsgPack/NodeServicesTests1.cs @@ -32,7 +32,7 @@ public void Dispose() private SimulatorNodesTests GetTests() { var client = _factory.CreateClient(); // Call to create server - var registry = _factory.Resolve(); + var registry = _factory.Resolve>(); var endpointId = registry.RegisterEndpointAsync(_server.GetConnection().Endpoint).Result; return new SimulatorNodesTests(_server, () => // Create an adapter over the api new TwinWebApiAdapter(_client.Resolve()), endpointId); diff --git a/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/Plc/MsgPack/NodeServicesTests2.cs b/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/Plc/MsgPack/NodeServicesTests2.cs index ac70d5ca4a..b0bb46c3b8 100644 --- a/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/Plc/MsgPack/NodeServicesTests2.cs +++ b/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/Plc/MsgPack/NodeServicesTests2.cs @@ -32,7 +32,7 @@ public void Dispose() private PlcModelComplexTypeTests GetTests() { var client = _factory.CreateClient(); // Call to create server - var registry = _factory.Resolve(); + var registry = _factory.Resolve>(); var endpointId = registry.RegisterEndpointAsync(_server.GetConnection().Endpoint).Result; return new PlcModelComplexTypeTests(_server, () => // Create an adapter over the api new TwinWebApiAdapter(_client.Resolve()), endpointId); diff --git a/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/TestData/Json/BrowsePathTests.cs b/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/TestData/Json/BrowsePathTests.cs index 51258de818..5a2b1346dd 100644 --- a/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/TestData/Json/BrowsePathTests.cs +++ b/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/TestData/Json/BrowsePathTests.cs @@ -33,7 +33,7 @@ public void Dispose() private BrowsePathTests GetTests() { var client = _factory.CreateClient(); // Call to create server - var registry = _factory.Resolve(); + var registry = _factory.Resolve>(); var endpointId = registry.RegisterEndpointAsync(_server.GetConnection().Endpoint).Result; return new BrowsePathTests(() => // Create an adapter over the api new TwinWebApiAdapter(_client.Resolve()), endpointId); diff --git a/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/TestData/Json/BrowseStreamTests.cs b/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/TestData/Json/BrowseStreamTests.cs index bec553a088..63b1719b99 100644 --- a/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/TestData/Json/BrowseStreamTests.cs +++ b/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/TestData/Json/BrowseStreamTests.cs @@ -33,7 +33,7 @@ public void Dispose() private BrowseStreamTests GetTests() { var client = _factory.CreateClient(); // Call to create server - var registry = _factory.Resolve(); + var registry = _factory.Resolve>(); var endpointId = registry.RegisterEndpointAsync(_server.GetConnection().Endpoint).Result; return new BrowseStreamTests(() => // Create an adapter over the api new TwinWebApiAdapter(_client.Resolve()), endpointId); diff --git a/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/TestData/Json/BrowseTest.cs b/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/TestData/Json/BrowseTest.cs index 3023dfaf67..731c50d306 100644 --- a/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/TestData/Json/BrowseTest.cs +++ b/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/TestData/Json/BrowseTest.cs @@ -33,7 +33,7 @@ public void Dispose() private BrowseServicesTests GetTests() { var client = _factory.CreateClient(); // Call to create server - var registry = _factory.Resolve(); + var registry = _factory.Resolve>(); var endpointId = registry.RegisterEndpointAsync(_server.GetConnection().Endpoint).Result; return new BrowseServicesTests(() => // Create an adapter over the api new TwinWebApiAdapter(_client.Resolve()), endpointId); diff --git a/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/TestData/Json/CallArrayTests.cs b/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/TestData/Json/CallArrayTests.cs index dd149f3f1e..124c8fbfd1 100644 --- a/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/TestData/Json/CallArrayTests.cs +++ b/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/TestData/Json/CallArrayTests.cs @@ -33,7 +33,7 @@ public void Dispose() private CallArrayMethodTests GetTests() { var client = _factory.CreateClient(); // Call to create server - var registry = _factory.Resolve(); + var registry = _factory.Resolve>(); var endpointId = registry.RegisterEndpointAsync(_server.GetConnection().Endpoint).Result; return new CallArrayMethodTests(() => // Create an adapter over the api new TwinWebApiAdapter(_client.Resolve()), endpointId); diff --git a/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/TestData/Json/CallScalarTests.cs b/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/TestData/Json/CallScalarTests.cs index 4075c399f9..b5474f3442 100644 --- a/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/TestData/Json/CallScalarTests.cs +++ b/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/TestData/Json/CallScalarTests.cs @@ -33,7 +33,7 @@ public void Dispose() private CallScalarMethodTests GetTests() { var client = _factory.CreateClient(); // Call to create server - var registry = _factory.Resolve(); + var registry = _factory.Resolve>(); var endpointId = registry.RegisterEndpointAsync(_server.GetConnection().Endpoint).Result; return new CallScalarMethodTests(() => // Create an adapter over the api new TwinWebApiAdapter(_client.Resolve()), endpointId); diff --git a/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/TestData/Json/MetadataArrayTests.cs b/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/TestData/Json/MetadataArrayTests.cs index 819426ef51..0425b19c08 100644 --- a/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/TestData/Json/MetadataArrayTests.cs +++ b/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/TestData/Json/MetadataArrayTests.cs @@ -33,7 +33,7 @@ public void Dispose() private CallArrayMethodTests GetTests() { var client = _factory.CreateClient(); // Call to create server - var registry = _factory.Resolve(); + var registry = _factory.Resolve>(); var endpointId = registry.RegisterEndpointAsync(_server.GetConnection().Endpoint).Result; return new CallArrayMethodTests(() => // Create an adapter over the api new TwinWebApiAdapter(_client.Resolve()), endpointId, newMetadata: true); diff --git a/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/TestData/Json/MetadataScalarTests.cs b/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/TestData/Json/MetadataScalarTests.cs index 7d8615e006..8e2d544c0d 100644 --- a/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/TestData/Json/MetadataScalarTests.cs +++ b/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/TestData/Json/MetadataScalarTests.cs @@ -33,7 +33,7 @@ public void Dispose() private CallScalarMethodTests GetTests() { var client = _factory.CreateClient(); // Call to create server - var registry = _factory.Resolve(); + var registry = _factory.Resolve>(); var endpointId = registry.RegisterEndpointAsync(_server.GetConnection().Endpoint).Result; return new CallScalarMethodTests(() => // Create an adapter over the api new TwinWebApiAdapter(_client.Resolve()), endpointId, newMetadata: true); diff --git a/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/TestData/Json/MetadataTests.cs b/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/TestData/Json/MetadataTests.cs index 880d0dc603..010331c7a1 100644 --- a/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/TestData/Json/MetadataTests.cs +++ b/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/TestData/Json/MetadataTests.cs @@ -33,7 +33,7 @@ public void Dispose() private NodeMetadataTests GetTests() { var client = _factory.CreateClient(); // Call to create server - var registry = _factory.Resolve(); + var registry = _factory.Resolve>(); var endpointId = registry.RegisterEndpointAsync(_server.GetConnection().Endpoint).Result; return new NodeMetadataTests(() => // Create an adapter over the api new TwinWebApiAdapter(_client.Resolve()), endpointId); diff --git a/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/TestData/Json/ReadArrayTests.cs b/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/TestData/Json/ReadArrayTests.cs index 30aac20800..9054462a56 100644 --- a/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/TestData/Json/ReadArrayTests.cs +++ b/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/TestData/Json/ReadArrayTests.cs @@ -34,7 +34,7 @@ public void Dispose() private ReadArrayValueTests GetTests() { var client = _factory.CreateClient(); // Call to create server - var registry = _factory.Resolve(); + var registry = _factory.Resolve>(); var endpointId = registry.RegisterEndpointAsync(_server.GetConnection().Endpoint).Result; return new ReadArrayValueTests(() => // Create an adapter over the api new TwinWebApiAdapter(_client.Resolve()), endpointId, diff --git a/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/TestData/Json/ReadScalarTests.cs b/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/TestData/Json/ReadScalarTests.cs index a163fed18c..6e1fb79001 100644 --- a/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/TestData/Json/ReadScalarTests.cs +++ b/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/TestData/Json/ReadScalarTests.cs @@ -34,7 +34,7 @@ public void Dispose() private ReadScalarValueTests GetTests() { var client = _factory.CreateClient(); // Call to create server - var registry = _factory.Resolve(); + var registry = _factory.Resolve>(); var endpointId = registry.RegisterEndpointAsync(_server.GetConnection().Endpoint).Result; return new ReadScalarValueTests(() => // Create an adapter over the api new TwinWebApiAdapter(_client.Resolve()), endpointId, diff --git a/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/TestData/Json/WriteArrayTests.cs b/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/TestData/Json/WriteArrayTests.cs index c25d8f2613..95c0912a97 100644 --- a/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/TestData/Json/WriteArrayTests.cs +++ b/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/TestData/Json/WriteArrayTests.cs @@ -34,7 +34,7 @@ public void Dispose() private WriteArrayValueTests GetTests() { var client = _factory.CreateClient(); // Call to create server - var registry = _factory.Resolve(); + var registry = _factory.Resolve>(); var endpointId = registry.RegisterEndpointAsync(_server.GetConnection().Endpoint).Result; return new WriteArrayValueTests(() => // Create an adapter over the api new TwinWebApiAdapter(_client.Resolve()), endpointId, diff --git a/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/TestData/Json/WriteScalarTests.cs b/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/TestData/Json/WriteScalarTests.cs index c119a90709..3c76b7d9a0 100644 --- a/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/TestData/Json/WriteScalarTests.cs +++ b/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/TestData/Json/WriteScalarTests.cs @@ -34,7 +34,7 @@ public void Dispose() private WriteScalarValueTests GetTests() { var client = _factory.CreateClient(); // Call to create server - var registry = _factory.Resolve(); + var registry = _factory.Resolve>(); var endpointId = registry.RegisterEndpointAsync(_server.GetConnection().Endpoint).Result; return new WriteScalarValueTests(() => // Create an adapter over the api new TwinWebApiAdapter(_client.Resolve()), diff --git a/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/TestData/MsgPack/BrowsePathTests.cs b/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/TestData/MsgPack/BrowsePathTests.cs index 4b5b100cce..bd97235997 100644 --- a/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/TestData/MsgPack/BrowsePathTests.cs +++ b/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/TestData/MsgPack/BrowsePathTests.cs @@ -33,7 +33,7 @@ public void Dispose() private BrowsePathTests GetTests() { var client = _factory.CreateClient(); // Call to create server - var registry = _factory.Resolve(); + var registry = _factory.Resolve>(); var endpointId = registry.RegisterEndpointAsync(_server.GetConnection().Endpoint).Result; return new BrowsePathTests(() => // Create an adapter over the api new TwinWebApiAdapter(_client.Resolve()), endpointId); diff --git a/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/TestData/MsgPack/BrowseStreamTests.cs b/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/TestData/MsgPack/BrowseStreamTests.cs index 1250e1e598..20b62563ef 100644 --- a/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/TestData/MsgPack/BrowseStreamTests.cs +++ b/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/TestData/MsgPack/BrowseStreamTests.cs @@ -33,7 +33,7 @@ public void Dispose() private BrowseStreamTests GetTests() { var client = _factory.CreateClient(); // Call to create server - var registry = _factory.Resolve(); + var registry = _factory.Resolve>(); var endpointId = registry.RegisterEndpointAsync(_server.GetConnection().Endpoint).Result; return new BrowseStreamTests(() => // Create an adapter over the api new TwinWebApiAdapter(_client.Resolve()), endpointId); diff --git a/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/TestData/MsgPack/BrowseTest.cs b/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/TestData/MsgPack/BrowseTest.cs index bc944df146..9b8bcc6b4c 100644 --- a/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/TestData/MsgPack/BrowseTest.cs +++ b/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/TestData/MsgPack/BrowseTest.cs @@ -33,7 +33,7 @@ public void Dispose() private BrowseServicesTests GetTests() { var client = _factory.CreateClient(); // Call to create server - var registry = _factory.Resolve(); + var registry = _factory.Resolve>(); var endpointId = registry.RegisterEndpointAsync(_server.GetConnection().Endpoint).Result; return new BrowseServicesTests(() => // Create an adapter over the api new TwinWebApiAdapter(_client.Resolve()), endpointId); diff --git a/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/TestData/MsgPack/CallArrayTests.cs b/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/TestData/MsgPack/CallArrayTests.cs index 314bc98d97..2dc13302b7 100644 --- a/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/TestData/MsgPack/CallArrayTests.cs +++ b/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/TestData/MsgPack/CallArrayTests.cs @@ -33,7 +33,7 @@ public void Dispose() private CallArrayMethodTests GetTests() { var client = _factory.CreateClient(); // Call to create server - var registry = _factory.Resolve(); + var registry = _factory.Resolve>(); var endpointId = registry.RegisterEndpointAsync(_server.GetConnection().Endpoint).Result; return new CallArrayMethodTests(() => // Create an adapter over the api new TwinWebApiAdapter(_client.Resolve()), endpointId); diff --git a/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/TestData/MsgPack/CallScalarTests.cs b/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/TestData/MsgPack/CallScalarTests.cs index 37c68db72f..dda93ae3de 100644 --- a/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/TestData/MsgPack/CallScalarTests.cs +++ b/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/TestData/MsgPack/CallScalarTests.cs @@ -33,7 +33,7 @@ public void Dispose() private CallScalarMethodTests GetTests() { var client = _factory.CreateClient(); // Call to create server - var registry = _factory.Resolve(); + var registry = _factory.Resolve>(); var endpointId = registry.RegisterEndpointAsync(_server.GetConnection().Endpoint).Result; return new CallScalarMethodTests(() => // Create an adapter over the api new TwinWebApiAdapter(_client.Resolve()), endpointId); diff --git a/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/TestData/MsgPack/MetadataArrayTests.cs b/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/TestData/MsgPack/MetadataArrayTests.cs index 8c9ae5c6b5..e50f3e2bb3 100644 --- a/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/TestData/MsgPack/MetadataArrayTests.cs +++ b/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/TestData/MsgPack/MetadataArrayTests.cs @@ -33,7 +33,7 @@ public void Dispose() private CallArrayMethodTests GetTests() { var client = _factory.CreateClient(); // Call to create server - var registry = _factory.Resolve(); + var registry = _factory.Resolve>(); var endpointId = registry.RegisterEndpointAsync(_server.GetConnection().Endpoint).Result; return new CallArrayMethodTests(() => // Create an adapter over the api new TwinWebApiAdapter(_client.Resolve()), endpointId, newMetadata: true); diff --git a/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/TestData/MsgPack/MetadataScalarTests.cs b/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/TestData/MsgPack/MetadataScalarTests.cs index f1f2974cc8..931e9223eb 100644 --- a/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/TestData/MsgPack/MetadataScalarTests.cs +++ b/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/TestData/MsgPack/MetadataScalarTests.cs @@ -33,7 +33,7 @@ public void Dispose() private CallScalarMethodTests GetTests() { var client = _factory.CreateClient(); // Call to create server - var registry = _factory.Resolve(); + var registry = _factory.Resolve>(); var endpointId = registry.RegisterEndpointAsync(_server.GetConnection().Endpoint).Result; return new CallScalarMethodTests(() => // Create an adapter over the api new TwinWebApiAdapter(_client.Resolve()), endpointId, newMetadata: true); diff --git a/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/TestData/MsgPack/MetadataTests.cs b/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/TestData/MsgPack/MetadataTests.cs index 5dacc618e3..c6056b3e7e 100644 --- a/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/TestData/MsgPack/MetadataTests.cs +++ b/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/TestData/MsgPack/MetadataTests.cs @@ -33,7 +33,7 @@ public void Dispose() private NodeMetadataTests GetTests() { var client = _factory.CreateClient(); // Call to create server - var registry = _factory.Resolve(); + var registry = _factory.Resolve>(); var endpointId = registry.RegisterEndpointAsync(_server.GetConnection().Endpoint).Result; return new NodeMetadataTests(() => // Create an adapter over the api new TwinWebApiAdapter(_client.Resolve()), endpointId); diff --git a/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/TestData/MsgPack/ReadArrayTests.cs b/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/TestData/MsgPack/ReadArrayTests.cs index 960947eb77..c54c58b6dd 100644 --- a/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/TestData/MsgPack/ReadArrayTests.cs +++ b/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/TestData/MsgPack/ReadArrayTests.cs @@ -34,7 +34,7 @@ public void Dispose() private ReadArrayValueTests GetTests() { var client = _factory.CreateClient(); // Call to create server - var registry = _factory.Resolve(); + var registry = _factory.Resolve>(); var endpointId = registry.RegisterEndpointAsync(_server.GetConnection().Endpoint).Result; return new ReadArrayValueTests(() => // Create an adapter over the api new TwinWebApiAdapter(_client.Resolve()), endpointId, diff --git a/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/TestData/MsgPack/ReadScalarTests.cs b/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/TestData/MsgPack/ReadScalarTests.cs index fe4e6fe57b..9009f04a65 100644 --- a/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/TestData/MsgPack/ReadScalarTests.cs +++ b/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/TestData/MsgPack/ReadScalarTests.cs @@ -34,7 +34,7 @@ public void Dispose() private ReadScalarValueTests GetTests() { var client = _factory.CreateClient(); // Call to create server - var registry = _factory.Resolve(); + var registry = _factory.Resolve>(); var endpointId = registry.RegisterEndpointAsync(_server.GetConnection().Endpoint).Result; return new ReadScalarValueTests(() => // Create an adapter over the api new TwinWebApiAdapter(_client.Resolve()), endpointId, diff --git a/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/TestData/MsgPack/WriteArrayTests.cs b/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/TestData/MsgPack/WriteArrayTests.cs index 22f1f8ad92..f3aed325e7 100644 --- a/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/TestData/MsgPack/WriteArrayTests.cs +++ b/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/TestData/MsgPack/WriteArrayTests.cs @@ -34,7 +34,7 @@ public void Dispose() private WriteArrayValueTests GetTests() { var client = _factory.CreateClient(); // Call to create server - var registry = _factory.Resolve(); + var registry = _factory.Resolve>(); var endpointId = registry.RegisterEndpointAsync(_server.GetConnection().Endpoint).Result; return new WriteArrayValueTests(() => // Create an adapter over the api new TwinWebApiAdapter(_client.Resolve()), endpointId, diff --git a/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/TestData/MsgPack/WriteScalarTests.cs b/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/TestData/MsgPack/WriteScalarTests.cs index 038a6aaf55..1ee9f8e464 100644 --- a/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/TestData/MsgPack/WriteScalarTests.cs +++ b/src/Azure.IIoT.OpcUa.Publisher.Service.WebApi/tests/Sdk/TestData/MsgPack/WriteScalarTests.cs @@ -34,7 +34,7 @@ public void Dispose() private WriteScalarValueTests GetTests() { var client = _factory.CreateClient(); // Call to create server - var registry = _factory.Resolve(); + var registry = _factory.Resolve>(); var endpointId = registry.RegisterEndpointAsync(_server.GetConnection().Endpoint).Result; return new WriteScalarValueTests(() => // Create an adapter over the api new TwinWebApiAdapter(_client.Resolve()), diff --git a/src/Azure.IIoT.OpcUa.Publisher.Service/src/Clients/Adapters/DiscoveryApiAdapter.cs b/src/Azure.IIoT.OpcUa.Publisher.Service/src/Clients/Adapters/DiscoveryApiAdapter.cs index a258a54459..143779f55e 100644 --- a/src/Azure.IIoT.OpcUa.Publisher.Service/src/Clients/Adapters/DiscoveryApiAdapter.cs +++ b/src/Azure.IIoT.OpcUa.Publisher.Service/src/Clients/Adapters/DiscoveryApiAdapter.cs @@ -14,7 +14,7 @@ namespace Azure.IIoT.OpcUa.Publisher.Service.Clients.Adapters /// /// Implements discovery services as adapter on top of discovery api. /// - public sealed class DiscoveryApiAdapter : INetworkDiscovery, IServerDiscovery + public sealed class DiscoveryApiAdapter : INetworkDiscovery, IServerDiscovery { /// /// Create adapter @@ -27,28 +27,29 @@ public DiscoveryApiAdapter(IDiscoveryApi client) /// public async Task RegisterAsync(ServerRegistrationRequestModel request, - CancellationToken ct = default) + object? context = null, CancellationToken ct = default) { await _client.RegisterAsync(request, ct).ConfigureAwait(false); } /// public async Task DiscoverAsync(DiscoveryRequestModel request, - CancellationToken ct = default) + object? context = null, CancellationToken ct = default) { await _client.DiscoverAsync(request, ct).ConfigureAwait(false); } /// public async Task CancelAsync(DiscoveryCancelRequestModel request, - CancellationToken ct = default) + object? context = null, CancellationToken ct = default) { await _client.CancelAsync(request, ct).ConfigureAwait(false); } /// public async Task FindServerAsync( - ServerEndpointQueryModel query, CancellationToken ct = default) + ServerEndpointQueryModel query, object? context = null, + CancellationToken ct = default) { return await _client.FindServerAsync(query, ct).ConfigureAwait(false); } diff --git a/src/Azure.IIoT.OpcUa.Publisher.Service/src/Clients/DiscoveryServicesClient.cs b/src/Azure.IIoT.OpcUa.Publisher.Service/src/Clients/DiscoveryServicesClient.cs index 041ae97e32..acab279ef3 100644 --- a/src/Azure.IIoT.OpcUa.Publisher.Service/src/Clients/DiscoveryServicesClient.cs +++ b/src/Azure.IIoT.OpcUa.Publisher.Service/src/Clients/DiscoveryServicesClient.cs @@ -20,7 +20,8 @@ namespace Azure.IIoT.OpcUa.Publisher.Service.Clients /// /// Implement the discovery services through all registered publishers /// - public sealed class DiscoveryServicesClient : INetworkDiscovery, IServerDiscovery, IDisposable + public sealed class DiscoveryServicesClient : INetworkDiscovery, + IServerDiscovery, IDisposable { /// /// Create endpoint registry @@ -45,10 +46,10 @@ public void Dispose() } /// - public async Task CancelAsync(DiscoveryCancelRequestModel request, CancellationToken ct) + public async Task CancelAsync(DiscoveryCancelRequestModel request, string? context, CancellationToken ct) { using var activity = _activitySource.StartActivity("CancelDiscovery"); - await foreach (var publisher in EnumeratePublishersAsync(ct)) + await foreach (var publisher in EnumeratePublishersAsync(context, ct)) { if (publisher.Id == null) { @@ -71,11 +72,11 @@ public async Task CancelAsync(DiscoveryCancelRequestModel request, CancellationT /// public async Task FindServerAsync(ServerEndpointQueryModel query, - CancellationToken ct) + string? context, CancellationToken ct) { using var activity = _activitySource.StartActivity("FindServer"); var exceptions = new List(); - await foreach (var publisher in EnumeratePublishersAsync(ct)) + await foreach (var publisher in EnumeratePublishersAsync(context, ct)) { if (publisher.Id == null) { @@ -101,14 +102,14 @@ public async Task FindServerAsync(ServerEndpointQu exceptions.Add(ex); } } - throw new AggregateException("Failed to find server on any publisher.", exceptions); + throw new AggregateException("Failed to find server.", exceptions); } /// - public async Task DiscoverAsync(DiscoveryRequestModel request, CancellationToken ct) + public async Task DiscoverAsync(DiscoveryRequestModel request, string? context, CancellationToken ct) { using var activity = _activitySource.StartActivity("Discover"); - await foreach (var publisher in EnumeratePublishersAsync(ct)) + await foreach (var publisher in EnumeratePublishersAsync(context, ct)) { if (publisher.Id == null) { @@ -131,10 +132,11 @@ public async Task DiscoverAsync(DiscoveryRequestModel request, CancellationToken } /// - public async Task RegisterAsync(ServerRegistrationRequestModel request, CancellationToken ct) + public async Task RegisterAsync(ServerRegistrationRequestModel request, string? context, + CancellationToken ct) { using var activity = _activitySource.StartActivity("RegisterServer"); - await foreach (var publisher in EnumeratePublishersAsync(ct)) + await foreach (var publisher in EnumeratePublishersAsync(context, ct)) { if (publisher.Id == null) { @@ -157,28 +159,36 @@ public async Task RegisterAsync(ServerRegistrationRequestModel request, Cancella } /// - /// List all publishers + /// Get a dedicated publisher or list all publishers /// + /// /// /// - private async IAsyncEnumerable EnumeratePublishersAsync( + private async IAsyncEnumerable EnumeratePublishersAsync(string? id = null, [EnumeratorCancellation] CancellationToken ct = default) { - string? continuationToken = null; - do + if (id != null) + { + yield return await _publishers.GetPublisherAsync(id, ct: ct).ConfigureAwait(false); + } + else { - var result = await _publishers.ListPublishersAsync(continuationToken, false, - null, ct).ConfigureAwait(false); - if (result.Items != null) + string? continuationToken = null; + do { - foreach (var item in result.Items) + var result = await _publishers.ListPublishersAsync(continuationToken, false, + null, ct).ConfigureAwait(false); + if (result.Items != null) { - yield return item; + foreach (var item in result.Items) + { + yield return item; + } } + continuationToken = result.ContinuationToken; } - continuationToken = result.ContinuationToken; + while (continuationToken != null); } - while (continuationToken != null); } private readonly IPublisherRegistry _publishers; diff --git a/src/Azure.IIoT.OpcUa.Publisher.Service/src/IEndpointManager.cs b/src/Azure.IIoT.OpcUa.Publisher.Service/src/IEndpointManager.cs index 559841f95f..6fee553906 100644 --- a/src/Azure.IIoT.OpcUa.Publisher.Service/src/IEndpointManager.cs +++ b/src/Azure.IIoT.OpcUa.Publisher.Service/src/IEndpointManager.cs @@ -12,16 +12,18 @@ namespace Azure.IIoT.OpcUa.Publisher.Service /// /// Server endpoint manager /// - public interface IEndpointManager + /// + public interface IEndpointManager where T : class { /// /// Find the endpoint and server application information that /// matches the endpoint query and register it in the registry. /// /// + /// /// /// The endpoint id if succussful Task RegisterEndpointAsync(ServerEndpointQueryModel query, - CancellationToken ct = default); + T? context = null, CancellationToken ct = default); } } diff --git a/src/Azure.IIoT.OpcUa.Publisher.Service/src/Services/EndpointManager.cs b/src/Azure.IIoT.OpcUa.Publisher.Service/src/Services/EndpointManager.cs index 29fa72e30c..023299eeb3 100644 --- a/src/Azure.IIoT.OpcUa.Publisher.Service/src/Services/EndpointManager.cs +++ b/src/Azure.IIoT.OpcUa.Publisher.Service/src/Services/EndpointManager.cs @@ -15,14 +15,14 @@ namespace Azure.IIoT.OpcUa.Publisher.Service.Services /// Registers endpoints with the endpoint and application /// registry /// - public sealed class EndpointManager : IEndpointManager + public sealed class EndpointManager : IEndpointManager { /// /// Create endpoint manager /// /// /// - public EndpointManager(IServerDiscovery discovery, IApplicationBulkProcessor registry) + public EndpointManager(IServerDiscovery discovery, IApplicationBulkProcessor registry) { _discovery = discovery ?? throw new ArgumentNullException(nameof(discovery)); _registry = registry ?? throw new ArgumentNullException(nameof(registry)); @@ -30,9 +30,9 @@ public EndpointManager(IServerDiscovery discovery, IApplicationBulkProcessor reg /// public async Task RegisterEndpointAsync(ServerEndpointQueryModel query, - CancellationToken ct = default) + string? context = null, CancellationToken ct = default) { - var application = await _discovery.FindServerAsync(query, ct).ConfigureAwait(false) + var application = await _discovery.FindServerAsync(query, context, ct).ConfigureAwait(false) ?? throw new ResourceNotFoundException("Could not find any endpoint"); var registered = await _registry.AddDiscoveredApplicationAsync(application, ct).ConfigureAwait(false); @@ -44,7 +44,7 @@ public async Task RegisterEndpointAsync(ServerEndpointQueryModel query, ?? throw new ResourceInvalidStateException("Failed to register endpoint."); } - private readonly IServerDiscovery _discovery; + private readonly IServerDiscovery _discovery; private readonly IApplicationBulkProcessor _registry; } } diff --git a/src/Azure.IIoT.OpcUa.Publisher/src/Discovery/NetworkDiscovery.cs b/src/Azure.IIoT.OpcUa.Publisher/src/Discovery/NetworkDiscovery.cs index 959adab490..2e85df5c9f 100644 --- a/src/Azure.IIoT.OpcUa.Publisher/src/Discovery/NetworkDiscovery.cs +++ b/src/Azure.IIoT.OpcUa.Publisher/src/Discovery/NetworkDiscovery.cs @@ -33,7 +33,7 @@ namespace Azure.IIoT.OpcUa.Publisher.Discovery /// /// Provides network discovery of endpoints /// - public sealed class NetworkDiscovery : INetworkDiscovery, IDisposable + public sealed class NetworkDiscovery : INetworkDiscovery, IDisposable { /// /// Running in container @@ -78,7 +78,8 @@ public NetworkDiscovery(IEndpointDiscovery client, IEventClient events, } /// - public Task RegisterAsync(ServerRegistrationRequestModel request, CancellationToken ct) + public Task RegisterAsync(ServerRegistrationRequestModel request, object? context, + CancellationToken ct) { if (request.DiscoveryUrl == null) { @@ -92,11 +93,12 @@ public Task RegisterAsync(ServerRegistrationRequestModel request, CancellationTo { DiscoveryUrls = new List { request.DiscoveryUrl } } - }, ct); + }, context, ct); } /// - public async Task DiscoverAsync(DiscoveryRequestModel request, CancellationToken ct) + public async Task DiscoverAsync(DiscoveryRequestModel request, object? context, + CancellationToken ct) { kDiscoverAsync.Add(1, _metrics.TagList); ArgumentNullException.ThrowIfNull(request); @@ -126,7 +128,8 @@ public async Task DiscoverAsync(DiscoveryRequestModel request, CancellationToken } /// - public async Task CancelAsync(DiscoveryCancelRequestModel request, CancellationToken ct) + public async Task CancelAsync(DiscoveryCancelRequestModel request, object? context, + CancellationToken ct) { kCancelAsync.Add(1, _metrics.TagList); ArgumentNullException.ThrowIfNull(request); diff --git a/src/Azure.IIoT.OpcUa.Publisher/src/Discovery/ServerDiscovery.cs b/src/Azure.IIoT.OpcUa.Publisher/src/Discovery/ServerDiscovery.cs index 5e9e669f55..519d200d09 100644 --- a/src/Azure.IIoT.OpcUa.Publisher/src/Discovery/ServerDiscovery.cs +++ b/src/Azure.IIoT.OpcUa.Publisher/src/Discovery/ServerDiscovery.cs @@ -18,7 +18,7 @@ namespace Azure.IIoT.OpcUa.Publisher.Discovery /// /// Server discovery on top of OPC UA endpoint discovery /// - public sealed class ServerDiscovery : IServerDiscovery + public sealed class ServerDiscovery : IServerDiscovery { /// /// Create services @@ -36,7 +36,7 @@ public ServerDiscovery(IEndpointDiscovery client, IJsonSerializer serializer, /// public async Task FindServerAsync( - ServerEndpointQueryModel query, CancellationToken ct) + ServerEndpointQueryModel query, object? context, CancellationToken ct) { if (query?.DiscoveryUrl == null) { diff --git a/src/Azure.IIoT.OpcUa/src/Publisher/INetworkDiscovery.cs b/src/Azure.IIoT.OpcUa/src/Publisher/INetworkDiscovery.cs index 199bc4d883..13543e3fb4 100644 --- a/src/Azure.IIoT.OpcUa/src/Publisher/INetworkDiscovery.cs +++ b/src/Azure.IIoT.OpcUa/src/Publisher/INetworkDiscovery.cs @@ -12,33 +12,37 @@ namespace Azure.IIoT.OpcUa.Publisher /// /// Network discovery services /// - public interface INetworkDiscovery + /// + public interface INetworkDiscovery where T : class { /// /// Discovery server in network with discovery url. /// /// + /// /// /// Task RegisterAsync(ServerRegistrationRequestModel request, - CancellationToken ct = default); + T? context = null, CancellationToken ct = default); /// /// Start a discovery run for servers in network. /// /// + /// /// /// Task DiscoverAsync(DiscoveryRequestModel request, - CancellationToken ct = default); + T? context = null, CancellationToken ct = default); /// /// Cancel a discovery run that is ongoing /// /// + /// /// /// Task CancelAsync(DiscoveryCancelRequestModel request, - CancellationToken ct = default); + T? context = null, CancellationToken ct = default); } } diff --git a/src/Azure.IIoT.OpcUa/src/Publisher/IServerDiscovery.cs b/src/Azure.IIoT.OpcUa/src/Publisher/IServerDiscovery.cs index bcb5d912b8..95893a60c2 100644 --- a/src/Azure.IIoT.OpcUa/src/Publisher/IServerDiscovery.cs +++ b/src/Azure.IIoT.OpcUa/src/Publisher/IServerDiscovery.cs @@ -12,7 +12,8 @@ namespace Azure.IIoT.OpcUa.Publisher /// /// Server discovery interface /// - public interface IServerDiscovery + /// + public interface IServerDiscovery where T : class { /// /// Find a server using the endpoint url in the query @@ -21,9 +22,11 @@ public interface IServerDiscovery /// list. /// /// + /// /// /// Task FindServerAsync( - ServerEndpointQueryModel query, CancellationToken ct = default); + ServerEndpointQueryModel query, T? context = null, + CancellationToken ct = default); } }