tr104: micro-service support

This commit is contained in:
Vivek Kumar Dutta 2023-10-20 19:35:26 +05:30
parent 32e6e38103
commit 501966b150
4 changed files with 57 additions and 2 deletions

4
tr104/Config.in Normal file
View file

@ -0,0 +1,4 @@
config TR104_DOTSO_PLUGIN
bool "Use bbfdm DotSO plugin backend to provide TR104 and extension datamodel"
depends on PACKAGE_tr104
default n

View file

@ -11,7 +11,7 @@ LOCAL_DEV:=0
ifeq ($(LOCAL_DEV),0)
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://dev.iopsys.eu/voice/tr104.git
PKG_SOURCE_VERSION:=63a9876a4f7f030bac433fc44427884e7e97baf5
PKG_SOURCE_VERSION:=cd0c5d1f4a8489e3d93b5cf433f8f0df638bf62b
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
PKG_MIRROR_HASH:=skip
endif
@ -21,12 +21,14 @@ PKG_LICENSE_FILES:=LICENSE
include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/cmake.mk
include ../bbfdm/bbfdm.mk
define Package/$(PKG_NAME)
SECTION:=utils
CATEGORY:=Utilities
SUBMENU:=TRx69
TITLE:=TR104 Datamodel Daemon
MENU:=1
DEPENDS:=+libuci +libubox +libubus +libblobmsg-json +asterisk
endef
@ -34,8 +36,13 @@ define Package/$(PKG_NAME)/description
TR104 datamodel daemon
endef
define Package/$(PKG_NAME)/config
source "$(SOURCE)/Config.in"
endef
CMAKE_OPTIONS += \
-DBBF_VENDOR_PREFIX:String="$(CONFIG_BBF_VENDOR_PREFIX)" \
-DDAEMON_JSON_INPUT:String="/etc/tr104/input.json" \
-DDM_ENABLE_UBUS=ON
ifeq ($(LOCAL_DEV),1)
@ -46,10 +53,18 @@ endif
define Package/$(PKG_NAME)/install
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_DIR) $(1)/etc/tr104d
ifeq ($(CONFIG_TR104_DOTSO_PLUGIN),y)
$(call BbfdmInstallPlugin,$(1),$(PKG_BUILD_DIR)/libdm/tr104/libtr104.so)
$(call BbfdmInstallPlugin,$(1),$(PKG_BUILD_DIR)/libdm/tr104_ext/libtr104ext.so)
else
$(INSTALL_DIR) $(1)/etc/tr104/plugins/
$(INSTALL_DIR) $(1)/usr/sbin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/daemon/ubus/tr104d $(1)/usr/sbin/
$(INSTALL_BIN) $(PKG_BUILD_DIR)/libdm/tr104/libtr104.so $(1)/etc/tr104/
$(INSTALL_BIN) $(PKG_BUILD_DIR)/libdm/tr104_ext/libtr104ext.so $(1)/etc/tr104/plugins/
$(INSTALL_BIN) ./files/etc/init.d/tr104d $(1)/etc/init.d/
$(INSTALL_BIN) ./files/etc/tr104/input.json $(1)/etc/tr104/input.json
endif
endef
$(eval $(call BuildPackage,$(PKG_NAME)))

View file

@ -14,7 +14,9 @@ log() {
start_service()
{
procd_open_instance "tr104d"
procd_set_param command ${PROG}
procd_append_param command -m "/etc/tr104/input.json"
procd_set_param stdout 1
procd_set_param stderr 1

View file

@ -0,0 +1,34 @@
{
"daemon": {
"config": {
"loglevel": "1",
"refresh_time": "10",
"transaction_timeout": "30"
},
"input": {
"type": "DotSo",
"name": "/etc/tr104/libtr104.so",
"plugin_dir": "/etc/tr104/plugins/"
},
"output": {
"type": "UBUS",
"name": "tr104",
"parent_dm": "Device.Services.",
"object": "VoiceService",
"root_obj": "bbfdm"
}
},
"cli": {
"config": {
"proto": "both",
"instance_mode": 0
},
"input": {
"type": "UBUS",
"name": "tr104"
},
"output": {
"type": "CLI"
}
}
}