Auto: abcip-4.3 — diagnostic / system tags as browseable variables

Closes #240
This commit is contained in:
Joseph Doherty
2026-04-26 02:55:56 -04:00
parent 9c108cd00a
commit 901a5b9b21
10 changed files with 915 additions and 10 deletions

View File

@@ -39,6 +39,13 @@
.PARAMETER SlowBridgeNodeId
Optional NodeId for a Tag declared with ScanRateMs >= 1000. Pair with
FastBridgeNodeId to enable the scan-rate assertion.
.PARAMETER SystemConnectionStatusNodeId
Optional NodeId for the synthetic _System/_ConnectionStatus variable
emitted by AB CIP discovery (PR abcip-4.3). When supplied, the script
runs the SystemTagBrowse assertion — reads the value through the OPC UA
server + asserts it surfaces one of the canonical HostState strings.
NodeId form: ns=<n>;s=AbCip/<gateway>/_System/_ConnectionStatus.
#>
param(
@@ -48,7 +55,12 @@ param(
[string]$OpcUaUrl = "opc.tcp://localhost:4840",
[Parameter(Mandatory)] [string]$BridgeNodeId,
[string]$FastBridgeNodeId,
[string]$SlowBridgeNodeId
[string]$SlowBridgeNodeId,
# PR abcip-4.3 — NodeId for the synthetic _System/_ConnectionStatus variable that
# discovery emits under each device. Optional — when wired, runs the
# SystemTagBrowse assertion that browses + reads the system folder through the OPC UA
# server. NodeId form: ns=<n>;s=AbCip/<gateway>/_System/_ConnectionStatus.
[string]$SystemConnectionStatusNodeId
)
$ErrorActionPreference = "Stop"
@@ -208,5 +220,28 @@ $results += [PSCustomObject]@{
}
}
# PR abcip-4.3 — _System/_ConnectionStatus browse-and-read assertion. Reads the live
# diagnostic snapshot via the OPC UA Client CLI; the value comes straight from the
# AbCipSystemTagSource (no libplctag round-trip). When the probe loop is healthy + the
# gateway is reachable, the value should be "Running"; on a stopped fixture it would be
# "Stopped". The assertion accepts any of the four canonical states, plus the "Unknown"
# transient that surfaces before the first probe iteration completes.
if ($SystemConnectionStatusNodeId) {
Write-Header "SystemTagBrowse (_System/_ConnectionStatus from $SystemConnectionStatusNodeId)"
$sysReadArgs = @($opcUaCli.PrefixArgs) + @("read", "-u", $OpcUaUrl, "-n", $SystemConnectionStatusNodeId)
$sysOut = & $opcUaCli.File @sysReadArgs 2>&1
$sysJoined = ($sysOut -join "`n")
$sysMatched = $sysJoined -match "Running|Stopped|Unknown|Faulted"
$results += [PSCustomObject]@{
Name = "SystemTagBrowse"
Passed = $sysMatched
Detail = if ($sysMatched) {
"_ConnectionStatus surfaced one of Running / Stopped / Unknown / Faulted via OPC UA"
} else {
"_ConnectionStatus did not surface a recognised HostState — got '$sysJoined'"
}
}
}
Write-Summary -Title "AB CIP e2e" -Results $results
if ($results | Where-Object { -not $_.Passed }) { exit 1 }