Merge #918: real-origin variant of the recorded-v1-client compatibility gate
v2-ci / unit-tests (push) Waiting to run
v2-ci / unit-tests (push) Waiting to run
Goldens captured on pre-H2 master 1086593a over the real LocalDataServices,
LocalExportCatalog, DataCapabilitiesProvider, sample hub, write executor and
subscription service; only the physical driver write/acquisition, transport and
clock are faked. Closes #918.
This commit is contained in:
@@ -135,15 +135,92 @@ solution.
|
||||
- The v1 rejection statuses keep their code, detail and empty trailers, with and without the header: Unimplemented
|
||||
major, PermissionDenied for each missing grant.
|
||||
- A binary or oversized header gets `InvalidArgument` with the family's existing detail and no trailers.
|
||||
- **Not covered: a real-origin variant** (`LocalDataServices` + `LocalExportCatalog` + `DataCapabilitiesProvider`). It needs
|
||||
the Runtime.Tests origin fixture rebuilt in Host.Tests through public APIs, plus its own golden set captured against
|
||||
pre-X0 code. That was judged too heavy for X0 and is left as a follow-up.
|
||||
- **Real-origin variant:** `GrpcDataV1RealOriginCompatibilityTests` (#918), described in the next subsection. The fake-origin
|
||||
gate stays as the transport-layer pin (it reaches optional v1 fields, such as engineering units and a continuation
|
||||
token, that the real catalog never emits).
|
||||
- **Rule for H2, A2 and A3.**
|
||||
1. First extend the fake `Origin` (and the real-origin variant, once it exists) so it emits that phase's new-shape data:
|
||||
history info, conditions, and the new operation bits in metadata and capabilities.
|
||||
2. Then, **without the header**, the test must still see the same golden bytes.
|
||||
1. First extend the fake `Origin` **and** the real-origin fixture (`RealOrigin`) so they emit that phase's new-shape
|
||||
data: history info, conditions, and the new operation bits in metadata, capabilities and the exports.
|
||||
2. Then, **without the header**, both gates must still see their golden bytes.
|
||||
3. **Never re-record the goldens**. A difference is a v1 wire regression.
|
||||
|
||||
### Recorded-v1-client gate, real-origin variant (#918)
|
||||
|
||||
`GrpcDataV1RealOriginCompatibilityTests` + `GrpcDataV1RealOriginGoldens` (Host.Tests, `Phase=X0`). The fake-origin gate
|
||||
cannot see a regression *inside* the origin: H2 grows `LocalDataServices.Implemented(target)` (HistoryRead),
|
||||
`DataCapabilitiesProvider` and `LocalExportCatalog.Compilation.cs` (`Metadata.history`, header-gated). A headerless v1
|
||||
call could then change while the fake-origin gate stays green. This variant closes that gap. Its goldens were captured on
|
||||
pre-H2 master `1086593a`.
|
||||
|
||||
- **Fixture.** `RealOrigin` compiles a `DraftSnapshot` with `LocalExportCatalog.Compile`, the production path. It has
|
||||
one Raw export and one UNS export, both `Cluster`-rooted with the v1 operation set.
|
||||
- Raw `Plant/Modbus/dev1/…`: `Speed` (Int32, writable), `Temperature` (Double), `Label` (String), `Running` (Boolean),
|
||||
`Levels` (UInt16[3]), `Flow` (Double, `isHistorized` + `historianTagname`) and `HighTemp` (Boolean, `alarm` intent).
|
||||
- UNS `Area1/Line1/Filler/…`: references `Speed`, `FlowRate` (display override of `Flow`) and `Levels`.
|
||||
- Five tags get a sample through real hub ingress. `Flow` and `HighTemp` never do, so they read `WaitingForInitialData`.
|
||||
- **Scenarios.** Each request is driven from its golden request hex, with no header and with `history,conditions`.
|
||||
- GetCapabilities.
|
||||
- Browse of the raw device and of the UNS equipment.
|
||||
- GetMetadata of 11 views, including a NotFound.
|
||||
- Read of 8 items: every scalar kind, the array, the never-published historized tag, a UNS reference and a NotFound.
|
||||
- Write of 4 items: raw and UNS writes are dispatched; a read-only and a missing node are rejected before dispatch. A
|
||||
positive control asserts that the two admitted writes reached the driver route.
|
||||
- Subscribe, up to its initial frames: ack (raw, UNS, array, NotFound), SnapshotBegin, one Values frame per item, and
|
||||
SnapshotEnd. The "client" then cancels the call.
|
||||
- Reject paths, code + detail + empty trailers, with and without the header: Unimplemented major 2, and PermissionDenied
|
||||
when the exports lack Browse, Metadata, Read or Subscribe. Write without the grant is pinned as body bytes
|
||||
(`Write/no-write-grant`).
|
||||
- **Real.**
|
||||
- `DataConnectionGrpcService` and `DataProtoMapper`;
|
||||
- `DataConnectionAuthenticator` with a real API key;
|
||||
- `DataPlaneAuthorityState` with a `Cluster` `Operator` NodeAcl, `TriePermissionEvaluator` and `DataOperationPolicy`;
|
||||
- `CatalogActivation` and `LocalExportCatalog.Compile`;
|
||||
- `DataCapabilitiesProvider`, `PartitionedSampleHub`, `LocalDataServices`;
|
||||
- `DataWriteExecutor`, with its `WriteOperationRegistry` and `WriteValueBudget`. The fake route publishes the outcome
|
||||
through a real `LateWriteObserver` reservation, as the driver host does;
|
||||
- `LocalSubscriptionService`, `DataSubscriptionSession` and `SubscriptionTransportCapacity`.
|
||||
- **Faked.**
|
||||
- The physical driver write dispatch (`IDataWriteRoute`): a fixed route, answering DriverConfirmedSuccess.
|
||||
- The physical upstream acquisition (`ISubscriptionDemandSource`): Good, settings unrevised.
|
||||
- The gRPC/HTTP2 transport: a hand-built `ServerCallContext`.
|
||||
- The clock: `FrozenClock`, which never advances and never fires a timer.
|
||||
|
||||
Production reaches the two driver seams through the Akka `DriverHostActor`, which is out of scope here.
|
||||
- **Visibility.** Subscribe and Write need internal Runtime seams, so `ZB.MOM.WW.OtOpcUa.Runtime.csproj` gained
|
||||
`InternalsVisibleTo ZB.MOM.WW.OtOpcUa.Host.Tests`. It did not exist before. The seams are `LocalSubscriptionService`,
|
||||
`ISubscriptionDemandSource`, `DataWriteExecutor` and `IDataWriteRoute`, the same ones Runtime.Tests use.
|
||||
- **Determinism. Nothing is normalised.** Every input that could vary is fixed instead:
|
||||
- the API key id and secret (not `ApiKeySecret.Generate`);
|
||||
- the serving incarnation;
|
||||
- the frozen clock, so ages are 0, timestamps are fixed and no lease or heartbeat timer runs;
|
||||
- the catalog and authority epochs, which are process-local counters starting at 1 (the fixture throws if that changes);
|
||||
- the hub watermark (5, one per published sample).
|
||||
|
||||
Browse pages are sized so that no continuation token is emitted: the token is HMAC'd with a per-process random key and
|
||||
is the one field that would need normalising. `Normalise` is the single place a later phase may add a listed
|
||||
normalisation.
|
||||
|
||||
Bytes were identical across 9 recorder runs (Debug) and 5 `run-unit-phase.py X0` runs (Release).
|
||||
- **Red/green.** Each perturbation was made temporarily, run, and reverted. The fake-origin gate stayed green in all of
|
||||
them.
|
||||
|
||||
| Perturbation | Real-origin result |
|
||||
|---|---|
|
||||
| `Implemented` + `HistoryRead`, with `Understood` + `HistoryRead` and the fixture exports granting it (an un-gated H2) | GetCapabilities fails, with and without the header |
|
||||
| `Compile` emits an extra metadata field (engineering units on every variable) | Browse, Browse/uns and GetMetadata fail |
|
||||
| `DataCapabilitiesProvider` compact codec version 1 → 2 | GetCapabilities fails |
|
||||
| `Implemented` + `HistoryRead` alone, with `Understood` still `V1` | Green, correctly: the X0 tolerance masks the bit off the wire |
|
||||
|
||||
The last row matters for H2. `LocalDataServices.Metadata()` iterates a fixed list of the five v1 operations, so a new
|
||||
bit reaches metadata only when that list grows. Capabilities show it as soon as `Understood`, `Implemented` and an
|
||||
export all carry it.
|
||||
- **Rule for H2, A2 and A3.**
|
||||
1. Extend `RealOrigin`'s snapshot with the phase's new-shape data: historized tags with `HistoryInfo`, alarm-bearing
|
||||
tags with conditions, and exports granting the new bits.
|
||||
2. Still expect these exact bytes **without** the header.
|
||||
3. Expect them **with** the header too, until the server advertises the feature in `SupportedFeatures`.
|
||||
4. Never re-record.
|
||||
|
||||
## 3. Gate runs
|
||||
|
||||
Run on macOS, 2026-11-23, on HEAD `981c60784`: every code and test change, after the review fixes. The only later commit
|
||||
@@ -174,6 +251,12 @@ Final round (second Fable pass, approve; three small fixes `9b29a5f65`, `5453c20
|
||||
Configuration 314 passed. Follow-ups: #918 (real-origin variant of the v1 gate, required before the H2 exit), #919
|
||||
(render the dropped-operation diagnostics in AdminUI).
|
||||
|
||||
#918 (real-origin variant), macOS, 2026-11-23, on master `1086593a` plus the #918 change:
|
||||
|
||||
- `run-unit-phase.py X0` passed 5 runs in a row, 127 tests each. Host.Tests contributed 71: 43 fake-origin and 28
|
||||
real-origin.
|
||||
- The full Host.Tests suite (`Category!=E2E&Category!=LiveIntegration`) passed 454.
|
||||
|
||||
History of failed runs:
|
||||
|
||||
- The first P02/P07 run (before `75cf5eb8f`) failed.
|
||||
|
||||
@@ -765,7 +765,8 @@
|
||||
"project": "tests/Server/ZB.MOM.WW.OtOpcUa.Host.Tests/ZB.MOM.WW.OtOpcUa.Host.Tests.csproj",
|
||||
"filter": "(Feature=GrpcData&Phase=X0)",
|
||||
"new_classes": [
|
||||
"GrpcDataV1CompatibilityTests"
|
||||
"GrpcDataV1CompatibilityTests",
|
||||
"GrpcDataV1RealOriginCompatibilityTests"
|
||||
],
|
||||
"existing_classes": []
|
||||
}
|
||||
|
||||
@@ -11,6 +11,11 @@
|
||||
Inflate(blob, maxBytes), which takes the decompression ceiling as a parameter so the
|
||||
artifact-bomb guard is provable without inflating half a gigabyte per test run. -->
|
||||
<InternalsVisibleTo Include="ZB.MOM.WW.OtOpcUa.Runtime.Tests"/>
|
||||
<!-- #918: the recorded-v1-client compatibility gate's real-origin variant (Host.Tests) drives the real
|
||||
DataConnectionGrpcService over the real origin stack. Subscribe and Write need the internal
|
||||
LocalSubscriptionService / DataWriteExecutor seams (only the physical driver demand and write
|
||||
dispatch are faked), the same seams Runtime.Tests use. -->
|
||||
<InternalsVisibleTo Include="ZB.MOM.WW.OtOpcUa.Host.Tests"/>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
+471
@@ -0,0 +1,471 @@
|
||||
using Google.Protobuf;
|
||||
using Grpc.Core;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.Extensions.Options;
|
||||
using Shouldly;
|
||||
using Xunit;
|
||||
using ZB.MOM.WW.OtOpcUa.Commons.DataConnections;
|
||||
using ZB.MOM.WW.OtOpcUa.Configuration.Entities;
|
||||
using ZB.MOM.WW.OtOpcUa.Configuration.Enums;
|
||||
using ZB.MOM.WW.OtOpcUa.Configuration.Validation;
|
||||
using ZB.MOM.WW.OtOpcUa.Core.Abstractions.DataConnections;
|
||||
using ZB.MOM.WW.OtOpcUa.Core.Authorization;
|
||||
using ZB.MOM.WW.OtOpcUa.Host.Configuration;
|
||||
using ZB.MOM.WW.OtOpcUa.Host.Grpc;
|
||||
using ZB.MOM.WW.OtOpcUa.Host.OpcUa;
|
||||
using ZB.MOM.WW.OtOpcUa.Runtime.DataConnections;
|
||||
using ZB.MOM.WW.OtOpcUa.Runtime.Drivers;
|
||||
using W = ZB.MOM.WW.OtOpcUa.Commons.Protos.DataConnection.V1;
|
||||
|
||||
namespace ZB.MOM.WW.OtOpcUa.Host.Tests.DataConnections;
|
||||
|
||||
/// <summary>
|
||||
/// Recorded-v1-client compatibility gate, REAL-ORIGIN variant (#918; plan §4.3, exit gate of X0, H2, A2 and A3).
|
||||
/// <see cref="GrpcDataV1CompatibilityTests"/> pins the transport layer over a fixed fake origin, so it cannot see a
|
||||
/// v1 regression inside the origin itself (<c>LocalDataServices.Implemented</c>, <c>DataCapabilitiesProvider</c>,
|
||||
/// <c>LocalExportCatalog.Compile</c> metadata). This variant replays recorded v1 requests
|
||||
/// (<see cref="GrpcDataV1RealOriginGoldens.Requests"/>, parsed from the golden hex) against the real
|
||||
/// <see cref="DataConnectionGrpcService"/> wired to the real origin stack, and compares the responses with goldens
|
||||
/// captured on pre-H2 master <c>1086593a</c>.
|
||||
/// <para><b>Real:</b> <see cref="DataConnectionGrpcService"/>, <see cref="DataProtoMapper"/>,
|
||||
/// <see cref="DataConnectionAuthenticator"/> (real API key), <see cref="DataPlaneAuthorityState"/> + node ACL +
|
||||
/// <see cref="TriePermissionEvaluator"/>/<see cref="DataOperationPolicy"/>, <see cref="CatalogActivation"/>,
|
||||
/// <see cref="LocalExportCatalog.Compile"/> over a <see cref="DraftSnapshot"/> (Raw + UNS exports),
|
||||
/// <see cref="DataCapabilitiesProvider"/>, <see cref="PartitionedSampleHub"/> (samples go through real ingress),
|
||||
/// <see cref="LocalDataServices"/>, <see cref="DataWriteExecutor"/> (+ its operation registry and value budget),
|
||||
/// <see cref="LocalSubscriptionService"/> / <c>DataSubscriptionSession</c> (snapshot from the hub).</para>
|
||||
/// <para><b>Faked:</b> the physical driver write dispatch (<see cref="IDataWriteRoute"/>: resolves every catalog tag
|
||||
/// to a fixed route and answers DriverConfirmedSuccess), the physical upstream acquisition
|
||||
/// (<see cref="ISubscriptionDemandSource"/>: Good, settings unrevised), the gRPC/HTTP2 transport (hand-built
|
||||
/// <see cref="ServerCallContext"/>; marshalling is <c>ToByteArray()</c>) and the clock (<see cref="FrozenClock"/>,
|
||||
/// which never advances and never fires a timer, so ages are zero and no heartbeat/lease timer runs).</para>
|
||||
/// <para><b>Normalised:</b> nothing. Every input that could vary is fixed instead: the API key id/secret, the serving
|
||||
/// incarnation, the clock, and the catalog/authority epochs (process-local counters starting at 1). Browse pages are
|
||||
/// sized so no continuation token (HMAC'd with a per-process random key) is ever emitted. If a later phase finds a
|
||||
/// genuinely varying field it must normalise it in <see cref="Normalise"/>, list it here and in
|
||||
/// <c>docs/plans/evidence/grpc-data-ext/X0.md</c> §2, and never re-record.</para>
|
||||
/// RULE for H2/A2/A3: extend <see cref="RealOrigin"/>'s snapshot with that phase's new-shape data (historized tags
|
||||
/// with HistoryInfo, conditions, the new operation bits on the exports), then these tests must still see the same
|
||||
/// golden bytes WITHOUT the header.
|
||||
/// </summary>
|
||||
[Trait("Category", "Unit"), Trait("Feature", "GrpcData"), Trait("Phase", "X0")]
|
||||
public sealed class GrpcDataV1RealOriginCompatibilityTests
|
||||
{
|
||||
public static TheoryData<string> Scenarios => new(RealOriginRequests.Scenarios);
|
||||
|
||||
[Fact]
|
||||
public void Recorded_v1_requests_still_encode_identically()
|
||||
{
|
||||
RealOriginRequests.Scenarios.ShouldBe(GrpcDataV1RealOriginGoldens.Requests.Keys, ignoreOrder: true);
|
||||
foreach (var scenario in RealOriginRequests.Scenarios)
|
||||
Hex(RealOriginRequests.Bytes(scenario)).ShouldBe(GrpcDataV1RealOriginGoldens.Requests[scenario], $"recorded {scenario} request");
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[MemberData(nameof(Scenarios))]
|
||||
public async Task V1_client_without_feature_header_gets_the_recorded_v1_response_bytes(string scenario)
|
||||
{
|
||||
await using var origin = new RealOrigin();
|
||||
var actual = await origin.DriveAsync(scenario, new Metadata());
|
||||
actual.ShouldBe(GrpcDataV1RealOriginGoldens.Responses[scenario], $"{scenario} response diverged from the recorded v1 bytes");
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[MemberData(nameof(Scenarios))]
|
||||
public async Task Feature_header_changes_nothing_while_the_server_supports_no_feature(string scenario)
|
||||
{
|
||||
await using var origin = new RealOrigin();
|
||||
var actual = await origin.DriveAsync(scenario, new Metadata { { "x-otopcua-data-features", "history,conditions" } });
|
||||
actual.ShouldBe(GrpcDataV1RealOriginGoldens.Responses[scenario], $"{scenario} response must not change in X0 when features are requested");
|
||||
}
|
||||
|
||||
public static TheoryData<string, string> V1Rejections()
|
||||
{
|
||||
var data = new TheoryData<string, string>();
|
||||
foreach (var header in new[] { "", "history,conditions" })
|
||||
foreach (var scenario in new[] { "GetCapabilities/major-2", "Browse/no-browse-grant", "GetMetadata/no-metadata-grant",
|
||||
"Read/no-read-grant", "Subscribe/no-subscribe-grant" })
|
||||
data.Add(scenario, header);
|
||||
return data;
|
||||
}
|
||||
|
||||
/// <summary>The v1 rejection statuses (code, detail, trailers) a real origin produces, with and without the header.</summary>
|
||||
[Theory]
|
||||
[MemberData(nameof(V1Rejections))]
|
||||
public async Task V1_rejections_keep_their_status_detail_and_trailers(string scenario, string header)
|
||||
{
|
||||
var headers = header.Length == 0 ? new Metadata() : new Metadata { { "x-otopcua-data-features", header } };
|
||||
var (rpc, shape) = (scenario.Split('/')[0], scenario.Split('/')[1]);
|
||||
await using var origin = new RealOrigin(ExportOperations(shape));
|
||||
var request = shape == "major-2" ? new W.CapabilitiesRequest { ProtocolMajor = 2, ProtocolMinor = 5 }.ToByteArray() : null;
|
||||
var failure = await Should.ThrowAsync<RpcException>(() => origin.DriveAsync(rpc, headers, request));
|
||||
var (code, detail) = shape == "major-2"
|
||||
? (StatusCode.Unimplemented, "Incompatible protocol major.")
|
||||
: (StatusCode.PermissionDenied, "Data operation denied.");
|
||||
failure.StatusCode.ShouldBe(code);
|
||||
failure.Status.Detail.ShouldBe(detail);
|
||||
failure.Trailers.ShouldBeEmpty();
|
||||
}
|
||||
|
||||
/// <summary>A real origin whose exports do not grant Write answers each v1 write item in the body (pinned bytes).</summary>
|
||||
[Theory]
|
||||
[InlineData("")]
|
||||
[InlineData("history,conditions")]
|
||||
public async Task Write_without_a_write_grant_rejects_each_item_before_dispatch_with_the_v1_bytes(string header)
|
||||
{
|
||||
var headers = header.Length == 0 ? new Metadata() : new Metadata { { "x-otopcua-data-features", header } };
|
||||
await using var origin = new RealOrigin(ExportOperations("no-write-grant"));
|
||||
var actual = await origin.DriveAsync("Write", headers);
|
||||
actual.ShouldBe(GrpcDataV1RealOriginGoldens.Responses["Write/no-write-grant"]);
|
||||
origin.Dispatched.ShouldBeEmpty();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Real_origin_actually_dispatched_the_admitted_writes()
|
||||
{
|
||||
// Positive control for the write goldens: the admitted items reached the (fake) driver route.
|
||||
await using var origin = new RealOrigin();
|
||||
await origin.DriveAsync("Write", new Metadata());
|
||||
origin.Dispatched.ShouldBe(["op-raw", "op-uns"], ignoreOrder: true);
|
||||
}
|
||||
|
||||
private static DataOperations ExportOperations(string shape) => shape switch
|
||||
{
|
||||
"no-browse-grant" => DataOperationSets.V1 & ~DataOperations.Browse,
|
||||
"no-metadata-grant" => DataOperationSets.V1 & ~DataOperations.Metadata,
|
||||
"no-read-grant" => DataOperationSets.V1 & ~DataOperations.Read,
|
||||
"no-write-grant" => DataOperationSets.V1 & ~DataOperations.Write,
|
||||
"no-subscribe-grant" => DataOperationSets.V1 & ~DataOperations.Subscribe,
|
||||
_ => DataOperationSets.V1,
|
||||
};
|
||||
|
||||
internal static string Hex(byte[] bytes) => Convert.ToHexString(bytes);
|
||||
|
||||
/// <summary>X0: no field varies (see the class remarks). A later phase lists any explicit normalisation here.</summary>
|
||||
internal static IMessage Normalise(IMessage message) => message;
|
||||
}
|
||||
|
||||
/// <summary>The recorded v1 client requests against <see cref="RealOrigin"/>'s catalog. Changing any value invalidates the goldens.</summary>
|
||||
internal static class RealOriginRequests
|
||||
{
|
||||
private const string RawNs = "https://zb.com/otopcua/raw";
|
||||
private const string UnsNs = "https://zb.com/otopcua/uns";
|
||||
internal static readonly DataBudget Budget = new(TimeSpan.FromSeconds(5), 16, 65_536);
|
||||
|
||||
internal static DataView Raw(string path) => new(new("cluster", RawNs, "string", path), DataRealm.Raw, null, 0, path);
|
||||
internal static DataView Uns(string path) => new(new("cluster", UnsNs, "string", path), DataRealm.Uns, null, 0, path);
|
||||
|
||||
internal static readonly DataView Device = Raw("Plant/Modbus/dev1");
|
||||
internal static readonly DataView Speed = Raw("Plant/Modbus/dev1/Speed");
|
||||
internal static readonly DataView Temperature = Raw("Plant/Modbus/dev1/Temperature");
|
||||
internal static readonly DataView Label = Raw("Plant/Modbus/dev1/Label");
|
||||
internal static readonly DataView Running = Raw("Plant/Modbus/dev1/Running");
|
||||
internal static readonly DataView Levels = Raw("Plant/Modbus/dev1/Levels");
|
||||
internal static readonly DataView Flow = Raw("Plant/Modbus/dev1/Flow");
|
||||
internal static readonly DataView HighTemp = Raw("Plant/Modbus/dev1/HighTemp");
|
||||
internal static readonly DataView Missing = Raw("Plant/Modbus/dev1/Missing");
|
||||
// UNS equipment folders are minted under their entity id; references under the name path.
|
||||
internal static readonly DataView Equipment = new(new("cluster", UnsNs, "string", "equipment-1"), DataRealm.Uns, null, 0, "Area1/Line1/Filler");
|
||||
internal static readonly DataView UnsSpeed = Uns("Area1/Line1/Filler/Speed");
|
||||
internal static readonly DataView UnsFlow = Uns("Area1/Line1/Filler/FlowRate");
|
||||
internal static readonly DataView UnsLevels = Uns("Area1/Line1/Filler/Levels");
|
||||
|
||||
internal static readonly string[] Scenarios =
|
||||
["GetCapabilities", "Browse", "Browse/uns", "GetMetadata", "Read", "Write", "Subscribe"];
|
||||
|
||||
internal static IMessage Message(string scenario) => scenario switch
|
||||
{
|
||||
"GetCapabilities" => new W.CapabilitiesRequest { ProtocolMajor = 1, ProtocolMinor = 5 },
|
||||
"Browse" => DataProtoMapper.EncodeBrowseRequest(new BrowseRequest(Device, null, null, Budget)),
|
||||
"Browse/uns" => DataProtoMapper.EncodeBrowseRequest(new BrowseRequest(Equipment, null, null, Budget)),
|
||||
"GetMetadata" => DataProtoMapper.EncodeMetadataRequest(new MetadataRequest(
|
||||
[Speed, Temperature, Label, Running, Levels, Flow, HighTemp, UnsSpeed, UnsFlow, UnsLevels, Missing], Budget)),
|
||||
"Read" => DataProtoMapper.EncodeReadRequest(new ReadRequest(
|
||||
[
|
||||
new("r-speed", Speed, TimeSpan.FromSeconds(2)), new("r-temp", Temperature, null), new("r-label", Label, null),
|
||||
new("r-running", Running, null), new("r-levels", Levels, null), new("r-flow", Flow, null),
|
||||
new("r-uns-speed", UnsSpeed, null), new("r-missing", Missing, null),
|
||||
], Budget)),
|
||||
"Write" => WriteRequest(),
|
||||
"Subscribe" => DataProtoMapper.EncodeCommand(new OpenSubscription("sub-1", 1, "open-1", TimeSpan.FromSeconds(5),
|
||||
[
|
||||
new("item-speed", Speed, new(TimeSpan.FromMilliseconds(500), TimeSpan.FromSeconds(1), DataChangeTrigger.StatusValue, null)),
|
||||
new("item-uns-speed", UnsSpeed, new(TimeSpan.FromMilliseconds(500), TimeSpan.FromSeconds(1), DataChangeTrigger.StatusValue, null)),
|
||||
new("item-levels", Levels, new(TimeSpan.FromSeconds(1), TimeSpan.FromSeconds(1), DataChangeTrigger.StatusValue, null)),
|
||||
new("item-missing", Missing, new(TimeSpan.FromSeconds(1), TimeSpan.FromSeconds(1), DataChangeTrigger.StatusValue, null)),
|
||||
], false, TimeSpan.FromMinutes(5), Budget)),
|
||||
_ => throw new ArgumentOutOfRangeException(nameof(scenario)),
|
||||
};
|
||||
|
||||
private static W.WriteRequest WriteRequest()
|
||||
{
|
||||
using var raw = DataValue.FromScalar(DataValueKind.Int32, 17);
|
||||
using var uns = DataValue.FromScalar(DataValueKind.Int32, 18);
|
||||
using var readOnly = DataValue.FromScalar(DataValueKind.Double, 1.5);
|
||||
using var missing = DataValue.FromScalar(DataValueKind.String, "abc");
|
||||
return DataProtoMapper.EncodeWriteRequest(new WriteBatch(
|
||||
[
|
||||
new("w-raw", "op-raw", Speed, raw, RealOrigin.CatalogEpoch, RealOrigin.Incarnation, TimeSpan.FromSeconds(4), 1),
|
||||
new("w-uns", "op-uns", UnsSpeed, uns, RealOrigin.CatalogEpoch, RealOrigin.Incarnation, TimeSpan.FromSeconds(4), 1),
|
||||
new("w-readonly", "op-readonly", Temperature, readOnly, RealOrigin.CatalogEpoch, RealOrigin.Incarnation, TimeSpan.FromSeconds(4), 1),
|
||||
new("w-missing", "op-missing", Missing, missing, RealOrigin.CatalogEpoch, RealOrigin.Incarnation, TimeSpan.FromSeconds(4), 1),
|
||||
], Budget));
|
||||
}
|
||||
|
||||
internal static byte[] Bytes(string scenario) => Message(scenario).ToByteArray();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The real origin stack for one node of cluster <c>cluster</c>, compiled from a small deterministic deployed
|
||||
/// snapshot: Raw <c>Plant/Modbus/dev1/{Speed (Int32, writable), Temperature (Double), Label (String), Running
|
||||
/// (Boolean), Levels (UInt16[3]), Flow (Double, historized), HighTemp (Boolean, alarm-bearing)}</c> and UNS
|
||||
/// <c>Area1/Line1/Filler/{Speed, FlowRate (display override of Flow), Levels}</c>, with one Raw and one UNS export.
|
||||
/// </summary>
|
||||
internal sealed class RealOrigin : IAsyncDisposable
|
||||
{
|
||||
internal const string Incarnation = "serving-1";
|
||||
internal const long CatalogEpoch = 1;
|
||||
private const string Pepper = "pepper";
|
||||
// Fixed (not ApiKeySecret.Generate) so no CSPRNG value enters the call.
|
||||
private const string KeyId = "00112233aabbccdd";
|
||||
private const string Secret = "v1-real-origin-fixed-secret";
|
||||
|
||||
private readonly FrozenClock _clock = new();
|
||||
private readonly PartitionedSampleHub _hub;
|
||||
private readonly Route _route = new();
|
||||
private readonly DataConnectionAuthenticator _authenticator;
|
||||
private readonly LocalDataServices _services;
|
||||
internal ServingIdentity Serving { get; }
|
||||
|
||||
internal RealOrigin(DataOperations exportOperations = DataOperationSets.V1)
|
||||
{
|
||||
var fence = new DataWriteDispatchFence();
|
||||
var authority = new DataPlaneAuthorityState(fence);
|
||||
var activation = new CatalogActivation(fence);
|
||||
var key = new ApiKey { ApiKeyId = KeyId, Name = "peer", Principal = "peer", SecretHash = ApiKeySecret.ComputeHash(Secret, Pepper), Enabled = true };
|
||||
authority.Apply("cluster", "rev-1", [key],
|
||||
[new NodeAcl { NodeAclId = "grant", ClusterId = "cluster", Principal = "peer", ScopeKind = NodeAclScopeKind.Cluster,
|
||||
PermissionFlags = NodePermissions.Operator }],
|
||||
new Dictionary<AclScopeRef, IReadOnlyList<NodeAclPath>>());
|
||||
var epoch = activation.Begin("rev-1");
|
||||
activation.AuthorityInstalled(epoch, authority.Current.GenerationId);
|
||||
activation.Complete(epoch, true);
|
||||
Serving = new ServingIdentity("node-a", Incarnation, "Primary", epoch, authority.Current.GenerationId, 1);
|
||||
if (Serving.CatalogEpoch != CatalogEpoch) throw new InvalidOperationException("Catalog epoch is no longer deterministic.");
|
||||
var catalog = LocalExportCatalog.Compile(Snapshot(exportOperations), Serving, activation.CaptureAuthority());
|
||||
|
||||
_hub = new PartitionedSampleHub(new DataResourceLimits
|
||||
{
|
||||
PartitionCount = 1, MaxRetainedBytes = 1_000_000, MaxTrackedSources = 100,
|
||||
MaxIngressItemsPerPartition = 100, MaxDirtySourcesPerPartition = 100, MaxControlItemsPerPartition = 100,
|
||||
MaxSnapshotItems = 100, MaxSnapshotBytes = 100_000, MaxSnapshotCatchUpItems = 1,
|
||||
MaxSnapshotLifetime = TimeSpan.FromMinutes(1),
|
||||
}, _clock, autoDrain: false);
|
||||
Publish(catalog, "Speed", DataValue.FromScalar(DataValueKind.Int32, 42));
|
||||
Publish(catalog, "Temperature", DataValue.FromScalar(DataValueKind.Double, 21.5));
|
||||
Publish(catalog, "Label", DataValue.FromScalar(DataValueKind.String, "batch-7"));
|
||||
Publish(catalog, "Running", DataValue.FromScalar(DataValueKind.Boolean, true));
|
||||
Publish(catalog, "Levels", DataValue.FromArray(DataValueKind.UInt16, new object[] { (ushort)1, (ushort)2, (ushort)3 }, [3]));
|
||||
// Flow and HighTemp are deliberately never published (WaitingForInitialData).
|
||||
_hub.ProcessPending();
|
||||
|
||||
var limits = new DataLimits(100, 100, 1_000_000, 100, 10, 1_000_000, TimeSpan.FromSeconds(15), TimeSpan.FromHours(1), TimeSpan.FromMinutes(1));
|
||||
var capabilities = new DataCapabilitiesProvider("cluster", () => Serving, () => catalog.IsActive, limits);
|
||||
var policy = new DataOperationPolicy(authority, new TriePermissionEvaluator(authority.Tries, _clock), _clock);
|
||||
var registry = new WriteOperationRegistry(Incarnation, 16, 16_384, TimeSpan.FromMinutes(1), _clock);
|
||||
var values = new WriteValueBudget(16_384);
|
||||
var bounds = new DriverWriteBounds(TimeSpan.FromMilliseconds(100));
|
||||
var sessionLimits = new SubscriptionSessionLimits(16, 16, 100_000, TimeSpan.FromMinutes(10));
|
||||
var transport = new SubscriptionTransportCapacity(4, 4, 1_000_000, _clock);
|
||||
LocalDataServices? services = null;
|
||||
services = new LocalDataServices(() => catalog, _hub, policy, capabilities, _clock,
|
||||
writes: context => new DataWriteExecutor(context, () => catalog, policy, capabilities, _route, registry, values, _clock, bounds),
|
||||
targetSubscriptions: (context, target) => new LocalSubscriptionService(services!, context, target, new Demand(), sessionLimits, transport));
|
||||
_services = services;
|
||||
_authenticator = new DataConnectionAuthenticator(authority, Options.Create(new ApiKeyOptions { Pepper = Pepper }), _clock);
|
||||
}
|
||||
|
||||
internal IReadOnlyList<string> Dispatched => _route.Dispatched;
|
||||
|
||||
private static DraftSnapshot Snapshot(DataOperations operations)
|
||||
{
|
||||
Tag Tag(string id, string name, string type, TagAccessLevel access = TagAccessLevel.Read, string config = "{}") =>
|
||||
new() { TagId = id, DeviceId = "device-1", Name = name, DataType = type, AccessLevel = access, TagConfig = config };
|
||||
return new DraftSnapshot
|
||||
{
|
||||
GenerationId = 1, ClusterId = "cluster",
|
||||
ServerClusters = [new() { ClusterId = "cluster", Name = "Cluster", Enterprise = "Enterprise", Site = "Site", CreatedBy = "test", RedundancyMode = RedundancyMode.None }],
|
||||
RawFolders = [new() { RawFolderId = "folder-1", ClusterId = "cluster", Name = "Plant" }],
|
||||
DriverInstances = [new() { DriverInstanceId = "driver-1", ClusterId = "cluster", RawFolderId = "folder-1", Name = "Modbus", DriverType = "Modbus", DriverConfig = "{}" }],
|
||||
Devices = [new() { DeviceId = "device-1", DriverInstanceId = "driver-1", Name = "dev1", DeviceConfig = "{}" }],
|
||||
Tags =
|
||||
[
|
||||
Tag("tag-speed", "Speed", "Int32", TagAccessLevel.ReadWrite),
|
||||
Tag("tag-temperature", "Temperature", "Double"),
|
||||
Tag("tag-label", "Label", "String"),
|
||||
Tag("tag-running", "Running", "Boolean"),
|
||||
Tag("tag-levels", "Levels", "UInt16", config: """{"isArray":true,"arrayLength":3}"""),
|
||||
Tag("tag-flow", "Flow", "Double", config: """{"isHistorized":true,"historianTagname":"Plant.Flow"}"""),
|
||||
Tag("tag-hightemp", "HighTemp", "Boolean", config: """{"alarm":{"alarmType":"OffNormalAlarm","severity":700}}"""),
|
||||
],
|
||||
UnsAreas = [new() { UnsAreaId = "area-1", ClusterId = "cluster", Name = "Area1" }],
|
||||
UnsLines = [new() { UnsLineId = "line-1", UnsAreaId = "area-1", Name = "Line1" }],
|
||||
Equipment = [new() { EquipmentId = "equipment-1", UnsLineId = "line-1", Name = "Filler", MachineCode = "F1" }],
|
||||
UnsTagReferences =
|
||||
[
|
||||
new() { UnsTagReferenceId = "ref-speed", EquipmentId = "equipment-1", TagId = "tag-speed" },
|
||||
new() { UnsTagReferenceId = "ref-flow", EquipmentId = "equipment-1", TagId = "tag-flow", DisplayNameOverride = "FlowRate" },
|
||||
new() { UnsTagReferenceId = "ref-levels", EquipmentId = "equipment-1", TagId = "tag-levels" },
|
||||
],
|
||||
DataExports =
|
||||
[
|
||||
new() { DataExportId = "export-raw", ClusterId = "cluster", Enabled = true, Realm = DataRealm.Raw,
|
||||
RootKind = "Cluster", RootEntityId = "cluster", PrincipalId = "peer", AllowedOperations = operations },
|
||||
new() { DataExportId = "export-uns", ClusterId = "cluster", Enabled = true, Realm = DataRealm.Uns,
|
||||
RootKind = "Cluster", RootEntityId = "cluster", PrincipalId = "peer", AllowedOperations = operations },
|
||||
],
|
||||
};
|
||||
}
|
||||
|
||||
private void Publish(LocalExportCatalog catalog, string tag, DataValue value)
|
||||
{
|
||||
using (value)
|
||||
{
|
||||
var source = catalog.Nodes.Single(x => x.EntityKind == "RawTag" && x.Metadata.BrowseName == tag).Source!;
|
||||
var ticket = new SourceTicket(source, new(1, 1));
|
||||
if (!_hub.TryBind(ticket) || !_hub.TryReserveIngress(ticket, value.EstimatedRetainedBytes, out var reservation))
|
||||
throw new InvalidOperationException("Hub refused the fixture sample.");
|
||||
using (reservation!)
|
||||
{
|
||||
var sample = new DataSample(value.Retain(), 0, FrozenClock.Now.AddSeconds(-1), FrozenClock.Now, Serving, 1);
|
||||
if (!reservation!.TryCommit(sample, 1)) { sample.Dispose(); throw new InvalidOperationException("Hub refused the commit."); }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
internal async Task<string> DriveAsync(string scenario, Metadata headers, byte[]? request = null)
|
||||
{
|
||||
var rpc = scenario.Split('/')[0];
|
||||
var bytes = request ?? Convert.FromHexString(GrpcDataV1RealOriginGoldens.Requests[scenario]);
|
||||
var options = new DataConnectionOptions { Enabled = true, ListenPort = 9443, AllowedHosts = ["source.local"], CertificatePath = "server.pem" };
|
||||
using var call = new CancellationTokenSource();
|
||||
using var linked = CancellationTokenSource.CreateLinkedTokenSource(call.Token, TestContext.Current.CancellationToken);
|
||||
var context = new Context(rpc, headers, linked.Token);
|
||||
var http = new DefaultHttpContext();
|
||||
http.Connection.LocalPort = 9443; http.Request.Protocol = "HTTP/2"; http.Request.Scheme = "https"; http.Request.Method = "POST";
|
||||
http.Request.Host = new HostString("source.local", 9443); http.Request.Path = context.Method;
|
||||
http.Items[typeof(DataAuthenticatedContext)] = _authenticator.Authenticate($"{ApiKeySecret.Prefix}_{KeyId}_{Secret}");
|
||||
http.Items[typeof(DataTarget)] = new DataTarget(DataTargetMode.Node, "cluster", "node-a");
|
||||
context.UserState["__HttpContext"] = http;
|
||||
var service = new DataConnectionGrpcService(_services, Options.Create(options), _authenticator);
|
||||
IMessage response = rpc switch
|
||||
{
|
||||
"GetCapabilities" => await service.GetCapabilities(W.CapabilitiesRequest.Parser.ParseFrom(bytes), context),
|
||||
"Browse" => await service.Browse(W.BrowseRequest.Parser.ParseFrom(bytes), context),
|
||||
"GetMetadata" => await service.GetMetadata(W.MetadataRequest.Parser.ParseFrom(bytes), context),
|
||||
"Read" => await service.Read(W.ReadRequest.Parser.ParseFrom(bytes), context),
|
||||
"Write" => await service.Write(W.WriteRequest.Parser.ParseFrom(bytes), context),
|
||||
"Subscribe" => null!,
|
||||
_ => throw new ArgumentOutOfRangeException(nameof(scenario)),
|
||||
};
|
||||
if (rpc != "Subscribe")
|
||||
return GrpcDataV1RealOriginCompatibilityTests.Hex(GrpcDataV1RealOriginCompatibilityTests.Normalise(response).ToByteArray());
|
||||
|
||||
// The v1 client's initial frames: the ack, snapshot begin, the snapshot values, snapshot end. The real session
|
||||
// streams forever, so the "client" cancels the call once it has seen snapshot end.
|
||||
var writer = new Writer(call);
|
||||
var running = service.Subscribe(new V1CompatibilityHarness.Reader(W.SubscriptionCommand.Parser.ParseFrom(bytes)), writer, context);
|
||||
try { await running.WaitAsync(TimeSpan.FromSeconds(30), TestContext.Current.CancellationToken); }
|
||||
catch (Exception) when (writer.SawSnapshotEnd) { }
|
||||
if (!writer.SawSnapshotEnd) throw new InvalidOperationException("Subscribe ended before snapshot end.");
|
||||
return string.Join("|", writer.Frames.Select(f =>
|
||||
GrpcDataV1RealOriginCompatibilityTests.Hex(GrpcDataV1RealOriginCompatibilityTests.Normalise(f).ToByteArray())));
|
||||
}
|
||||
|
||||
public ValueTask DisposeAsync() { _hub.Dispose(); return ValueTask.CompletedTask; }
|
||||
|
||||
/// <summary>Fake physical driver write: every catalog tag routes to one fixed driver route and succeeds.</summary>
|
||||
private sealed class Route : IDataWriteRoute
|
||||
{
|
||||
private readonly System.Collections.Concurrent.ConcurrentQueue<string> _dispatched = new();
|
||||
private readonly LateWriteObserver _observer = new(16, TimeSpan.FromMinutes(1));
|
||||
internal string[] Dispatched => _dispatched.ToArray();
|
||||
public bool TryResolve(DataView view, out WriteRouteTarget? target)
|
||||
{
|
||||
target = new("driver-1", view.Address.Identifier, "driver-incarnation", 1, 1);
|
||||
return true;
|
||||
}
|
||||
public Task<DataWriteOutcome> DispatchAsync(WriteAdmissionTicket ticket, WriteClaim claim, CancellationToken ct)
|
||||
{
|
||||
if (!_observer.TryReserve(out var reservation)) throw new InvalidOperationException("Observer exhausted.");
|
||||
// Same order as the driver host: observe the physical call, mark dispatched, then let it complete.
|
||||
var physical = new TaskCompletionSource<DataWriteOutcome>(TaskCreationOptions.RunContinuationsAsynchronously);
|
||||
reservation!.Observe(physical.Task, claim, ticket);
|
||||
_dispatched.Enqueue(ticket.Proof.Admission.OperationId);
|
||||
if (!claim.TryMarkDispatched()) throw new InvalidOperationException("Claim refused dispatch.");
|
||||
var outcome = new DataWriteOutcome(DataWriteState.DriverConfirmedSuccess, 0, null);
|
||||
physical.TrySetResult(outcome);
|
||||
return Task.FromResult(outcome);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Fake physical upstream acquisition: Good, settings unrevised.</summary>
|
||||
private sealed class Demand : ISubscriptionDemandSource
|
||||
{
|
||||
public ValueTask<SubscriptionDemandResult> AcquireAsync(SubscriptionAuthorizedView view, DataSubscriptionSettings settings,
|
||||
CancellationToken cancellationToken) => ValueTask.FromResult(new SubscriptionDemandResult(DataItemStatus.Good, settings, 1, new Lease()));
|
||||
private sealed class Lease : IDisposable { public void Dispose() { } }
|
||||
}
|
||||
|
||||
private sealed class Writer(CancellationTokenSource call) : IServerStreamWriter<W.SubscriptionFrame>
|
||||
{
|
||||
private readonly object _lock = new();
|
||||
public List<W.SubscriptionFrame> Frames { get; } = [];
|
||||
public bool SawSnapshotEnd { get; private set; }
|
||||
public WriteOptions? WriteOptions { get; set; }
|
||||
public Task WriteAsync(W.SubscriptionFrame frame)
|
||||
{
|
||||
lock (_lock)
|
||||
{
|
||||
if (SawSnapshotEnd) return Task.CompletedTask;
|
||||
Frames.Add(frame.Clone());
|
||||
if (frame.FrameCase == W.SubscriptionFrame.FrameOneofCase.Control && frame.Control.Kind == (int)DataStreamControlKind.SnapshotEnd)
|
||||
{ SawSnapshotEnd = true; call.Cancel(); }
|
||||
}
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
public Task WriteAsync(W.SubscriptionFrame frame, CancellationToken cancellationToken) => WriteAsync(frame);
|
||||
}
|
||||
|
||||
private sealed class Context(string rpc, Metadata headers, CancellationToken token) : ServerCallContext
|
||||
{
|
||||
protected override string MethodCore => DataConnectionEndpoints.ServicePrefix + rpc;
|
||||
protected override string HostCore => "source.local";
|
||||
protected override string PeerCore => "ipv4:127.0.0.1:0";
|
||||
protected override DateTime DeadlineCore => DateTime.MaxValue;
|
||||
protected override Metadata RequestHeadersCore => headers;
|
||||
protected override CancellationToken CancellationTokenCore => token;
|
||||
protected override Metadata ResponseTrailersCore { get; } = [];
|
||||
protected override Status StatusCore { get; set; }
|
||||
protected override WriteOptions? WriteOptionsCore { get; set; }
|
||||
protected override AuthContext AuthContextCore => new(null, new Dictionary<string, List<AuthProperty>>());
|
||||
protected override ContextPropagationToken CreatePropagationTokenCore(ContextPropagationOptions? options) => throw new NotSupportedException();
|
||||
protected override Task WriteResponseHeadersAsyncCore(Metadata responseHeaders) => Task.CompletedTask;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>A clock that never moves and never fires a timer, so every age, lease and timestamp is fixed.</summary>
|
||||
internal sealed class FrozenClock : TimeProvider
|
||||
{
|
||||
internal static readonly DateTimeOffset Now = new(2026, 11, 23, 12, 0, 0, TimeSpan.Zero);
|
||||
public override DateTimeOffset GetUtcNow() => Now;
|
||||
public override long GetTimestamp() => Now.UtcTicks;
|
||||
public override long TimestampFrequency => TimeSpan.TicksPerSecond;
|
||||
public override ITimer CreateTimer(TimerCallback callback, object? state, TimeSpan dueTime, TimeSpan period) => new Never();
|
||||
private sealed class Never : ITimer
|
||||
{
|
||||
public bool Change(TimeSpan dueTime, TimeSpan period) => true;
|
||||
public void Dispose() { }
|
||||
public ValueTask DisposeAsync() => ValueTask.CompletedTask;
|
||||
}
|
||||
}
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
namespace ZB.MOM.WW.OtOpcUa.Host.Tests.DataConnections;
|
||||
|
||||
/// <summary>
|
||||
/// Golden bytes recorded by <see cref="GrpcDataV1RealOriginCompatibilityTests"/> against the REAL origin stack on
|
||||
/// pre-H2 master <c>1086593a</c> (#918). Uppercase hex of <c>ToByteArray()</c>; Subscribe frames are joined with '|'.
|
||||
/// NEVER re-record these to make a later phase (H2, A2, A3, ...) pass: a difference is a v1 wire regression of the
|
||||
/// real origin, not a stale golden. A later phase extends <see cref="RealOrigin"/>'s snapshot with its new-shape data
|
||||
/// and must still produce these exact bytes for a headerless (and, while unsupported, a feature-requesting) v1 call.
|
||||
/// </summary>
|
||||
internal static class GrpcDataV1RealOriginGoldens
|
||||
{
|
||||
internal static readonly IReadOnlyDictionary<string, string> Requests = new Dictionary<string, string>
|
||||
{
|
||||
["GetCapabilities"] = "08011005",
|
||||
["Browse"] = "0A570A400A07636C7573746572121A68747470733A2F2F7A622E636F6D2F6F746F706375612F7261771A06737472696E672211506C616E742F4D6F646275732F6465763110012A11506C616E742F4D6F646275732F64657631220B0880E1EB17101018808004",
|
||||
["Browse/uns"] = "0A520A3A0A07636C7573746572121A68747470733A2F2F7A622E636F6D2F6F746F706375612F756E731A06737472696E67220B65717569706D656E742D3110022A1241726561312F4C696E65312F46696C6C6572220B0880E1EB17101018808004",
|
||||
["GetMetadata"] = "0A630A460A07636C7573746572121A68747470733A2F2F7A622E636F6D2F6F746F706375612F7261771A06737472696E672217506C616E742F4D6F646275732F646576312F537065656410012A17506C616E742F4D6F646275732F646576312F53706565640A6F0A4C0A07636C7573746572121A68747470733A2F2F7A622E636F6D2F6F746F706375612F7261771A06737472696E67221D506C616E742F4D6F646275732F646576312F54656D706572617475726510012A1D506C616E742F4D6F646275732F646576312F54656D70657261747572650A630A460A07636C7573746572121A68747470733A2F2F7A622E636F6D2F6F746F706375612F7261771A06737472696E672217506C616E742F4D6F646275732F646576312F4C6162656C10012A17506C616E742F4D6F646275732F646576312F4C6162656C0A670A480A07636C7573746572121A68747470733A2F2F7A622E636F6D2F6F746F706375612F7261771A06737472696E672219506C616E742F4D6F646275732F646576312F52756E6E696E6710012A19506C616E742F4D6F646275732F646576312F52756E6E696E670A650A470A07636C7573746572121A68747470733A2F2F7A622E636F6D2F6F746F706375612F7261771A06737472696E672218506C616E742F4D6F646275732F646576312F4C6576656C7310012A18506C616E742F4D6F646275732F646576312F4C6576656C730A610A450A07636C7573746572121A68747470733A2F2F7A622E636F6D2F6F746F706375612F7261771A06737472696E672216506C616E742F4D6F646275732F646576312F466C6F7710012A16506C616E742F4D6F646275732F646576312F466C6F770A690A490A07636C7573746572121A68747470733A2F2F7A622E636F6D2F6F746F706375612F7261771A06737472696E67221A506C616E742F4D6F646275732F646576312F4869676854656D7010012A1A506C616E742F4D6F646275732F646576312F4869676854656D700A650A470A07636C7573746572121A68747470733A2F2F7A622E636F6D2F6F746F706375612F756E731A06737472696E67221841726561312F4C696E65312F46696C6C65722F537065656410022A1841726561312F4C696E65312F46696C6C65722F53706565640A6B0A4A0A07636C7573746572121A68747470733A2F2F7A622E636F6D2F6F746F706375612F756E731A06737472696E67221B41726561312F4C696E65312F46696C6C65722F466C6F775261746510022A1B41726561312F4C696E65312F46696C6C65722F466C6F77526174650A670A480A07636C7573746572121A68747470733A2F2F7A622E636F6D2F6F746F706375612F756E731A06737472696E67221941726561312F4C696E65312F46696C6C65722F4C6576656C7310022A1941726561312F4C696E65312F46696C6C65722F4C6576656C730A670A480A07636C7573746572121A68747470733A2F2F7A622E636F6D2F6F746F706375612F7261771A06737472696E672219506C616E742F4D6F646275732F646576312F4D697373696E6710012A19506C616E742F4D6F646275732F646576312F4D697373696E67120B0880E1EB17101018808004",
|
||||
["Read"] = "0A730A07722D737065656412630A460A07636C7573746572121A68747470733A2F2F7A622E636F6D2F6F746F706375612F7261771A06737472696E672217506C616E742F4D6F646275732F646576312F537065656410012A17506C616E742F4D6F646275732F646576312F53706565641880DAC4090A790A06722D74656D70126F0A4C0A07636C7573746572121A68747470733A2F2F7A622E636F6D2F6F746F706375612F7261771A06737472696E67221D506C616E742F4D6F646275732F646576312F54656D706572617475726510012A1D506C616E742F4D6F646275732F646576312F54656D70657261747572650A6E0A07722D6C6162656C12630A460A07636C7573746572121A68747470733A2F2F7A622E636F6D2F6F746F706375612F7261771A06737472696E672217506C616E742F4D6F646275732F646576312F4C6162656C10012A17506C616E742F4D6F646275732F646576312F4C6162656C0A740A09722D72756E6E696E6712670A480A07636C7573746572121A68747470733A2F2F7A622E636F6D2F6F746F706375612F7261771A06737472696E672219506C616E742F4D6F646275732F646576312F52756E6E696E6710012A19506C616E742F4D6F646275732F646576312F52756E6E696E670A710A08722D6C6576656C7312650A470A07636C7573746572121A68747470733A2F2F7A622E636F6D2F6F746F706375612F7261771A06737472696E672218506C616E742F4D6F646275732F646576312F4C6576656C7310012A18506C616E742F4D6F646275732F646576312F4C6576656C730A6B0A06722D666C6F7712610A450A07636C7573746572121A68747470733A2F2F7A622E636F6D2F6F746F706375612F7261771A06737472696E672216506C616E742F4D6F646275732F646576312F466C6F7710012A16506C616E742F4D6F646275732F646576312F466C6F770A740A0B722D756E732D737065656412650A470A07636C7573746572121A68747470733A2F2F7A622E636F6D2F6F746F706375612F756E731A06737472696E67221841726561312F4C696E65312F46696C6C65722F537065656410022A1841726561312F4C696E65312F46696C6C65722F53706565640A740A09722D6D697373696E6712670A480A07636C7573746572121A68747470733A2F2F7A622E636F6D2F6F746F706375612F7261771A06737472696E672219506C616E742F4D6F646275732F646576312F4D697373696E6710012A19506C616E742F4D6F646275732F646576312F4D697373696E67120B0880E1EB17101018808004",
|
||||
["Write"] = "0A8E010A05772D72617712066F702D7261771A630A460A07636C7573746572121A68747470733A2F2F7A622E636F6D2F6F746F706375612F7261771A06737472696E672217506C616E742F4D6F646275732F646576312F537065656410012A17506C616E742F4D6F646275732F646576312F53706565642204080518222801320973657276696E672D313880B4891340010A90010A05772D756E7312066F702D756E731A650A470A07636C7573746572121A68747470733A2F2F7A622E636F6D2F6F746F706375612F756E731A06737472696E67221841726561312F4C696E65312F46696C6C65722F537065656410022A1841726561312F4C696E65312F46696C6C65722F53706565642204080518242801320973657276696E672D313880B4891340010AAB010A0A772D726561646F6E6C79120B6F702D726561646F6E6C791A6F0A4C0A07636C7573746572121A68747470733A2F2F7A622E636F6D2F6F746F706375612F7261771A06737472696E67221D506C616E742F4D6F646275732F646576312F54656D706572617475726510012A1D506C616E742F4D6F646275732F646576312F54656D7065726174757265220B080C31000000000000F83F2801320973657276696E672D313880B4891340010A9D010A09772D6D697373696E67120A6F702D6D697373696E671A670A480A07636C7573746572121A68747470733A2F2F7A622E636F6D2F6F746F706375612F7261771A06737472696E672219506C616E742F4D6F646275732F646576312F4D697373696E6710012A19506C616E742F4D6F646275732F646576312F4D697373696E672207080D3A036162632801320973657276696E672D313880B489134001120B0880E1EB17101018808004",
|
||||
["Subscribe"] = "0A057375622D3110011A066F70656E2D312080E1EB172AA9040A7F0A0A6974656D2D737065656412630A460A07636C7573746572121A68747470733A2F2F7A622E636F6D2F6F746F706375612F7261771A06737472696E672217506C616E742F4D6F646275732F646576312F537065656410012A17506C616E742F4D6F646275732F646576312F53706565641A0C08C096B1021080ADE20418020A85010A0E6974656D2D756E732D737065656412650A470A07636C7573746572121A68747470733A2F2F7A622E636F6D2F6F746F706375612F756E731A06737472696E67221841726561312F4C696E65312F46696C6C65722F537065656410022A1841726561312F4C696E65312F46696C6C65722F53706565641A0C08C096B1021080ADE20418020A82010A0B6974656D2D6C6576656C7312650A470A07636C7573746572121A68747470733A2F2F7A622E636F6D2F6F746F706375612F7261771A06737472696E672218506C616E742F4D6F646275732F646576312F4C6576656C7310012A18506C616E742F4D6F646275732F646576312F4C6576656C731A0C0880ADE2041080ADE20418020A85010A0C6974656D2D6D697373696E6712670A480A07636C7573746572121A68747470733A2F2F7A622E636F6D2F6F746F706375612F7261771A06737472696E672219506C616E742F4D6F646275732F646576312F4D697373696E6710012A19506C616E742F4D6F646275732F646576312F4D697373696E671A0C0880ADE2041080ADE20418021880BCC1960B220B0880E1EB17101018808004",
|
||||
};
|
||||
|
||||
internal static readonly IReadOnlyDictionary<string, string> Responses = new Dictionary<string, string>
|
||||
{
|
||||
["GetCapabilities"] = "080110051A220A066E6F64652D61120973657276696E672D311A075072696D6172792001280130012001281F32110102030405060708090A0B0C0D0E0F10113A260864106418C0843D2064280A30C0843D3880A3C3474080D0918E860148808C8D9E0250A08D06400148015207636C75737465725801600168017801",
|
||||
["Browse"] = "0A570A400A07636C7573746572121A68747470733A2F2F7A622E636F6D2F6F746F706375612F7261771A06737472696E672211506C616E742F4D6F646275732F6465763110012A11506C616E742F4D6F646275732F6465763110011AA6010A610A450A07636C7573746572121A68747470733A2F2F7A622E636F6D2F6F746F706375612F7261771A06737472696E672216506C616E742F4D6F646275732F646576312F466C6F7710012A16506C616E742F4D6F646275732F646576312F466C6F771204466C6F771A085661726961626C65200C28FFFFFFFFFFFFFFFFFF01401748015220383A6472697665722D31506C616E742F4D6F646275732F646576312F466C6F771AB6010A690A490A07636C7573746572121A68747470733A2F2F7A622E636F6D2F6F746F706375612F7261771A06737472696E67221A506C616E742F4D6F646275732F646576312F4869676854656D7010012A1A506C616E742F4D6F646275732F646576312F4869676854656D7012084869676854656D701A085661726961626C65200228FFFFFFFFFFFFFFFFFF01401748015224383A6472697665722D31506C616E742F4D6F646275732F646576312F4869676854656D701AAA010A630A460A07636C7573746572121A68747470733A2F2F7A622E636F6D2F6F746F706375612F7261771A06737472696E672217506C616E742F4D6F646275732F646576312F4C6162656C10012A17506C616E742F4D6F646275732F646576312F4C6162656C12054C6162656C1A085661726961626C65200D28FFFFFFFFFFFFFFFFFF01401748015221383A6472697665722D31506C616E742F4D6F646275732F646576312F4C6162656C1AAA010A650A470A07636C7573746572121A68747470733A2F2F7A622E636F6D2F6F746F706375612F7261771A06737472696E672218506C616E742F4D6F646275732F646576312F4C6576656C7310012A18506C616E742F4D6F646275732F646576312F4C6576656C7312064C6576656C731A085661726961626C6520112801320103401748015222383A6472697665722D31506C616E742F4D6F646275732F646576312F4C6576656C7368081AB2010A670A480A07636C7573746572121A68747470733A2F2F7A622E636F6D2F6F746F706375612F7261771A06737472696E672219506C616E742F4D6F646275732F646576312F52756E6E696E6710012A19506C616E742F4D6F646275732F646576312F52756E6E696E67120752756E6E696E671A085661726961626C65200228FFFFFFFFFFFFFFFFFF01401748015223383A6472697665722D31506C616E742F4D6F646275732F646576312F52756E6E696E671AAC010A630A460A07636C7573746572121A68747470733A2F2F7A622E636F6D2F6F746F706375612F7261771A06737472696E672217506C616E742F4D6F646275732F646576312F537065656410012A17506C616E742F4D6F646275732F646576312F5370656564120553706565641A085661726961626C65200528FFFFFFFFFFFFFFFFFF013801401F48015221383A6472697665722D31506C616E742F4D6F646275732F646576312F53706565641AC2010A6F0A4C0A07636C7573746572121A68747470733A2F2F7A622E636F6D2F6F746F706375612F7261771A06737472696E67221D506C616E742F4D6F646275732F646576312F54656D706572617475726510012A1D506C616E742F4D6F646275732F646576312F54656D7065726174757265120B54656D70657261747572651A085661726961626C65200C28FFFFFFFFFFFFFFFFFF01401748015227383A6472697665722D31506C616E742F4D6F646275732F646576312F54656D706572617475726520013209080110011880A3C3473A220A066E6F64652D61120973657276696E672D311A075072696D617279200128013001",
|
||||
["Browse/uns"] = "0A520A3A0A07636C7573746572121A68747470733A2F2F7A622E636F6D2F6F746F706375612F756E731A06737472696E67220B65717569706D656E742D3110022A1241726561312F4C696E65312F46696C6C657210011AB4010A6B0A4A0A07636C7573746572121A68747470733A2F2F7A622E636F6D2F6F746F706375612F756E731A06737472696E67221B41726561312F4C696E65312F46696C6C65722F466C6F775261746510022A1B41726561312F4C696E65312F46696C6C65722F466C6F77526174651208466C6F77526174651A085661726961626C65200C28FFFFFFFFFFFFFFFFFF01401748015220383A6472697665722D31506C616E742F4D6F646275732F646576312F466C6F771AAC010A670A480A07636C7573746572121A68747470733A2F2F7A622E636F6D2F6F746F706375612F756E731A06737472696E67221941726561312F4C696E65312F46696C6C65722F4C6576656C7310022A1941726561312F4C696E65312F46696C6C65722F4C6576656C7312064C6576656C731A085661726961626C6520112801320103401748015222383A6472697665722D31506C616E742F4D6F646275732F646576312F4C6576656C7368081AAE010A650A470A07636C7573746572121A68747470733A2F2F7A622E636F6D2F6F746F706375612F756E731A06737472696E67221841726561312F4C696E65312F46696C6C65722F537065656410022A1841726561312F4C696E65312F46696C6C65722F5370656564120553706565641A085661726961626C65200528FFFFFFFFFFFFFFFFFF013801401F48015221383A6472697665722D31506C616E742F4D6F646275732F646576312F537065656420013209080110011880A3C3473A220A066E6F64652D61120973657276696E672D311A075072696D617279200128013001",
|
||||
["GetMetadata"] = "0ABF010A013010011AAC010A630A460A07636C7573746572121A68747470733A2F2F7A622E636F6D2F6F746F706375612F7261771A06737472696E672217506C616E742F4D6F646275732F646576312F537065656410012A17506C616E742F4D6F646275732F646576312F5370656564120553706565641A085661726961626C65200528FFFFFFFFFFFFFFFFFF013801401F48015221383A6472697665722D31506C616E742F4D6F646275732F646576312F53706565642A09080110011880A3C3470AD5010A013110011AC2010A6F0A4C0A07636C7573746572121A68747470733A2F2F7A622E636F6D2F6F746F706375612F7261771A06737472696E67221D506C616E742F4D6F646275732F646576312F54656D706572617475726510012A1D506C616E742F4D6F646275732F646576312F54656D7065726174757265120B54656D70657261747572651A085661726961626C65200C28FFFFFFFFFFFFFFFFFF01401748015227383A6472697665722D31506C616E742F4D6F646275732F646576312F54656D70657261747572652A09080110011880A3C3470ABD010A013210011AAA010A630A460A07636C7573746572121A68747470733A2F2F7A622E636F6D2F6F746F706375612F7261771A06737472696E672217506C616E742F4D6F646275732F646576312F4C6162656C10012A17506C616E742F4D6F646275732F646576312F4C6162656C12054C6162656C1A085661726961626C65200D28FFFFFFFFFFFFFFFFFF01401748015221383A6472697665722D31506C616E742F4D6F646275732F646576312F4C6162656C2A09080110011880A3C3470AC5010A013310011AB2010A670A480A07636C7573746572121A68747470733A2F2F7A622E636F6D2F6F746F706375612F7261771A06737472696E672219506C616E742F4D6F646275732F646576312F52756E6E696E6710012A19506C616E742F4D6F646275732F646576312F52756E6E696E67120752756E6E696E671A085661726961626C65200228FFFFFFFFFFFFFFFFFF01401748015223383A6472697665722D31506C616E742F4D6F646275732F646576312F52756E6E696E672A09080110011880A3C3470ABD010A013410011AAA010A650A470A07636C7573746572121A68747470733A2F2F7A622E636F6D2F6F746F706375612F7261771A06737472696E672218506C616E742F4D6F646275732F646576312F4C6576656C7310012A18506C616E742F4D6F646275732F646576312F4C6576656C7312064C6576656C731A085661726961626C6520112801320103401748015222383A6472697665722D31506C616E742F4D6F646275732F646576312F4C6576656C7368082A09080110011880A3C3470AB9010A013510011AA6010A610A450A07636C7573746572121A68747470733A2F2F7A622E636F6D2F6F746F706375612F7261771A06737472696E672216506C616E742F4D6F646275732F646576312F466C6F7710012A16506C616E742F4D6F646275732F646576312F466C6F771204466C6F771A085661726961626C65200C28FFFFFFFFFFFFFFFFFF01401748015220383A6472697665722D31506C616E742F4D6F646275732F646576312F466C6F772A09080110011880A3C3470AC9010A013610011AB6010A690A490A07636C7573746572121A68747470733A2F2F7A622E636F6D2F6F746F706375612F7261771A06737472696E67221A506C616E742F4D6F646275732F646576312F4869676854656D7010012A1A506C616E742F4D6F646275732F646576312F4869676854656D7012084869676854656D701A085661726961626C65200228FFFFFFFFFFFFFFFFFF01401748015224383A6472697665722D31506C616E742F4D6F646275732F646576312F4869676854656D702A09080110011880A3C3470AC1010A013710011AAE010A650A470A07636C7573746572121A68747470733A2F2F7A622E636F6D2F6F746F706375612F756E731A06737472696E67221841726561312F4C696E65312F46696C6C65722F537065656410022A1841726561312F4C696E65312F46696C6C65722F5370656564120553706565641A085661726961626C65200528FFFFFFFFFFFFFFFFFF013801401F48015221383A6472697665722D31506C616E742F4D6F646275732F646576312F53706565642A09080110011880A3C3470AC7010A013810011AB4010A6B0A4A0A07636C7573746572121A68747470733A2F2F7A622E636F6D2F6F746F706375612F756E731A06737472696E67221B41726561312F4C696E65312F46696C6C65722F466C6F775261746510022A1B41726561312F4C696E65312F46696C6C65722F466C6F77526174651208466C6F77526174651A085661726961626C65200C28FFFFFFFFFFFFFFFFFF01401748015220383A6472697665722D31506C616E742F4D6F646275732F646576312F466C6F772A09080110011880A3C3470ABF010A013910011AAC010A670A480A07636C7573746572121A68747470733A2F2F7A622E636F6D2F6F746F706375612F756E731A06737472696E67221941726561312F4C696E65312F46696C6C65722F4C6576656C7310022A1941726561312F4C696E65312F46696C6C65722F4C6576656C7312064C6576656C731A085661726961626C6520112801320103401748015222383A6472697665722D31506C616E742F4D6F646275732F646576312F4C6576656C7368082A09080110011880A3C3470A060A023130100312220A066E6F64652D61120973657276696E672D311A075072696D617279200128013001",
|
||||
["Read"] = "0A4D0A07722D73706565641001180120002A3C0A04080518541A0608BFD590D806220608C0D590D8062A220A066E6F64652D61120973657276696E672D311A075072696D61727920012801300130010A530A06722D74656D701001180120002A430A0B080C3100000000008035401A0608BFD590D806220608C0D590D8062A220A066E6F64652D61120973657276696E672D311A075072696D61727920012801300130010A540A07722D6C6162656C1001180120002A430A0B080D3A0762617463682D371A0608BFD590D806220608C0D590D8062A220A066E6F64652D61120973657276696E672D311A075072696D61727920012801300130010A4F0A09722D72756E6E696E671001180120002A3C0A04080210011A0608BFD590D806220608C0D590D8062A220A066E6F64652D61120973657276696E672D311A075072696D61727920012801300130010A650A08722D6C6576656C731001180120002A530A1B08115A1708081201031A04080820011A04080820021A04080820031A0608BFD590D806220608C0D590D8062A220A066E6F64652D61120973657276696E672D311A075072696D61727920012801300130010A0C0A06722D666C6F77100718020A510A0B722D756E732D73706565641001180120002A3C0A04080518541A0608BFD590D806220608C0D590D8062A220A066E6F64652D61120973657276696E672D311A075072696D61727920012801300130010A0F0A09722D6D697373696E671003180312220A066E6F64652D61120973657276696E672D311A075072696D617279200128013001",
|
||||
["Write"] = "0A090A05772D72617710020A090A05772D756E7310020A420A0A772D726561646F6E6C791001188080C48108222C577269746520756E617661696C61626C65206F722064656E696564206265666F72652064697370617463682E0A410A09772D6D697373696E671001188080C48108222C577269746520756E617661696C61626C65206F722064656E696564206265666F72652064697370617463682E12220A066E6F64652D61120973657276696E672D311A075072696D617279200128013001",
|
||||
// Ack (4 items: raw, UNS, array, NotFound), SnapshotBegin, one Values frame per item, SnapshotEnd.
|
||||
["Subscribe"] = "0A057375622D311001180122A6010A066F70656E2D31122B0A0A6974656D2D737065656410011A0D0A057375622D31100118012001220C08C096B1021080ADE2041802122F0A0E6974656D2D756E732D737065656410011A0D0A057375622D31100118022001220C08C096B1021080ADE2041802122C0A0B6974656D2D6C6576656C7310011A0D0A057375622D31100118032001220C0880ADE2041080ADE204180212100A0C6974656D2D6D697373696E67100342220A066E6F64652D61120973657276696E672D311A075072696D617279200128013001|0A057375622D31100118022A0A0801120210051801200142220A066E6F64652D61120973657276696E672D311A075072696D617279200128013001|0A057375622D31100118033255080112510A0D0A057375622D31100118012001123C0A04080518541A0608BFD590D806220608C0D590D8062A220A066E6F64652D61120973657276696E672D311A075072696D61727920012801300130011800200142220A066E6F64652D61120973657276696E672D311A075072696D617279200128013001|0A057375622D31100118043255080112510A0D0A057375622D31100118022001123C0A04080518541A0608BFD590D806220608C0D590D8062A220A066E6F64652D61120973657276696E672D311A075072696D61727920012801300130011800200142220A066E6F64652D61120973657276696E672D311A075072696D617279200128013001|0A057375622D3110011805326C080112680A0D0A057375622D3110011803200112530A1B08115A1708081201031A04080820011A04080820021A04080820031A0608BFD590D806220608C0D590D8062A220A066E6F64652D61120973657276696E672D311A075072696D61727920012801300130011800200142220A066E6F64652D61120973657276696E672D311A075072696D617279200128013001|0A057375622D31100118062A0A0802120210051801200142220A066E6F64652D61120973657276696E672D311A075072696D617279200128013001",
|
||||
// The Write request against an origin whose exports lack Write (every item RejectedBeforeDispatch).
|
||||
["Write/no-write-grant"] = "0A330A05772D7261771001188080C481082222577269746520756E617661696C61626C65206265666F72652064697370617463682E0A330A05772D756E731001188080C481082222577269746520756E617661696C61626C65206265666F72652064697370617463682E0A380A0A772D726561646F6E6C791001188080C481082222577269746520756E617661696C61626C65206265666F72652064697370617463682E0A370A09772D6D697373696E671001188080C481082222577269746520756E617661696C61626C65206265666F72652064697370617463682E12220A066E6F64652D61120973657276696E672D311A075072696D617279200128013001",
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user