|
|
|
@@ -1,14 +1,17 @@
|
|
|
|
|
// AlarmSubtagLiveSmokeTests.cs
|
|
|
|
|
//
|
|
|
|
|
// Validates the open design item from Task 17: exact subtag names and the
|
|
|
|
|
// canonical AlarmSubtagTarget reference shape for a known Galaxy alarm.
|
|
|
|
|
//
|
|
|
|
|
// This test exercises the full subtag-fallback pipeline end-to-end against
|
|
|
|
|
// a real Galaxy + MXAccess install:
|
|
|
|
|
// Validates the subtag-fallback pipeline against a real Galaxy + MXAccess install:
|
|
|
|
|
// LmxSubtagAlarmSource (own LMXProxyServerClass) ->
|
|
|
|
|
// SubtagAlarmConsumer (state machine + AcknowledgeByName write) ->
|
|
|
|
|
// synthesized MxAlarmTransitionEvent (Raise / Clear, Degraded=true, SyntheticGuid)
|
|
|
|
|
//
|
|
|
|
|
// FIELD NAMES CONFIRMED: InAlarm/Acked/AckMsg/Priority are the confirmed AVEVA
|
|
|
|
|
// AlarmExtension primitive field names, verified by querying the live ZB Galaxy
|
|
|
|
|
// attribute_definition rows. The remaining open item for live validation is
|
|
|
|
|
// confirming the runtime item reference path — i.e. that
|
|
|
|
|
// "<Object>.<AlarmAttr>.InAlarm" is the correct MXAccess path with no
|
|
|
|
|
// intermediate alarm-condition segment.
|
|
|
|
|
//
|
|
|
|
|
// HOW TO RUN:
|
|
|
|
|
// 1. On the dev rig with AVEVA System Platform installed and Galaxy running:
|
|
|
|
|
// $env:MXGATEWAY_RUN_LIVE_MXACCESS_TESTS = "1"
|
|
|
|
@@ -16,12 +19,6 @@
|
|
|
|
|
// 3. Run with an alarm flip script (same one used by AlarmsLiveSmokeTests)
|
|
|
|
|
// so that TestMachine_001.TestAlarm001 toggles its Active/Acked subtags
|
|
|
|
|
// on a ~10 s cadence.
|
|
|
|
|
// 4. VERIFY the placeholder subtag names (PLACEHOLDER_* constants below)
|
|
|
|
|
// against the live Galaxy before flipping Skip -- see VERIFY comment block.
|
|
|
|
|
//
|
|
|
|
|
// OPEN ITEM (Task 17): the exact subtag address strings are not yet confirmed
|
|
|
|
|
// from a live Galaxy or from C:\Users\dohertj2\Desktop\mxaccess
|
|
|
|
|
// docs/MXAccess-Public-API.md. Flip this test only after verifying them.
|
|
|
|
|
//
|
|
|
|
|
// net48/x86 constraints:
|
|
|
|
|
// - No init-only properties, records, index/range operators, C# 8+ pattern
|
|
|
|
@@ -43,34 +40,31 @@ namespace ZB.MOM.WW.MxGateway.Worker.Tests.Probes;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Live dev-rig smoke test for the subtag-fallback alarm pipeline.
|
|
|
|
|
/// Validates the open design item from Task 17: confirms that
|
|
|
|
|
/// <see cref="LmxSubtagAlarmSource"/> wired to a real
|
|
|
|
|
/// Confirms that <see cref="LmxSubtagAlarmSource"/> wired to a real
|
|
|
|
|
/// <c>LMXProxyServerClass</c> + <see cref="SubtagAlarmConsumer"/> can
|
|
|
|
|
/// synthesize <see cref="MxAlarmTransitionEvent"/> records from Galaxy
|
|
|
|
|
/// alarm subtags, and that <see cref="SubtagAlarmConsumer.AcknowledgeByName"/>
|
|
|
|
|
/// writes the ack-comment subtag successfully.
|
|
|
|
|
/// alarm subtags using the confirmed AVEVA <c>AlarmExtension</c> field
|
|
|
|
|
/// names (InAlarm/Acked/AckMsg/Priority), and that
|
|
|
|
|
/// <see cref="SubtagAlarmConsumer.AcknowledgeByName"/> writes the
|
|
|
|
|
/// ack-comment subtag (AckMsg) successfully.
|
|
|
|
|
///
|
|
|
|
|
/// Skip-gated; flip <c>Skip=null</c> on the dev rig with the alarm flip
|
|
|
|
|
/// script running. VERIFY the PLACEHOLDER_* subtag names before running.
|
|
|
|
|
/// script running. The remaining live-validation item is confirming that
|
|
|
|
|
/// the runtime MXAccess item reference path requires no intermediate
|
|
|
|
|
/// alarm-condition segment (i.e. <c><Object>.<AlarmAttr>.InAlarm</c>
|
|
|
|
|
/// resolves as-is).
|
|
|
|
|
/// </summary>
|
|
|
|
|
public sealed class AlarmSubtagLiveSmokeTests
|
|
|
|
|
{
|
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
|
// PLACEHOLDER references — VERIFY before flipping Skip.
|
|
|
|
|
// Subtag addresses for TestMachine_001.TestAlarm001.
|
|
|
|
|
//
|
|
|
|
|
// These values are the best-guess subtag addresses for TestMachine_001.TestAlarm001
|
|
|
|
|
// as used by the existing AlarmsLiveSmokeTests (which watches the same Galaxy
|
|
|
|
|
// provider). The exact attribute suffix strings (.InAlarm, .Acked,
|
|
|
|
|
// .AckComment, .Priority) MUST be confirmed against:
|
|
|
|
|
// - C:\Users\dohertj2\Desktop\mxaccess\docs\MXAccess-Public-API.md
|
|
|
|
|
// - A live Galaxy attribute browse or MXTraceHarness capture
|
|
|
|
|
// before this test is flipped on. The subtag address format is
|
|
|
|
|
// <ObjectTagName>.<AlarmAttributeName>
|
|
|
|
|
// where the alarm attribute names are Galaxy-attribute names surfaced
|
|
|
|
|
// through MXAccess. Known AVEVA attribute names are .InAlarm (bool),
|
|
|
|
|
// .Acked (bool), .Priority (int), and a writable comment attribute whose
|
|
|
|
|
// exact name varies by alarm template (commonly .AlarmComment or
|
|
|
|
|
// .AckComment).
|
|
|
|
|
// Field names (InAlarm/Acked/AckMsg/Priority) are CONFIRMED against the live
|
|
|
|
|
// ZB Galaxy AlarmExtension primitive attribute_definition rows. The subtag
|
|
|
|
|
// address format is <ObjectTagName>.<AlarmAttributeName>. The remaining
|
|
|
|
|
// live-validation item is confirming that the MXAccess runtime item
|
|
|
|
|
// reference resolves without an intermediate alarm-condition segment
|
|
|
|
|
// (i.e. "<Object>.<AlarmAttr>.InAlarm" resolves as-is).
|
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
/// <summary>The Galaxy provider expression used by the existing live smoke tests.</summary>
|
|
|
|
@@ -83,20 +77,17 @@ public sealed class AlarmSubtagLiveSmokeTests
|
|
|
|
|
/// <summary>The test alarm's tag name as the dispatcher composes it (Group.TagName).</summary>
|
|
|
|
|
private const string AlarmTagName = "TestMachine_001.TestAlarm001";
|
|
|
|
|
|
|
|
|
|
// PLACEHOLDER — VERIFY against MXAccess-Public-API.md and live Galaxy.
|
|
|
|
|
// Typical InProcess Platform alarm active subtag: "<TagName>.InAlarm"
|
|
|
|
|
// Confirmed AVEVA AlarmExtension field name (in-alarm boolean).
|
|
|
|
|
private const string PlaceholderActiveSubtag = "TestMachine_001.TestAlarm001.InAlarm";
|
|
|
|
|
|
|
|
|
|
// PLACEHOLDER — VERIFY. Typical: "<TagName>.Acked"
|
|
|
|
|
// Confirmed AVEVA AlarmExtension field name (acknowledged boolean).
|
|
|
|
|
private const string PlaceholderAckedSubtag = "TestMachine_001.TestAlarm001.Acked";
|
|
|
|
|
|
|
|
|
|
// PLACEHOLDER — VERIFY. The writable ack-comment attribute varies by alarm
|
|
|
|
|
// template; common names are .AlarmComment, .AckComment, or .OperComment.
|
|
|
|
|
// Use a live Galaxy attribute browse (InTouch AlarmDB or MXTraceHarness
|
|
|
|
|
// GetItemList) to confirm before flipping.
|
|
|
|
|
private const string PlaceholderAckCommentSubtag = "TestMachine_001.TestAlarm001.AlarmComment";
|
|
|
|
|
// Confirmed AVEVA AlarmExtension field name (ack-comment write target).
|
|
|
|
|
// Writing this subtag performs the acknowledge in AVEVA.
|
|
|
|
|
private const string PlaceholderAckCommentSubtag = "TestMachine_001.TestAlarm001.AckMsg";
|
|
|
|
|
|
|
|
|
|
// PLACEHOLDER — VERIFY. Typically: "<TagName>.Priority"
|
|
|
|
|
// Confirmed AVEVA AlarmExtension field name (alarm priority/severity).
|
|
|
|
|
private const string PlaceholderPrioritySubtag = "TestMachine_001.TestAlarm001.Priority";
|
|
|
|
|
|
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
@@ -125,7 +116,7 @@ public sealed class AlarmSubtagLiveSmokeTests
|
|
|
|
|
/// the Degraded flag and synthetic GUID are stamped, then
|
|
|
|
|
/// AcknowledgeByName and verifies the ack-comment write returns 0.
|
|
|
|
|
/// </summary>
|
|
|
|
|
[Fact(Skip = "Live dev-rig smoke test — flip Skip=null with AVEVA + an alarm flip script running. Subtag fallback path. VERIFY PLACEHOLDER_* subtag names before enabling.")]
|
|
|
|
|
[Fact(Skip = "Live dev-rig smoke test — flip Skip=null with AVEVA + an alarm flip script running. Subtag fallback path. Field names confirmed (InAlarm/Acked/AckMsg/Priority); live-validate runtime path resolves without intermediate alarm-condition segment.")]
|
|
|
|
|
public void SubtagFallback_FullPipelineRoundTrip_SynthesizesRaiseAndAcknowledges()
|
|
|
|
|
{
|
|
|
|
|
Exception? threadException = null;
|
|
|
|
@@ -165,9 +156,10 @@ public sealed class AlarmSubtagLiveSmokeTests
|
|
|
|
|
Log(string.Format("RaiseWaitTimeout={0}s ClearWaitTimeout={1}s",
|
|
|
|
|
RaiseWaitTimeout.TotalSeconds, ClearWaitTimeout.TotalSeconds));
|
|
|
|
|
|
|
|
|
|
// Build target with PLACEHOLDER subtag names.
|
|
|
|
|
// VERIFY these against MXAccess-Public-API.md and a live Galaxy
|
|
|
|
|
// attribute browse before flipping Skip=null.
|
|
|
|
|
// Build target with confirmed AVEVA AlarmExtension subtag names.
|
|
|
|
|
// InAlarm/Acked/AckMsg/Priority confirmed against live ZB Galaxy
|
|
|
|
|
// attribute_definition rows. Remaining live-validation: runtime path resolves
|
|
|
|
|
// without an intermediate alarm-condition segment.
|
|
|
|
|
AlarmSubtagTarget target = new AlarmSubtagTarget
|
|
|
|
|
{
|
|
|
|
|
AlarmFullReference = AlarmFullReference,
|
|
|
|
|