diff --git a/bbfdm/Config_bbfdm.in b/bbfdm/Config_bbfdmd.in similarity index 80% rename from bbfdm/Config_bbfdm.in rename to bbfdm/Config_bbfdmd.in index e753ee40f3ffeb3d172ee12f543a48a295004641..e8fd309d0a2f0846ded207588cf315d38b932d59 100644 --- a/bbfdm/Config_bbfdm.in +++ b/bbfdm/Config_bbfdmd.in @@ -1,7 +1,7 @@ -if PACKAGE_libbbfdm -config BBF_VENDOR_LIST - string "Vendor List" - default "iopsys" +if PACKAGE_bbfdmd +config BBF_VENDOR_EXTENSION + bool "Enable Vendor Extension" + default y config BBF_VENDOR_PREFIX string "Vendor Prefix" diff --git a/bbfdm/Makefile b/bbfdm/Makefile index 8a8a45d8dab0067da15dea94bef6e0674ec5e19e..74826c2d6da0d67ea4c84ace2fd70f750f95bb8d 100644 --- a/bbfdm/Makefile +++ b/bbfdm/Makefile @@ -5,13 +5,13 @@ include $(TOPDIR)/rules.mk PKG_NAME:=bbfdm -PKG_VERSION:=1.11.5 +PKG_VERSION:=1.12.0 USE_LOCAL:=0 ifneq ($(USE_LOCAL),1) PKG_SOURCE_PROTO:=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_MIRROR_HASH:=skip endif @@ -40,21 +40,20 @@ define Package/libbbfdm-ubus DEPENDS:=+libuci +libubox +libubus +libblobmsg-json +libjson-c +libbbfdm-api endef -define Package/libbbfdm +define Package/bbfdmd 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 + TITLE:=Datamodel ubus backend to expose core tree + DEPENDS:=+libuci +libubox +libubus +libblobmsg-json +libjson-c +libbbfdm-api +libopenssl +libbbfdm-ubus +bbf_configmngr endef -define Package/bbfdmd +define Package/dm-service SECTION:=utils CATEGORY:=Utilities SUBMENU:=TRx69 - TITLE:=Datamodel ubus backend - DEPENDS:=+libuci +libubox +libubus +libblobmsg-json +libbbfdm-api +libbbfdm-ubus +libbbfdm +jq +bbf_configmngr + 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 define Package/bbf_configmngr @@ -63,11 +62,10 @@ define Package/bbf_configmngr SUBMENU:=TRx69 TITLE:= BBF Config Manager DEPENDS:=+libuci +libubox +libubus +libblobmsg-json - MENU:=1 endef -define Package/libbbfdm/config - source "$(SOURCE)/Config_bbfdm.in" +define Package/bbfdmd/config + source "$(SOURCE)/Config_bbfdmd.in" endef define Package/bbf_configmngr/config @@ -82,8 +80,12 @@ define Package/libbbfdm-ubus/description Library contains the APIs to expose data model over ubus endef -define Package/libbbfdm/description - Library contains the data model tree, It includes basic TR181 nodes. +define Package/bbfdmd/description + Daemon to expose Datamodel core tree +endef + +define Package/dm-service/description + Daemon to expose Datamodel micro-service tree endef define Package/bbf_configmngr/description @@ -97,17 +99,9 @@ endef endif CMAKE_OPTIONS += \ - -DBBF_TR181=ON - -CMAKE_OPTIONS += \ - -DBBF_VENDOR_LIST:String="$(CONFIG_BBF_VENDOR_LIST)" \ -DBBF_VENDOR_PREFIX:String="$(CONFIG_BBF_VENDOR_PREFIX)" \ - -DBBF_MAX_OBJECT_INSTANCES:Integer=$(CONFIG_BBF_MAX_OBJECT_INSTANCES) - -ifeq ($(CONFIG_PACKAGE_bbfdmd),y) -CMAKE_OPTIONS += \ + -DBBF_MAX_OBJECT_INSTANCES:Integer=$(CONFIG_BBF_MAX_OBJECT_INSTANCES) \ -DBBFDMD_MAX_MSG_LEN:Integer=10485760 -endif define Package/libbbfdm-api/install $(INSTALL_DIR) $(1)/lib @@ -129,45 +123,43 @@ define Package/libbbfdm-ubus/install $(CP) $(PKG_BUILD_DIR)/libbbfdm-ubus/libbbfdm-ubus.so $(1)/lib/ endef -define Package/libbbfdm/install +define Package/bbfdmd/install $(INSTALL_DIR) $(1)/etc/bbfdm/dmmap + $(INSTALL_DIR) $(1)/usr/share/bbfdm - $(INSTALL_DIR) $(1)/usr/share/bbfdm/ - $(CP) $(PKG_BUILD_DIR)/libbbfdm/libbbfdm.so $(1)/usr/share/bbfdm/libbbfdm.so + $(INSTALL_DIR) $(1)/etc/config + $(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_DATA) ./files/lib/upgrade/keep.d/bbf $(1)/lib/upgrade/keep.d/bbf - + $(INSTALL_DIR) $(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) - $(BBFDM_INSTALL_CORE_PLUGIN) $(PKG_BUILD_DIR)/libbbfdm/dmtree/vendor/iopsys/libbbfdm_iopsys_ext.so $(1) +ifeq ($(CONFIG_BBF_VENDOR_EXTENSION),y) + $(BBFDM_INSTALL_CORE_PLUGIN) $(PKG_BUILD_DIR)/libbbfdm/vendor/vendor.json $(1) 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_check_idle.sh $(1)/usr/share/bbfdm/scripts/ endef -define Package/libbbfdm/prerm - #!/bin/sh - rm -rf /etc/bbfdm/dmmap/* - exit 0 -endef - -define Package/bbfdmd/install +define Package/dm-service/install $(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_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 define Package/bbf_configmngr/install @@ -183,6 +175,12 @@ ifeq ($(CONFIG_BBF_CONFIGMNGR_SCRIPT_BACKEND),y) endif endef +define Package/bbfdmd/prerm + #!/bin/sh + rm -rf /etc/bbfdm/dmmap/* + exit 0 +endef + define Build/InstallDev $(INSTALL_DIR) $(1)/usr/lib $(INSTALL_DIR) $(1)/usr/include @@ -198,5 +196,5 @@ endef $(eval $(call BuildPackage,bbf_configmngr)) $(eval $(call BuildPackage,libbbfdm-api)) $(eval $(call BuildPackage,libbbfdm-ubus)) -$(eval $(call BuildPackage,libbbfdm)) $(eval $(call BuildPackage,bbfdmd)) +$(eval $(call BuildPackage,dm-service)) diff --git a/bbfdm/files/etc/bbfdm/input.json b/bbfdm/files/etc/bbfdm/input.json deleted file mode 100644 index 74c7e8abe22e7ceeb4459245c9c4495ed4378b55..0000000000000000000000000000000000000000 --- a/bbfdm/files/etc/bbfdm/input.json +++ /dev/null @@ -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" - } - } -} diff --git a/bbfdm/files/etc/config/bbfdm b/bbfdm/files/etc/config/bbfdm index 6d4f8371269a7a7bb5d186ddcf745aa45e0f94e2..b537f0cc366b9143f5b06a962970037d1299fe7f 100644 --- a/bbfdm/files/etc/config/bbfdm +++ b/bbfdm/files/etc/config/bbfdm @@ -1,7 +1,7 @@ config bbfdmd 'bbfdmd' option enable '1' + option debug '0' option loglevel '3' - option subprocess_level '2' config micro_services 'micro_services' option enable '1' diff --git a/bbfdm/files/etc/init.d/bbfdm.services b/bbfdm/files/etc/init.d/bbfdm.services index 2c27f2729eeeea5e8c0ee745b4f1e17bd3f6a66f..b4bae28eac72b8fe670c960d3800757eb3f16025 100644 --- a/bbfdm/files/etc/init.d/bbfdm.services +++ b/bbfdm/files/etc/init.d/bbfdm.services @@ -4,7 +4,7 @@ START=40 STOP=8 USE_PROCD=1 -PROG=/usr/sbin/bbfdmd +PROG=/usr/sbin/dm-service BBFDM_MICROSERVICE_DIR="/etc/bbfdm/micro_services" @@ -23,12 +23,12 @@ validate_bbfdm_micro_service_section() _add_microservice() { - local name path + local name path loglevel local enable enable_core # Check enable from micro-service path="${1}" - enable_core="${3}" + enable_core="${2}" name="$(basename ${path})" name="${name//.json}" @@ -38,11 +38,14 @@ _add_microservice() log "datamodel micro-service ${name} not enabled" return 0 fi + + loglevel="$(jq -r '.daemon.config.loglevel//3' ${path})" procd_open_instance "${name}" procd_set_param command ${PROG} procd_append_param command -m "${name}" + procd_append_param command -l "${loglevel}" if [ "${enable_core}" -eq "1" ]; then procd_set_param limits core="unlimited" diff --git a/bbfdm/files/etc/init.d/bbfdmd b/bbfdm/files/etc/init.d/bbfdmd index 1d770b44c3dc26b095aa079f48306e75268301ff..7f2bf985ce5c0cd9ea27da595f9e87bda8150ebb 100644 --- a/bbfdm/files/etc/init.d/bbfdmd +++ b/bbfdm/files/etc/init.d/bbfdmd @@ -6,9 +6,6 @@ STOP=10 USE_PROCD=1 PROG=/usr/sbin/bbfdmd -BBFDM_JSON_INPUT="/etc/bbfdm/input.json" -BBFDM_TEMP_DIR="/tmp/bbfdm" - . /usr/share/libubox/jshn.sh log() { @@ -19,15 +16,13 @@ validate_bbfdm_bbfdmd_section() { uci_validate_section bbfdm bbfdmd "bbfdmd" \ 'enable:bool:true' \ - 'sock:string' \ 'debug:bool:false' \ - 'loglevel:uinteger:1' \ - 'subprocess_level:uinteger' + 'loglevel:uinteger:3' } configure_bbfdmd() { - local enable debug sock + local enable debug local jlog jrefresh jtimeout jlevel config_load bbfdm @@ -38,19 +33,13 @@ configure_bbfdmd() [ "${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_append_param command -l "${loglevel}" + if [ "${debug}" -eq 1 ]; then procd_set_param stdout 1 procd_set_param stderr 1 fi - - if [ -f "${sock}" ]; then - procd_append_param command -s "${sock}" - fi } start_service() diff --git a/bbfdm/tools/bbfdm.sh b/bbfdm/tools/bbfdm.sh index cf665086e3af574b48721c13e332bd98a9e4b159..bc0e056ce61ebc68667fc20d4ba4fbc67d2d12f7 100755 --- a/bbfdm/tools/bbfdm.sh +++ b/bbfdm/tools/bbfdm.sh @@ -2,7 +2,7 @@ BBFDM_BASE_DM_PATH="usr/share/bbfdm" 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="" MICRO_SERVICE=0