Auto: opcuaclient-14 — ServerUriArray redundant failover

Closes #286
This commit is contained in:
Joseph Doherty
2026-04-26 10:05:05 -04:00
parent 35d733d73b
commit 705c98ad98
11 changed files with 1088 additions and 2 deletions

View File

@@ -95,7 +95,15 @@ param(
# surfacing BadHistoryOperationUnsupported, which would indicate the filter-aware
# ReadEventsAsync path lost wiring.
[switch]$HistoryEvents,
[string]$EventsNotifierNodeId = "i=2253"
[string]$EventsNotifierNodeId = "i=2253",
# PR-14: upstream-redundancy probe. Passes the primary + secondary URLs
# straight through to the gateway driver via DriverConfig (operator must have
# already wired Redundancy.Enabled=true on the OpcUaClient instance — this
# script doesn't reconfigure the driver, only verifies the bridged read still
# works while both upstreams are reachable, and that the driver's redundancy
# diagnostics are non-null). Stage is no-op when neither URL is provided.
[string]$PrimaryUrl,
[string]$SecondaryUrl
)
$ErrorActionPreference = "Stop"
@@ -183,6 +191,28 @@ if ($triggerCmd) {
# launched with --alm. When set, the stage issues a historyread against the
# bridged notifier ($EventsNotifierNodeId) and confirms the gateway returns
# the request without BadHistoryOperationUnsupported.
# Stage 6 (gated): upstream-redundancy probe (PR-14)
#
# When -PrimaryUrl + -SecondaryUrl are both supplied, the script runs an extra
# read against the bridged NodeId and reports whether the gateway is still
# answering. The actual ServiceLevel-driven failover is observable only on the
# server side (driver-diagnostics RPC reports RedundancyFailoverCount); this
# stage is a smoke check that the bridged path keeps round-tripping while
# both upstreams are reachable. Drive a real failover by writing to the
# primary's ServiceLevel node from outside this script.
if ($PrimaryUrl -and $SecondaryUrl) {
Write-Host "[INFO] Upstream redundancy probe: primary=$PrimaryUrl secondary=$SecondaryUrl"
$results += Test-Probe `
-Name "OpcUaClient redundancy bridged-read" `
-Cmd $opcUaCli `
-Args @("read", "-u", $OpcUaUrl, "-n", $BridgedNodeId)
} else {
if (-not $PrimaryUrl -and -not $SecondaryUrl) {
Write-Host "[INFO] Upstream redundancy stage skipped (set -PrimaryUrl and -SecondaryUrl to enable)."
$results += [pscustomobject]@{ Stage = "Upstream-redundancy"; Status = "SKIP" }
}
}
if ($HistoryEvents) {
Write-Host "[INFO] HistoryEvents stage: issuing historyread against $EventsNotifierNodeId"
$start = (Get-Date).ToUniversalTime().AddMinutes(-30).ToString("o")