@@ -28,12 +28,25 @@
|
||||
NodeId at which the server publishes the Address.
|
||||
|
||||
.PARAMETER Write
|
||||
Issue #268 / plan PR F4-a — opts the script into the post-F4-a write
|
||||
stages. F4-a ships the write infrastructure (driver-level Writes.Enabled
|
||||
flag + per-tag Writable opt-in) without any actual wire writes; F4-b/c
|
||||
populate this stage with real macro / parameter / PMC write coverage.
|
||||
Until then the switch is a no-op marker so the e2e harness records that
|
||||
the write surface was deliberately exercised (or skipped).
|
||||
Issue #268 (F4-a) + #269 (F4-b) — opts the script into write stages.
|
||||
Without -Write the script runs read-only probe / loopback / bridge
|
||||
coverage. With -Write the script additionally exercises the F4-b
|
||||
cnc_wrparam + cnc_wrmacro round-trip stages against the configured
|
||||
-ParamAddress / -MacroAddress (default safe values). The wire writes
|
||||
fire only when FOCAS_TRUST_WIRE=1 (already gated above) AND the
|
||||
operator explicitly requests the write path.
|
||||
|
||||
.PARAMETER ParamAddress
|
||||
Parameter address for the F4-b write stage (default PARAM:1815).
|
||||
Only used when -Write is supplied. Pick a parameter that's safe to
|
||||
scribble on for your CNC setup — the default is benign for a stock
|
||||
Fanuc 30i but every site differs.
|
||||
|
||||
.PARAMETER MacroAddress
|
||||
Macro variable for the F4-b write stage (default MACRO:500). Macro
|
||||
writes are the lowest-risk write surface (no parameter-write switch
|
||||
needed, no MDI mode required) so this stage runs whenever -Write is
|
||||
supplied.
|
||||
#>
|
||||
|
||||
param(
|
||||
@@ -42,7 +55,9 @@ param(
|
||||
[string]$Address = "R100",
|
||||
[string]$OpcUaUrl = "opc.tcp://localhost:4840",
|
||||
[Parameter(Mandatory)] [string]$BridgeNodeId,
|
||||
[switch]$Write
|
||||
[switch]$Write,
|
||||
[string]$ParamAddress = "PARAM:1815",
|
||||
[string]$MacroAddress = "MACRO:500"
|
||||
)
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
@@ -102,11 +117,35 @@ $results += Test-SubscribeSeesChange `
|
||||
-ExpectedValue "$subValue"
|
||||
|
||||
if ($Write) {
|
||||
# F4-a no-op stage. Real per-kind write coverage lands in F4-b/c which extend the wire
|
||||
# client past the BadNotSupported short-circuit + populate this branch with
|
||||
# macro / parameter / PMC write assertions. Logged here so the harness records that the
|
||||
# operator deliberately requested the write path.
|
||||
Write-Host "[skip] -Write requested; F4-a ships infrastructure only — wire-write stages land in F4-b/c (issue #268)."
|
||||
# F4-b — macro + parameter round-trip writes. Both stages use the same
|
||||
# write-then-read shape the existing PMC stages use; the per-tag value
|
||||
# comes back through Test-DriverLoopback's read step.
|
||||
#
|
||||
# Macro writes run unconditionally when -Write is supplied — no MDI / no
|
||||
# parameter-write switch dependency, lowest-risk write surface on a CNC.
|
||||
$macroValue = Get-Random -Minimum 100 -Maximum 9999
|
||||
$results += Test-DriverLoopback `
|
||||
-Cli $focasCli `
|
||||
-WriteArgs (@("write") + $commonFocas + @("-a", $MacroAddress, "-t", "Int32", "-v", $macroValue)) `
|
||||
-ReadArgs (@("read") + $commonFocas + @("-a", $MacroAddress, "-t", "Int32")) `
|
||||
-ExpectedValue "$macroValue"
|
||||
|
||||
# Parameter writes only fire when the operator double-opts in via
|
||||
# FOCAS_PARAM_WRITE=1. The CNC must be in MDI mode + parameter-write
|
||||
# switch enabled or every write returns EW_PASSWD (BadUserAccessDenied);
|
||||
# without an opt-in the script won't even attempt the write. F4-d will
|
||||
# land an OPC UA-side unlock workflow that lets this stage run without
|
||||
# the pendant.
|
||||
if ($env:FOCAS_PARAM_WRITE -eq "1" -or $env:FOCAS_PARAM_WRITE -eq "true") {
|
||||
$paramValue = Get-Random -Minimum 100 -Maximum 9999
|
||||
$results += Test-DriverLoopback `
|
||||
-Cli $focasCli `
|
||||
-WriteArgs (@("write") + $commonFocas + @("-a", $ParamAddress, "-t", "Int32", "-v", $paramValue)) `
|
||||
-ReadArgs (@("read") + $commonFocas + @("-a", $ParamAddress, "-t", "Int32")) `
|
||||
-ExpectedValue "$paramValue"
|
||||
} else {
|
||||
Write-Host "[skip] FOCAS_PARAM_WRITE not set — parameter-write stage requires the CNC to be in MDI mode + parameter-write switch enabled (see docs/v2/focas-deployment.md 'Write safety')."
|
||||
}
|
||||
}
|
||||
|
||||
Write-Summary -Title "FOCAS e2e" -Results $results
|
||||
|
||||
Reference in New Issue
Block a user