A remote alarm scope larger than this makes the mapping's alarms Unavailable (ConditionCapacity); each imported condition materialises up to @DataConnectionValidator.NodesPerImportedCondition nodes.
+
+
+
@Actions(m, m.RemoteNamespaceMappingRowId != Guid.Empty)
}
diff --git a/src/Server/ZB.MOM.WW.OtOpcUa.AdminUI/DataConnections/DataOperationAuthoring.cs b/src/Server/ZB.MOM.WW.OtOpcUa.AdminUI/DataConnections/DataOperationAuthoring.cs
index df10c753e..44bba8434 100644
--- a/src/Server/ZB.MOM.WW.OtOpcUa.AdminUI/DataConnections/DataOperationAuthoring.cs
+++ b/src/Server/ZB.MOM.WW.OtOpcUa.AdminUI/DataConnections/DataOperationAuthoring.cs
@@ -1,19 +1,22 @@
+using ZB.MOM.WW.OtOpcUa.Configuration.Validation;
using ZB.MOM.WW.OtOpcUa.Core.Abstractions.DataConnections;
namespace ZB.MOM.WW.OtOpcUa.AdminUI.DataConnections;
///
/// The operation checkboxes the data-connection editors offer, and the mixed-version banner (plan §4.3). The set
-/// grows with the authoring validator, never ahead of it: H2 adds .
+/// grows with the authoring validator, never ahead of it: H2 adds , A2a
+/// (A2b the method bits).
///
public static class DataOperationAuthoring
{
/// The operation bits an operator can tick, in display order.
public static IReadOnlyList AuthorableOperations { get; } =
- [DataOperations.Browse, DataOperations.Metadata, DataOperations.Read, DataOperations.Subscribe, DataOperations.Write, DataOperations.HistoryRead];
+ [DataOperations.Browse, DataOperations.Metadata, DataOperations.Read, DataOperations.Subscribe, DataOperations.Write, DataOperations.HistoryRead,
+ DataOperations.AlarmSubscribe];
/// The checkbox label of a bit.
- public static string Label(DataOperations operation) => operation == DataOperations.HistoryRead ? "HistoryRead" : operation.ToString();
+ public static string Label(DataOperations operation) => operation.ToString();
///
/// The informational banner shown while a post-v1 feature bit is ticked: ConfigDb records no node build, so the
@@ -22,4 +25,18 @@ public static class DataOperationAuthoring
public static string? FeatureBitBanner(DataOperations operations) => (operations & ~DataOperationSets.V1) == 0 ? null
: "Every node of both clusters must run X0+ before authoring this: a pre-X0 node rejects the whole data-connection "
+ "snapshot when a row carries an operation bit it does not know. Nothing checks this automatically.";
+
+ ///
+ /// The validator's non-blocking condition-capacity warnings (plan §5.5/§6) for this cluster's consumer nodes, computed on
+ /// the saved drafts with the host default DataConnections:MaxImportedConditionNodes.
+ ///
+ public static IReadOnlyList ConditionCapacityWarnings(DraftSnapshot snapshot, string clusterId)
+ {
+ var nodes = snapshot.ClusterNodes.Where(n => string.Equals(n.ClusterId, clusterId, StringComparison.OrdinalIgnoreCase))
+ .Select(n => n.NodeId).ToHashSet(StringComparer.OrdinalIgnoreCase);
+ return DataConnectionValidator.ConditionCapacityWarnings(snapshot)
+ .Where(w => w.Context is not null && nodes.Contains(w.Context))
+ .Select(w => w.Message + " The cap is the host's setting; this check assumes its default.")
+ .ToArray();
+ }
}
diff --git a/tests/Server/ZB.MOM.WW.OtOpcUa.AdminUI.Tests/DataConnections/GrpcDataConditionEditorTests.cs b/tests/Server/ZB.MOM.WW.OtOpcUa.AdminUI.Tests/DataConnections/GrpcDataConditionEditorTests.cs
new file mode 100644
index 000000000..e621b41ec
--- /dev/null
+++ b/tests/Server/ZB.MOM.WW.OtOpcUa.AdminUI.Tests/DataConnections/GrpcDataConditionEditorTests.cs
@@ -0,0 +1,81 @@
+using Shouldly;
+using Xunit;
+using ZB.MOM.WW.OtOpcUa.AdminUI.DataConnections;
+using ZB.MOM.WW.OtOpcUa.Configuration.Entities;
+using ZB.MOM.WW.OtOpcUa.Configuration.Validation;
+using ZB.MOM.WW.OtOpcUa.Core.Abstractions.DataConnections;
+
+namespace ZB.MOM.WW.OtOpcUa.AdminUI.Tests.DataConnections;
+
+/// A2 editor models: the AlarmSubscribe checkbox, the condition limits' defaults, the X0 banner and the capacity warning.
+[Trait("Category", "Unit"), Trait("Feature", "GrpcData"), Trait("Phase", "A2")]
+public sealed class GrpcDataConditionEditorTests
+{
+ [Fact]
+ public void AlarmSubscribe_is_authorable_and_the_method_bits_are_not()
+ {
+ DataOperationAuthoring.AuthorableOperations.ShouldContain(DataOperations.AlarmSubscribe);
+ foreach (var bit in new[] { DataOperations.AlarmAcknowledge, DataOperations.AlarmConfirm, DataOperations.AlarmShelve })
+ DataOperationAuthoring.AuthorableOperations.ShouldNotContain(bit, "A2b");
+ // Every authorable bit is one the validator accepts and the node understands.
+ var all = DataOperationAuthoring.AuthorableOperations.Aggregate(DataOperations.None, (a, b) => a | b);
+ (all & ~DataOperationSets.Understood).ShouldBe(DataOperations.None);
+ // (Write is left out only because a Write mapping also needs write-through, which the minimal draft does not set.)
+ DataConnectionValidator.Validate(GrpcDataEditorValidationTestsAccess.ValidSnapshot(all & ~DataOperations.Write))
+ .ShouldNotContain(x => x.Code.EndsWith("OperationsInvalid", StringComparison.Ordinal));
+ DataOperationAuthoring.Label(DataOperations.AlarmSubscribe).ShouldBe("AlarmSubscribe");
+ new DataConnectionEditorModel().Value.AllowedOperations.HasFlag(DataOperations.AlarmSubscribe).ShouldBeFalse();
+ new RemoteMappingEditorModel().Value.AllowedOperations.HasFlag(DataOperations.AlarmSubscribe).ShouldBeFalse();
+ }
+
+ [Fact]
+ public void New_drafts_carry_the_plans_condition_limits_and_no_Galaxy_ack()
+ {
+ var mapping = new RemoteMappingEditorModel().Value;
+ (mapping.MaxConditions, mapping.ConditionStaleTimeoutMilliseconds, mapping.ConditionMethodTimeoutMilliseconds,
+ mapping.ConditionSnapshotTimeoutMilliseconds).ShouldBe((1000, 30000, 5000, 30000));
+ var export = new DataExport();
+ export.MaxConditions.ShouldBe(1000);
+ export.AllowGalaxyServiceAck.ShouldBeFalse();
+ }
+
+ [Fact]
+ public void The_X0_banner_shows_while_AlarmSubscribe_is_ticked()
+ {
+ var banner = DataOperationAuthoring.FeatureBitBanner(DataOperations.Read | DataOperations.AlarmSubscribe).ShouldNotBeNull();
+ banner.ShouldContain("every node of both clusters must run X0+ before authoring this", Case.Insensitive);
+ }
+
+ [Fact]
+ public void An_AlarmSubscribe_draft_validates_and_an_out_of_range_condition_limit_does_not()
+ {
+ var draft = GrpcDataEditorValidationTestsAccess.ValidSnapshot(DataOperations.Read | DataOperations.AlarmSubscribe);
+ DataConnectionValidator.Validate(draft).ShouldNotContain(x => x.Code.EndsWith("LimitInvalid", StringComparison.Ordinal));
+ draft.RemoteNamespaceMappings[0].MaxConditions = DataConnectionValidator.MaxConditionsLimit + 1;
+ DataConnectionValidator.Validate(draft).ShouldContain(x => x.Code == "DataMappingLimitInvalid");
+ draft.RemoteNamespaceMappings[0].MaxConditions = 1000;
+ draft.DataExports[0].MaxConditions = 0;
+ DataConnectionValidator.Validate(draft).ShouldContain(x => x.Code == "DataExportLimitInvalid");
+ }
+
+ [Fact]
+ public void The_capacity_warning_lists_only_this_clusters_over_cap_consumer_nodes()
+ {
+ RemoteNamespaceMapping Mapping(string id, string cluster, string node) => new()
+ {
+ RemoteNamespaceMappingId = id, ClusterId = cluster, Enabled = true, ConsumerNodeIds = [node], MaxConditions = 5000,
+ AllowedOperations = DataOperations.Read | DataOperations.AlarmSubscribe,
+ };
+ var snapshot = new DraftSnapshot
+ {
+ GenerationId = 1, ClusterId = "MAIN",
+ ClusterNodes = [new() { NodeId = "main-1", ClusterId = "MAIN", Host = "h", ApplicationUri = "urn:a", CreatedBy = "t" }, new() { NodeId = "other-1", ClusterId = "OTHER", Host = "h", ApplicationUri = "urn:b", CreatedBy = "t" }],
+ // 5000 × 49 = 245,000 > 122,500 for each node.
+ RemoteNamespaceMappings = [Mapping("m", "MAIN", "main-1"), Mapping("o", "OTHER", "other-1")],
+ };
+ var warning = DataOperationAuthoring.ConditionCapacityWarnings(snapshot, "main").ShouldHaveSingleItem();
+ warning.ShouldContain("main-1");
+ warning.ShouldContain("MaxImportedConditionNodes");
+ DataOperationAuthoring.ConditionCapacityWarnings(snapshot, "none").ShouldBeEmpty();
+ }
+}
diff --git a/tests/Server/ZB.MOM.WW.OtOpcUa.AdminUI.Tests/DataConnections/GrpcDataHistoryEditorTests.cs b/tests/Server/ZB.MOM.WW.OtOpcUa.AdminUI.Tests/DataConnections/GrpcDataHistoryEditorTests.cs
index daf4f86ad..690822d3f 100644
--- a/tests/Server/ZB.MOM.WW.OtOpcUa.AdminUI.Tests/DataConnections/GrpcDataHistoryEditorTests.cs
+++ b/tests/Server/ZB.MOM.WW.OtOpcUa.AdminUI.Tests/DataConnections/GrpcDataHistoryEditorTests.cs
@@ -14,7 +14,8 @@ public sealed class GrpcDataHistoryEditorTests
public void HistoryRead_is_authorable_and_new_drafts_do_not_grant_it()
{
DataOperationAuthoring.AuthorableOperations.ShouldContain(DataOperations.HistoryRead);
- DataOperationAuthoring.AuthorableOperations.ShouldNotContain(DataOperations.AlarmSubscribe, "A2 bits stay unauthorable");
+ // A2a made AlarmSubscribe authorable (GrpcDataConditionEditorTests); the method bits stay unauthorable until A2b.
+ DataOperationAuthoring.AuthorableOperations.ShouldNotContain(DataOperations.AlarmAcknowledge, "A2b bits stay unauthorable");
// Every authorable bit is one the validator accepts — the editor never gets ahead of authoring.
var all = DataOperationAuthoring.AuthorableOperations.Aggregate(DataOperations.None, (a, b) => a | b);
(all & ~DataOperationSets.Understood).ShouldBe(DataOperations.None);