Project descriptor files (.opp)
A .opp file is a tiny Python expression containing exactly ONE
constructor call — either OmnetppProject(...) or
SimulationProject(...) — with keyword-only literal arguments
(strings, numbers, booleans, lists, dicts, None). No variables,
no function calls, no imports.
Upstream reference:
https://github.com/omnetpp/opp_repl/blob/main/doc/opp_files.md
Path resolution rules
root_folder, overlay_build_root, opp_env_workspace:
relative paths resolve against the directory containing the
.opp file, not the shell's CWD. root_folder="." therefore
always means "this folder". Absolute paths pass through.
- All other folder parameters (
bin_folder, ned_folders,
ini_file_folders, ...) are relative to the project root, not
to the .opp file.
Ways to locate the project root
Tried in order:
root_folder="/abs/path" or root_folder="." (most common).
root_folder_environment_variable="MY_PROJECT" -- reads the env
var at load time.
SimulationProject also accepts
root_folder_environment_variable_relative_folder="samples/aloha"
which gets appended to the env var's value. Handy for pointing
at OMNeT++ samples via __omnetpp_root_dir without writing a
.opp per sample.
OmnetppProject parameters
| Parameter |
Purpose |
name |
Identifier used in omnetpp_project= |
version |
Optional version string |
root_folder_environment_variable |
Defaults to "__omnetpp_root_dir" |
root_folder |
Explicit root (overrides env var) |
overlay_name |
Enable fuse-overlayfs build layer |
overlay_build_root |
Override the overlay build root |
opp_env_workspace / opp_env_project |
Route build/run through opp_env |
SimulationProject parameters (the important ones)
| Parameter |
Default |
Purpose |
name |
(required) |
Identifier |
omnetpp_project |
None |
OMNeT++ install to use, by name |
root_folder |
None |
Usually "." |
build_types |
["dynamic library"] |
or ["executable"] |
executables |
None |
List of executable names |
dynamic_libraries |
None |
Shared lib names, e.g. ["INET"] |
bin_folder |
"." |
Where binaries are placed |
library_folder |
"." |
Where shared libs are placed |
ned_folders |
["."] |
NED source directories |
ini_file_folders |
["."] |
Scanned recursively for *.ini |
used_projects |
[] |
Dependencies by name (e.g. ["inet"]) |
fingerprint_store |
"fingerprint.json" |
Baseline JSON for fingerprint tests |
speed_store |
"speed.json" |
Baseline JSON for speed tests |
statistics_folder |
"." |
Folder for statistical-test baselines |
media_folder |
"." |
Folder for chart-test baseline images |
overlay_name |
None |
Enable overlay build |
opp_env_workspace / opp_env_project |
None |
Route through opp_env |
github_owner / github_repository / github_workflows |
None |
GitHub Actions integration |
Full parameter list: see linked files under templates/.
Loading
- CLI:
opp_repl --load "path/to/file.opp" (globs allowed,
flag repeatable).
- REPL:
load_opp_file("~/workspace/inet/inet.opp") or
load_workspace("~/workspace") (recursively scans for *.opp).
- Command-line tools auto-load all
*.opp in CWD when no --load
is given.
OmnetppProject files are always processed before
SimulationProject files, so simulation projects can refer to them
by name.
Ready-made templates (bundled)
Copy and customise from templates/:
| File |
Use case |
templates/omnetpp.opp |
Standard OMNeT++ installation |
templates/omnetpp_env_var.opp |
OMNeT++ located via env var |
templates/sample_executable.opp |
OMNeT++ sample (aloha/fifo) as executable |
templates/inet.opp |
INET as dynamic library |
templates/simu5g.opp |
Simu5G (depends on INET) |
templates/overlay.opp |
Overlay build atop an existing tree |
templates/opp_env.opp |
opp_env-managed OMNeT++ install |
templates/opp_env_sim.opp |
opp_env-managed simulation project |
Programmatic alternative
When the path is only known at runtime (git worktrees, generated
installs), skip the .opp file:
define_omnetpp_project("omnetpp-6.1", root_folder="/tmp/omnetpp-v6.1")
define_simulation_project("inet-4.5", root_folder="/tmp/inet-v4.5",
omnetpp_project="omnetpp",
library_folder="src", bin_folder="bin",
dynamic_libraries=["INET"],
ned_folders=["src", "examples"],
ini_file_folders=["examples"])
Pitfalls
- Syntax is restricted — variables / imports / function calls raise
at load time. Treat
.opp files as JSON-in-Python.
- A missing
omnetpp_project= on a SimulationProject is fine as
long as an OmnetppProject is auto-detected from
__omnetpp_root_dir.
- When two versions of the same project are registered, lookup by
name alone is ambiguous: use
get_simulation_project("inet", version="4.5").
- For executable projects, ALWAYS set
executables=["<name>"]
matching the target name produced by opp_makemake -o <name>.
If they disagree, run_simulations() fails with exit code 127
because opp_repl looks for a binary that doesn't exist. See
opp-repl-project-scaffolding for the end-to-end setup.
- A
.opp file alone is not enough to build. You also need
.oppbuildspec, .nedfolders, and a Makefile (the first two
are committed; the third is generated by generate_makefile(),
which build_project() calls automatically on current opp_repl —
older versions used make_makefiles()).
Missing any of these produces cryptic build failures.
See also
opp-repl-concepts — the object model these files feed.
opp-repl-project-scaffolding — full new-project template set
(.opp, .oppbuildspec, .nedfolders, NED/C++ skeletons).
opp-repl-overlay-builds — overlay_name details.
opp-repl-opp-env-integration — opp_env routing.
opp-repl-running-simulations — what happens once projects load.
1---2name: opp-repl-opp-files3description: Write .opp project descriptor files that register OMNeT++ installations and simulation projects (INET, Simu5G, samples, opp_env-managed, overlay builds, git worktrees). Load this when a new project needs a descriptor or an existing one needs tweaking. Covers allowed syntax, path resolution, every constructor parameter, and ready-made templates under templates/.4---56# Project descriptor files (.opp)78A `.opp` file is a tiny Python expression containing exactly ONE9constructor call — either `OmnetppProject(...)` or10`SimulationProject(...)` — with keyword-only literal arguments11(strings, numbers, booleans, lists, dicts, None). No variables,12no function calls, no imports.1314Upstream reference:15https://github.com/omnetpp/opp_repl/blob/main/doc/opp_files.md1617## Path resolution rules1819- `root_folder`, `overlay_build_root`, `opp_env_workspace`:20 relative paths resolve against the **directory containing the21 `.opp` file**, not the shell's CWD. `root_folder="."` therefore22 always means "this folder". Absolute paths pass through.23- All other folder parameters (`bin_folder`, `ned_folders`,24 `ini_file_folders`, ...) are relative to the *project* root, not25 to the `.opp` file.2627## Ways to locate the project root2829Tried in order:30311. `root_folder="/abs/path"` or `root_folder="."` (most common).322. `root_folder_environment_variable="MY_PROJECT"` -- reads the env33 var at load time.343. `SimulationProject` also accepts35 `root_folder_environment_variable_relative_folder="samples/aloha"`36 which gets appended to the env var's value. Handy for pointing37 at OMNeT++ samples via `__omnetpp_root_dir` without writing a38 `.opp` per sample.3940## OmnetppProject parameters4142| Parameter | Purpose |43|-----------------------------------------|--------------------------------------------------|44| `name` | Identifier used in `omnetpp_project=` |45| `version` | Optional version string |46| `root_folder_environment_variable` | Defaults to `"__omnetpp_root_dir"` |47| `root_folder` | Explicit root (overrides env var) |48| `overlay_name` | Enable fuse-overlayfs build layer |49| `overlay_build_root` | Override the overlay build root |50| `opp_env_workspace` / `opp_env_project` | Route build/run through `opp_env` |5152## SimulationProject parameters (the important ones)5354| Parameter | Default | Purpose |55|------------------------|------------------------|-------------------------------------------|56| `name` | *(required)* | Identifier |57| `omnetpp_project` | None | OMNeT++ install to use, by name |58| `root_folder` | None | Usually `"."` |59| `build_types` | `["dynamic library"]` | or `["executable"]` |60| `executables` | None | List of executable names |61| `dynamic_libraries` | None | Shared lib names, e.g. `["INET"]` |62| `bin_folder` | `"."` | Where binaries are placed |63| `library_folder` | `"."` | Where shared libs are placed |64| `ned_folders` | `["."]` | NED source directories |65| `ini_file_folders` | `["."]` | Scanned recursively for `*.ini` |66| `used_projects` | `[]` | Dependencies by name (e.g. `["inet"]`) |67| `fingerprint_store` | `"fingerprint.json"` | Baseline JSON for fingerprint tests |68| `speed_store` | `"speed.json"` | Baseline JSON for speed tests |69| `statistics_folder` | `"."` | Folder for statistical-test baselines |70| `media_folder` | `"."` | Folder for chart-test baseline images |71| `overlay_name` | None | Enable overlay build |72| `opp_env_workspace` / `opp_env_project` | None | Route through opp_env |73| `github_owner` / `github_repository` / `github_workflows` | None | GitHub Actions integration |7475Full parameter list: see linked files under `templates/`.7677## Loading7879- CLI: `opp_repl --load "path/to/file.opp"` (globs allowed,80 flag repeatable).81- REPL: `load_opp_file("~/workspace/inet/inet.opp")` or82 `load_workspace("~/workspace")` (recursively scans for `*.opp`).83- Command-line tools auto-load all `*.opp` in CWD when no `--load`84 is given.8586**OmnetppProject files are always processed before87SimulationProject files**, so simulation projects can refer to them88by name.8990## Ready-made templates (bundled)9192Copy and customise from `templates/`:9394| File | Use case |95|-----------------------------------|--------------------------------------------|96| `templates/omnetpp.opp` | Standard OMNeT++ installation |97| `templates/omnetpp_env_var.opp` | OMNeT++ located via env var |98| `templates/sample_executable.opp` | OMNeT++ sample (aloha/fifo) as executable |99| `templates/inet.opp` | INET as dynamic library |100| `templates/simu5g.opp` | Simu5G (depends on INET) |101| `templates/overlay.opp` | Overlay build atop an existing tree |102| `templates/opp_env.opp` | opp_env-managed OMNeT++ install |103| `templates/opp_env_sim.opp` | opp_env-managed simulation project |104105## Programmatic alternative106107When the path is only known at runtime (git worktrees, generated108installs), skip the `.opp` file:109110 define_omnetpp_project("omnetpp-6.1", root_folder="/tmp/omnetpp-v6.1")111 define_simulation_project("inet-4.5", root_folder="/tmp/inet-v4.5",112 omnetpp_project="omnetpp",113 library_folder="src", bin_folder="bin",114 dynamic_libraries=["INET"],115 ned_folders=["src", "examples"],116 ini_file_folders=["examples"])117118## Pitfalls119120- Syntax is restricted — variables / imports / function calls raise121 at load time. Treat `.opp` files as JSON-in-Python.122- A missing `omnetpp_project=` on a SimulationProject is fine as123 long as an `OmnetppProject` is auto-detected from124 `__omnetpp_root_dir`.125- When two versions of the same project are registered, lookup by126 name alone is ambiguous: use127 `get_simulation_project("inet", version="4.5")`.128- **For executable projects, ALWAYS set `executables=["<name>"]`**129 matching the target name produced by `opp_makemake -o <name>`.130 If they disagree, `run_simulations()` fails with exit code 127131 because opp_repl looks for a binary that doesn't exist. See132 `opp-repl-project-scaffolding` for the end-to-end setup.133- **A `.opp` file alone is not enough to build.** You also need134 `.oppbuildspec`, `.nedfolders`, and a `Makefile` (the first two135 are committed; the third is generated by `generate_makefile()`,136 which `build_project()` calls automatically on current opp_repl —137 older versions used `make_makefiles()`).138 Missing any of these produces cryptic build failures.139140## See also141142- `opp-repl-concepts` — the object model these files feed.143- `opp-repl-project-scaffolding` — full new-project template set144 (`.opp`, `.oppbuildspec`, `.nedfolders`, NED/C++ skeletons).145- `opp-repl-overlay-builds` — `overlay_name` details.146- `opp-repl-opp-env-integration` — opp_env routing.147- `opp-repl-running-simulations` — what happens once projects load.