mirror of
https://dev.iopsys.eu/feed/iopsys.git
synced 2025-12-10 07:44:50 +01:00
obuspa: fixes for downgrade
This commit is contained in:
parent
ee619a99a6
commit
d3a1612294
2 changed files with 34 additions and 41 deletions
|
|
@ -5,7 +5,7 @@
|
||||||
include $(TOPDIR)/rules.mk
|
include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
PKG_NAME:=obuspa
|
PKG_NAME:=obuspa
|
||||||
PKG_VERSION:=7.0.5.23
|
PKG_VERSION:=7.0.5.24
|
||||||
|
|
||||||
LOCAL_DEV:=0
|
LOCAL_DEV:=0
|
||||||
ifneq ($(LOCAL_DEV),1)
|
ifneq ($(LOCAL_DEV),1)
|
||||||
|
|
|
||||||
|
|
@ -217,12 +217,10 @@ validate_controller_section()
|
||||||
'Enable:bool:1' \
|
'Enable:bool:1' \
|
||||||
'EndpointID:string' \
|
'EndpointID:string' \
|
||||||
'assigned_role_name:string' \
|
'assigned_role_name:string' \
|
||||||
'AssignedRole:string' \
|
|
||||||
'Protocol:or("STOMP","CoAP","MQTT", "WebSocket")' \
|
'Protocol:or("STOMP","CoAP","MQTT", "WebSocket")' \
|
||||||
'Destination:string' \
|
'Destination:string' \
|
||||||
'Topic:string' \
|
'Topic:string' \
|
||||||
'ParameterName:list(string)' \
|
'ParameterName:list(string)' \
|
||||||
'Reference:string' \
|
|
||||||
'mqtt:string' \
|
'mqtt:string' \
|
||||||
'stomp:string' \
|
'stomp:string' \
|
||||||
'Host:string' \
|
'Host:string' \
|
||||||
|
|
@ -230,7 +228,7 @@ validate_controller_section()
|
||||||
'Path:string' \
|
'Path:string' \
|
||||||
'EnableEncryption:bool' \
|
'EnableEncryption:bool' \
|
||||||
'PeriodicNotifInterval:uinteger' \
|
'PeriodicNotifInterval:uinteger' \
|
||||||
'SessionMode:string:Allow' \
|
'SessionMode:string' \
|
||||||
'ProvisioningCode:string'
|
'ProvisioningCode:string'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -255,7 +253,6 @@ validate_mtp_section()
|
||||||
'Path:string' \
|
'Path:string' \
|
||||||
'mqtt:string' \
|
'mqtt:string' \
|
||||||
'stomp:string' \
|
'stomp:string' \
|
||||||
'Reference:string' \
|
|
||||||
'PublishQoS:uinteger' \
|
'PublishQoS:uinteger' \
|
||||||
'EnableEncryption:bool'
|
'EnableEncryption:bool'
|
||||||
}
|
}
|
||||||
|
|
@ -324,7 +321,7 @@ configure_controller()
|
||||||
local EndpointID Enable
|
local EndpointID Enable
|
||||||
local Protocol Destination
|
local Protocol Destination
|
||||||
local Topic mqtt stomp assigned_role_name AssignedRole ParameterName ProvisioningCode
|
local Topic mqtt stomp assigned_role_name AssignedRole ParameterName ProvisioningCode
|
||||||
local Host Port Path EnableEncryption Reference SessionMode PeriodicNotifInterval
|
local Host Port Path EnableEncryption PeriodicNotifInterval
|
||||||
local dm_ref sec
|
local dm_ref sec
|
||||||
|
|
||||||
sec="${1}"
|
sec="${1}"
|
||||||
|
|
@ -346,16 +343,12 @@ configure_controller()
|
||||||
fi
|
fi
|
||||||
|
|
||||||
dm_ref=""
|
dm_ref=""
|
||||||
if [ -z "${Reference}" ]; then
|
if [ "${Protocol}" = "STOMP" ]; then
|
||||||
if [ "${Protocol}" = "STOMP" ]; then
|
stomp="${stomp/stomp_/cpe-}"
|
||||||
stomp="${stomp/stomp_/cpe-}"
|
dm_ref=$(get_refrence_path "Device.STOMP.Connection." "${stomp}")
|
||||||
dm_ref=$(get_refrence_path "Device.STOMP.Connection." "${stomp}")
|
elif [ "${Protocol}" = "MQTT" ]; then
|
||||||
elif [ "${Protocol}" = "MQTT" ]; then
|
mqtt="${mqtt/mqtt_/cpe-}"
|
||||||
mqtt="${mqtt/mqtt_/cpe-}"
|
dm_ref=$(get_refrence_path "Device.MQTT.Client." "${mqtt}")
|
||||||
dm_ref=$(get_refrence_path "Device.MQTT.Client." "${mqtt}")
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
dm_ref="${Reference}"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
db_set "${BASEPATH}.Alias" "${sec}"
|
db_set "${BASEPATH}.Alias" "${sec}"
|
||||||
|
|
@ -370,16 +363,15 @@ configure_controller()
|
||||||
db_set "${BASEPATH}.PeriodicNotifInterval" "${PeriodicNotifInterval}"
|
db_set "${BASEPATH}.PeriodicNotifInterval" "${PeriodicNotifInterval}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "${SessionMode}" ]; then
|
#if [ -n "${SessionMode}" ]; then
|
||||||
db_set "${BASEPATH}.E2ESession.SessionMode" "${SessionMode}"
|
# db_set "${BASEPATH}.E2ESession.SessionMode" "${SessionMode}"
|
||||||
fi
|
#fi
|
||||||
|
|
||||||
if [ -n "${assigned_role_name}" ]; then
|
if [ -n "${assigned_role_name}" ]; then
|
||||||
AssignedRole=$(get_role_index "${assigned_role_name}")
|
AssignedRole=$(get_role_index "${assigned_role_name}")
|
||||||
fi
|
if [ -n "${AssignedRole}" ]; then
|
||||||
|
db_set "${BASEPATH}.AssignedRole" "${AssignedRole}"
|
||||||
if [ -n "${AssignedRole}" ]; then
|
fi
|
||||||
db_set "${BASEPATH}.AssignedRole" "${AssignedRole}"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
db_set "${BASEPATH}.MTP.1.Alias" "${sec}"
|
db_set "${BASEPATH}.MTP.1.Alias" "${sec}"
|
||||||
|
|
@ -559,16 +551,12 @@ configure_mtp() {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
dm_ref=""
|
dm_ref=""
|
||||||
if [ -z "${Reference}" ]; then
|
if [ "${Protocol}" = "STOMP" ]; then
|
||||||
if [ "${Protocol}" = "STOMP" ]; then
|
stomp="${stomp/stomp_/cpe-}"
|
||||||
stomp="${stomp/stomp_/cpe-}"
|
dm_ref=$(get_refrence_path "Device.STOMP.Connection." "${stomp}")
|
||||||
dm_ref=$(get_refrence_path "Device.STOMP.Connection." "${stomp}")
|
elif [ "${Protocol}" = "MQTT" ]; then
|
||||||
elif [ "${Protocol}" = "MQTT" ]; then
|
mqtt="${mqtt/mqtt_/cpe-}"
|
||||||
mqtt="${mqtt/mqtt_/cpe-}"
|
dm_ref=$(get_refrence_path "Device.MQTT.Client." "${mqtt}")
|
||||||
dm_ref=$(get_refrence_path "Device.MQTT.Client." "${mqtt}")
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
dm_ref="${Reference}"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
db_set "${BASEPATH}.Alias" "${sec}"
|
db_set "${BASEPATH}.Alias" "${sec}"
|
||||||
|
|
@ -776,8 +764,8 @@ sync_db_controller()
|
||||||
{
|
{
|
||||||
local cntrs copts sec pvalue protocol
|
local cntrs copts sec pvalue protocol
|
||||||
|
|
||||||
copts="Enable EndpointID AssignedRole PeriodicNotifInterval"
|
copts="Enable EndpointID PeriodicNotifInterval"
|
||||||
popts="Destination Topic Reference Host Port Path EnableEncryption"
|
popts="Destination Topic Host Port Path EnableEncryption"
|
||||||
|
|
||||||
cntrs="$(get_instances_from_db_dump Device.LocalAgent.Controller.)"
|
cntrs="$(get_instances_from_db_dump Device.LocalAgent.Controller.)"
|
||||||
for cntr in $cntrs; do
|
for cntr in $cntrs; do
|
||||||
|
|
@ -809,8 +797,7 @@ sync_db_localagent_mtp()
|
||||||
local mtps opts popts sec pvalue protocol
|
local mtps opts popts sec pvalue protocol
|
||||||
|
|
||||||
opts="Enable"
|
opts="Enable"
|
||||||
popts="ResponseTopicConfigured Destination Port Path Reference EnableEncryption PublishQoS"
|
popts="ResponseTopicConfigured Destination Port Path EnableEncryption PublishQoS"
|
||||||
ropts="mqtt stomp"
|
|
||||||
|
|
||||||
mtps="$(get_instances_from_db_dump Device.LocalAgent.MTP.)"
|
mtps="$(get_instances_from_db_dump Device.LocalAgent.MTP.)"
|
||||||
for inst in $mtps; do
|
for inst in $mtps; do
|
||||||
|
|
@ -833,9 +820,6 @@ sync_db_localagent_mtp()
|
||||||
pvalue="$(get_param_value_from_dump "${inst}"."${protocol}"."${param}")"
|
pvalue="$(get_param_value_from_dump "${inst}"."${protocol}"."${param}")"
|
||||||
uci_set obuspa "${sec}" "${param}" "${pvalue}"
|
uci_set obuspa "${sec}" "${param}" "${pvalue}"
|
||||||
done
|
done
|
||||||
for param in ${ropts}; do
|
|
||||||
uci_set obuspa "${sec}" "${param}" ""
|
|
||||||
done
|
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1002,6 +986,9 @@ db_init()
|
||||||
reverse_update_db_with_uci
|
reverse_update_db_with_uci
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Remove ControllerTrust.Role., if present in db for backward compatibility
|
||||||
|
delete_sql_db_entry_with_pattern "Device.LocalAgent.ControllerTrust.Role."
|
||||||
|
|
||||||
# Remove reset file if present
|
# Remove reset file if present
|
||||||
[ -f "${RESET_FILE}" ] && mv ${RESET_FILE} ${RESET_FILE}.old
|
[ -f "${RESET_FILE}" ] && mv ${RESET_FILE} ${RESET_FILE}.old
|
||||||
|
|
||||||
|
|
@ -1034,11 +1021,17 @@ db_init()
|
||||||
}
|
}
|
||||||
|
|
||||||
start_service() {
|
start_service() {
|
||||||
local enabled
|
local enabled role_file
|
||||||
|
|
||||||
mkdir -p /tmp/obuspa/
|
mkdir -p /tmp/obuspa/
|
||||||
config_load obuspa
|
config_load obuspa
|
||||||
config_get_bool enabled global enabled 0
|
config_get_bool enabled global enabled 0
|
||||||
|
config_get role_file global role_file ""
|
||||||
|
# Use the default role file if not defined in uci, but present in path
|
||||||
|
if [ -z "${role_file}" ] && [ -f "/etc/obuspa/roles.json" ] ; then
|
||||||
|
uci -q set obuspa.global.role_file="/etc/obuspa/roles.json"
|
||||||
|
uci_commit obuspa
|
||||||
|
fi
|
||||||
|
|
||||||
procd_open_instance ${CONFIGURATION}
|
procd_open_instance ${CONFIGURATION}
|
||||||
if [ "${enabled}" -eq 1 ]; then
|
if [ "${enabled}" -eq 1 ]; then
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue