[opcuaclient] OpcUaClient — Discovery URL FindServers #358

Merged
dohertj2 merged 1 commits from auto/opcuaclient/6 into auto/driver-gaps 2026-04-25 20:13:23 -04:00
Owner

Summary

Discovery URL FindServers flow for OpcUaClient — prepends LDS-advertised endpoints to the failover candidate list.

  • OpcUaClientDriverOptions.DiscoveryUrl (string?, default null) — opt-in. Doc-comment notes that FindServers requires SecurityMode=None on the discovery channel per OPC UA spec, even when the data channel is encrypted.
  • OpcUaClientDriver.InitializeAsync — when set, opens an unsecured DiscoveryClient, calls FindServersAsync + GetEndpointsAsync (per discovered server's discovery URL), filters endpoints to the configured SecurityPolicy / SecurityMode, prepends discovered URLs to the failover candidate list.
  • Discovery failures are non-fatal (try/catch with empty result) so a transient LDS outage doesn't block init.
  • New ResolveEndpointCandidates(opts, discovered) overload with case-insensitive de-dup so a URL appearing in both lists is only attempted once.

Default DiscoveryUrl=null preserves all prior behavior.

Test plan

  • dotnet build src/ZB.MOM.WW.OtOpcUa.Driver.OpcUaClient — clean (0 / 0)
  • dotnet test tests/ZB.MOM.WW.OtOpcUa.Driver.OpcUaClient.Tests133 / 133 passed (6 new in OpcUaClientFailoverTests: default-null, prepend-order, dedup, case-insensitive dedup, replace-default, no-discovery passthrough)
  • Live discovery — skipped (requires real LDS)

🤖 Auto-generated by the Mode-B execution loop. Closes #278.

Closes #278

## Summary Discovery URL `FindServers` flow for OpcUaClient — prepends LDS-advertised endpoints to the failover candidate list. - **`OpcUaClientDriverOptions.DiscoveryUrl`** (string?, default null) — opt-in. Doc-comment notes that **FindServers requires SecurityMode=None on the discovery channel** per OPC UA spec, even when the data channel is encrypted. - **`OpcUaClientDriver.InitializeAsync`** — when set, opens an unsecured `DiscoveryClient`, calls `FindServersAsync` + `GetEndpointsAsync` (per discovered server's discovery URL), filters endpoints to the configured `SecurityPolicy` / `SecurityMode`, prepends discovered URLs to the failover candidate list. - **Discovery failures are non-fatal** (try/catch with empty result) so a transient LDS outage doesn't block init. - New `ResolveEndpointCandidates(opts, discovered)` overload with case-insensitive de-dup so a URL appearing in both lists is only attempted once. Default `DiscoveryUrl=null` preserves all prior behavior. ## Test plan - [x] `dotnet build src/ZB.MOM.WW.OtOpcUa.Driver.OpcUaClient` — clean (0 / 0) - [x] `dotnet test tests/ZB.MOM.WW.OtOpcUa.Driver.OpcUaClient.Tests` — **133 / 133 passed** (6 new in `OpcUaClientFailoverTests`: default-null, prepend-order, dedup, case-insensitive dedup, replace-default, no-discovery passthrough) - [ ] Live discovery — skipped (requires real LDS) 🤖 Auto-generated by the Mode-B execution loop. Closes #278. Closes #278
dohertj2 added 1 commit 2026-04-25 20:13:18 -04:00
Adds optional `DiscoveryUrl` knob to OpcUaClientDriverOptions. When set,
the driver runs `DiscoveryClient.CreateAsync` + `FindServersAsync` +
`GetEndpointsAsync` against that URL during InitializeAsync and prepends
the discovered endpoint URLs (filtered to matching SecurityPolicy +
SecurityMode) to the failover candidate list. De-duplicates URLs that
appear in both discovered and static lists (case-insensitive). Discovery
failures are non-fatal — falls back to statically configured candidates.

The doc comment notes that FindServers requires SecurityMode=None on the
discovery channel per OPC UA spec, even when the data channel uses Sign
or SignAndEncrypt.

Closes #278

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
dohertj2 merged commit 1d3e9a3237 into auto/driver-gaps 2026-04-25 20:13:23 -04:00
dohertj2 deleted branch auto/opcuaclient/6 2026-04-25 20:13:23 -04:00
Sign in to join this conversation.