From UCI to a data model: what prplOS improved, and why it is necessary
Grow through practice
No need to finish reading — test nowOne line: UCI is a unified interface for configuration files; Ambiorix is a runtime data model. prplOS did not simply replace UCI; it put “configuration + state + methods + events” into one object model.
For UCI itself (files, commands, commit, pitfalls), see “OpenWrt UCI: config files, commands, and boundaries”.
Give UCI a fair hearing
UCI solves a concrete problem: every daemon had its own config file, and that was too fragmented.
It centralizes configuration under /etc/config/<package> and expresses it as a three-level tree:
config interface 'wan'
option proto 'dhcp'
option metric '10'
list dns '1.1.1.1'
package: one config file;section:config <type> '<name>';option/list: key/value or list.
There is a uci CLI, libuci, and Lua bindings. uci set/add/delete stages changes in /tmp/.uci; uci commit writes them; reload_config makes services re-read.
The advantages are real: text is readable/diffable/scriptable, boot is fast, and the ecosystem is mature. For a home router, this is enough and cheap.
The boundaries of UCI (by design, not a bug)
| Dimension | UCI's approach | Consequence |
|---|---|---|
| Type/schema | values are mostly strings/lists; booleans by convention | no central schema; validation lives in services |
| Transaction | uci commit writes staged changes | “commit” exists, but no cross-service rollback |
| Model | package → section → option/list | no object relationships, search paths, uniform key |
| Runtime | config files + ubus are two worlds | each service maps UCI→ubus itself |
| Events | UCI itself emits no object-level change events | relies on reload_config or service-specific handling |
| Remote management | not a TR-181 data model | vendors write their own mapping; hard to interoperate |
Two details from the official docs are telling:
- “there are no syntactical differences between text and boolean options” — types are conventions;
- a section without
enabledcan be disabled by renaming it — because there is no uniform model semantics.
This does not mean UCI is bad. It means UCI only handles “configuration storage/editing”, not a runtime object model.
OpenWrt already has ubus (runtime RPC/events) and procd (service management), but UCI, ubus and procd are three pieces: config lives in files, state lives in ubus, and each service connects them. Cross-service atomic changes, unified validation, and object-level notifications are still implemented per service.
What prplOS/Ambiorix changes
prplOS is based on OpenWrt, but its management plane uses the TR-181 data model + Ambiorix:
ODL (schema)
→ libamxd (runtime object tree: config + state)
→ libamxb (bus abstraction, can use ubus)
→ amxrt (runtime: load ODL/backends, register)
Key changes:
1) ODL turns “conventions” into “definitions”
%define {
object Interface[] {
%key string Alias;
string Proto;
int32 Metric;
}
}
Types, defaults, read-only, multi-instance, keys, actions and events are in the model — not in section-naming conventions and documentation.
2) The object tree is “current state”, not “parsed file output” Configuration, statistics and operational state live in the same tree; reading a path gives the current value, not a service's copy after parsing UCI.
3) Transactions: multiple actions succeed together, or nothing changes The libamxd documentation is explicit: “execute multiple actions at once, and if one of the actions fails nothing should be changed.” This addresses UCI's worst case: change five places, the third fails, the first two are already on disk.
4) Events: when an object changes, subscribers know dm:object-changed, dm:instance-added, etc., with filters/subscriptions; UIs and daemons do not need polling or private “config changed” signals.
5) Standard model: TR-181 / TR-369 USP The same object paths are reachable from a local CLI, the bus, and remote management (USP/ACS); multi-vendor interop comes from a standard, not a per-vendor UCI mapping.
6) Extensions without touching the core extensions/ + select can add parameters to existing objects without modifying the core ODL.
7) UCI was not “eliminated” prplOS's tr181-routing still ships mod-routing-uci for static/OS-level routing. In other words: UCI can exist as a backend, but it is no longer the center of the management plane.
Where is the data model stored?
Separate four layers and most “where is it stored?” confusion disappears:
| Thing | Default location / form | Survives process exit? |
|---|---|---|
| ODL schema / defaults | /etc/amx/<name>/*.odl | Yes, file |
| Runtime object tree (amxd_dm) | amxrt process memory | No |
%persistent objects/params | ${name}.odl under odl.directory | Yes, if saving is enabled |
| UCI config | /etc/config/* | Yes, after uci commit |
The key point:
The AMX data model is first an in-memory object tree, not a database. Only objects/parameters marked
%persistentare saved byamxrtinto an ODL file.
A typical amxrt save configuration looks like this (the actual storage-path is project-specific):
%config {
odl = {
dm-save = true,
dm-save-on-changed = true,
dm-save-delay = 1000,
directory = "${storage-path}/odl"
};
}
dm-save: save on exit;dm-save-on-changed: save after changes settle;directory: where save files go;- the file is usually
${name}.odl, containing%populate { ... }, and can be read back withdm-loadorinclude.
Boundaries worth remembering:
- The whole object tree is not persisted.
Only %persistent objects/parameters are written. Runtime state, counters and temporary fields are not.
- A non-persistent parent blocks the subtree.
Saving walks from the root; if a parent is not persistent, children are not saved even when marked %persistent.
- It stores values, not event or transaction history.
dm:object-changed notifications are runtime events, not records in the ODL file.
- UCI remains a separate persistence layer.
A backend such as mod-routing-uci may write some configuration back to /etc/config; that is backend behaviour, not amxd automatically writing UCI.
- Explicit save APIs exist.
libamxo provides amxo_parser_save / amxo_parser_save_object; automatic saving is enabled by the amxrt configuration above.
So the better question is not “which file contains the data model”, but:
Are you persisting ODL definitions, runtime state, or UCI configuration?
Where “advanced” actually comes from
It is not “an object model is fancier”, but four concrete shifts:
| From | To | Field benefit |
|---|---|---|
| string keys/values | typed/constrained objects | errors surface earlier, not in docs |
| per-service parsing | unified model/access | CLI, UI and remote management use one path |
| edit file + reload | transaction + events | failures roll back; changes are observable |
| vendor config | TR-181 standard objects | multi-vendor/remote management interop |
Each shift maps to a field problem: multi-instance, remote management, rollback, live UI. The advanced idea is not abstract aesthetics; it is the solution to those problems.
“Necessary” depends on the scenario
- Home router / small device: UCI is enough. A data model adds complexity, memory and learning cost; simplicity is an advantage.
- Carrier CPE / multi-WAN / multi-SSID / TR-069/USP / multi-vendor: standard objects, transactions, events and unified access matter → Ambiorix/TR-181 fits better.
- prplOS is positioned as carrier-grade: it is not “OpenWrt with a new skin”, but OpenWrt plus a data-model layer; UCI can still be a backend.
So do not make “advanced” the goal. Ask first: do you need “unified configuration”, or “an operable object model”?
A minimal comparison
UCI:
config interface 'wan'
option proto 'dhcp'
option metric '10'
ODL (simplified, not a full TR-181 definition):
%define {
object Interface[] {
%key string Alias;
string Proto;
int32 Metric;
}
}
- UCI's
interfaceis a section type + naming convention; - ODL's
Interface[]is multi-instance + key + types + attachable actions/events; - the path
Device.IP.Interface.{i}.can be operated uniformly by local, remote and bus clients.
Verification status
- ✅ UCI docs:
/etc/config, section/option/list,/tmp/.uci,commit,reload_config, no syntactic type distinction; - ✅ prplOS/Ambiorix docs: TR-181, ODL, transaction semantics, events,
selectextensions,mod-routing-uci; - ⚠️ no performance/memory comparison: this article is about models and semantics, not “how much faster/smaller”;
- ✅ Persistence: libamxo save documentation and amxrt
odl.dm-save/directoryconfiguration. - ⚠️ Device test:
storage-pathand the save file were not verified on a physical prplOS device. - ❓ Permission details: object-level ACLs are not covered.
One sentence
UCI gives configuration a unified home; Ambiorix makes configuration, state, methods and events one object model. “Advanced” is not “more complex”; it is moving from “edit files” to “operate verifiable, observable, rollback-able objects”. Necessity depends on whether you really have to operate a device.
Sources: OpenWrt UCI usage · OpenWrt UCI technical reference · libamxd: Actions, Transactions & Events · Data Model Modules · prplOS business routing (with mod-routing-uci) · amxrt persistent storage · libamxo save API · TR-181 Series: Inside prplOS: AMX Runtime (Guide). Related: OpenWrt UCI guide.
Comments 0
No comments yet — be the first!