mirror of
https://github.com/OPCFoundation/UA-.NETStandard.git
synced 2026-10-17 05:11:13 +08:00
e8bec27d5d
# Description
Complete WoT Binding preservation and the two-pump aggregation workflow
without implicit overlays or multi-source action fan-out.
- Add verified linked-document export and bounded partition merging.
Preserve complete source facts, reject contradictory archival content,
and retain usable readable content when a future native grammar is
unsupported.
- Wire local Methods and Condition events through the existing
injectable binding/runtime infrastructure. Keep local and upstream
identities distinct, translate namespace-bearing values, and bound
occurrence routes by source and generation.
- Wait for asynchronous event-producer readiness before completing
subscription creation, so the first alarm is not lost. Preserve
cancellation, teardown, and startup-failure reporting.
- Import runtime types in inheritance order and attach typed Method
argument Properties. Keep generated Double spelling deterministic across
supported frameworks and remove an AOT-unsafe registry validation
conversion.
- Generate both pumps and their asset/group projections. Expose fifteen
typed readings per pump, separate source-owned controls, and
acknowledge/confirm/reset workflows. Extend the demo script for managed
and NativeAOT execution, bounded failures, and exact-process cleanup.
- Synchronize current-state documentation and specification fixtures.
Compose fixture paths from platform-independent components and emit/pin
LF pump XML so byte-exact regeneration holds on Windows, Linux, and
macOS.
- Keep sample JSON readable with sorted members, two-space indentation,
and LF line endings. Normalize generated filenames to single hyphens
without changing registry resource IDs, document values, logical links,
or dependency ordering; the manifest maps resource IDs to their physical
filenames.
Most changed files are deterministic regenerations of checked-in sample
documents. The demo manifest contains 533 linked resources; the
aggregation server remains generic and has no Pump-specific compiled
model dependency.
No new alarm vocabulary, shelving/suppression/dialog/ConditionRefresh
transport mapping, Azure SDK changes, or complete Pump/OpenUSD parity is
introduced.
## Related Issues
Fixes #4430, which records the approved implementation scope, design
decisions, and acceptance criteria.
Follow-up to #4411. Specification fixtures are pinned to
[OPCF-Members/spec-drafts commit
82620d9](https://github.com/OPCF-Members/spec-drafts/commit/82620d9e313f35386dfc7477f7875cd47d2fd268),
associated with OPCF-Members/spec-drafts#35.
## Validation
- .NET 10 and .NET 8: complete affected converter/schema, WoT
Connectivity, and binding suites passed.
- .NET Framework 4.8: affected libraries, converter/generator, projected
runtime, readiness, and NodeSet-import compatibility runs passed. The
existing filesystem test exceeding the host's legacy path limit passed
through a temporary short-path alias, without changing its assertions.
- All 29 aggregation sample tests passed, including the independent
companion-model oracle.
- Managed/default-port and NativeAOT/alternate-port demo runs completed
with 533 documents, two pumps, thirty Good readings, and all four
pump/source control and alarm workflows.
- Timeout and duplicate-port failure paths were exercised; owned
processes and ports were released.
- Specification artifact/rule checks, byte-identical example mirroring,
statement-digest verification, and changed-file whitespace checks
passed.
- The [Build and Test .NET 10.0 workflow for
278b092](https://github.com/OPCFoundation/UA-.NETStandard/actions/runs/34095520510)
passed, including the previously failing Linux/macOS Types and WoT
Connectivity jobs. Portability fixes preserve the existing assertions
and add an explicit LF-output regression.
- After the readability changes in `dc61d032`, all 131 targeted
sample/projected-runtime cases passed on both .NET 10 and .NET Framework
4.8, and all 29 aggregation sample tests passed after rebuilding. All
539 JSON assets meet the formatting and filename rules; the 538 document
JSON values are unchanged, with only physical paths changing in the
manifest. Byte-exact regeneration assertions remain in place.
Local validation was scoped to affected projects rather than the entire
UA.slnx solution. Numeric coverage percentages and remaining CI gates
remain for CI; coverage thresholds were not changed. Existing unrelated
analyzer warnings were left unchanged.
## Checklist
- [ ] 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.
- [ ] 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.
- [ ] I ran **all** tests locally using the **UA.slnx** solution against
at least .net **framework** and .net **10**, and all passed.
- [ ] I fixed **all** failing and flaky tests in the CI pipelines and
**all** CodeQL warnings.
- [x] I have addressed **all** PR feedback received.
Regression and integration tests are included and passed as described
above; the combined tests/coverage checkbox remains open because numeric
coverage was not measured locally.
---------
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 6a9f41b1-72f0-4c74-bd7f-26fa531e5738
291 lines
9.1 KiB
C#
291 lines
9.1 KiB
C#
/* ========================================================================
|
|
* Copyright (c) 2005-2026 The OPC Foundation, Inc. All rights reserved.
|
|
*
|
|
* OPC Foundation MIT License 1.00
|
|
*
|
|
* Permission is hereby granted, free of charge, to any person
|
|
* obtaining a copy of this software and associated documentation
|
|
* files (the "Software"), to deal in the Software without
|
|
* restriction, including without limitation the rights to use,
|
|
* copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
* copies of the Software, and to permit persons to whom the
|
|
* Software is furnished to do so, subject to the following
|
|
* conditions:
|
|
*
|
|
* The above copyright notice and this permission notice shall be
|
|
* included in all copies or substantial portions of the Software.
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
|
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
|
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
* OTHER DEALINGS IN THE SOFTWARE.
|
|
*
|
|
* The complete license agreement can be found here:
|
|
* http://opcfoundation.org/License/MIT/1.00/
|
|
* ======================================================================*/
|
|
|
|
using System;
|
|
using Opc.Ua;
|
|
using Opc.Ua.WotCon.Client;
|
|
|
|
namespace AggregationClient
|
|
{
|
|
/// <summary>
|
|
/// Configures the reusable aggregation loader and reader workflow.
|
|
/// </summary>
|
|
public sealed class AggregationClientOptions
|
|
{
|
|
/// <summary>
|
|
/// Gets or sets the aggregation server endpoint.
|
|
/// </summary>
|
|
public string AggregationEndpoint { get; set; } =
|
|
"opc.tcp://localhost:62550/AggregationServer";
|
|
|
|
/// <summary>
|
|
/// Gets or sets the Source A endpoint substituted into the Pump TD.
|
|
/// </summary>
|
|
public string SourceAEndpoint { get; set; } =
|
|
"opc.tcp://localhost:62551/SourceA";
|
|
|
|
/// <summary>
|
|
/// Gets or sets the Source B endpoint substituted into the Pump TD.
|
|
/// </summary>
|
|
public string SourceBEndpoint { get; set; } =
|
|
"opc.tcp://localhost:62552/SourceB";
|
|
|
|
/// <summary>
|
|
/// Gets or sets the OPC UA application name.
|
|
/// </summary>
|
|
public string ApplicationName { get; set; } = "AggregationClient";
|
|
|
|
/// <summary>
|
|
/// Gets or sets the isolated PKI root.
|
|
/// </summary>
|
|
public string? PkiRoot { get; set; }
|
|
|
|
/// <summary>
|
|
/// Gets or sets the directory containing documents.json and its documents.
|
|
/// </summary>
|
|
public string DocumentsDirectory { get; set; } =
|
|
System.IO.Path.Combine(System.AppContext.BaseDirectory, "Documents");
|
|
|
|
/// <summary>
|
|
/// Gets or sets whether to run the explicit control and alarm demonstration.
|
|
/// </summary>
|
|
public bool ExerciseControls { get; set; }
|
|
}
|
|
|
|
/// <summary>
|
|
/// Result of loading, refreshing, browsing and reading the aggregate Pump.
|
|
/// </summary>
|
|
public sealed class AggregationClientResult
|
|
{
|
|
/// <summary>
|
|
/// Initializes a result.
|
|
/// </summary>
|
|
public AggregationClientResult(
|
|
WotRegistryBulkLoadResult loadResult,
|
|
ArrayOf<WotPumpBrowseNode> browsedNodes,
|
|
ArrayOf<WotPumpValueResult> values)
|
|
{
|
|
LoadResult = loadResult;
|
|
BrowsedNodes = browsedNodes;
|
|
Values = values;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Initializes the result of loading both pumps.
|
|
/// </summary>
|
|
public AggregationClientResult(
|
|
WotRegistryBulkLoadResult loadResult,
|
|
ArrayOf<WotPumpResult> pumps,
|
|
ArrayOf<WotPumpControlResult> controls = default)
|
|
{
|
|
LoadResult = loadResult;
|
|
Pumps = pumps;
|
|
Controls = controls;
|
|
if (!pumps.IsEmpty)
|
|
{
|
|
BrowsedNodes = pumps[0].BrowsedNodes;
|
|
Values = pumps[0].Values;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Gets the document load and refresh result.
|
|
/// </summary>
|
|
public WotRegistryBulkLoadResult LoadResult { get; }
|
|
|
|
/// <summary>
|
|
/// Gets the recursively browsed Pump nodes.
|
|
/// </summary>
|
|
public ArrayOf<WotPumpBrowseNode> BrowsedNodes { get; }
|
|
|
|
/// <summary>
|
|
/// Gets the values read from the materialized Pump.
|
|
/// </summary>
|
|
public ArrayOf<WotPumpValueResult> Values { get; }
|
|
|
|
/// <summary>
|
|
/// Gets the independently browsed and read pumps.
|
|
/// </summary>
|
|
public ArrayOf<WotPumpResult> Pumps { get; }
|
|
|
|
/// <summary>
|
|
/// Gets completed source-owned management and alarm round trips.
|
|
/// </summary>
|
|
public ArrayOf<WotPumpControlResult> Controls { get; }
|
|
}
|
|
|
|
/// <summary>
|
|
/// Identifies a completed Start, Stop, Reset, Acknowledge and Confirm demonstration.
|
|
/// </summary>
|
|
public sealed class WotPumpControlResult
|
|
{
|
|
/// <summary>
|
|
/// Initializes the completed control result.
|
|
/// </summary>
|
|
public WotPumpControlResult(string pumpName, string sourceName)
|
|
{
|
|
PumpName = pumpName ?? throw new ArgumentNullException(nameof(pumpName));
|
|
SourceName = sourceName ?? throw new ArgumentNullException(nameof(sourceName));
|
|
}
|
|
|
|
/// <summary>
|
|
/// Gets the pump whose local actions were exercised.
|
|
/// </summary>
|
|
public string PumpName { get; }
|
|
|
|
/// <summary>
|
|
/// Gets the independently observed upstream source.
|
|
/// </summary>
|
|
public string SourceName { get; }
|
|
}
|
|
|
|
/// <summary>
|
|
/// Contains the model identity, browse results, and typed readings for one pump.
|
|
/// </summary>
|
|
public sealed class WotPumpResult
|
|
{
|
|
/// <summary>
|
|
/// Initializes the pump result.
|
|
/// </summary>
|
|
public WotPumpResult(
|
|
string name,
|
|
NodeId rootNodeId,
|
|
ArrayOf<WotPumpBrowseNode> browsedNodes,
|
|
ArrayOf<WotPumpValueResult> values)
|
|
{
|
|
Name = name ?? throw new ArgumentNullException(nameof(name));
|
|
RootNodeId = rootNodeId;
|
|
BrowsedNodes = browsedNodes;
|
|
Values = values;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Gets the stable pump name.
|
|
/// </summary>
|
|
public string Name { get; }
|
|
|
|
/// <summary>
|
|
/// Gets the root discovered by browsing from Objects.
|
|
/// </summary>
|
|
public NodeId RootNodeId { get; }
|
|
|
|
/// <summary>
|
|
/// Gets the pump's objects, variables, methods, and nested properties.
|
|
/// </summary>
|
|
public ArrayOf<WotPumpBrowseNode> BrowsedNodes { get; }
|
|
|
|
/// <summary>
|
|
/// Gets the measurements, supervision signals, and identity values.
|
|
/// </summary>
|
|
public ArrayOf<WotPumpValueResult> Values { get; }
|
|
}
|
|
|
|
/// <summary>
|
|
/// Describes one node found while browsing the materialized Pump.
|
|
/// </summary>
|
|
public sealed class WotPumpBrowseNode
|
|
{
|
|
/// <summary>
|
|
/// Initializes a browse result.
|
|
/// </summary>
|
|
public WotPumpBrowseNode(
|
|
NodeId nodeId,
|
|
QualifiedName browseName,
|
|
LocalizedText displayName,
|
|
NodeClass nodeClass)
|
|
{
|
|
NodeId = nodeId;
|
|
BrowseName = browseName;
|
|
DisplayName = displayName;
|
|
NodeClass = nodeClass;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Gets the node id.
|
|
/// </summary>
|
|
public NodeId NodeId { get; }
|
|
|
|
/// <summary>
|
|
/// Gets the browse name.
|
|
/// </summary>
|
|
public QualifiedName BrowseName { get; }
|
|
|
|
/// <summary>
|
|
/// Gets the display name.
|
|
/// </summary>
|
|
public LocalizedText DisplayName { get; }
|
|
|
|
/// <summary>
|
|
/// Gets the node class.
|
|
/// </summary>
|
|
public NodeClass NodeClass { get; }
|
|
}
|
|
|
|
/// <summary>
|
|
/// Contains one materialized Pump value.
|
|
/// </summary>
|
|
public sealed class WotPumpValueResult
|
|
{
|
|
/// <summary>
|
|
/// Initializes a value result.
|
|
/// </summary>
|
|
public WotPumpValueResult(
|
|
string name,
|
|
NodeId nodeId,
|
|
StatusCode statusCode,
|
|
Variant value)
|
|
{
|
|
Name = name;
|
|
NodeId = nodeId;
|
|
StatusCode = statusCode;
|
|
Value = value;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Gets the stable property name.
|
|
/// </summary>
|
|
public string Name { get; }
|
|
|
|
/// <summary>
|
|
/// Gets the materialized node id.
|
|
/// </summary>
|
|
public NodeId NodeId { get; }
|
|
|
|
/// <summary>
|
|
/// Gets the read status.
|
|
/// </summary>
|
|
public StatusCode StatusCode { get; }
|
|
|
|
/// <summary>
|
|
/// Gets the read value.
|
|
/// </summary>
|
|
public Variant Value { get; }
|
|
}
|
|
}
|