mirror of
https://dev.iopsys.eu/feed/iopsys.git
synced 2025-12-10 07:44:50 +01:00
bbfdm: add dm-service daemon
This commit is contained in:
parent
fc37507afb
commit
31e6887d42
7 changed files with 65 additions and 103 deletions
|
|
@ -1,7 +1,7 @@
|
||||||
if PACKAGE_libbbfdm
|
if PACKAGE_bbfdmd
|
||||||
config BBF_VENDOR_LIST
|
config BBF_VENDOR_EXTENSION
|
||||||
string "Vendor List"
|
bool "Enable Vendor Extension"
|
||||||
default "iopsys"
|
default y
|
||||||
|
|
||||||
config BBF_VENDOR_PREFIX
|
config BBF_VENDOR_PREFIX
|
||||||
string "Vendor Prefix"
|
string "Vendor Prefix"
|
||||||
100
bbfdm/Makefile
100
bbfdm/Makefile
|
|
@ -5,13 +5,13 @@
|
||||||
include $(TOPDIR)/rules.mk
|
include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
PKG_NAME:=bbfdm
|
PKG_NAME:=bbfdm
|
||||||
PKG_VERSION:=1.11.5
|
PKG_VERSION:=1.12.0
|
||||||
|
|
||||||
USE_LOCAL:=0
|
USE_LOCAL:=0
|
||||||
ifneq ($(USE_LOCAL),1)
|
ifneq ($(USE_LOCAL),1)
|
||||||
PKG_SOURCE_PROTO:=git
|
PKG_SOURCE_PROTO:=git
|
||||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/bbf/bbfdm.git
|
PKG_SOURCE_URL:=https://dev.iopsys.eu/bbf/bbfdm.git
|
||||||
PKG_SOURCE_VERSION:=ebdb414e098228ca4fb2c266eb58dee8e4b228a0
|
PKG_SOURCE_VERSION:=9a6dfdfe3e8a6e0964b2b8006453c8278fbf9467
|
||||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||||
PKG_MIRROR_HASH:=skip
|
PKG_MIRROR_HASH:=skip
|
||||||
endif
|
endif
|
||||||
|
|
@ -40,21 +40,20 @@ define Package/libbbfdm-ubus
|
||||||
DEPENDS:=+libuci +libubox +libubus +libblobmsg-json +libjson-c +libbbfdm-api
|
DEPENDS:=+libuci +libubox +libubus +libblobmsg-json +libjson-c +libbbfdm-api
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define Package/libbbfdm
|
|
||||||
SECTION:=utils
|
|
||||||
CATEGORY:=Utilities
|
|
||||||
SUBMENU:=TRx69
|
|
||||||
TITLE:=Library for broadband forum data model support
|
|
||||||
DEPENDS:=+libuci +libubox +libubus +libblobmsg-json +libjson-c +libbbfdm-api +libopenssl
|
|
||||||
MENU:=1
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Package/bbfdmd
|
define Package/bbfdmd
|
||||||
SECTION:=utils
|
SECTION:=utils
|
||||||
CATEGORY:=Utilities
|
CATEGORY:=Utilities
|
||||||
SUBMENU:=TRx69
|
SUBMENU:=TRx69
|
||||||
TITLE:=Datamodel ubus backend
|
TITLE:=Datamodel ubus backend to expose core tree
|
||||||
DEPENDS:=+libuci +libubox +libubus +libblobmsg-json +libbbfdm-api +libbbfdm-ubus +libbbfdm +jq +bbf_configmngr
|
DEPENDS:=+libuci +libubox +libubus +libblobmsg-json +libjson-c +libbbfdm-api +libopenssl +libbbfdm-ubus +bbf_configmngr
|
||||||
|
endef
|
||||||
|
|
||||||
|
define Package/dm-service
|
||||||
|
SECTION:=utils
|
||||||
|
CATEGORY:=Utilities
|
||||||
|
SUBMENU:=TRx69
|
||||||
|
TITLE:=Datamodel ubus backend to expose micro-service tree
|
||||||
|
DEPENDS:=+libuci +libubox +libubus +libblobmsg-json +libjson-c +libbbfdm-api +libbbfdm-ubus +jq +bbf_configmngr
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define Package/bbf_configmngr
|
define Package/bbf_configmngr
|
||||||
|
|
@ -63,11 +62,10 @@ define Package/bbf_configmngr
|
||||||
SUBMENU:=TRx69
|
SUBMENU:=TRx69
|
||||||
TITLE:= BBF Config Manager
|
TITLE:= BBF Config Manager
|
||||||
DEPENDS:=+libuci +libubox +libubus +libblobmsg-json
|
DEPENDS:=+libuci +libubox +libubus +libblobmsg-json
|
||||||
MENU:=1
|
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define Package/libbbfdm/config
|
define Package/bbfdmd/config
|
||||||
source "$(SOURCE)/Config_bbfdm.in"
|
source "$(SOURCE)/Config_bbfdmd.in"
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define Package/bbf_configmngr/config
|
define Package/bbf_configmngr/config
|
||||||
|
|
@ -82,8 +80,12 @@ define Package/libbbfdm-ubus/description
|
||||||
Library contains the APIs to expose data model over ubus
|
Library contains the APIs to expose data model over ubus
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define Package/libbbfdm/description
|
define Package/bbfdmd/description
|
||||||
Library contains the data model tree, It includes basic TR181 nodes.
|
Daemon to expose Datamodel core tree
|
||||||
|
endef
|
||||||
|
|
||||||
|
define Package/dm-service/description
|
||||||
|
Daemon to expose Datamodel micro-service tree
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define Package/bbf_configmngr/description
|
define Package/bbf_configmngr/description
|
||||||
|
|
@ -97,17 +99,9 @@ endef
|
||||||
endif
|
endif
|
||||||
|
|
||||||
CMAKE_OPTIONS += \
|
CMAKE_OPTIONS += \
|
||||||
-DBBF_TR181=ON
|
|
||||||
|
|
||||||
CMAKE_OPTIONS += \
|
|
||||||
-DBBF_VENDOR_LIST:String="$(CONFIG_BBF_VENDOR_LIST)" \
|
|
||||||
-DBBF_VENDOR_PREFIX:String="$(CONFIG_BBF_VENDOR_PREFIX)" \
|
-DBBF_VENDOR_PREFIX:String="$(CONFIG_BBF_VENDOR_PREFIX)" \
|
||||||
-DBBF_MAX_OBJECT_INSTANCES:Integer=$(CONFIG_BBF_MAX_OBJECT_INSTANCES)
|
-DBBF_MAX_OBJECT_INSTANCES:Integer=$(CONFIG_BBF_MAX_OBJECT_INSTANCES) \
|
||||||
|
|
||||||
ifeq ($(CONFIG_PACKAGE_bbfdmd),y)
|
|
||||||
CMAKE_OPTIONS += \
|
|
||||||
-DBBFDMD_MAX_MSG_LEN:Integer=10485760
|
-DBBFDMD_MAX_MSG_LEN:Integer=10485760
|
||||||
endif
|
|
||||||
|
|
||||||
define Package/libbbfdm-api/install
|
define Package/libbbfdm-api/install
|
||||||
$(INSTALL_DIR) $(1)/lib
|
$(INSTALL_DIR) $(1)/lib
|
||||||
|
|
@ -129,45 +123,43 @@ define Package/libbbfdm-ubus/install
|
||||||
$(CP) $(PKG_BUILD_DIR)/libbbfdm-ubus/libbbfdm-ubus.so $(1)/lib/
|
$(CP) $(PKG_BUILD_DIR)/libbbfdm-ubus/libbbfdm-ubus.so $(1)/lib/
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define Package/libbbfdm/install
|
define Package/bbfdmd/install
|
||||||
$(INSTALL_DIR) $(1)/etc/bbfdm/dmmap
|
$(INSTALL_DIR) $(1)/etc/bbfdm/dmmap
|
||||||
|
$(INSTALL_DIR) $(1)/usr/share/bbfdm
|
||||||
|
|
||||||
$(INSTALL_DIR) $(1)/usr/share/bbfdm/
|
$(INSTALL_DIR) $(1)/etc/config
|
||||||
$(CP) $(PKG_BUILD_DIR)/libbbfdm/libbbfdm.so $(1)/usr/share/bbfdm/libbbfdm.so
|
$(INSTALL_CONF) ./files/etc/config/bbfdm $(1)/etc/config/bbfdm
|
||||||
|
|
||||||
|
$(INSTALL_DIR) $(1)/usr/sbin
|
||||||
|
$(INSTALL_BIN) $(PKG_BUILD_DIR)/bbfdmd/ubus/bbfdmd $(1)/usr/sbin/
|
||||||
|
|
||||||
|
$(INSTALL_DIR) $(1)/etc/init.d
|
||||||
|
$(INSTALL_BIN) ./files/etc/init.d/bbfdmd $(1)/etc/init.d/bbfdmd
|
||||||
|
|
||||||
|
$(INSTALL_DIR) $(1)/etc/hotplug.d/iface
|
||||||
|
$(INSTALL_BIN) ./files/etc/hotplug.d/iface/85-bbfdm-sysctl $(1)/etc/hotplug.d/iface/85-bbfdm-sysctl
|
||||||
|
|
||||||
$(INSTALL_DIR) $(1)/lib/upgrade/keep.d
|
$(INSTALL_DIR) $(1)/lib/upgrade/keep.d
|
||||||
$(INSTALL_DATA) ./files/lib/upgrade/keep.d/bbf $(1)/lib/upgrade/keep.d/bbf
|
$(INSTALL_DATA) ./files/lib/upgrade/keep.d/bbf $(1)/lib/upgrade/keep.d/bbf
|
||||||
|
|
||||||
$(INSTALL_DIR) $(1)/etc/uci-defaults
|
$(INSTALL_DIR) $(1)/etc/uci-defaults
|
||||||
$(INSTALL_BIN) ./files/etc/uci-defaults/91-fix-bbfdmd-enabled-option $(1)/etc/uci-defaults/
|
$(INSTALL_BIN) ./files/etc/uci-defaults/91-fix-bbfdmd-enabled-option $(1)/etc/uci-defaults/
|
||||||
|
|
||||||
ifeq ($(findstring iopsys,$(CONFIG_BBF_VENDOR_LIST)),iopsys)
|
ifeq ($(CONFIG_BBF_VENDOR_EXTENSION),y)
|
||||||
$(BBFDM_INSTALL_CORE_PLUGIN) $(PKG_BUILD_DIR)/libbbfdm/dmtree/vendor/iopsys/libbbfdm_iopsys_ext.so $(1)
|
$(BBFDM_INSTALL_CORE_PLUGIN) $(PKG_BUILD_DIR)/libbbfdm/vendor/vendor.json $(1)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
$(INSTALL_DIR) $(1)/usr/share/bbfdm/scripts/
|
$(INSTALL_DIR) $(1)/usr/share/bbfdm/scripts
|
||||||
$(CP) $(PKG_BUILD_DIR)/utilities/files/usr/share/bbfdm/scripts/bbf_activate_handler.sh $(1)/usr/share/bbfdm/scripts/
|
$(CP) $(PKG_BUILD_DIR)/utilities/files/usr/share/bbfdm/scripts/bbf_activate_handler.sh $(1)/usr/share/bbfdm/scripts/
|
||||||
$(CP) $(PKG_BUILD_DIR)/utilities/files/usr/share/bbfdm/scripts/bbf_check_idle.sh $(1)/usr/share/bbfdm/scripts/
|
$(CP) $(PKG_BUILD_DIR)/utilities/files/usr/share/bbfdm/scripts/bbf_check_idle.sh $(1)/usr/share/bbfdm/scripts/
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define Package/libbbfdm/prerm
|
define Package/dm-service/install
|
||||||
#!/bin/sh
|
|
||||||
rm -rf /etc/bbfdm/dmmap/*
|
|
||||||
exit 0
|
|
||||||
endef
|
|
||||||
|
|
||||||
define Package/bbfdmd/install
|
|
||||||
$(INSTALL_DIR) $(1)/etc/init.d
|
$(INSTALL_DIR) $(1)/etc/init.d
|
||||||
$(INSTALL_DIR) $(1)/etc/hotplug.d/iface
|
|
||||||
$(INSTALL_DIR) $(1)/etc/config
|
|
||||||
$(INSTALL_DIR) $(1)/etc/bbfdm
|
|
||||||
$(INSTALL_DIR) $(1)/usr/sbin
|
|
||||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/bbfdmd/ubus/bbfdmd $(1)/usr/sbin/
|
|
||||||
$(INSTALL_DATA) ./files/etc/bbfdm/input.json $(1)/etc/bbfdm/
|
|
||||||
$(INSTALL_BIN) ./files/etc/init.d/bbfdmd $(1)/etc/init.d/bbfdmd
|
|
||||||
$(INSTALL_BIN) ./files/etc/init.d/bbfdm.services $(1)/etc/init.d/
|
$(INSTALL_BIN) ./files/etc/init.d/bbfdm.services $(1)/etc/init.d/
|
||||||
$(INSTALL_CONF) ./files/etc/config/bbfdm $(1)/etc/config/bbfdm
|
|
||||||
$(INSTALL_BIN) ./files/etc/hotplug.d/iface/85-bbfdm-sysctl $(1)/etc/hotplug.d/iface/85-bbfdm-sysctl
|
$(INSTALL_DIR) $(1)/usr/sbin
|
||||||
|
$(INSTALL_BIN) $(PKG_BUILD_DIR)/dm-service/dm-service $(1)/usr/sbin/
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define Package/bbf_configmngr/install
|
define Package/bbf_configmngr/install
|
||||||
|
|
@ -183,6 +175,12 @@ ifeq ($(CONFIG_BBF_CONFIGMNGR_SCRIPT_BACKEND),y)
|
||||||
endif
|
endif
|
||||||
endef
|
endef
|
||||||
|
|
||||||
|
define Package/bbfdmd/prerm
|
||||||
|
#!/bin/sh
|
||||||
|
rm -rf /etc/bbfdm/dmmap/*
|
||||||
|
exit 0
|
||||||
|
endef
|
||||||
|
|
||||||
define Build/InstallDev
|
define Build/InstallDev
|
||||||
$(INSTALL_DIR) $(1)/usr/lib
|
$(INSTALL_DIR) $(1)/usr/lib
|
||||||
$(INSTALL_DIR) $(1)/usr/include
|
$(INSTALL_DIR) $(1)/usr/include
|
||||||
|
|
@ -198,5 +196,5 @@ endef
|
||||||
$(eval $(call BuildPackage,bbf_configmngr))
|
$(eval $(call BuildPackage,bbf_configmngr))
|
||||||
$(eval $(call BuildPackage,libbbfdm-api))
|
$(eval $(call BuildPackage,libbbfdm-api))
|
||||||
$(eval $(call BuildPackage,libbbfdm-ubus))
|
$(eval $(call BuildPackage,libbbfdm-ubus))
|
||||||
$(eval $(call BuildPackage,libbbfdm))
|
|
||||||
$(eval $(call BuildPackage,bbfdmd))
|
$(eval $(call BuildPackage,bbfdmd))
|
||||||
|
$(eval $(call BuildPackage,dm-service))
|
||||||
|
|
|
||||||
|
|
@ -1,28 +0,0 @@
|
||||||
{
|
|
||||||
"daemon": {
|
|
||||||
"config": {
|
|
||||||
},
|
|
||||||
"input": {
|
|
||||||
"type": "DotSo",
|
|
||||||
"name": "/usr/share/bbfdm/libbbfdm.so",
|
|
||||||
"plugin_dir": "/usr/share/bbfdm/plugins"
|
|
||||||
},
|
|
||||||
"output": {
|
|
||||||
"type": "UBUS",
|
|
||||||
"name": "bbfdm"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"cli": {
|
|
||||||
"config": {
|
|
||||||
"proto": "both",
|
|
||||||
"instance_mode": 0
|
|
||||||
},
|
|
||||||
"input": {
|
|
||||||
"type": "UBUS",
|
|
||||||
"name": "bbfdm"
|
|
||||||
},
|
|
||||||
"output": {
|
|
||||||
"type": "CLI"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
config bbfdmd 'bbfdmd'
|
config bbfdmd 'bbfdmd'
|
||||||
option enable '1'
|
option enable '1'
|
||||||
|
option debug '0'
|
||||||
option loglevel '3'
|
option loglevel '3'
|
||||||
option subprocess_level '2'
|
|
||||||
|
|
||||||
config micro_services 'micro_services'
|
config micro_services 'micro_services'
|
||||||
option enable '1'
|
option enable '1'
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ START=40
|
||||||
STOP=8
|
STOP=8
|
||||||
|
|
||||||
USE_PROCD=1
|
USE_PROCD=1
|
||||||
PROG=/usr/sbin/bbfdmd
|
PROG=/usr/sbin/dm-service
|
||||||
|
|
||||||
BBFDM_MICROSERVICE_DIR="/etc/bbfdm/micro_services"
|
BBFDM_MICROSERVICE_DIR="/etc/bbfdm/micro_services"
|
||||||
|
|
||||||
|
|
@ -23,12 +23,12 @@ validate_bbfdm_micro_service_section()
|
||||||
|
|
||||||
_add_microservice()
|
_add_microservice()
|
||||||
{
|
{
|
||||||
local name path
|
local name path loglevel
|
||||||
local enable enable_core
|
local enable enable_core
|
||||||
|
|
||||||
# Check enable from micro-service
|
# Check enable from micro-service
|
||||||
path="${1}"
|
path="${1}"
|
||||||
enable_core="${3}"
|
enable_core="${2}"
|
||||||
|
|
||||||
name="$(basename ${path})"
|
name="$(basename ${path})"
|
||||||
name="${name//.json}"
|
name="${name//.json}"
|
||||||
|
|
@ -38,11 +38,14 @@ _add_microservice()
|
||||||
log "datamodel micro-service ${name} not enabled"
|
log "datamodel micro-service ${name} not enabled"
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
loglevel="$(jq -r '.daemon.config.loglevel//3' ${path})"
|
||||||
|
|
||||||
procd_open_instance "${name}"
|
procd_open_instance "${name}"
|
||||||
|
|
||||||
procd_set_param command ${PROG}
|
procd_set_param command ${PROG}
|
||||||
procd_append_param command -m "${name}"
|
procd_append_param command -m "${name}"
|
||||||
|
procd_append_param command -l "${loglevel}"
|
||||||
|
|
||||||
if [ "${enable_core}" -eq "1" ]; then
|
if [ "${enable_core}" -eq "1" ]; then
|
||||||
procd_set_param limits core="unlimited"
|
procd_set_param limits core="unlimited"
|
||||||
|
|
|
||||||
|
|
@ -6,9 +6,6 @@ STOP=10
|
||||||
USE_PROCD=1
|
USE_PROCD=1
|
||||||
PROG=/usr/sbin/bbfdmd
|
PROG=/usr/sbin/bbfdmd
|
||||||
|
|
||||||
BBFDM_JSON_INPUT="/etc/bbfdm/input.json"
|
|
||||||
BBFDM_TEMP_DIR="/tmp/bbfdm"
|
|
||||||
|
|
||||||
. /usr/share/libubox/jshn.sh
|
. /usr/share/libubox/jshn.sh
|
||||||
|
|
||||||
log() {
|
log() {
|
||||||
|
|
@ -19,15 +16,13 @@ validate_bbfdm_bbfdmd_section()
|
||||||
{
|
{
|
||||||
uci_validate_section bbfdm bbfdmd "bbfdmd" \
|
uci_validate_section bbfdm bbfdmd "bbfdmd" \
|
||||||
'enable:bool:true' \
|
'enable:bool:true' \
|
||||||
'sock:string' \
|
|
||||||
'debug:bool:false' \
|
'debug:bool:false' \
|
||||||
'loglevel:uinteger:1' \
|
'loglevel:uinteger:3'
|
||||||
'subprocess_level:uinteger'
|
|
||||||
}
|
}
|
||||||
|
|
||||||
configure_bbfdmd()
|
configure_bbfdmd()
|
||||||
{
|
{
|
||||||
local enable debug sock
|
local enable debug
|
||||||
local jlog jrefresh jtimeout jlevel
|
local jlog jrefresh jtimeout jlevel
|
||||||
|
|
||||||
config_load bbfdm
|
config_load bbfdm
|
||||||
|
|
@ -38,19 +33,13 @@ configure_bbfdmd()
|
||||||
|
|
||||||
[ "${enable}" -eq 0 ] && return 0
|
[ "${enable}" -eq 0 ] && return 0
|
||||||
|
|
||||||
if [ -f "${BBFDM_JSON_INPUT}" ]; then
|
|
||||||
echo "$(jq --arg log ${loglevel} --arg level ${subprocess_level} '.daemon.config += {"loglevel": $log, "subprocess_level": $level}' ${BBFDM_JSON_INPUT})" > "${BBFDM_TEMP_DIR}/input.json"
|
|
||||||
fi
|
|
||||||
|
|
||||||
procd_set_param command ${PROG}
|
procd_set_param command ${PROG}
|
||||||
|
procd_append_param command -l "${loglevel}"
|
||||||
|
|
||||||
if [ "${debug}" -eq 1 ]; then
|
if [ "${debug}" -eq 1 ]; then
|
||||||
procd_set_param stdout 1
|
procd_set_param stdout 1
|
||||||
procd_set_param stderr 1
|
procd_set_param stderr 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -f "${sock}" ]; then
|
|
||||||
procd_append_param command -s "${sock}"
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
start_service()
|
start_service()
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
BBFDM_BASE_DM_PATH="usr/share/bbfdm"
|
BBFDM_BASE_DM_PATH="usr/share/bbfdm"
|
||||||
BBFDM_INPUT_PATH="etc/bbfdm/micro_services"
|
BBFDM_INPUT_PATH="etc/bbfdm/micro_services"
|
||||||
INPUT_TEMPLATE='{"daemon":{"enable":"1","service_name":"template","config":{"loglevel":"1"}}}'
|
INPUT_TEMPLATE='{"daemon":{"enable":"1","service_name":"template","config":{"loglevel":"3"}}}'
|
||||||
OUT_NAME=""
|
OUT_NAME=""
|
||||||
|
|
||||||
MICRO_SERVICE=0
|
MICRO_SERVICE=0
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue