bbfdm/utilities
2024-07-09 17:48:18 +05:30
..
files/usr docs: cleanup and update 2024-07-09 17:48:18 +05:30
src/ubus Introduce bbf.config with C code 2024-06-04 12:18:02 +02:00
Makefile Introduce bbf.config with C code 2024-06-04 12:18:02 +02:00
README.md docs: cleanup and update 2024-07-09 17:48:18 +05:30

Utilities to support datamodel deployments

This directory has sets of small utilities to ease the datamodel deployments and integration with higher layer application protocols.

List of utilities:

  1. bbf.diag
  2. bbf.secure
  3. bbf.config

bbf.diag utility

bbf.diag is a rpcd libexec based utility, which is responsible for providing ubus backend to few datamodel diagnostics commands like:

  • ipping
  • nslookup
  • serverselection
  • udpecho

How to add a new bbf.diag utility

To add a new bbf.diag utility user has to add an script with below syntax

#!/bin/sh

. /usr/share/libubox/jshn.sh
. /usr/share/bbfdm/scripts/bbf_api

__list() {
        json_add_object "test"
        json_add_string "host" "str"
        json_close_object
}

__error() {
        json_init
        json_add_string "Status" "$1"
}

__launch() {
        json_init
        json_add_string "Status" "$1"
}

if [ "$1" = "list" ]; then
        __list
elif [ -n "$1" ]; then
        __launch "$1"
else
        __error "Error_Internal" "1"
fi

User needs to install this newly added script using BBFDM_INSTALL_SCRIPT bbfdm.mk API.

References:

bbf.secure utility

USPTR369 Specifications requirement of 'SecuredRole' requires bbfdm layer to retrieve and provide the Secured(Password/key) parameter values in plain text.

But storing Secured parameters in plain text in uci/filesystem is bit of a security risk, to mitigate the risk bbf.secure provides way to store the Secured parameter values in hashed format.

A how to use guide for bbf.secure available here

bbf.config utility

OpenWRT way of reloading services with ubus call uci commit '{"name":"<uci_name>"} does not perfectly fits with datamodel requirements. It send a trigger via rpcd to procd by using this ubus call which returns instantly, internally procd reloads for all the services which has a reload dependency configured on that specific uci. Sometimes, there is a good amount of delay in trigger and actual service reload.

Bbf.config solves that by adding an in-build reload monitoring functionality which get the list of impacted services and then monitor for PID change for the services with a timeout of 10 sec, with this we make sure Higher layer application(icwmp/obsupa) waits for the application before processing more command.

Currently have two variants of bbf.config, which can be enabled with below compile time configs

  1. CONFIG_BBF_CONFIGMNGR_SCRIPT_BACKEND => Simple rpcd script based backend
  2. CONFIG_BBF_CONFIGMNGR_C_BACKEND => C based application backend with PID monitoring (default)