Ran the driver CLIs against the live docker-compose fixtures to debug
what actually works. Two real bugs surfaced:
1. `e2e-config.sample.json` pointed at the wrong simulator ports:
- Modbus: 5502 → **5020** (pymodbus compose binding)
- S7: 102 → **1102** (python-snap7, non-priv port)
- AbCip: no port → now explicit **:44818**
`test-modbus.ps1` default `-ModbusHost` also shipped with 5502;
fixed to 5020.
2. Modbus loopback was off-by-2 because pymodbus `standard.json` makes
HR[100] an auto-increment register (value ticks on every poll).
Switched `test-modbus.ps1` to **HR[200]** (scratch range in the
profile) + updated sample config `bridgeNodeId` to match.
Also fixed the AbCip probe: `-t @raw_cpu_type` was rejected by the
driver's TagPath parser ("malformed TagPath"). Probe now uses the
user-supplied `-TagPath` for every family. Works against both
ab_server and real controllers.
Verified driver-side against live containers:
- Modbus 5020: probe ✓, HR[200] write+read round-trip ✓
- AB CIP 44818: probe ✓, TestDINT write+read round-trip ✓
- S7 1102: probe ✓, DB1.DBW0 write+read round-trip ✓
## Known blocker (stages 3-5)
README now flags — and the 4 child issues under umbrella #209 track —
that `src/ZB.MOM.WW.OtOpcUa.Server/Program.cs:98-104` only registers
Galaxy + FOCAS driver factories. `DriverInstanceBootstrapper` silently
skips any `DriverType` without a registered factory, so stages 3-5
(anything crossing the OPC UA server) can't work today even with a
perfect Config DB seed. Issues #210-213 scope the factory + seed SQL
work per driver.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
99 lines
3.5 KiB
PowerShell
99 lines
3.5 KiB
PowerShell
#Requires -Version 7.0
|
|
<#
|
|
.SYNOPSIS
|
|
End-to-end CLI test for the AB CIP driver (ControlLogix / CompactLogix /
|
|
Micro800 / GuardLogix) bridged through the OtOpcUa server.
|
|
|
|
.DESCRIPTION
|
|
Mirrors test-modbus.ps1 but against libplctag's ab_server (or a real Logix
|
|
controller). Five assertions: probe / driver-loopback / forward-bridge /
|
|
reverse-bridge / subscribe-sees-change.
|
|
|
|
Prereqs:
|
|
- ab_server container up (tests/.../AbCip.IntegrationTests/Docker/docker-compose.yml,
|
|
--profile controllogix) OR a real PLC on the network.
|
|
- OtOpcUa server running with an AB CIP DriverInstance pointing at the
|
|
same gateway + a Tag published at the -BridgeNodeId you pass.
|
|
|
|
.PARAMETER Gateway
|
|
ab://host[:port]/cip-path. Default ab://127.0.0.1/1,0 (ab_server ControlLogix).
|
|
|
|
.PARAMETER Family
|
|
ControlLogix / CompactLogix / Micro800 / GuardLogix (default ControlLogix).
|
|
|
|
.PARAMETER TagPath
|
|
Logix symbolic path to exercise. Default 'TestDINT' — matches the ab_server
|
|
--tag=TestDINT:DINT[1] seed.
|
|
|
|
.PARAMETER OpcUaUrl
|
|
OtOpcUa server endpoint.
|
|
|
|
.PARAMETER BridgeNodeId
|
|
NodeId at which the server publishes the TagPath.
|
|
#>
|
|
|
|
param(
|
|
[string]$Gateway = "ab://127.0.0.1/1,0",
|
|
[string]$Family = "ControlLogix",
|
|
[string]$TagPath = "TestDINT",
|
|
[string]$OpcUaUrl = "opc.tcp://localhost:4840",
|
|
[Parameter(Mandatory)] [string]$BridgeNodeId
|
|
)
|
|
|
|
$ErrorActionPreference = "Stop"
|
|
. "$PSScriptRoot/_common.ps1"
|
|
|
|
$abcipCli = Get-CliInvocation `
|
|
-ProjectFolder "src/ZB.MOM.WW.OtOpcUa.Driver.AbCip.Cli" `
|
|
-ExeName "otopcua-abcip-cli"
|
|
$opcUaCli = Get-CliInvocation `
|
|
-ProjectFolder "src/ZB.MOM.WW.OtOpcUa.Client.CLI" `
|
|
-ExeName "otopcua-cli"
|
|
|
|
$commonAbCip = @("-g", $Gateway, "-f", $Family)
|
|
$results = @()
|
|
|
|
# The AbCip driver's TagPath parser rejects CIP attribute syntax like
|
|
# `@raw_cpu_type` ("malformed TagPath"), so probe uses the real TagPath for
|
|
# every family. Works against ab_server + real controllers alike.
|
|
$results += Test-Probe `
|
|
-Cli $abcipCli `
|
|
-ProbeArgs (@("probe") + $commonAbCip + @("-t", $TagPath, "--type", "DInt"))
|
|
|
|
$writeValue = Get-Random -Minimum 1 -Maximum 9999
|
|
$results += Test-DriverLoopback `
|
|
-Cli $abcipCli `
|
|
-WriteArgs (@("write") + $commonAbCip + @("-t", $TagPath, "--type", "DInt", "-v", $writeValue)) `
|
|
-ReadArgs (@("read") + $commonAbCip + @("-t", $TagPath, "--type", "DInt")) `
|
|
-ExpectedValue "$writeValue"
|
|
|
|
$bridgeValue = Get-Random -Minimum 10000 -Maximum 19999
|
|
$results += Test-ServerBridge `
|
|
-DriverCli $abcipCli `
|
|
-DriverWriteArgs (@("write") + $commonAbCip + @("-t", $TagPath, "--type", "DInt", "-v", $bridgeValue)) `
|
|
-OpcUaCli $opcUaCli `
|
|
-OpcUaUrl $OpcUaUrl `
|
|
-OpcUaNodeId $BridgeNodeId `
|
|
-ExpectedValue "$bridgeValue"
|
|
|
|
$reverseValue = Get-Random -Minimum 20000 -Maximum 29999
|
|
$results += Test-OpcUaWriteBridge `
|
|
-OpcUaCli $opcUaCli `
|
|
-OpcUaUrl $OpcUaUrl `
|
|
-OpcUaNodeId $BridgeNodeId `
|
|
-DriverCli $abcipCli `
|
|
-DriverReadArgs (@("read") + $commonAbCip + @("-t", $TagPath, "--type", "DInt")) `
|
|
-ExpectedValue "$reverseValue"
|
|
|
|
$subValue = Get-Random -Minimum 30000 -Maximum 39999
|
|
$results += Test-SubscribeSeesChange `
|
|
-OpcUaCli $opcUaCli `
|
|
-OpcUaUrl $OpcUaUrl `
|
|
-OpcUaNodeId $BridgeNodeId `
|
|
-DriverCli $abcipCli `
|
|
-DriverWriteArgs (@("write") + $commonAbCip + @("-t", $TagPath, "--type", "DInt", "-v", $subValue)) `
|
|
-ExpectedValue "$subValue"
|
|
|
|
Write-Summary -Title "AB CIP e2e" -Results $results
|
|
if ($results | Where-Object { -not $_.Passed }) { exit 1 }
|