Skip to content

Testing and interop

IEC 101 has more knobs than IEC 104: two link modes, four field sizes, link timing and repetition rules. OT Fabric tests it in three layers: tests inside the repositories, recorded traffic of real stations, and an interop suite that runs the library against three independent stacks in both roles and both link modes.

go-iec60870-5 (make check) tests the FT 1.2 codec and decoder (resynchronization after noise, truncated and oversized frames, fuzzing), the link procedures of IEC 60870-5-2 (status, reset, FCB repetition, DFC, ACD, the “not reset” state, single character acknowledgements), and the client against the server end to end. Hostile-peer tests send noise, wrong addresses and functions, floods and half-open lines; chaos tests drop, duplicate, corrupt, delay and reorder frames and check that no command executes twice and every request ends (make chaos).

Recorded traffic of an SEL RTAC and of three utility stations decodes and encodes back byte for byte, its link procedures check out, Wireshark agrees, and the recorded stations are replayed against the client.

iec101ctl runs every command against go-iec60870-5’s own server and client (make e2e in iec60870ctl), and against the reference images below.

iec60870-5-interop v0.5.0 (container contract 2.3) packages three independent IEC 101 implementations, each as client and server, unbalanced and balanced:

Adapter Implementation Language Image
lib60870 MZ Automation lib60870-C v2.4.1 C ghcr.io/otfabric/iec60870-5-interop-iec101-lib60870
cbsigma cB-Sigma/iec60870 v0.3.0 Go ghcr.io/otfabric/iec60870-5-interop-iec101-cbsigma
digitalpetri digitalpetri/iec60870 at commit 33e52b3 (no release yet) Java ghcr.io/otfabric/iec60870-5-interop-iec101-digitalpetri

The serial byte stream crosses one TCP connection unchanged, as through a terminal server: the server is the controlled station on port 2401, the client the controlling station. lib60870-C only talks to a tty, so its adapter bridges a pseudo terminal to the socket. Every image declares the field sizes it takes, and the harness runs the defaults and four other sets: 2/2/2/3, 1/2/1/3 and 2/1/2/2 (link address, cause, common address, object address) in both modes and 0/1/1/2 (no link address field) in balanced mode, including the broadcast common address 65535 and an object address of 70000.

  1. Start a reference station:

    Terminal window
    docker network create iec101-demo
    docker run -d --rm --name station --network iec101-demo \
    ghcr.io/otfabric/iec60870-5-interop-iec101-lib60870:v0.5.0 server --link-mode balanced
  2. Interrogate it with a controlling station of another stack:

    Terminal window
    docker run --rm --network iec101-demo ghcr.io/otfabric/iec60870-5-interop-iec101-cbsigma:v0.5.0 \
    client interrogate --host station --link-mode balanced
    docker stop station && docker network rm iec101-demo

ghcr.io/otfabric/iec60870-5-interop-iec101-otfabric is go-iec60870-5 behind the same container contract as the reference images (adapter name otfabric), new with iec60870-5-interop v0.5.0, so you can test your IEC 101 controlling station or controlled station against it, the way OT Fabric tests its own stack against yours:

Terminal window
docker run -d --name go-iec101 -p 127.0.0.1:2401:2401 \
ghcr.io/otfabric/iec60870-5-interop-iec101-otfabric:<tag> server --link-mode balanced
until docker exec go-iec101 test -f /run/iec60870-5-interop/ready; do sleep 0.1; done

The station serves the baseline fixture on port 2401, unbalanced or balanced, with every field size, and client <operation> runs go-iec60870-5’s controlling station against yours. Run against the three references, it passed every cross-stack case; the balanced cases against a digitalpetri station are the known upstream bug above.

Its tags are go-iec60870-5 versions, such as v0.5.1, and latest; a rebuild of a version replaces its tag, so pin the digest when you need an exact build, and version prints the versions inside the image. It is not part of an iec60870-5-interop release or its manifest.json, and it reports independentEngine: false: a result against it tells you about your stack, not something independent about OT Fabric’s. A result you publish, naming your implementation and version, is independent evidence. Like the references, it is for testing only and has no place on a network you do not control.

make interop-iec101 runs on every push (job iec101 of the Interop workflow), with the images pinned by digest. The last recorded run (2026-11-12, contract 2.3): 490 subtests passed, 5 skipped, none failed.

Reference Client to reference server Reference client to server
lib60870-C pass, unbalanced and balanced, every field size pass, unbalanced and balanced, every field size
cB-Sigma pass, unbalanced and balanced, every field size pass, unbalanced and balanced, every field size
digitalpetri pass unbalanced; balanced skipped (known upstream bug) pass; six unbalanced cases not run (its master addresses the station whose link address equals the common address)

The client runs link start-up, interrogation, counter interrogation, read (including an unknown address and an unknown common address), clock synchronization and the test command, and commands direct, select-before-operate and cancel with their reports. Each reference client replays the harness’s cases against go-iec60870-5’s server and must get exactly the expected result.

The skips are the known bug digitalpetri-balanced-server-no-link-reset: a balanced digitalpetri station sends user data without initializing its own primary direction, which IEC 60870-5-101 requires. go-iec60870-5 keeps the “secondary link not reset” state and does not take the data, as cB-Sigma does.

iec101ctl v0.9.1 passes 399 cases against the same three stacks, both roles, both link modes, default and non-default field sizes.

  • Independence. cB-Sigma’s IEC 101 was debugged against lib60870-C, so those two are not fully independent of each other; digitalpetri is the third peer for that reason.
  • Certified test equipment and field devices. Not used. Recorded traffic of real stations is the closest evidence.
  • Not covered by independent runs: a one-octet object address, single character acknowledgement sent by the library, multidrop lines, and DFC set by the peer. They are covered by the library’s own tests.
  • Not implemented: file transfer and IEC 62351-5 on IEC 101.