Files
scadalink-design/docs/test_infra/test_infra_lmxfakeproxy.md
Joseph Doherty d91aa83665 refactor(docs): move requirements and test infra docs into docs/ subdirectories
Organize documentation by moving requirements (HighLevelReqs, Component-*,
lmxproxy_protocol) to docs/requirements/ and test infrastructure docs to
docs/test_infra/. Updates all cross-references in README, CLAUDE.md,
infra/README, component docs, and 23 plan files.
2026-03-21 01:11:35 -04:00

2.3 KiB

Test Infrastructure: LmxFakeProxy

Overview

LmxFakeProxy is a .NET gRPC server that implements the scada.ScadaService proto (full parity with the real LmxProxy server) but bridges to the OPC UA test server instead of System Platform MXAccess. This enables end-to-end testing of RealLmxProxyClient and the LmxProxy DCL adapter.

Image & Ports

  • Image: Custom build (infra/lmxfakeproxy/Dockerfile)
  • gRPC endpoint: localhost:50051

Configuration

Environment Variable Default Description
PORT 50051 gRPC listen port
OPC_ENDPOINT opc.tcp://localhost:50000 Backend OPC UA server
OPC_PREFIX ns=3;s= Prefix prepended to LMX tags to form OPC UA NodeIds
API_KEY (none) If set, enforces API key on all gRPC calls

Tag Address Mapping

LMX-style flat addresses are mapped to OPC UA NodeIds by prepending the configured prefix:

LMX Tag OPC UA NodeId
Motor.Speed ns=3;s=Motor.Speed
Pump.FlowRate ns=3;s=Pump.FlowRate
Tank.Level ns=3;s=Tank.Level

Supported RPCs

Full parity with the scada.ScadaService proto:

  • Connect / Disconnect / GetConnectionState — Session management
  • Read / ReadBatch — Read tag values via OPC UA
  • Write / WriteBatch / WriteBatchAndWait — Write values via OPC UA
  • Subscribe — Server-streaming subscriptions via OPC UA MonitoredItems
  • CheckApiKey — API key validation

Verification

  1. Ensure the OPC UA test server is running:
docker ps --filter name=scadalink-opcua
  1. Start the fake proxy:
docker compose up -d lmxfakeproxy
  1. Check logs:
docker logs scadalink-lmxfakeproxy
  1. Test with the ScadaLink CLI or a gRPC client.

Running Standalone (without Docker)

cd infra/lmxfakeproxy
dotnet run -- --opc-endpoint opc.tcp://localhost:50000 --opc-prefix "ns=3;s="

With API key enforcement:

dotnet run -- --api-key my-secret-key
  • Data Connection Layer — Test RealLmxProxyClient and LmxProxyDataConnection against real OPC UA data
  • Site Runtime — Deploy instances with LmxProxy data connections pointing at this server
  • Integration Tests — End-to-end tests of the LmxProxy protocol path