smolpy 1.10.1.dev2__tar.gz → 1.10.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {smolpy-1.10.1.dev2 → smolpy-1.10.2}/.github/workflows/docker-image.yml +64 -12
- smolpy-1.10.2/.github/workflows/ns3-base.yml +131 -0
- {smolpy-1.10.1.dev2 → smolpy-1.10.2}/PKG-INFO +38 -8
- {smolpy-1.10.1.dev2 → smolpy-1.10.2}/README.md +37 -7
- {smolpy-1.10.1.dev2 → smolpy-1.10.2}/docs/adr/0004-execution-backends.md +3 -3
- {smolpy-1.10.1.dev2 → smolpy-1.10.2}/docs/backends.md +2 -2
- {smolpy-1.10.1.dev2 → smolpy-1.10.2}/docs/roadmap.md +3 -3
- {smolpy-1.10.1.dev2 → smolpy-1.10.2}/src/smolpy/__init__.py +7 -0
- {smolpy-1.10.1.dev2 → smolpy-1.10.2}/src/smolpy/cli.py +3 -0
- {smolpy-1.10.1.dev2 → smolpy-1.10.2}/tests/test_cli.py +16 -0
- smolpy-1.10.1.dev2/.github/workflows/ns3-base.yml +0 -86
- {smolpy-1.10.1.dev2 → smolpy-1.10.2}/.github/workflows/ci.yml +0 -0
- {smolpy-1.10.1.dev2 → smolpy-1.10.2}/.github/workflows/dev-build.yml +0 -0
- {smolpy-1.10.1.dev2 → smolpy-1.10.2}/.github/workflows/docs.yml +0 -0
- {smolpy-1.10.1.dev2 → smolpy-1.10.2}/.github/workflows/github-release.yml +0 -0
- {smolpy-1.10.1.dev2 → smolpy-1.10.2}/.github/workflows/publish.yml +0 -0
- {smolpy-1.10.1.dev2 → smolpy-1.10.2}/.github/workflows/release.yml +0 -0
- {smolpy-1.10.1.dev2 → smolpy-1.10.2}/.github/workflows/rust-wheels.yml +0 -0
- {smolpy-1.10.1.dev2 → smolpy-1.10.2}/.gitignore +0 -0
- {smolpy-1.10.1.dev2 → smolpy-1.10.2}/LICENSE +0 -0
- {smolpy-1.10.1.dev2 → smolpy-1.10.2}/benchmarks/__init__.py +0 -0
- {smolpy-1.10.1.dev2 → smolpy-1.10.2}/benchmarks/__main__.py +0 -0
- {smolpy-1.10.1.dev2 → smolpy-1.10.2}/benchmarks/load.py +0 -0
- {smolpy-1.10.1.dev2 → smolpy-1.10.2}/benchmarks/results/2026-11-13-0921-simpy-jaws-zbook-baseline.json +0 -0
- {smolpy-1.10.1.dev2 → smolpy-1.10.2}/benchmarks/results/2026-11-13-1527-simpy-jaws-zbook-optimised.json +0 -0
- {smolpy-1.10.1.dev2 → smolpy-1.10.2}/benchmarks/results/2026-11-13-2116-simpy-jaws-zbook-research-batch.json +0 -0
- {smolpy-1.10.1.dev2 → smolpy-1.10.2}/benchmarks/results/2026-11-13-2119-simpy-jaws-zbook-research-b4.json +0 -0
- {smolpy-1.10.1.dev2 → smolpy-1.10.2}/benchmarks/results/2026-11-15-1255-rust-jaws-zbook-stop-criterion.json +0 -0
- {smolpy-1.10.1.dev2 → smolpy-1.10.2}/benchmarks/results/2026-11-15-1333-rust-jaws-zbook-research-b4.json +0 -0
- {smolpy-1.10.1.dev2 → smolpy-1.10.2}/benchmarks/results/2026-11-15-1346-rust-jaws-zbook-research-batch.json +0 -0
- {smolpy-1.10.1.dev2 → smolpy-1.10.2}/benchmarks/results/2026-11-16-1839-simpy-ns3-jaws-zbook-tcp-under-load.json +0 -0
- {smolpy-1.10.1.dev2 → smolpy-1.10.2}/benchmarks/runner.py +0 -0
- {smolpy-1.10.1.dev2 → smolpy-1.10.2}/benchmarks/scenarios.py +0 -0
- {smolpy-1.10.1.dev2 → smolpy-1.10.2}/benchmarks/worker.py +0 -0
- {smolpy-1.10.1.dev2 → smolpy-1.10.2}/docker/Dockerfile +0 -0
- {smolpy-1.10.1.dev2 → smolpy-1.10.2}/docker/Dockerfile.dockerignore +0 -0
- {smolpy-1.10.1.dev2 → smolpy-1.10.2}/docker/Dockerfile.ns3 +0 -0
- {smolpy-1.10.1.dev2 → smolpy-1.10.2}/docker/Dockerfile.ns3.dockerignore +0 -0
- {smolpy-1.10.1.dev2 → smolpy-1.10.2}/docker/ns3-base/Dockerfile +0 -0
- {smolpy-1.10.1.dev2 → smolpy-1.10.2}/docker/ns3-base/smoke.cc +0 -0
- {smolpy-1.10.1.dev2 → smolpy-1.10.2}/docker/smoke.smol +0 -0
- {smolpy-1.10.1.dev2 → smolpy-1.10.2}/docs/adr/0001-protocol-package-structure.md +0 -0
- {smolpy-1.10.1.dev2 → smolpy-1.10.2}/docs/adr/0002-modbus-tcp-implementation.md +0 -0
- {smolpy-1.10.1.dev2 → smolpy-1.10.2}/docs/adr/0003-smol-external-dsl.md +0 -0
- {smolpy-1.10.1.dev2 → smolpy-1.10.2}/docs/adr/0005-profinet-rt.md +0 -0
- {smolpy-1.10.1.dev2 → smolpy-1.10.2}/docs/adr/0006-profiling-and-baseline-benchmark.md +0 -0
- {smolpy-1.10.1.dev2 → smolpy-1.10.2}/docs/adr/0007-execution-independent-scenario-model.md +0 -0
- {smolpy-1.10.1.dev2 → smolpy-1.10.2}/docs/adr/0008-rust-des-engine-mvp.md +0 -0
- {smolpy-1.10.1.dev2 → smolpy-1.10.2}/docs/adr/0009-batch-execution-and-cross-backend-validation.md +0 -0
- {smolpy-1.10.1.dev2 → smolpy-1.10.2}/docs/adr/0010-ethernet-frames-on-the-wire.md +0 -0
- {smolpy-1.10.1.dev2 → smolpy-1.10.2}/docs/benchmarks.md +0 -0
- {smolpy-1.10.1.dev2 → smolpy-1.10.2}/docs/dashboard.md +0 -0
- {smolpy-1.10.1.dev2 → smolpy-1.10.2}/docs/dsl-reference.md +0 -0
- {smolpy-1.10.1.dev2 → smolpy-1.10.2}/docs/examples.md +0 -0
- {smolpy-1.10.1.dev2 → smolpy-1.10.2}/docs/index.md +0 -0
- {smolpy-1.10.1.dev2 → smolpy-1.10.2}/docs/language-reference.md +0 -0
- {smolpy-1.10.1.dev2 → smolpy-1.10.2}/docs/modbus.md +0 -0
- {smolpy-1.10.1.dev2 → smolpy-1.10.2}/docs/model-semantics.md +0 -0
- {smolpy-1.10.1.dev2 → smolpy-1.10.2}/docs/mqtt.md +0 -0
- {smolpy-1.10.1.dev2 → smolpy-1.10.2}/docs/profinet.md +0 -0
- {smolpy-1.10.1.dev2 → smolpy-1.10.2}/docs/scenario-model.md +0 -0
- {smolpy-1.10.1.dev2 → smolpy-1.10.2}/docs/simulation-engine.md +0 -0
- {smolpy-1.10.1.dev2 → smolpy-1.10.2}/examples/README.md +0 -0
- {smolpy-1.10.1.dev2 → smolpy-1.10.2}/examples/example.py +0 -0
- {smolpy-1.10.1.dev2 → smolpy-1.10.2}/examples/example.smol +0 -0
- {smolpy-1.10.1.dev2 → smolpy-1.10.2}/examples/example_10_clients.py +0 -0
- {smolpy-1.10.1.dev2 → smolpy-1.10.2}/examples/example_12_clients.py +0 -0
- {smolpy-1.10.1.dev2 → smolpy-1.10.2}/examples/example_20_clients.py +0 -0
- {smolpy-1.10.1.dev2 → smolpy-1.10.2}/examples/example_file_transfer.py +0 -0
- {smolpy-1.10.1.dev2 → smolpy-1.10.2}/examples/example_modbus.py +0 -0
- {smolpy-1.10.1.dev2 → smolpy-1.10.2}/examples/example_mqtt.py +0 -0
- {smolpy-1.10.1.dev2 → smolpy-1.10.2}/examples/example_profinet.py +0 -0
- {smolpy-1.10.1.dev2 → smolpy-1.10.2}/examples/example_profinet.smol +0 -0
- {smolpy-1.10.1.dev2 → smolpy-1.10.2}/examples/example_staggered_transfer.py +0 -0
- {smolpy-1.10.1.dev2 → smolpy-1.10.2}/examples/example_two_tier.py +0 -0
- {smolpy-1.10.1.dev2 → smolpy-1.10.2}/mkdocs.yml +0 -0
- {smolpy-1.10.1.dev2 → smolpy-1.10.2}/pyproject.toml +0 -0
- {smolpy-1.10.1.dev2 → smolpy-1.10.2}/rust/Cargo.lock +0 -0
- {smolpy-1.10.1.dev2 → smolpy-1.10.2}/rust/Cargo.toml +0 -0
- {smolpy-1.10.1.dev2 → smolpy-1.10.2}/rust/smol-engine/Cargo.toml +0 -0
- {smolpy-1.10.1.dev2 → smolpy-1.10.2}/rust/smol-engine/src/frames.rs +0 -0
- {smolpy-1.10.1.dev2 → smolpy-1.10.2}/rust/smol-engine/src/lib.rs +0 -0
- {smolpy-1.10.1.dev2 → smolpy-1.10.2}/rust/smol-engine/src/rng.rs +0 -0
- {smolpy-1.10.1.dev2 → smolpy-1.10.2}/rust/smol-engine/src/scenario.rs +0 -0
- {smolpy-1.10.1.dev2 → smolpy-1.10.2}/rust/smol-engine/src/sim.rs +0 -0
- {smolpy-1.10.1.dev2 → smolpy-1.10.2}/rust/smol-engine/src/timebase.rs +0 -0
- {smolpy-1.10.1.dev2 → smolpy-1.10.2}/rust/smolpy-engine-rs/Cargo.toml +0 -0
- {smolpy-1.10.1.dev2 → smolpy-1.10.2}/rust/smolpy-engine-rs/README.md +0 -0
- {smolpy-1.10.1.dev2 → smolpy-1.10.2}/rust/smolpy-engine-rs/pyproject.toml +0 -0
- {smolpy-1.10.1.dev2 → smolpy-1.10.2}/rust/smolpy-engine-rs/smoke_test.py +0 -0
- {smolpy-1.10.1.dev2 → smolpy-1.10.2}/rust/smolpy-engine-rs/src/lib.rs +0 -0
- {smolpy-1.10.1.dev2 → smolpy-1.10.2}/src/smolpy/_worker.py +0 -0
- {smolpy-1.10.1.dev2 → smolpy-1.10.2}/src/smolpy/backends.py +0 -0
- {smolpy-1.10.1.dev2 → smolpy-1.10.2}/src/smolpy/batch.py +0 -0
- {smolpy-1.10.1.dev2 → smolpy-1.10.2}/src/smolpy/core/__init__.py +0 -0
- {smolpy-1.10.1.dev2 → smolpy-1.10.2}/src/smolpy/core/adapter.py +0 -0
- {smolpy-1.10.1.dev2 → smolpy-1.10.2}/src/smolpy/core/batch.py +0 -0
- {smolpy-1.10.1.dev2 → smolpy-1.10.2}/src/smolpy/core/link.py +0 -0
- {smolpy-1.10.1.dev2 → smolpy-1.10.2}/src/smolpy/core/network.py +0 -0
- {smolpy-1.10.1.dev2 → smolpy-1.10.2}/src/smolpy/core/node.py +0 -0
- {smolpy-1.10.1.dev2 → smolpy-1.10.2}/src/smolpy/core/observation.py +0 -0
- {smolpy-1.10.1.dev2 → smolpy-1.10.2}/src/smolpy/ethernet/__init__.py +0 -0
- {smolpy-1.10.1.dev2 → smolpy-1.10.2}/src/smolpy/ethernet/switch.py +0 -0
- {smolpy-1.10.1.dev2 → smolpy-1.10.2}/src/smolpy/lang/__init__.py +0 -0
- {smolpy-1.10.1.dev2 → smolpy-1.10.2}/src/smolpy/lang/ast.py +0 -0
- {smolpy-1.10.1.dev2 → smolpy-1.10.2}/src/smolpy/lang/errors.py +0 -0
- {smolpy-1.10.1.dev2 → smolpy-1.10.2}/src/smolpy/lang/grammar.lark +0 -0
- {smolpy-1.10.1.dev2 → smolpy-1.10.2}/src/smolpy/lang/interpreter.py +0 -0
- {smolpy-1.10.1.dev2 → smolpy-1.10.2}/src/smolpy/lang/transformer.py +0 -0
- {smolpy-1.10.1.dev2 → smolpy-1.10.2}/src/smolpy/modbus/__init__.py +0 -0
- {smolpy-1.10.1.dev2 → smolpy-1.10.2}/src/smolpy/modbus/slave.py +0 -0
- {smolpy-1.10.1.dev2 → smolpy-1.10.2}/src/smolpy/model/__init__.py +0 -0
- {smolpy-1.10.1.dev2 → smolpy-1.10.2}/src/smolpy/model/frames.py +0 -0
- {smolpy-1.10.1.dev2 → smolpy-1.10.2}/src/smolpy/model/scenario.py +0 -0
- {smolpy-1.10.1.dev2 → smolpy-1.10.2}/src/smolpy/model/streams.py +0 -0
- {smolpy-1.10.1.dev2 → smolpy-1.10.2}/src/smolpy/model/timebase.py +0 -0
- {smolpy-1.10.1.dev2 → smolpy-1.10.2}/src/smolpy/model/validate.py +0 -0
- {smolpy-1.10.1.dev2 → smolpy-1.10.2}/src/smolpy/mqtt/__init__.py +0 -0
- {smolpy-1.10.1.dev2 → smolpy-1.10.2}/src/smolpy/mqtt/broker.py +0 -0
- {smolpy-1.10.1.dev2 → smolpy-1.10.2}/src/smolpy/ns3/__init__.py +0 -0
- {smolpy-1.10.1.dev2 → smolpy-1.10.2}/src/smolpy/ns3/cpp/smol-ns3.cc +0 -0
- {smolpy-1.10.1.dev2 → smolpy-1.10.2}/src/smolpy/profinet/__init__.py +0 -0
- {smolpy-1.10.1.dev2 → smolpy-1.10.2}/src/smolpy/profinet/device.py +0 -0
- {smolpy-1.10.1.dev2 → smolpy-1.10.2}/src/smolpy/sim/__init__.py +0 -0
- {smolpy-1.10.1.dev2 → smolpy-1.10.2}/src/smolpy/sim/engine.py +0 -0
- {smolpy-1.10.1.dev2 → smolpy-1.10.2}/src/smolpy/stats.py +0 -0
- {smolpy-1.10.1.dev2 → smolpy-1.10.2}/src/smolpy/viz/__init__.py +0 -0
- {smolpy-1.10.1.dev2 → smolpy-1.10.2}/src/smolpy/viz/dashboard.py +0 -0
- {smolpy-1.10.1.dev2 → smolpy-1.10.2}/src/smolpy/viz/text_dashboard.py +0 -0
- {smolpy-1.10.1.dev2 → smolpy-1.10.2}/tests/__init__.py +0 -0
- {smolpy-1.10.1.dev2 → smolpy-1.10.2}/tests/equivalence/__init__.py +0 -0
- {smolpy-1.10.1.dev2 → smolpy-1.10.2}/tests/equivalence/harness.py +0 -0
- {smolpy-1.10.1.dev2 → smolpy-1.10.2}/tests/equivalence/scenarios.py +0 -0
- {smolpy-1.10.1.dev2 → smolpy-1.10.2}/tests/equivalence/test_equivalence.py +0 -0
- {smolpy-1.10.1.dev2 → smolpy-1.10.2}/tests/equivalence/test_rust_timebase.py +0 -0
- {smolpy-1.10.1.dev2 → smolpy-1.10.2}/tests/test_backends.py +0 -0
- {smolpy-1.10.1.dev2 → smolpy-1.10.2}/tests/test_batch.py +0 -0
- {smolpy-1.10.1.dev2 → smolpy-1.10.2}/tests/test_benchmarks.py +0 -0
- {smolpy-1.10.1.dev2 → smolpy-1.10.2}/tests/test_dsl.py +0 -0
- {smolpy-1.10.1.dev2 → smolpy-1.10.2}/tests/test_engine_ir.py +0 -0
- {smolpy-1.10.1.dev2 → smolpy-1.10.2}/tests/test_lang.py +0 -0
- {smolpy-1.10.1.dev2 → smolpy-1.10.2}/tests/test_model.py +0 -0
- {smolpy-1.10.1.dev2 → smolpy-1.10.2}/tests/test_ns3.py +0 -0
- {smolpy-1.10.1.dev2 → smolpy-1.10.2}/tests/test_profinet.py +0 -0
- {smolpy-1.10.1.dev2 → smolpy-1.10.2}/tests/test_semantics.py +0 -0
- {smolpy-1.10.1.dev2 → smolpy-1.10.2}/tests/test_simulation.py +0 -0
- {smolpy-1.10.1.dev2 → smolpy-1.10.2}/tests/test_stats.py +0 -0
- {smolpy-1.10.1.dev2 → smolpy-1.10.2}/tests/test_sweep.py +0 -0
- {smolpy-1.10.1.dev2 → smolpy-1.10.2}/tests/test_timebase.py +0 -0
- {smolpy-1.10.1.dev2 → smolpy-1.10.2}/tests/test_validate.py +0 -0
- {smolpy-1.10.1.dev2 → smolpy-1.10.2}/uv.lock +0 -0
|
@@ -4,15 +4,19 @@ name: Docker image
|
|
|
4
4
|
# the wheels of one version of smolpy and smolpy-engine-rs:
|
|
5
5
|
# - <version>, latest: without ns-3, for linux/amd64 and linux/arm64;
|
|
6
6
|
# - <version>-ns3, latest-ns3: on the ns-3 base image, with smol-ns3 built
|
|
7
|
-
# in, for linux/amd64
|
|
7
|
+
# in, for linux/amd64 and linux/arm64. Each platform is built and tested
|
|
8
|
+
# on a runner of its own architecture, as smol-ns3 is compiled in the
|
|
9
|
+
# image; it is pushed as <version>-ns3-<arch>, and the two tags are the
|
|
10
|
+
# multi-platform index of both.
|
|
8
11
|
# Every image is tested before anything is pushed: a .smol run through the
|
|
9
12
|
# CLI; the wheel smoke test (bit-exact with SimPy) without ns-3, and the ns-3
|
|
10
13
|
# suite with it.
|
|
11
14
|
#
|
|
12
15
|
# - Called by publish.yml at a release, once both packages are on PyPI: uses
|
|
13
16
|
# the files of the same run and pushes both images.
|
|
14
|
-
# - On a pull request that touches the images: builds the wheels here,
|
|
15
|
-
# linux/amd64
|
|
17
|
+
# - On a pull request that touches the images: builds the wheels here, tests
|
|
18
|
+
# the image without ns-3 for linux/amd64 and the image with ns-3 for both
|
|
19
|
+
# platforms, and pushes nothing.
|
|
16
20
|
|
|
17
21
|
on:
|
|
18
22
|
pull_request:
|
|
@@ -96,6 +100,15 @@ jobs:
|
|
|
96
100
|
manylinux: auto
|
|
97
101
|
args: --release --out dist -m rust/smolpy-engine-rs/Cargo.toml
|
|
98
102
|
|
|
103
|
+
# for the ns-3 image on linux/arm64
|
|
104
|
+
- name: Build smolpy-engine-rs for aarch64
|
|
105
|
+
if: ${{ env.RELEASE != 'true' }}
|
|
106
|
+
uses: PyO3/maturin-action@v1
|
|
107
|
+
with:
|
|
108
|
+
target: aarch64
|
|
109
|
+
manylinux: auto
|
|
110
|
+
args: --release --out dist -m rust/smolpy-engine-rs/Cargo.toml
|
|
111
|
+
|
|
99
112
|
# --- the image ---
|
|
100
113
|
|
|
101
114
|
- name: Version
|
|
@@ -167,13 +180,20 @@ jobs:
|
|
|
167
180
|
echo "Pushed $IMAGE:$VERSION and $IMAGE:latest" >> "$GITHUB_STEP_SUMMARY"
|
|
168
181
|
|
|
169
182
|
image-ns3:
|
|
170
|
-
name: ${{ inputs.version && format('Image {0}-ns3', inputs.version) || 'Image with ns-3 (test build)' }}
|
|
183
|
+
name: ${{ inputs.version && format('Image {0}-ns3', inputs.version) || 'Image with ns-3 (test build)' }}, ${{ matrix.platform }}
|
|
171
184
|
needs: image
|
|
172
|
-
runs-on:
|
|
185
|
+
runs-on: ${{ matrix.runner }}
|
|
173
186
|
permissions:
|
|
174
187
|
contents: read
|
|
175
188
|
packages: write # push to ghcr.io
|
|
176
189
|
|
|
190
|
+
strategy:
|
|
191
|
+
fail-fast: false
|
|
192
|
+
matrix:
|
|
193
|
+
include:
|
|
194
|
+
- { platform: linux/amd64, arch: amd64, runner: ubuntu-latest }
|
|
195
|
+
- { platform: linux/arm64, arch: arm64, runner: ubuntu-24.04-arm }
|
|
196
|
+
|
|
177
197
|
env:
|
|
178
198
|
IMAGE: ghcr.io/${{ github.repository_owner }}/smolpy
|
|
179
199
|
RELEASE: ${{ inputs.version && 'true' || 'false' }}
|
|
@@ -196,13 +216,15 @@ jobs:
|
|
|
196
216
|
# below that needed another build would fail
|
|
197
217
|
- name: Build
|
|
198
218
|
run: |
|
|
199
|
-
docker buildx build --platform
|
|
219
|
+
docker buildx build --platform "${{ matrix.platform }}" --load \
|
|
200
220
|
--build-arg VERSION="$VERSION" -f docker/Dockerfile.ns3 -t smolpy:test-ns3 .
|
|
221
|
+
docker image inspect --format '{{.Os}}/{{.Architecture}}' smolpy:test-ns3 \
|
|
222
|
+
| grep -qx "${{ matrix.platform }}"
|
|
201
223
|
docker image ls smolpy:test-ns3
|
|
202
224
|
|
|
203
225
|
- name: Test the CLI on ns-3
|
|
204
226
|
run: |
|
|
205
|
-
docker run --rm smolpy:test-ns3 --
|
|
227
|
+
docker run --rm smolpy:test-ns3 --version | grep -qx "smolpy $VERSION"
|
|
206
228
|
mkdir -p out && chmod 777 out
|
|
207
229
|
cp docker/smoke.smol out/
|
|
208
230
|
docker run --rm -v "$PWD/out:/work" \
|
|
@@ -230,8 +252,38 @@ jobs:
|
|
|
230
252
|
- name: Push
|
|
231
253
|
if: ${{ env.RELEASE == 'true' }}
|
|
232
254
|
run: |
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
255
|
+
docker tag smolpy:test-ns3 "$IMAGE:$VERSION-ns3-${{ matrix.arch }}"
|
|
256
|
+
docker push "$IMAGE:$VERSION-ns3-${{ matrix.arch }}"
|
|
257
|
+
echo "Pushed $IMAGE:$VERSION-ns3-${{ matrix.arch }}" >> "$GITHUB_STEP_SUMMARY"
|
|
258
|
+
|
|
259
|
+
# <version>-ns3 and latest-ns3: one tag for both platforms, from the images
|
|
260
|
+
# tested above
|
|
261
|
+
image-ns3-index:
|
|
262
|
+
name: ${{ inputs.version && format('Image {0}-ns3, both platforms', inputs.version) || 'Image with ns-3, both platforms (release only)' }}
|
|
263
|
+
needs: [image, image-ns3]
|
|
264
|
+
if: ${{ inputs.version }}
|
|
265
|
+
runs-on: ubuntu-latest
|
|
266
|
+
permissions:
|
|
267
|
+
contents: read
|
|
268
|
+
packages: write # push to ghcr.io
|
|
269
|
+
|
|
270
|
+
env:
|
|
271
|
+
IMAGE: ghcr.io/${{ github.repository_owner }}/smolpy
|
|
272
|
+
VERSION: ${{ needs.image.outputs.version }}
|
|
273
|
+
|
|
274
|
+
steps:
|
|
275
|
+
- uses: docker/setup-buildx-action@v3
|
|
276
|
+
|
|
277
|
+
- name: Log in to ghcr.io
|
|
278
|
+
uses: docker/login-action@v3
|
|
279
|
+
with:
|
|
280
|
+
registry: ghcr.io
|
|
281
|
+
username: ${{ github.actor }}
|
|
282
|
+
password: ${{ secrets.GITHUB_TOKEN }}
|
|
283
|
+
|
|
284
|
+
- name: Push the index
|
|
285
|
+
run: |
|
|
286
|
+
docker buildx imagetools create -t "$IMAGE:$VERSION-ns3" -t "$IMAGE:latest-ns3" \
|
|
287
|
+
"$IMAGE:$VERSION-ns3-amd64" "$IMAGE:$VERSION-ns3-arm64"
|
|
288
|
+
docker buildx imagetools inspect "$IMAGE:$VERSION-ns3"
|
|
289
|
+
echo "Pushed $IMAGE:$VERSION-ns3 and $IMAGE:latest-ns3 for linux/amd64 and linux/arm64" >> "$GITHUB_STEP_SUMMARY"
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
name: ns-3 base image
|
|
2
|
+
|
|
3
|
+
# ghcr.io/jwszolek/smolpy-ns3-base:<ns-3 version> (ADR-0004, Container
|
|
4
|
+
# images): the pinned ns-3 release, built once. It is rebuilt only when its
|
|
5
|
+
# Dockerfile changes, which is how the pinned release changes, so releases
|
|
6
|
+
# never build ns-3. For linux/amd64 and linux/arm64, each built on a runner of
|
|
7
|
+
# its own architecture, as an emulated build of ns-3 would take hours: each
|
|
8
|
+
# platform is pushed as <ns-3 version>-<arch>, and <ns-3 version> is the
|
|
9
|
+
# multi-platform index of the two.
|
|
10
|
+
#
|
|
11
|
+
# Every build is tested before it is pushed: a scratch program, as the ns-3
|
|
12
|
+
# backend's generated scenarios will be, built and run against it.
|
|
13
|
+
#
|
|
14
|
+
# - On a pull request that changes it: build and test both, push nothing.
|
|
15
|
+
# - After the merge to main, or run by hand: build, test and push.
|
|
16
|
+
|
|
17
|
+
on:
|
|
18
|
+
push:
|
|
19
|
+
branches:
|
|
20
|
+
- main
|
|
21
|
+
paths:
|
|
22
|
+
- "docker/ns3-base/**"
|
|
23
|
+
- ".github/workflows/ns3-base.yml"
|
|
24
|
+
pull_request:
|
|
25
|
+
paths:
|
|
26
|
+
- "docker/ns3-base/**"
|
|
27
|
+
- ".github/workflows/ns3-base.yml"
|
|
28
|
+
workflow_dispatch:
|
|
29
|
+
|
|
30
|
+
jobs:
|
|
31
|
+
image:
|
|
32
|
+
name: ns-3 base image, ${{ matrix.platform }}
|
|
33
|
+
runs-on: ${{ matrix.runner }}
|
|
34
|
+
timeout-minutes: 120
|
|
35
|
+
permissions:
|
|
36
|
+
contents: read
|
|
37
|
+
packages: write # push to ghcr.io
|
|
38
|
+
|
|
39
|
+
strategy:
|
|
40
|
+
fail-fast: false
|
|
41
|
+
matrix:
|
|
42
|
+
include:
|
|
43
|
+
- { platform: linux/amd64, arch: amd64, runner: ubuntu-latest }
|
|
44
|
+
- { platform: linux/arm64, arch: arm64, runner: ubuntu-24.04-arm }
|
|
45
|
+
|
|
46
|
+
env:
|
|
47
|
+
IMAGE: ghcr.io/${{ github.repository_owner }}/smolpy-ns3-base
|
|
48
|
+
PUSH: ${{ github.event_name != 'pull_request' }}
|
|
49
|
+
|
|
50
|
+
outputs:
|
|
51
|
+
version: ${{ steps.v.outputs.version }}
|
|
52
|
+
|
|
53
|
+
steps:
|
|
54
|
+
- uses: actions/checkout@v4
|
|
55
|
+
|
|
56
|
+
- name: The pinned ns-3 release
|
|
57
|
+
id: v
|
|
58
|
+
run: |
|
|
59
|
+
VERSION=$(sed -nE 's/^ARG NS3_VERSION=(.+)$/\1/p' docker/ns3-base/Dockerfile)
|
|
60
|
+
test -n "$VERSION"
|
|
61
|
+
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
|
|
62
|
+
echo "ns-3 $VERSION on $(uname -m)"
|
|
63
|
+
|
|
64
|
+
- uses: docker/setup-buildx-action@v3
|
|
65
|
+
|
|
66
|
+
# the layers of an unchanged ns-3 build come from the cache
|
|
67
|
+
- name: Build
|
|
68
|
+
uses: docker/build-push-action@v6
|
|
69
|
+
with:
|
|
70
|
+
context: docker/ns3-base
|
|
71
|
+
platforms: ${{ matrix.platform }}
|
|
72
|
+
load: true
|
|
73
|
+
tags: ns3-base:test
|
|
74
|
+
cache-from: type=gha,scope=ns3-base-${{ matrix.arch }}
|
|
75
|
+
cache-to: type=gha,scope=ns3-base-${{ matrix.arch }},mode=max
|
|
76
|
+
|
|
77
|
+
- name: Test with a scratch program
|
|
78
|
+
run: |
|
|
79
|
+
docker run --rm -v "$PWD/docker/ns3-base/smoke.cc:/opt/ns-3/scratch/smoke.cc:ro" \
|
|
80
|
+
ns3-base:test ./ns3 run smoke
|
|
81
|
+
docker image inspect --format '{{.Os}}/{{.Architecture}}' ns3-base:test \
|
|
82
|
+
| grep -qx "${{ matrix.platform }}"
|
|
83
|
+
docker image ls ns3-base:test
|
|
84
|
+
|
|
85
|
+
- name: Log in to ghcr.io
|
|
86
|
+
if: ${{ env.PUSH == 'true' }}
|
|
87
|
+
uses: docker/login-action@v3
|
|
88
|
+
with:
|
|
89
|
+
registry: ghcr.io
|
|
90
|
+
username: ${{ github.actor }}
|
|
91
|
+
password: ${{ secrets.GITHUB_TOKEN }}
|
|
92
|
+
|
|
93
|
+
- name: Push
|
|
94
|
+
if: ${{ env.PUSH == 'true' }}
|
|
95
|
+
env:
|
|
96
|
+
VERSION: ${{ steps.v.outputs.version }}
|
|
97
|
+
run: |
|
|
98
|
+
docker tag ns3-base:test "$IMAGE:$VERSION-${{ matrix.arch }}"
|
|
99
|
+
docker push "$IMAGE:$VERSION-${{ matrix.arch }}"
|
|
100
|
+
echo "Pushed $IMAGE:$VERSION-${{ matrix.arch }}" >> "$GITHUB_STEP_SUMMARY"
|
|
101
|
+
|
|
102
|
+
# <ns-3 version>: one tag for both platforms, from the images tested above
|
|
103
|
+
index:
|
|
104
|
+
name: ns-3 base image, both platforms
|
|
105
|
+
needs: image
|
|
106
|
+
if: ${{ github.event_name != 'pull_request' }}
|
|
107
|
+
runs-on: ubuntu-latest
|
|
108
|
+
permissions:
|
|
109
|
+
contents: read
|
|
110
|
+
packages: write # push to ghcr.io
|
|
111
|
+
|
|
112
|
+
env:
|
|
113
|
+
IMAGE: ghcr.io/${{ github.repository_owner }}/smolpy-ns3-base
|
|
114
|
+
VERSION: ${{ needs.image.outputs.version }}
|
|
115
|
+
|
|
116
|
+
steps:
|
|
117
|
+
- uses: docker/setup-buildx-action@v3
|
|
118
|
+
|
|
119
|
+
- name: Log in to ghcr.io
|
|
120
|
+
uses: docker/login-action@v3
|
|
121
|
+
with:
|
|
122
|
+
registry: ghcr.io
|
|
123
|
+
username: ${{ github.actor }}
|
|
124
|
+
password: ${{ secrets.GITHUB_TOKEN }}
|
|
125
|
+
|
|
126
|
+
- name: Push the index
|
|
127
|
+
run: |
|
|
128
|
+
docker buildx imagetools create -t "$IMAGE:$VERSION" \
|
|
129
|
+
"$IMAGE:$VERSION-amd64" "$IMAGE:$VERSION-arm64"
|
|
130
|
+
docker buildx imagetools inspect "$IMAGE:$VERSION"
|
|
131
|
+
echo "Pushed $IMAGE:$VERSION for linux/amd64 and linux/arm64" >> "$GITHUB_STEP_SUMMARY"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: smolpy
|
|
3
|
-
Version: 1.10.
|
|
3
|
+
Version: 1.10.2
|
|
4
4
|
Summary: Network simulation DSL and discrete-event simulator
|
|
5
5
|
License: MIT
|
|
6
6
|
License-File: LICENSE
|
|
@@ -39,16 +39,17 @@ Python rewrite of SMOL — a Network Description Language and Discrete-Event Sim
|
|
|
39
39
|
|
|
40
40
|
SMOLPy lets you describe a network topology in pure Python, define traffic flows, and run a discrete-event simulation that produces real metric time-series. A built-in Dear PyGui desktop dashboard shows the topology and live metric charts as the simulation runs.
|
|
41
41
|
|
|
42
|
-
> **
|
|
42
|
+
> **Three simulation engines, one model.** A scenario, written in Python or in a `.smol` file, becomes one execution-independent model, and it runs on any of three engines:
|
|
43
43
|
>
|
|
44
44
|
> - **SimPy** (Python): the reference implementation. It is always installed, runs the whole model and drives the dashboards.
|
|
45
45
|
> - **Rust** (`smol-engine`): a native engine that gives **SimPy's results bit for bit** and runs about **40× faster**. B1 at 10 M frames takes 4.9 s, against 200.8 s on SimPy.
|
|
46
|
+
> - **ns-3**: the same scenario on **[ns-3](https://www.nsnam.org/)**, the established network simulator, with its real IPv4, UDP and **TCP** stack. Modbus TCP and MQTT run over ns-3's TCP, with its handshake, acknowledgements, and flow and congestion control. Ethernet and PROFINET RT give SimPy's results bit for bit.
|
|
46
47
|
>
|
|
47
48
|
> ```python
|
|
48
|
-
> result = net.simulate(duration=60_000, backend="rust")
|
|
49
|
+
> result = net.simulate(duration=60_000, backend="rust") # or "ns3"
|
|
49
50
|
> ```
|
|
50
51
|
>
|
|
51
|
-
>
|
|
52
|
+
> Every engine runs the whole model: Ethernet, Modbus TCP, MQTT and PROFINET RT. Only the live and text dashboards need SimPy. See [Simulation engine](#simulation-engine), [Running on ns-3](#running-on-ns-3) and [Execution backends](https://jwszolek.github.io/SMOLPy/backends/).
|
|
52
53
|
|
|
53
54
|
📖 **Full documentation:** [jwszolek.github.io/SMOLPy](https://jwszolek.github.io/SMOLPy/)
|
|
54
55
|
|
|
@@ -99,7 +100,7 @@ docker run --rm -v "$PWD:/work" ghcr.io/jwszolek/smolpy run plant.smol --backend
|
|
|
99
100
|
- It runs as uid 1000. To own the files it writes as yourself, add `--user "$(id -u):$(id -g)"`.
|
|
100
101
|
- A version is pinned as `ghcr.io/jwszolek/smolpy:<version>`; `latest` is the latest release.
|
|
101
102
|
|
|
102
|
-
**With ns-3,** from the image `<version>-ns3` or `latest-ns3`, for `linux/amd64
|
|
103
|
+
**With ns-3,** from the image `<version>-ns3` or `latest-ns3`, published from 1.10.0 on, for `linux/amd64` and, from the release after 1.10.1, `linux/arm64`. It adds the pinned ns-3 build and the ns-3 backend, ready to run:
|
|
103
104
|
|
|
104
105
|
```bash
|
|
105
106
|
docker run --rm -v "$PWD:/work" ghcr.io/jwszolek/smolpy:latest-ns3 run plant.smol --backend ns3 -o results.csv
|
|
@@ -483,7 +484,7 @@ IRT (isochronous, scheduled) traffic, AR establishment (DCP / RPC connect), acyc
|
|
|
483
484
|
|
|
484
485
|
## Simulation engine
|
|
485
486
|
|
|
486
|
-
Every simulation goes through the same path. The Python API and `.smol` files build a **Scenario IR**, an execution-independent model ([ADR-0007](https://jwszolek.github.io/SMOLPy/adr/0007-execution-independent-scenario-model/)), and a **backend** runs it.
|
|
487
|
+
Every simulation goes through the same path. The Python API and `.smol` files build a **Scenario IR**, an execution-independent model ([ADR-0007](https://jwszolek.github.io/SMOLPy/adr/0007-execution-independent-scenario-model/)), and a **backend** runs it. Every engine follows the same written contract, [Model Semantics](https://jwszolek.github.io/SMOLPy/model-semantics/):
|
|
487
488
|
- simulated time is integer nanoseconds;
|
|
488
489
|
- frames are modelled on the wire as real Ethernet, with preamble, FCS and inter-frame gap.
|
|
489
490
|
|
|
@@ -502,11 +503,11 @@ batch = run_many(net, runs=30, duration=60_000, backend="rust")
|
|
|
502
503
|
smolpy run plant.smol --backend rust
|
|
503
504
|
```
|
|
504
505
|
|
|
505
|
-
- **The same numbers.** On deterministic scenarios the Rust engine reproduces SimPy's results bit for bit, down to the event count. Random traffic uses
|
|
506
|
+
- **The same numbers.** On deterministic scenarios the Rust engine reproduces SimPy's results bit for bit, down to the event count. Random traffic uses its own generator, so there the results agree statistically. ns-3 draws random traffic from SimPy's streams, so its Ethernet and PROFINET RT results are bit for bit with the same seed, random traffic included. CI checks both on every pull request ([ADR-0009](https://jwszolek.github.io/SMOLPy/adr/0009-batch-execution-and-cross-backend-validation/)).
|
|
506
507
|
- **ns-3 adds TCP.** Ethernet and PROFINET on ns-3 also give SimPy's results bit for bit. Modbus and MQTT run over ns-3's TCP, so their results differ by what TCP does: under heavy load by up to +43 % in latency. [Execution backends](https://jwszolek.github.io/SMOLPy/backends/) has the details and measurements.
|
|
507
508
|
- **Nothing is skipped silently.** A scenario that uses something a backend does not support is rejected before the run with a message naming the element. Asking the Rust engine for a dashboard is an error too.
|
|
508
509
|
|
|
509
|
-
The model
|
|
510
|
+
The model every engine implements:
|
|
510
511
|
|
|
511
512
|
- **MAC-learning switch** — each switch pre-seeds its forwarding table from the topology wiring, eliminating spurious flooding toward silent endpoints (e.g. a server that only receives). Dynamic learning still operates for traffic through intermediate switches.
|
|
512
513
|
- **Store-and-forward model** — transmission delay + propagation delay per hop.
|
|
@@ -516,6 +517,35 @@ The model both engines implement:
|
|
|
516
517
|
|
|
517
518
|
---
|
|
518
519
|
|
|
520
|
+
## Running on ns-3
|
|
521
|
+
|
|
522
|
+
The `ns3` backend runs a SMOL scenario on [ns-3](https://www.nsnam.org/) 3.49, the open-source network simulator used widely in networking research. The same `.smol` file or `Network` that runs on SimPy runs there too, unchanged:
|
|
523
|
+
|
|
524
|
+
```bash
|
|
525
|
+
docker run --rm -v "$PWD:/work" ghcr.io/jwszolek/smolpy:latest-ns3 run plant.smol --backend ns3 -o results.csv
|
|
526
|
+
```
|
|
527
|
+
|
|
528
|
+
```python
|
|
529
|
+
result = net.simulate(duration=60_000, backend="ns3")
|
|
530
|
+
```
|
|
531
|
+
|
|
532
|
+
**What it is for.**
|
|
533
|
+
- **A real TCP.** SMOL sizes Modbus TCP and MQTT frames as TCP segments, but SimPy and Rust do not model TCP's behaviour. On ns-3 every Modbus master–slave and MQTT client–broker pair has one persistent connection over ns-3's TCP: the handshake, delayed acknowledgements, CUBIC congestion control and the receiver's window.
|
|
534
|
+
- **A cross-check against an established simulator.** Below the TCP layer, ns-3 runs SMOL's own full-duplex Ethernet device and switch. So Ethernet over UDP and PROFINET RT on layer 2 give SimPy's results **bit for bit**, watchdog expiries and stochastic traffic included. That ties SMOL's reference model to ns-3's event scheduler and IP stack.
|
|
535
|
+
- **Where TCP matters.** `python -m benchmarks load` runs a plant cell whose Modbus and MQTT traffic shares a 10 Mb/s uplink with a UDP camera, from 50 % to 150 % offered load:
|
|
536
|
+
|
|
537
|
+
| Offered load | Modbus RTT, SimPy → ns-3 | MQTT latency, SimPy → ns-3 | Delivered to the HMI |
|
|
538
|
+
|---|---|---|---|
|
|
539
|
+
| 0.50 – 0.95 | within 0.4 % | within 0.4 % | the same |
|
|
540
|
+
| 1.00 | +18 % | +25 % | the same |
|
|
541
|
+
| 1.50 | 3.2 → 3.4 s (+6 %) | 3.2 → 4.5 s (+43 %) | −41 % |
|
|
542
|
+
|
|
543
|
+
Below saturation the engines agree. At saturation, TCP's own acknowledgements tip the link over. Heavily overloaded, TCP's windows hold MQTT back while the UDP stream, which does not back off, takes the link. [Execution backends](https://jwszolek.github.io/SMOLPy/backends/#modbus-and-mqtt-over-tcp) has the full table and the mechanism.
|
|
544
|
+
|
|
545
|
+
**Getting it.** ns-3 cannot be installed with `pip`, so the simplest way is the image `ghcr.io/jwszolek/smolpy:latest-ns3` ([Install](#install)). It holds the ns-3 build, SMOLPy, the Rust engine and `smol-ns3`, the C++ program that runs scenarios on ns-3, compiled in. With your own ns-3 3.49 build instead, set `NS3_HOME` to it: the first run compiles `smol-ns3` in about 8 s and caches it.
|
|
546
|
+
|
|
547
|
+
---
|
|
548
|
+
|
|
519
549
|
## Examples
|
|
520
550
|
|
|
521
551
|
See [`examples/README.md`](examples/README.md) for ten ready-to-run scenarios covering single-switch saturation, oversubscription, two-tier access bottlenecks, MQTT publish-subscribe, Modbus TCP polling, and PROFINET RT cyclic I/O.
|
|
@@ -11,16 +11,17 @@ Python rewrite of SMOL — a Network Description Language and Discrete-Event Sim
|
|
|
11
11
|
|
|
12
12
|
SMOLPy lets you describe a network topology in pure Python, define traffic flows, and run a discrete-event simulation that produces real metric time-series. A built-in Dear PyGui desktop dashboard shows the topology and live metric charts as the simulation runs.
|
|
13
13
|
|
|
14
|
-
> **
|
|
14
|
+
> **Three simulation engines, one model.** A scenario, written in Python or in a `.smol` file, becomes one execution-independent model, and it runs on any of three engines:
|
|
15
15
|
>
|
|
16
16
|
> - **SimPy** (Python): the reference implementation. It is always installed, runs the whole model and drives the dashboards.
|
|
17
17
|
> - **Rust** (`smol-engine`): a native engine that gives **SimPy's results bit for bit** and runs about **40× faster**. B1 at 10 M frames takes 4.9 s, against 200.8 s on SimPy.
|
|
18
|
+
> - **ns-3**: the same scenario on **[ns-3](https://www.nsnam.org/)**, the established network simulator, with its real IPv4, UDP and **TCP** stack. Modbus TCP and MQTT run over ns-3's TCP, with its handshake, acknowledgements, and flow and congestion control. Ethernet and PROFINET RT give SimPy's results bit for bit.
|
|
18
19
|
>
|
|
19
20
|
> ```python
|
|
20
|
-
> result = net.simulate(duration=60_000, backend="rust")
|
|
21
|
+
> result = net.simulate(duration=60_000, backend="rust") # or "ns3"
|
|
21
22
|
> ```
|
|
22
23
|
>
|
|
23
|
-
>
|
|
24
|
+
> Every engine runs the whole model: Ethernet, Modbus TCP, MQTT and PROFINET RT. Only the live and text dashboards need SimPy. See [Simulation engine](#simulation-engine), [Running on ns-3](#running-on-ns-3) and [Execution backends](https://jwszolek.github.io/SMOLPy/backends/).
|
|
24
25
|
|
|
25
26
|
📖 **Full documentation:** [jwszolek.github.io/SMOLPy](https://jwszolek.github.io/SMOLPy/)
|
|
26
27
|
|
|
@@ -71,7 +72,7 @@ docker run --rm -v "$PWD:/work" ghcr.io/jwszolek/smolpy run plant.smol --backend
|
|
|
71
72
|
- It runs as uid 1000. To own the files it writes as yourself, add `--user "$(id -u):$(id -g)"`.
|
|
72
73
|
- A version is pinned as `ghcr.io/jwszolek/smolpy:<version>`; `latest` is the latest release.
|
|
73
74
|
|
|
74
|
-
**With ns-3,** from the image `<version>-ns3` or `latest-ns3`, for `linux/amd64
|
|
75
|
+
**With ns-3,** from the image `<version>-ns3` or `latest-ns3`, published from 1.10.0 on, for `linux/amd64` and, from the release after 1.10.1, `linux/arm64`. It adds the pinned ns-3 build and the ns-3 backend, ready to run:
|
|
75
76
|
|
|
76
77
|
```bash
|
|
77
78
|
docker run --rm -v "$PWD:/work" ghcr.io/jwszolek/smolpy:latest-ns3 run plant.smol --backend ns3 -o results.csv
|
|
@@ -455,7 +456,7 @@ IRT (isochronous, scheduled) traffic, AR establishment (DCP / RPC connect), acyc
|
|
|
455
456
|
|
|
456
457
|
## Simulation engine
|
|
457
458
|
|
|
458
|
-
Every simulation goes through the same path. The Python API and `.smol` files build a **Scenario IR**, an execution-independent model ([ADR-0007](https://jwszolek.github.io/SMOLPy/adr/0007-execution-independent-scenario-model/)), and a **backend** runs it.
|
|
459
|
+
Every simulation goes through the same path. The Python API and `.smol` files build a **Scenario IR**, an execution-independent model ([ADR-0007](https://jwszolek.github.io/SMOLPy/adr/0007-execution-independent-scenario-model/)), and a **backend** runs it. Every engine follows the same written contract, [Model Semantics](https://jwszolek.github.io/SMOLPy/model-semantics/):
|
|
459
460
|
- simulated time is integer nanoseconds;
|
|
460
461
|
- frames are modelled on the wire as real Ethernet, with preamble, FCS and inter-frame gap.
|
|
461
462
|
|
|
@@ -474,11 +475,11 @@ batch = run_many(net, runs=30, duration=60_000, backend="rust")
|
|
|
474
475
|
smolpy run plant.smol --backend rust
|
|
475
476
|
```
|
|
476
477
|
|
|
477
|
-
- **The same numbers.** On deterministic scenarios the Rust engine reproduces SimPy's results bit for bit, down to the event count. Random traffic uses
|
|
478
|
+
- **The same numbers.** On deterministic scenarios the Rust engine reproduces SimPy's results bit for bit, down to the event count. Random traffic uses its own generator, so there the results agree statistically. ns-3 draws random traffic from SimPy's streams, so its Ethernet and PROFINET RT results are bit for bit with the same seed, random traffic included. CI checks both on every pull request ([ADR-0009](https://jwszolek.github.io/SMOLPy/adr/0009-batch-execution-and-cross-backend-validation/)).
|
|
478
479
|
- **ns-3 adds TCP.** Ethernet and PROFINET on ns-3 also give SimPy's results bit for bit. Modbus and MQTT run over ns-3's TCP, so their results differ by what TCP does: under heavy load by up to +43 % in latency. [Execution backends](https://jwszolek.github.io/SMOLPy/backends/) has the details and measurements.
|
|
479
480
|
- **Nothing is skipped silently.** A scenario that uses something a backend does not support is rejected before the run with a message naming the element. Asking the Rust engine for a dashboard is an error too.
|
|
480
481
|
|
|
481
|
-
The model
|
|
482
|
+
The model every engine implements:
|
|
482
483
|
|
|
483
484
|
- **MAC-learning switch** — each switch pre-seeds its forwarding table from the topology wiring, eliminating spurious flooding toward silent endpoints (e.g. a server that only receives). Dynamic learning still operates for traffic through intermediate switches.
|
|
484
485
|
- **Store-and-forward model** — transmission delay + propagation delay per hop.
|
|
@@ -488,6 +489,35 @@ The model both engines implement:
|
|
|
488
489
|
|
|
489
490
|
---
|
|
490
491
|
|
|
492
|
+
## Running on ns-3
|
|
493
|
+
|
|
494
|
+
The `ns3` backend runs a SMOL scenario on [ns-3](https://www.nsnam.org/) 3.49, the open-source network simulator used widely in networking research. The same `.smol` file or `Network` that runs on SimPy runs there too, unchanged:
|
|
495
|
+
|
|
496
|
+
```bash
|
|
497
|
+
docker run --rm -v "$PWD:/work" ghcr.io/jwszolek/smolpy:latest-ns3 run plant.smol --backend ns3 -o results.csv
|
|
498
|
+
```
|
|
499
|
+
|
|
500
|
+
```python
|
|
501
|
+
result = net.simulate(duration=60_000, backend="ns3")
|
|
502
|
+
```
|
|
503
|
+
|
|
504
|
+
**What it is for.**
|
|
505
|
+
- **A real TCP.** SMOL sizes Modbus TCP and MQTT frames as TCP segments, but SimPy and Rust do not model TCP's behaviour. On ns-3 every Modbus master–slave and MQTT client–broker pair has one persistent connection over ns-3's TCP: the handshake, delayed acknowledgements, CUBIC congestion control and the receiver's window.
|
|
506
|
+
- **A cross-check against an established simulator.** Below the TCP layer, ns-3 runs SMOL's own full-duplex Ethernet device and switch. So Ethernet over UDP and PROFINET RT on layer 2 give SimPy's results **bit for bit**, watchdog expiries and stochastic traffic included. That ties SMOL's reference model to ns-3's event scheduler and IP stack.
|
|
507
|
+
- **Where TCP matters.** `python -m benchmarks load` runs a plant cell whose Modbus and MQTT traffic shares a 10 Mb/s uplink with a UDP camera, from 50 % to 150 % offered load:
|
|
508
|
+
|
|
509
|
+
| Offered load | Modbus RTT, SimPy → ns-3 | MQTT latency, SimPy → ns-3 | Delivered to the HMI |
|
|
510
|
+
|---|---|---|---|
|
|
511
|
+
| 0.50 – 0.95 | within 0.4 % | within 0.4 % | the same |
|
|
512
|
+
| 1.00 | +18 % | +25 % | the same |
|
|
513
|
+
| 1.50 | 3.2 → 3.4 s (+6 %) | 3.2 → 4.5 s (+43 %) | −41 % |
|
|
514
|
+
|
|
515
|
+
Below saturation the engines agree. At saturation, TCP's own acknowledgements tip the link over. Heavily overloaded, TCP's windows hold MQTT back while the UDP stream, which does not back off, takes the link. [Execution backends](https://jwszolek.github.io/SMOLPy/backends/#modbus-and-mqtt-over-tcp) has the full table and the mechanism.
|
|
516
|
+
|
|
517
|
+
**Getting it.** ns-3 cannot be installed with `pip`, so the simplest way is the image `ghcr.io/jwszolek/smolpy:latest-ns3` ([Install](#install)). It holds the ns-3 build, SMOLPy, the Rust engine and `smol-ns3`, the C++ program that runs scenarios on ns-3, compiled in. With your own ns-3 3.49 build instead, set `NS3_HOME` to it: the first run compiles `smol-ns3` in about 8 s and caches it.
|
|
518
|
+
|
|
519
|
+
---
|
|
520
|
+
|
|
491
521
|
## Examples
|
|
492
522
|
|
|
493
523
|
See [`examples/README.md`](examples/README.md) for ten ready-to-run scenarios covering single-switch saturation, oversubscription, two-tier access bottlenecks, MQTT publish-subscribe, Modbus TCP polling, and PROFINET RT cyclic I/O.
|
|
@@ -183,7 +183,7 @@ ns-3 is the one backend that cannot be installed with `pip`. It is a C++ code ba
|
|
|
183
183
|
|
|
184
184
|
*As built (2026-11-16):* the image without ns-3 is `docker/Dockerfile`, built by `.github/workflows/docker-image.yml`. Each release, `publish.yml` calls it once both packages are on PyPI. It tests the image of each platform with the wheel smoke test and a `.smol` run through the CLI before it pushes `<version>` and `latest`. A pull request that changes the image builds and tests it for `linux/amd64` and pushes nothing. The image runs as uid 1000, not as root.
|
|
185
185
|
|
|
186
|
-
*As built (2026-11-16):* the image with ns-3 is `docker/Dockerfile.ns3`, built by a second job of the same workflow, for `linux/amd64
|
|
186
|
+
*As built (2026-11-16):* the image with ns-3 is `docker/Dockerfile.ns3`, built by a second job of the same workflow, for `linux/amd64` and (*as built, 2026-11-17*) `linux/arm64`. Each platform is built and tested on a runner of its own architecture, since `smol-ns3` is compiled in the image, and pushed as `<version>-ns3-amd64` and `-arm64`; `<version>-ns3` and `latest-ns3` are the index of both:
|
|
187
187
|
- **Contents.** The base image `smolpy-ns3-base:3.49`, plus `smolpy` and `smolpy-engine-rs` from the same wheels as the image without ns-3.
|
|
188
188
|
- **`smol-ns3` built in.** It is built once, in the image, into a cache that every user reads (`XDG_CACHE_HOME=/opt/smolpy/cache`). No run compiles it. The cache is read-only, so a run that would need another build, for example with another `CXX`, fails instead of building one. Its message says to set `XDG_CACHE_HOME` to a writable directory, where the build then takes about 8 s.
|
|
189
189
|
- **Tests.** Before the image is pushed, CI runs `docker/smoke.smol`, with every protocol, on ns-3 through the CLI as uid 1000. It also runs the ns-3 suite of the same commit against the SMOLPy installed in the image.
|
|
@@ -308,7 +308,7 @@ PROFINET RT is a layer 2 protocol (EtherType 0x8892), without IP, so ns-3's stac
|
|
|
308
308
|
This meets Phase 6's exit criterion that differences under load are quantified and documented.
|
|
309
309
|
|
|
310
310
|
**The ns-3 base image, as built** *(2026-11-16)*:
|
|
311
|
-
- `ghcr.io/jwszolek/smolpy-ns3-base:3.49`, built by `.github/workflows/ns3-base.yml` from `docker/ns3-base/Dockerfile`, for `linux/amd64`
|
|
311
|
+
- `ghcr.io/jwszolek/smolpy-ns3-base:3.49`, built by `.github/workflows/ns3-base.yml` from `docker/ns3-base/Dockerfile`, for `linux/amd64` and `linux/arm64`. Each platform is built and tested on a GitHub runner of its own architecture (`ubuntu-latest`, `ubuntu-24.04-arm`) and pushed as `3.49-amd64` and `3.49-arm64`; `3.49` is the index of both. It is rebuilt when that Dockerfile changes, and pushed after the merge to `main`.
|
|
312
312
|
- **Pinned release:** ns-3.49 (released 2026-10-07), as the git tag `ns-3.49` with its commit checked. Debian 12's g++ 12 and CMake 3.25 meet its minimums: g++ 11.1, C++23 and CMake 3.25.
|
|
313
313
|
- **Build:**
|
|
314
314
|
- The `release` profile, without examples, tests or Python bindings.
|
|
@@ -332,7 +332,7 @@ This meets Phase 6's exit criterion that differences under load are quantified a
|
|
|
332
332
|
- How ns-3 queue lengths should be sampled so that `queue_depth` is comparable to SimPy's per-port frame count.
|
|
333
333
|
- Whether the pinned ns-3 release's build tool supports building scratch programs with an extra module cleanly, or the module should be installed as a contrib module. *(Resolved: scratch programs build against the prebuilt modules; see the base image above.)*
|
|
334
334
|
- The size of the `-ns3` image, and whether to build ns-3 in its `optimized` profile only, without examples and tests, to keep it small.
|
|
335
|
-
- Whether GitHub's hosted runners can build the ns-3 base image for `linux/arm64` in reasonable time, or that platform needs a native arm64 runner or is offered for `amd64` only at first. *(Decided: `amd64` only at first; `arm64` on a native runner later.)*
|
|
335
|
+
- Whether GitHub's hosted runners can build the ns-3 base image for `linux/arm64` in reasonable time, or that platform needs a native arm64 runner or is offered for `amd64` only at first. *(Decided: `amd64` only at first; `arm64` on a native runner later. As built (2026-11-17): the base image on GitHub's hosted arm64 runner.)*
|
|
336
336
|
|
|
337
337
|
---
|
|
338
338
|
|
|
@@ -32,7 +32,7 @@ A scenario outside a backend's capabilities is rejected before it runs, with the
|
|
|
32
32
|
|
|
33
33
|
## Installing ns-3
|
|
34
34
|
|
|
35
|
-
ns-3 cannot be installed with `pip`. The simplest way is the image, for `linux/amd64`:
|
|
35
|
+
ns-3 cannot be installed with `pip`. The simplest way is the image, for `linux/amd64` and `linux/arm64`:
|
|
36
36
|
|
|
37
37
|
```bash
|
|
38
38
|
docker run --rm -v "$PWD:/work" ghcr.io/jwszolek/smolpy:latest-ns3 run plant.smol --backend ns3
|
|
@@ -50,7 +50,7 @@ The first run compiles `smol-ns3` against that build, which takes about 8 s, and
|
|
|
50
50
|
|
|
51
51
|
The cross-backend suite ([ADR-0009](adr/0009-batch-execution-and-cross-backend-validation.md)) compares every backend with SimPy.
|
|
52
52
|
|
|
53
|
-
**Rust** gives SimPy's results bit for bit: every sample,
|
|
53
|
+
**Rust** gives SimPy's results bit for bit on every deterministic scenario: every sample, down to the event count. Random traffic uses its own generator, so there the results agree statistically.
|
|
54
54
|
|
|
55
55
|
**ns-3** runs SMOL's own full-duplex Ethernet device and switch, because ns-3's CSMA is half duplex. On top of them it runs ns-3's IP stack, and its random traffic is drawn from SimPy's streams. So:
|
|
56
56
|
- **Ethernet** over UDP, with every pattern, IMIX and priorities, gives SimPy's results bit for bit. That holds for stochastic scenarios too, with the same seed.
|
|
@@ -172,9 +172,9 @@ A code-generated ns-3 scenario from the Scenario IR. Gives a realistic TCP/IP st
|
|
|
172
172
|
|
|
173
173
|
ns-3 cannot be installed with `pip`, so the backend ships as a container image, `ghcr.io/jwszolek/smolpy:<version>-ns3`. It holds the pinned ns-3 release built once, and CI runs the ns-3 equivalence suite in it ([ADR-0004 — Container images](adr/0004-execution-backends.md#container-images)). A lighter image with SMOLPy and the Rust engine, without ns-3, can be published from the first release of `smolpy-engine-rs`.
|
|
174
174
|
|
|
175
|
-
**Status: done.** All 3 steps are done, and so are the exit criteria.
|
|
175
|
+
**Status: done.** All 3 steps are done, and so are the exit criteria. The ns-3 images are built for `arm64` too, on a native runner.
|
|
176
176
|
1. **The image without ns-3: done.** `ghcr.io/jwszolek/smolpy:<version>` holds SMOLPy and the Rust engine, for `linux/amd64` and `linux/arm64`. It is built, tested and pushed at each release.
|
|
177
|
-
2. **The ns-3 base image: done.** `ghcr.io/jwszolek/smolpy-ns3-base:3.49` holds ns-3.49, built once, for `linux/amd64
|
|
177
|
+
2. **The ns-3 base image: done.** `ghcr.io/jwszolek/smolpy-ns3-base:3.49` holds ns-3.49, built once, for `linux/amd64` and `linux/arm64`, each on a runner of its own architecture.
|
|
178
178
|
3. **The ns-3 backend.**
|
|
179
179
|
- **Ethernet: done.** `backend="ns3"` runs adapters, switches and flows with every pattern, IMIX and 802.1Q priorities, with the six Ethernet metrics, on ns-3's IPv4/UDP stack.
|
|
180
180
|
- It runs over SMOL's own full-duplex Ethernet device, because ns-3's CSMA is half duplex (ADR-0004).
|
|
@@ -188,7 +188,7 @@ ns-3 cannot be installed with `pip`, so the backend ships as a container image,
|
|
|
188
188
|
- **PROFINET: done.** PROFINET RT runs on layer 2, on SMOL's Ethernet device, with the three PROFINET metrics.
|
|
189
189
|
- Every PROFINET scenario of the suite is bit-exact with SimPy, watchdog expiries included.
|
|
190
190
|
- A frame that arrives exactly at the watchdog's deadline is too late on both engines.
|
|
191
|
-
- **The image: done.** `ghcr.io/jwszolek/smolpy:<version>-ns3` and `latest-ns3`, for `linux/amd64`, hold the base image, SMOLPy and the Rust engine, and `smol-ns3` built in.
|
|
191
|
+
- **The image: done.** `ghcr.io/jwszolek/smolpy:<version>-ns3` and `latest-ns3`, for `linux/amd64` and `linux/arm64`, hold the base image, SMOLPy and the Rust engine, and `smol-ns3` built in.
|
|
192
192
|
- Each release builds it from the release's wheels.
|
|
193
193
|
- Before it is pushed, CI runs a `.smol` file on ns-3 through the CLI, and the ns-3 suite against the SMOLPy installed in it.
|
|
194
194
|
- **Under load: done.** `python -m benchmarks load` compares Modbus and MQTT on ns-3's TCP with SimPy on a plant cell whose uplink loads up to 150 % ([Execution backends](backends.md#modbus-and-mqtt-over-tcp)).
|
|
@@ -1,9 +1,16 @@
|
|
|
1
|
+
from importlib.metadata import PackageNotFoundError, version
|
|
2
|
+
|
|
1
3
|
from smolpy.batch import BatchResult, Run, run_many
|
|
2
4
|
from smolpy.core.network import Network
|
|
3
5
|
from smolpy.modbus.slave import ModbusSlave
|
|
4
6
|
from smolpy.mqtt.broker import MQTTBroker
|
|
5
7
|
from smolpy.profinet.device import ProfinetDevice
|
|
6
8
|
|
|
9
|
+
try:
|
|
10
|
+
__version__ = version("smolpy") # the installed distribution's, from git at build time
|
|
11
|
+
except PackageNotFoundError: # run from a source tree that is not installed
|
|
12
|
+
__version__ = "0+unknown"
|
|
13
|
+
|
|
7
14
|
__all__ = [
|
|
8
15
|
"BatchResult",
|
|
9
16
|
"MQTTBroker",
|
|
@@ -14,6 +14,8 @@ from rich.progress import Progress, SpinnerColumn, TextColumn, TimeElapsedColumn
|
|
|
14
14
|
from rich.text import Text
|
|
15
15
|
from rich.theme import Theme
|
|
16
16
|
|
|
17
|
+
from smolpy import __version__
|
|
18
|
+
|
|
17
19
|
if TYPE_CHECKING:
|
|
18
20
|
from smolpy.model import Scenario
|
|
19
21
|
|
|
@@ -303,6 +305,7 @@ def main() -> None:
|
|
|
303
305
|
prog="smolpy",
|
|
304
306
|
description="SMOLPy — Network simulation DSL and discrete-event simulator",
|
|
305
307
|
)
|
|
308
|
+
parser.add_argument("--version", action="version", version=f"smolpy {__version__}")
|
|
306
309
|
sub = parser.add_subparsers(dest="command", required=True)
|
|
307
310
|
|
|
308
311
|
run_cmd = sub.add_parser(
|
|
@@ -93,3 +93,19 @@ def test_runs_apply_to_smol_files_only(tmp_path) -> None:
|
|
|
93
93
|
# after a Python script, the options are the script's own
|
|
94
94
|
done = _smolpy(str(script), "--runs", "3")
|
|
95
95
|
assert done.returncode == 0 and "args ['--runs', '3']" in done.stdout
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
def test_version_is_the_installed_distributions() -> None:
|
|
99
|
+
from importlib.metadata import version
|
|
100
|
+
|
|
101
|
+
import smolpy
|
|
102
|
+
|
|
103
|
+
assert smolpy.__version__ == version("smolpy")
|
|
104
|
+
out = subprocess.run(
|
|
105
|
+
[sys.executable, "-c", "from smolpy.cli import main; main()", "--version"],
|
|
106
|
+
capture_output=True,
|
|
107
|
+
text=True,
|
|
108
|
+
timeout=60,
|
|
109
|
+
)
|
|
110
|
+
assert out.returncode == 0
|
|
111
|
+
assert out.stdout.strip() == f"smolpy {smolpy.__version__}"
|