---
title: "Same tests as the ECU matures"
description: "One test for a gateway ECU, whether it is a model, a container or hardware"
source: https://developer.remotivelabs.com/docs/get-started/examples/ethernet-gateway
last_updated: 2026-11-24
---

# Same tests as the ECU matures

- Goal: Test
- From: [Topology examples v0.9.0](https://github.com/remotivelabs/remotivelabs-topology-examples/tree/v0.9.0)
- Protocols: Ethernet
- Vehicle domains: Gateway

## Run it

```bash
git clone https://github.com/remotivelabs/remotivelabs-topology-examples.git
cd remotivelabs-topology-examples

remotive topology build -f ethernet_p2p/instances/model.instance.yaml build

docker compose -f build/ethernet-p2p-model/docker-compose.yml up --build
```

In a second terminal, run the tests with cd ethernet_p2p/tests and uv run pytest -s -vv.

An ECU under development usually starts as a model, becomes software in a container and ends up as hardware. With
RemotiveTopology the tests stay the same through all three: only the instance file that says how the ECU runs changes.

In this example `ECUB` is a gateway that forwards frames from `ECUA` on one Ethernet network (`NET1`) to `ECUC` on
another (`NET2`). The test sets signals on `ECUA` and checks that the same values arrive at `ECUC`.

- [Ethernet peer-to-peer example](https://github.com/remotivelabs/remotivelabs-topology-examples/blob/v0.9.0/ethernet_p2p/README.md)
- Platform with two Ethernet channels: [network.platform.yaml](https://github.com/remotivelabs/remotivelabs-topology-examples/blob/v0.9.0/ethernet_p2p/platform/network.platform.yaml)
- `ECUB` as a behavioral model: [model.instance.yaml](https://github.com/remotivelabs/remotivelabs-topology-examples/blob/v0.9.0/ethernet_p2p/instances/model.instance.yaml) and
  [the model](https://github.com/remotivelabs/remotivelabs-topology-examples/blob/v0.9.0/ethernet_p2p/ecub_model/src/__main__.py)
- `ECUB` as a plain UDP script in a container: [container.instance.yaml](https://github.com/remotivelabs/remotivelabs-topology-examples/blob/v0.9.0/ethernet_p2p/instances/container.instance.yaml)
- `ECUB` outside Docker, as external hardware would be: [external.instance.yaml](https://github.com/remotivelabs/remotivelabs-topology-examples/blob/v0.9.0/ethernet_p2p/instances/external.instance.yaml)
  and [ecub.py](https://github.com/remotivelabs/remotivelabs-topology-examples/blob/v0.9.0/ethernet_p2p/ecub_standalone/ecub.py)
- The tests: [tests/pytest](https://github.com/remotivelabs/remotivelabs-topology-examples/tree/v0.9.0/ethernet_p2p/tests/pytest)

Build and start the model variant, then run the tests in a second terminal:

```bash
remotive topology build -f ethernet_p2p/instances/model.instance.yaml build
docker compose -f build/ethernet-p2p-model/docker-compose.yml up --build

# in another terminal
cd ethernet_p2p/tests
uv run pytest -s -vv
```

Notice:
- Swap `model` for `container` or `external` in both commands to test the other variants. The external variant also
  needs host network setup, see the [example README](https://github.com/remotivelabs/remotivelabs-topology-examples/blob/v0.9.0/ethernet_p2p/README.md).
- The test only talks to `ECUA` and `ECUC`, which is why it doesn't change when `ECUB` does.

## Where it lives in the repo

- [ethernet_p2p/ecub_model/src/__main__.py](https://github.com/remotivelabs/remotivelabs-topology-examples/blob/v0.9.0/ethernet_p2p/ecub_model/src/__main__.py)
- [ethernet_p2p/ecub_standalone/ecub.py](https://github.com/remotivelabs/remotivelabs-topology-examples/blob/v0.9.0/ethernet_p2p/ecub_standalone/ecub.py)
- [ethernet_p2p/instances/container.instance.yaml](https://github.com/remotivelabs/remotivelabs-topology-examples/blob/v0.9.0/ethernet_p2p/instances/container.instance.yaml)
- [ethernet_p2p/instances/external.instance.yaml](https://github.com/remotivelabs/remotivelabs-topology-examples/blob/v0.9.0/ethernet_p2p/instances/external.instance.yaml)
- [ethernet_p2p/instances/model.instance.yaml](https://github.com/remotivelabs/remotivelabs-topology-examples/blob/v0.9.0/ethernet_p2p/instances/model.instance.yaml)
- [ethernet_p2p/platform/network.platform.yaml](https://github.com/remotivelabs/remotivelabs-topology-examples/blob/v0.9.0/ethernet_p2p/platform/network.platform.yaml)
- [ethernet_p2p/tests/pytest/](https://github.com/remotivelabs/remotivelabs-topology-examples/tree/v0.9.0/ethernet_p2p/tests/pytest)

[Read this use case on GitHub](https://github.com/remotivelabs/remotivelabs-topology-examples/blob/v0.9.0/usecases/ETHERNET_GATEWAY.md)

## Works well with

- [Behavioral model and test](https://developer.remotivelabs.com/docs/get-started/examples/behavioral-model-test.md): A BCM model and a test of the hazard lights, explained step by step
- [Test cases with pytest](https://developer.remotivelabs.com/docs/get-started/examples/pytest.md): Integration tests as Python code, run as part of the topology
