Skip to content
Snippets Groups Projects

USP Daemon (uspd)

uspd is data-model daemon which exposes data-model objects over ubus as required by TR-069/cwmp or TR-369/USP, uspd also understand USP syntax as defined in R-ARC.7 - R-ARC.12 and provide details for data-model queries.

Note 1: The command outputs shown in this readme are examples only, actual output may differ based on device and configuration.

Note 2: Long command outputs are compressed for better readability

Project Components

Project consists of following components:

  • Application itself written in C programming language
  • Documentation in a Markdown format

Build Instructions

uspd is written using C programming language and depends on a number of components found in OpenWrt for building and running.

UCI Config

uspd requires a configuration file to provide more granular objects over ubus. Granularity is an optional feature of uspd, it can be skipped or set to level 0. The configuration file is an uci file /etc/config/uspd. Sample configuration file is provided below.

config uspd 'usp'
        option granularitylevel  '0'
        option debug 'true'
        option loglevel  '2'
        option sock '/tmp/usp.sock'
        option transaction_timeout 60
        option subprocess_level '1'
        option refresh_time '5'

In the above uci, loglevel can have below value:

loglevel Meaning
0 Disabled logging
1 Only errors will be logged
2 Only errors and warnings will be logged
3 Log everything except debug
4 Everything will be logged

For more info on the uspd UCI configuration visit uci documentation OR raw uci schema

Concepts and Workflow

uspd internally uses libbbfdm to get the data-model objects. On startup it parses the uci file to check if the granularity is set and then as per the granularity value it registers the required ubus namespaces.

When a ubus method is called it first checks the path parameter to identify if it has special USP syntax, if present it parses and determine the correct objects from libbbfdm, then proceeds with the Get/Set/Operate/Add/Del operation on the qualified objects.

So, uspd search for [[+*]+ in path expression, if it matches then segments the path and get the schema from libbbfdm and store it in a link-list, then it proceeds with the next segment to filter out the unneeded schema paths. It keeps on doing so till all the expressions are solved and it finally left with qualified objects. Once all the expressions are solved, it starts getting the values for qualified objects and store it in a stack to print the output in pretty format.

For operate command, it solve the path expression and then call bbf_operate from libbbfdm to execute the operate command.

uspd uses dm_entry_param_method API from libbbfdm to get the device tree schema and it's values.

In short, it covers/supports the new syntax introduced in TR-369 by using the existing data-model available with libbbfdm.

Important topics

Dependencies

Build-Time Dependencies

To successfully build uspd, following libraries are needed:

Dependency Link License
libuci https://git.openwrt.org/project/uci.git LGPL 2.1
libubox https://git.openwrt.org/project/libubox.git BSD
libubus https://git.openwrt.org/project/ubus.git LGPL 2.1
libjson-c https://s3.amazonaws.com/json-c_releases MIT
libbbfdm https://dev.iopsys.eu/iopsys/bbf.git LGPL 2.1

Run-Time Dependencies

In order to run the uspd, following dependencies are needed to be running/available before uspd.

Dependency Link License
ubusd https://git.openwrt.org/project/ubus.git LGPL 2.1
libbbfdm https://dev.iopsys.eu/iopsys/bbf.git LGPL 2.1

System daemon ubusd is used to expose the USP functionality over ubus.