diff --git a/src/Core/ZB.MOM.WW.OtOpcUa.Configuration/Validation/DataConnectionValidator.cs b/src/Core/ZB.MOM.WW.OtOpcUa.Configuration/Validation/DataConnectionValidator.cs
index 28178c3ea..00990a538 100644
--- a/src/Core/ZB.MOM.WW.OtOpcUa.Configuration/Validation/DataConnectionValidator.cs
+++ b/src/Core/ZB.MOM.WW.OtOpcUa.Configuration/Validation/DataConnectionValidator.cs
@@ -21,9 +21,10 @@ public static class DataConnectionValidator
///
/// Node-side re-validation of an already-deployed artifact (artifact parse, origin catalog compile). Identical to
- /// except that operation bits this build does not understand are IGNORED
- /// rather than rejected (X0 tolerant reader): a newer central may author them, and rejecting would take down every
- /// data connection/export on the node. Each consumer of the rows keeps only the bits it understands (fail closed).
+ /// except that the X0-RESERVED operation bits ()
+ /// are IGNORED rather than rejected: a newer central may author them, and rejecting would take down every data
+ /// connection/export on the node. Each consumer of the rows keeps only the bits it understands (fail closed). A bit
+ /// outside both sets is still a malformed row (nothing can author it).
///
public static IReadOnlyList ValidateDeployed(DraftSnapshot draft) => Validate(draft, deployed: true);
@@ -33,8 +34,8 @@ public static class DataConnectionValidator
var errors = new List();
void Add(string code, string id, string message) => errors.Add(new(code, message, id));
bool Same(string? a, string? b) => Ids.Equals(a, b);
- bool ValidOps(DataOperations operations) => operations != DataOperations.None &&
- (deployed || (operations & ~KnownOperations) == 0);
+ var accepted = deployed ? KnownOperations | DataOperationSets.Reserved : KnownOperations;
+ bool ValidOps(DataOperations operations) => operations != DataOperations.None && (operations & ~accepted) == 0;
DataOperations Understood(DataOperations operations) => deployed ? operations & DataOperationSets.Understood : operations;
bool NodesValid(IEnumerable ids, string owner)
{
diff --git a/src/Server/ZB.MOM.WW.OtOpcUa.Host/Configuration/DataConnectionRegistration.cs b/src/Server/ZB.MOM.WW.OtOpcUa.Host/Configuration/DataConnectionRegistration.cs
index 57674882d..d4fbb71fb 100644
--- a/src/Server/ZB.MOM.WW.OtOpcUa.Host/Configuration/DataConnectionRegistration.cs
+++ b/src/Server/ZB.MOM.WW.OtOpcUa.Host/Configuration/DataConnectionRegistration.cs
@@ -212,7 +212,11 @@ public static class DataConnectionRegistration
var eligible = state.Generation > 0 && Enum.TryParse(state.Role, out var actual)
&& DataConnectionRoleAdapter.MayAcquire(mode, state.WarmRole, actual);
return new DataConnectionConsumerRoleSnapshot(mode, eligible, state.Generation);
- }, logger: sp.GetService()?.CreateLogger());
+ })
+ {
+ Logger = (Microsoft.Extensions.Logging.ILogger?)sp.GetService()?.CreateLogger()
+ ?? Microsoft.Extensions.Logging.Abstractions.NullLogger.Instance,
+ };
return runtime;
});
services.AddSingleton(sp =>
diff --git a/src/Server/ZB.MOM.WW.OtOpcUa.Runtime/DataConnections/DataConnectionDeploymentRuntime.cs b/src/Server/ZB.MOM.WW.OtOpcUa.Runtime/DataConnections/DataConnectionDeploymentRuntime.cs
index 3ea562e36..513345b26 100644
--- a/src/Server/ZB.MOM.WW.OtOpcUa.Runtime/DataConnections/DataConnectionDeploymentRuntime.cs
+++ b/src/Server/ZB.MOM.WW.OtOpcUa.Runtime/DataConnections/DataConnectionDeploymentRuntime.cs
@@ -49,7 +49,8 @@ public sealed class DataConnectionDeploymentRuntime : IAsyncDisposable
UnknownOperationsCounterName, unit: "{row}",
description: "Data-connection rows carrying operation bits this node does not understand; the bits were dropped (no grant).");
private readonly object _sync = new();
- private readonly ILogger _log;
+ /// Diagnostics sink for the X0 dropped-operation warning; optional (an init property keeps the constructor shape).
+ public ILogger Logger { private get; init; } = NullLogger.Instance;
private IReadOnlyDictionary _droppedOperations = new Dictionary();
private long _unknownOperationRows;
private readonly string _node, _owner;
@@ -76,9 +77,8 @@ public sealed class DataConnectionDeploymentRuntime : IAsyncDisposable
public DataConnectionDeploymentRuntime(string nodeId, string ownerCluster, IDataConnectionSecurityProvider security,
IDataConnectionScopeActivator scopeActivator, int maxConnections, TimeProvider? clock = null,
Func? consumerMayAcquire = null, bool useCompactBatches = true,
- Func? consumerRoleSnapshot = null, ILogger? logger = null)
+ Func? consumerRoleSnapshot = null)
{
- _log = logger ?? NullLogger.Instance;
ArgumentException.ThrowIfNullOrWhiteSpace(nodeId); ArgumentException.ThrowIfNullOrWhiteSpace(ownerCluster);
if (maxConnections <= 0) throw new ArgumentOutOfRangeException(nameof(maxConnections));
_node = nodeId; _owner = ownerCluster; _security = security ?? throw new ArgumentNullException(nameof(security));
@@ -226,7 +226,7 @@ public sealed class DataConnectionDeploymentRuntime : IAsyncDisposable
foreach (var (id, bits) in dropped)
{
UnknownOperationsCounter.Add(1);
- _log.LogWarning("Data connection {DataConnectionId} in artifact {ArtifactRevision} grants operation bits {UnknownOperations} " +
+ Logger.LogWarning("Data connection {DataConnectionId} in artifact {ArtifactRevision} grants operation bits {UnknownOperations} " +
"this node does not implement; they were dropped (no grant). Upgrade this node before relying on them.",
id, revision, (int)bits);
}
diff --git a/tests/Core/ZB.MOM.WW.OtOpcUa.Configuration.Tests/DataConnections/GrpcDataReservedOperationAuthoringTests.cs b/tests/Core/ZB.MOM.WW.OtOpcUa.Configuration.Tests/DataConnections/GrpcDataReservedOperationAuthoringTests.cs
index c440f8ca4..bca7eaff3 100644
--- a/tests/Core/ZB.MOM.WW.OtOpcUa.Configuration.Tests/DataConnections/GrpcDataReservedOperationAuthoringTests.cs
+++ b/tests/Core/ZB.MOM.WW.OtOpcUa.Configuration.Tests/DataConnections/GrpcDataReservedOperationAuthoringTests.cs
@@ -13,7 +13,7 @@ namespace ZB.MOM.WW.OtOpcUa.Configuration.Tests.DataConnections;
[Trait("Category", "Unit"), Trait("Feature", "GrpcData"), Trait("Phase", "X0")]
public sealed class GrpcDataReservedOperationAuthoringTests
{
- public static TheoryData ReservedBits => new(32, 64, 128, 256, 512, 1 << 20);
+ public static TheoryData ReservedBits => new(32, 64, 128, 256, 512);
[Theory]
[MemberData(nameof(ReservedBits))]
@@ -47,6 +47,21 @@ public sealed class GrpcDataReservedOperationAuthoringTests
DataConnectionValidator.ValidateDeployed(wider).ShouldContain(x => x.Code == "DataMappingOperationsInvalid");
}
+ [Theory]
+ [InlineData(1 << 10)]
+ [InlineData(1 << 30)]
+ public void A_bit_outside_v1_and_the_reservation_is_malformed_in_both_modes(int bit)
+ {
+ // Nothing can author it (no release reserves it), so node-side it stays a malformed row, as before X0
+ // (GrpcDataArtifactReadTests pins 1 << 30 failing closed).
+ foreach (var errors in new[] { DataConnectionValidator.Validate(Snapshot(DataOperations.Read | (DataOperations)bit)),
+ DataConnectionValidator.ValidateDeployed(Snapshot(DataOperations.Read | (DataOperations)bit)) })
+ {
+ errors.ShouldContain(x => x.Code == "DataConnectionOperationsInvalid");
+ errors.ShouldContain(x => x.Code == "DataExportOperationsInvalid");
+ }
+ }
+
private static DraftSnapshot Snapshot(DataOperations operations) => new()
{
GenerationId = 1, ClusterId = "local",