Repository navigation
Testing in CI
Ralf Steinert edited this page Nov 15, 2026
·
2 revisions
Two ways to get a simulated EtherNet/IP device into automated tests.
pip install enip-sim registers enip_bench and enip_bench_factory. Every test gets
a fresh device on free ports — TCP and UDP — so tests can run in parallel.
def test_scanner_sees_the_trip(enip_bench):
with enip_bench.open_io(rpi_ms=20) as io: # the device's own I/O points
io.set_outputs(b"\x01\x00\xf4\x01") # run forward, 50.0 Hz
io.run()
enip_bench.inject("trip", code=4)
io.wait_for_inputs(lambda d: d[0] & 0x04) # status: faulted
def test_block(enip_bench_factory):
block = enip_bench_factory("io-block")
with block.client() as c:
...--enip-bench FILE or the ini key enip_bench chooses what enip_bench starts
(default: the drive). bench.port and bench.io_port are the ports in use.
services:
enip:
image: ghcr.io/steitec/enip-sim:0.2.1
ports:
- 44818:44818
- 2222:2222/udp
- 127.0.0.1:44819:44819The image reports healthy once port 44818 accepts connections. Pin the version, not
:latest, so a new release does not change your tests under you.
enip-sim · MIT licensed · EtherNet/IP and CIP are trademarks of ODVA; enip-sim is not affiliated with ODVA and is not conformance-tested.