Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# SPDX-FileCopyrightText: Copyright (c) 2026 Northeastern University
# SPDX-License-Identifier: Apache-2.0

.git
build
build-*
cmake-build-*
out
dist
**/__pycache__
18 changes: 18 additions & 0 deletions docker/Dockerfile.bench
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# SPDX-FileCopyrightText: Copyright (c) 2026 Northeastern University
# SPDX-License-Identifier: Apache-2.0

# The benchmark image: just test_bench_full_loop_latency and the libraries it loads.
#
# docker build -f docker/Dockerfile.bench -t libe3-bench .

ARG BUILD_IMAGE=libe3-build:local
FROM ${BUILD_IMAGE} AS build

FROM ubuntu:24.04
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update \
&& apt-get install -y --no-install-recommends libzmq5 libsctp1 libprotobuf32t64 \
&& rm -rf /var/lib/apt/lists/* \
&& mkdir -p -m 0777 /tmp/dapps
COPY --from=build /src/build/test_bench_full_loop_latency /usr/local/bin/test_bench_full_loop_latency
ENTRYPOINT ["/usr/local/bin/test_bench_full_loop_latency"]
22 changes: 22 additions & 0 deletions docker/Dockerfile.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# SPDX-FileCopyrightText: Copyright (c) 2026 Northeastern University
# SPDX-License-Identifier: Apache-2.0

# Builds libe3, the examples, the integration tests and the latency benchmark
# with every encoding and SCTP. The other images copy their binaries from it.
#
# docker build -f docker/Dockerfile.build -t libe3-build .

FROM ubuntu:24.04 AS deps
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update \
&& apt-get install -y --no-install-recommends sudo ca-certificates libsctp-dev \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /src
# Only these two files, so the dependency layer is reused until build_libe3 changes.
COPY build_libe3 VERSION ./
RUN ./build_libe3 -I

FROM deps AS build
COPY . /src
RUN ./build_libe3 -r --all-encodings --enable-sctp \
--cmake-opt "-DLIBE3_BUILD_INTEGRATION_TESTS=ON -DLIBE3_ENABLE_LATREC=ON"
18 changes: 18 additions & 0 deletions docker/Dockerfile.dapp-sim
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# SPDX-FileCopyrightText: Copyright (c) 2026 Northeastern University
# SPDX-License-Identifier: Apache-2.0

# The dApp image: just example_simple_dapp and the libraries it loads.
#
# docker build -f docker/Dockerfile.dapp-sim -t libe3-dapp-sim .

ARG BUILD_IMAGE=libe3-build:local
FROM ${BUILD_IMAGE} AS build

FROM ubuntu:24.04
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update \
&& apt-get install -y --no-install-recommends libzmq5 libsctp1 libprotobuf32t64 \
&& rm -rf /var/lib/apt/lists/* \
&& mkdir -p -m 0777 /tmp/dapps
COPY --from=build /src/build/example_simple_dapp /usr/local/bin/example_simple_dapp
ENTRYPOINT ["/usr/local/bin/example_simple_dapp"]
18 changes: 18 additions & 0 deletions docker/Dockerfile.ran-sim
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# SPDX-FileCopyrightText: Copyright (c) 2026 Northeastern University
# SPDX-License-Identifier: Apache-2.0

# The RAN image: just example_simple_agent and the libraries it loads.
#
# docker build -f docker/Dockerfile.ran-sim -t libe3-ran-sim .

ARG BUILD_IMAGE=libe3-build:local
FROM ${BUILD_IMAGE} AS build

FROM ubuntu:24.04
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update \
&& apt-get install -y --no-install-recommends libzmq5 libsctp1 libprotobuf32t64 \
&& rm -rf /var/lib/apt/lists/* \
&& mkdir -p -m 0777 /tmp/dapps
COPY --from=build /src/build/example_simple_agent /usr/local/bin/example_simple_agent
ENTRYPOINT ["/usr/local/bin/example_simple_agent"]
51 changes: 51 additions & 0 deletions docker/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Container images

Four images that build libe3 once and run it as a simulated RAN, a simulated
dApp, or the latency benchmark. Each image is a plain `docker build`, so the
same files serve a laptop, a CI job and a cluster pipeline.

| Image | File | Runs |
|---|---|---|
| `libe3-build` | `Dockerfile.build` | Nothing. It holds the source, the toolchain and the build with every encoding, SCTP, the integration tests and latrec on. The others copy from it. |
| `libe3-ran-sim` | `Dockerfile.ran-sim` | `example_simple_agent`, a RAN E3 termination with the reference Service Model |
| `libe3-dapp-sim` | `Dockerfile.dapp-sim` | `example_simple_dapp`, a dApp E3 termination |
| `libe3-bench` | `Dockerfile.bench` | `test_bench_full_loop_latency`, the full-loop latency benchmark |

The dependency layer of `libe3-build` depends only on `build_libe3` and
`VERSION`, so a source change rebuilds the library but not the toolchain or
asn1c. `build_libe3 -I` stays the one place that lists the dependencies.

## Build

From the root of the repository:

```
docker build -f docker/Dockerfile.build -t libe3-build:local .
docker build -f docker/Dockerfile.ran-sim -t libe3-ran-sim:local .
docker build -f docker/Dockerfile.dapp-sim -t libe3-dapp-sim:local .
docker build -f docker/Dockerfile.bench -t libe3-bench:local .
```

The last three take `--build-arg BUILD_IMAGE=<image>` to copy from another
build of `libe3-build`.

## Run a RAN and a dApp together

```
docker/run-pair.sh posix sctp asn1
```

`run-pair.sh LINK TRANSPORT ENCODING` starts the RAN, then the dApp in the same
network namespace, with one shared directory for IPC. It passes when the dApp
exits 0 and prints at least one indication. The endpoints and ports are the
library defaults; the arguments after the image name are those of the examples
(`--link zmq|posix`, `--transport ipc|tcp|sctp`, `--encoding asn1|json|protobuf`).

SCTP needs the `sctp` kernel module on the machine that runs the containers:
containers share the host kernel.

## Run the benchmark

```
docker run --rm libe3-bench:local
```
54 changes: 54 additions & 0 deletions docker/run-pair.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#!/usr/bin/env bash
# SPDX-FileCopyrightText: Copyright (c) 2026 Northeastern University
# SPDX-License-Identifier: Apache-2.0
#
# Runs the simulated RAN and the simulated dApp as two containers that share a
# network namespace (loopback, so tcp and sctp work) and an IPC directory, and
# passes when the dApp exits 0 and prints at least one indication.
#
# docker/run-pair.sh [LINK] [TRANSPORT] [ENCODING] e.g. posix sctp asn1
#
# TAG picks the image tag (default: local). SECONDS_TO_RUN is how long the dApp
# runs (default: 8).

set -euo pipefail

link=${1:-posix}
transport=${2:-tcp}
encoding=${3:-asn1}
tag=${TAG:-local}
run_for=${SECONDS_TO_RUN:-8}

suffix=$$
ran=libe3-ran-$suffix
ipc=libe3-ipc-$suffix
args=(--link "$link" --transport "$transport" --encoding "$encoding")

cleanup() {
docker rm -f "$ran" >/dev/null 2>&1 || true
docker volume rm "$ipc" >/dev/null 2>&1 || true
}
trap cleanup EXIT

docker volume create "$ipc" >/dev/null
docker run -d --name "$ran" -v "$ipc:/tmp/dapps" "libe3-ran-sim:$tag" "${args[@]}" >/dev/null
sleep 1

set +e
dapp_log=$(timeout -k 10 $((run_for + 15)) docker run --rm --network "container:$ran" \
-v "$ipc:/tmp/dapps" "libe3-dapp-sim:$tag" \
"${args[@]}" --control --timed "$run_for" 2>&1)
dapp_exit=$?
set -e

docker kill -s INT "$ran" >/dev/null 2>&1 || true
echo "---- RAN (tail) ----"; docker logs --tail 20 "$ran" 2>&1 || true
echo "---- dApp (tail) ----"; tail -20 <<<"$dapp_log"

indications=$(grep -c "Indication #" <<<"$dapp_log" || true)
if [ "$dapp_exit" -ne 0 ]; then
echo "FAIL $link/$transport: dApp exit code $dapp_exit"; exit 1
elif [ "$indications" -eq 0 ]; then
echo "FAIL $link/$transport: no indication reached the dApp"; exit 1
fi
echo "PASS $link/$transport/$encoding: $indications indications"
Loading