← All posts

prplOS UCI backend: from TR-181 routes to /etc/config

Grow through practice

No need to finish reading — test now

This is the full chain: TR-181 objects → UCI backend module → /etc/config → netifd. It shows what “AMX calls UCI” actually looks like in prplOS.

The chain

Device.Routing.Router.{i}.IPv4Forwarding.{i}
  → tr181-routing
  → mod-routing-uci
  → uci set/commit
  → /etc/config/network
  → netifd

tr181-routing is the management plane; mod-routing-uci is one backend, for static/OS-level routes. Dynamic BGP/OSPF do not use it; they use mod-routing-bird2.

An illustrative mapping

A static route in the data model (fields simplified):

DestIPAddress     = 10.0.0.0
DestSubnetMask    = 255.0.0.0
GatewayIPAddress  = 192.168.1.1
Interface         = "lan"

The UCI backend may produce:

config route
    option interface 'lan'
    option target '10.0.0.0'
    option netmask '255.0.0.0'
    option gateway '192.168.1.1'

Then:

uci commit network

netifd reads it and installs the route in the kernel.

The exact section name and field mapping depend on the prplOS version and module implementation; this is a structural illustration, not a verbatim template.

Why ODL must not call UCI directly

ODL is a model definition, not an execution environment:

  • no transaction/retry semantics for UCI;
  • no handling of UCI deltas and commit;
  • it couples the model to an OpenWrt backend;
  • running external commands in a uloop callback blocks the loop.

Correct separation:

LayerResponsibility
ODLobjects, parameters, types, defaults
amxdruntime object tree, transactions, events
Backend moduletranslate changes into UCI/other backends
netifdapply network configuration

How to verify

After changing a static route on the device:

uci show network | grep route
ip route

Check that the UCI section exists and the kernel route is installed. On failure, inspect the backend log, then uci commit and netifd.

Boundaries

  • mod-routing-uci is not the BGP/OSPF backend;
  • UCI is native OpenWrt persistence, not the default AMX object-tree storage;
  • AMX %persistent data still saves as ODL;
  • this is a structural explanation; exact mappings were not verified on hardware.

Series: Inside prplOS: AMX Runtime (Guide) Related: Where the AMX data model lives · How AMX calls UCI · From UCI to a data model

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.