← All posts

Where the AMX data model lives: memory, ODL and UCI boundaries

Grow through practice

No need to finish reading — test now

Short answer: the AMX data model lives in memory by default, not in a database. amxrt saves only objects/parameters marked %persistent as an ODL file; UCI is a separate persistence layer.

Four layers, not one

ThingLocation / formSurvives process exit?
ODL schema / defaults/etc/amx/<name>/*.odlYes
Runtime object tree amxd_dmamxrt process memoryNo
%persistent values${name}.odl under odl.directoryYes, if saving is enabled
UCI configuration/etc/config/*Yes, after uci commit

Who saves

Not ubus and not ODL itself, but the data model provider/runtime:

  • amxrt automatically saves %persistent data;
  • a module can call libamxo amxo_parser_save / amxo_parser_save_object explicitly;
  • writing UCI goes through a UCI backend module using libuci, covered in the next articles.

Typical amxrt configuration:

%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 { ... }.

Three %persistent boundaries

  1. No attribute, no save.

Counters, temporary state and ordinary parameters are lost on exit.

  1. A non-persistent parent blocks the subtree.

Saving starts at the root; children are not saved if a parent is not persistent.

  1. Values are saved, not events or transaction history.

dm:object-changed is a runtime notification, not an ODL record.

Where UCI fits

UCI remains /etc/config/<package>:

uci set network.lan.ipaddr='192.168.1.1'
uci commit network

set writes a delta under /tmp/.uci; commit persists it. AMX never automatically turns its object tree into UCI; a backend module must translate.

Which one?

  • AMX/TR-181 management-plane persistence: %persistent + ODL save.
  • Native OpenWrt network/services: UCI.
  • Both: a backend module maps the model to UCI; do not run shell commands from ODL.

Series: Inside prplOS: AMX Runtime (Guide) Related: From UCI to a data model · How AMX calls UCI · UCI backend example Sources: libamxo ODL save docs, amxrt persistent storage README

Practice

Found this useful?

I write about AI agents × embedded / edge AI. Subscribe, or email me a concrete problem.

Guestbook →Subscribe (RSS)Support

Comments 0

No comments yet — be the first!

No login required; name is optional.