Files
UA-.NETStandard/samples/WotCon/AggregationServer
Marc Schier 90fc3cca2f Complete WoT Binding 1.1 alignment and conformance coverage (#4411)
# Description

Completes the UA-.NETStandard implementation of the final OPC UA WoT
Binding 1.1 semantics and aligns the WoT Connectivity 1.1 model with
xRegistry 0.4.0.

The change:

- retires `uav:isEvent` and `uav:severity` from current Binding output
while preserving unknown members through the generic converter's
ordinary residue mechanism;
- removes `uav:severity` from the asset Thing Description parser and
materializer, so document metadata cannot set occurrence severity;
- implements logical EventType definitions, ordered resolution
providers, explicit/default selection precedence, materialized member
paths, and the built-in `BaseEventType` fallback;
- adds deterministic portable identity and browse-path anchoring;
- populates bound type declarations instead of creating duplicate
siblings, including inherited and closed-content validation;
- resolves and validates `uav:externalSchema` without overriding
authoritative DataType definitions;
- hardens DataType dimensions, native projections, preservation
envelopes, URI transmission, projection limits, and delete-policy
handling;
- synchronizes the xRegistry and WoT Connectivity source-generation
inputs;
- pins all 27 specification examples, all 97 implementation-owned
normative requirements, and all 12 cross-language vector groups to the
final specification revision;
- adds `samples/WotCon/run-aggregation-demo.ps1` for a verified
one-command aggregation client/server round trip and replaces the README
topology sketch with Mermaid;
- normalizes redirected PowerShell diagnostic presentation in the
statement-digest test harness so its semantic assertions are stable on
Windows, Linux, and macOS.

WoT Connectivity remains model version `1.1`; draft iterations are
identified by release labels such as `1.1-draft5`.

**Specification dependency:** the evidence assets pin
`OPCF-Members/spec-drafts` `main` commit
`25db507121b503fd31c8816fbfae67a6822e813b`. The corresponding
specification follow-up is `OPCF-Members/spec-drafts#35`.

## Validation

- Latest GitHub/Azure CI: 266/266 checks passed.
- .NET 10 feedback-focused tests:
  - WoT Connectivity event/model/traceability: 72 passed
  - binding capability/traceability: 8 passed
  - coverage-gate tests: 25 passed
- Complete .NET 10 Tools project: 752 passed, 1 intentionally skipped.
- .NET Framework 4.8:
  - WoT Connectivity event/model/traceability: 72 passed
  - WotCon bindings build: 0 warnings, 0 errors
- NativeAOT build: 0 warnings, 0 errors.
- WoT aggregation demo: 16 documents uploaded and all 10 mapped values
read with Good status; exact processes and isolated PKI stores cleaned
up.
- Specification traceability: 402 normative statements mapped; all 97
implementation-owned statements have passing test evidence with zero
gaps.
- Shared conformance vectors: 12/12 groups execute.
- Final CI coverage:
  - project line coverage: 86.83% (floor 70%)
  - project branch coverage: 76.71% (floor 60%)
  - patch coverage: 100.00% (2,591/2,591 changed lines)
  - coverage gate passed

## Related Issues

Follow-up to #4375 and alignment with `OPCF-Members/spec-drafts#31` and
`OPCF-Members/spec-drafts#35`. No separate tracking issue was opened for
this follow-up.

## Checklist

- [x] I have signed the
[CLA](https://opcfoundation.org/license/cla/ContributorLicenseAgreementv1.0.pdf)
and read the
[CONTRIBUTING](https://github.com/OPCFoundation/UA-.NETStandard/blob/master/CONTRIBUTING.md)
doc.
- [x] I have added tests that prove my fix is effective or that my
feature works and increased code coverage.
- [x] I have added all necessary documentation.
- [x] I have verified that my changes do not introduce new build or
analyzer warnings in the changed paths.
- [ ] I ran **all** tests locally using the **UA.slnx** solution against
at least .net **framework** and .net **10**, and all passed.
- [x] I fixed **all** failing and flaky tests in the CI pipelines and
**all** CodeQL warnings.
- [x] I have addressed all PR feedback currently received.

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 6a9f41b1-72f0-4c74-bd7f-26fa531e5738
2026-09-04 23:36:18 +02:00
..

AggregationServer

This sample hosts the generic WoT registry, runtime document materialization, and protocol-binding projection runtime. It contains no Pump-specific generated code; DI, Machinery, Pumps, and the Pump instance are loaded at runtime from WoT files.

It also includes MemoryWotBinding.cs, a small in-memory custom binding and executor that demonstrates how third-party protocol bindings plug into the runtime without shipping that demo code in the Opc.Ua.WotCon.Bindings library. It is provided as a reference implementation and is deliberately not registered in this sample's host, so the aggregation topology exercises only the real HTTP, Modbus and OPC UA bindings. To try it, register it alongside the other bindings in AggregationServerHost.Configure:

var memoryStore = new MemoryWotStore();
opcUa.AddWotProtocolBinders()
    .AddWotBinder(new MemoryWotBinder())
    .AddWotBindingExecutor(new MemoryWotBindingExecutor(memoryStore));

The executable server targets net8.0, net9.0, and net10.0, where its OPC UA binding executor is available. Legacy CustomTestTarget solution builds use a no-op shell and are not runnable sample configurations.

Endpoint policy

WoT binding executors validate every outbound endpoint against a WotEndpointPolicy before opening a channel. The default policy blocks loopback and private address ranges, so a server cannot be talked into reaching its own listeners or a cloud metadata service on behalf of a remote caller.

This sample federates SourceA and SourceB, which run on the same host, so it opts in to loopback explicitly:

opcUa.AddWotEndpointPolicy(new WotEndpointPolicy { AllowLoopback = true });

Only the loopback gate is opened; the scheme allow-list, blocked-host list, and private-range checks stay at their secure defaults. A deployment that reaches real assets over the network should leave AllowLoopback off and instead pin the reachable devices with AllowedHosts.

See the WoT aggregation sample guide for topology, commands, monitoring, shadow replacement, troubleshooting, and NativeAOT publishing.