Added support of tr471 diagnostics

This commit is contained in:
suvendhu 2023-02-09 21:07:30 +05:30
parent 1b55211c8a
commit 2de7dbc43c
10 changed files with 1916 additions and 4 deletions

View file

@ -15,6 +15,7 @@ SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -I${PROJECT_SOURCE_DIR} -I${PROJECT_SOURCE_D
OPTION(BBF_TR181 "build with tr181 datamodel" ON)
OPTION(BBF_TR104 "build with tr104 datamodel" ON)
OPTION(BBF_TR143 "build with tr143 datamodel" ON)
OPTION(BBF_TR471 "build with tr471 datamodel" ON)
OPTION(BBF_DOTSO_PLUGIN "build with dotso plugin" ON)
OPTION(BBF_JSON_PLUGIN "build with json plugin" ON)
OPTION(BBF_VENDOR_EXTENSION "build with vendor extension enabled" ON)
@ -48,6 +49,16 @@ IF(BBF_TR143)
add_compile_definitions(BBF_TR143)
ENDIF(BBF_TR143)
IF(BBF_TR471)
IF(NOT BBF_TR143)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -I${PROJECT_SOURCE_DIR}/dmtree/tr143")
FILE(GLOB BBF_TR143_SOURCES ${PROJECT_SOURCE_DIR}/dmtree/tr143/diagnostics.c)
ENDIF()
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -I${PROJECT_SOURCE_DIR}/dmtree/tr471")
FILE(GLOB BBF_TR471_SOURCES ${PROJECT_SOURCE_DIR}/dmtree/tr471/*.c)
add_compile_definitions(BBF_TR471)
ENDIF(BBF_TR471)
IF(BBF_DOTSO_PLUGIN)
SET(BBF_DOTSO_PLUGIN_SOURCES dmdynamiclibrary.c)
add_compile_definitions(BBFDM_ENABLE_DOTSO_PLUGIN)
@ -92,7 +103,7 @@ IF(BBF_VENDOR_EXTENSION)
ENDIF(BBF_VENDOR_EXTENSION)
ADD_LIBRARY(bbfdm SHARED ${BBF_API_SOURCES} ${BBF_DM_SOURCES}
${BBF_TR181_SOURCES} ${BBF_TR104_SOURCES} ${BBF_TR143_SOURCES}
${BBF_TR181_SOURCES} ${BBF_TR104_SOURCES} ${BBF_TR143_SOURCES} ${BBF_TR471_SOURCES}
${BBF_DOTSO_PLUGIN_SOURCES}
${BBF_JSON_PLUGIN_SOURCES}
${BBF_VENDOR_EXTENSION_SOURCES})

View file

@ -12,10 +12,15 @@
#include "dmdiagnostics.h"
#include "dmbbfcommon.h"
#include "diagnostics.h"
#ifdef BBF_TR471
#include "iplayercap.h"
#endif
#ifdef BBF_TR143
#define TRACEROUTE_DIAGNOSTIC_PATH "/usr/share/bbfdm/traceroute"
#define DOWNLOAD_DIAGNOSTIC_PATH "/usr/share/bbfdm/download"
#define UPLOAD_DIAGNOSTIC_PATH "/usr/share/bbfdm/upload"
#endif
/*************************************************************
* COMMON FUNCTIONS
@ -29,6 +34,7 @@ static int get_diag_enable_true(char *refparam, struct dmctx *ctx, void *data, c
/*************************************************************
* GET & SET PARAM
**************************************************************/
#ifdef BBF_TR143
/*
* *** Device.IP.Diagnostics.IPPing. ***
*/
@ -2328,6 +2334,7 @@ static int operate_IPDiagnostics_ServerSelectionDiagnostics(char *refparam, stru
return CMD_SUCCESS;
}
#endif
/**********************************************************************************************************************************
* OBJ & LEAF DEFINITION
@ -2335,17 +2342,23 @@ static int operate_IPDiagnostics_ServerSelectionDiagnostics(char *refparam, stru
/* *** Device.IP.Diagnostics. *** */
DMOBJ tIPDiagnosticsObj[] = {
/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/
#ifdef BBF_TR143
{"IPPing", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tIPDiagnosticsIPPingParams, NULL, BBFDM_CWMP},
{"TraceRoute", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tIPDiagnosticsTraceRouteObj, tIPDiagnosticsTraceRouteParams, NULL, BBFDM_CWMP},
{"DownloadDiagnostics", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tIPDiagnosticsDownloadDiagnosticsObj, tIPDiagnosticsDownloadDiagnosticsParams, NULL, BBFDM_CWMP},
{"UploadDiagnostics", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tIPDiagnosticsUploadDiagnosticsObj, tIPDiagnosticsUploadDiagnosticsParams, NULL, BBFDM_CWMP},
{"UDPEchoDiagnostics", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tIPDiagnosticsUDPEchoDiagnosticsParams, NULL, BBFDM_CWMP},
{"ServerSelectionDiagnostics", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tIPDiagnosticsServerSelectionDiagnosticsParams, NULL, BBFDM_CWMP},
#endif
#ifdef BBF_TR471
{"IPLayerCapacityMetrics", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tIPLayerCapacityObj, tIPLayerCapacityParams, NULL, BBFDM_CWMP},
#endif
{0}
};
DMLEAF tIPDiagnosticsParams[] = {
/* PARAM, permission, type, getvalue, setvalue, bbfdm_type*/
#ifdef BBF_TR143
{"IPv4PingSupported", &DMREAD, DMT_BOOL, get_diag_enable_true, NULL, BBFDM_BOTH},
{"IPv6PingSupported", &DMREAD, DMT_BOOL, get_diag_enable_true, NULL, BBFDM_BOTH},
{"IPv4TraceRouteSupported", &DMREAD, DMT_BOOL, get_diag_enable_true, NULL, BBFDM_BOTH},
@ -2364,9 +2377,20 @@ DMLEAF tIPDiagnosticsParams[] = {
{"UploadDiagnostics()", &DMASYNC, DMT_COMMAND, get_operate_args_IPDiagnostics_UploadDiagnostics, operate_IPDiagnostics_UploadDiagnostics, BBFDM_USP},
{"UDPEchoDiagnostics()", &DMASYNC, DMT_COMMAND, get_operate_args_IPDiagnostics_UDPEchoDiagnostics, operate_IPDiagnostics_UDPEchoDiagnostics, BBFDM_USP},
{"ServerSelectionDiagnostics()", &DMASYNC, DMT_COMMAND, get_operate_args_IPDiagnostics_ServerSelectionDiagnostics, operate_IPDiagnostics_ServerSelectionDiagnostics, BBFDM_USP},
#endif
#ifdef BBF_TR471
{"IPLayerCapacitySupported", &DMREAD, DMT_BOOL, get_diag_enable_true, NULL, BBFDM_BOTH},
{"IPLayerMaxConnections", &DMREAD, DMT_UNINT, get_IPDiagnosticsIPLayerCapacity_MaxConnections, NULL, BBFDM_USP},
{"IPLayerMaxIncrementalResult", &DMREAD, DMT_UNINT, get_IPDiagnosticsIPLayerCapacity_MaxIncrementalResult, NULL, BBFDM_USP},
{"IPLayerCapSupportedSoftwareVersion", &DMREAD, DMT_STRING, get_IPDiagnosticsIPLayerCapacity_SoftwareVersion, NULL, BBFDM_USP},
{"IPLayerCapSupportedControlProtocolVersion", &DMREAD, DMT_UNINT, get_IPDiagnosticsIPLayerCapacity_ControlProtocolVersion, NULL, BBFDM_USP},
{"IPLayerCapSupportedMetrics", &DMREAD, DMT_STRING, get_IPDiagnosticsIPLayerCapacity_SupportedMetrics, NULL, BBFDM_USP},
{"IPLayerCapacity()", &DMASYNC, DMT_COMMAND, get_operate_args_IPDiagnostics_IPLayerCapacity, operate_IPDiagnostics_IPLayerCapacity, BBFDM_USP},
#endif
{0}
};
#ifdef BBF_TR143
/* *** Device.IP.Diagnostics.IPPing. *** */
DMLEAF tIPDiagnosticsIPPingParams[] = {
/* PARAM, permission, type, getvalue, setvalue, bbfdm_type*/
@ -2563,3 +2587,4 @@ DMLEAF tIPDiagnosticsServerSelectionDiagnosticsParams[] = {
{"IPAddressUsed", &DMREAD, DMT_STRING, get_IPDiagnosticsServerSelectionDiagnostics_IPAddressUsed, NULL, BBFDM_CWMP},
{0}
};
#endif

View file

@ -14,8 +14,12 @@
#include "libbbf_api/dmcommon.h"
#if defined(BBF_TR143) || defined(BBF_TR471)
extern DMOBJ tIPDiagnosticsObj[];
extern DMLEAF tIPDiagnosticsParams[];
#endif
#ifdef BBF_TR143
extern DMLEAF tIPDiagnosticsIPPingParams[];
extern DMOBJ tIPDiagnosticsTraceRouteObj[];
extern DMLEAF tIPDiagnosticsTraceRouteParams[];
@ -29,5 +33,6 @@ extern DMLEAF tIPDiagnosticsUploadDiagnosticsPerConnectionResultParams[];
extern DMLEAF tIPDiagnosticsUDPEchoConfigParams[];
extern DMLEAF tIPDiagnosticsUDPEchoDiagnosticsParams[];
extern DMLEAF tIPDiagnosticsServerSelectionDiagnosticsParams[];
#endif
#endif

View file

@ -13,7 +13,7 @@
#include "ppp.h"
#include "firewall.h"
#include "ip.h"
#ifdef BBF_TR143
#if defined(BBF_TR143) || defined(BBF_TR471)
#include "diagnostics.h"
#endif
@ -2326,7 +2326,7 @@ static int operate_IPInterface_Reset(char *refparam, struct dmctx *ctx, void *da
DMOBJ tIPObj[] = {
/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys, version*/
{"Interface", &DMWRITE, addObjIPInterface, delObjIPInterface, NULL, browseIPInterfaceInst, NULL, NULL, tIPInterfaceObj, tIPInterfaceParams, get_linker_ip_interface, BBFDM_BOTH, LIST_KEY{"Alias", "Name", NULL}, "2.0"},
#ifdef BBF_TR143
#if defined(BBF_TR143) || defined(BBF_TR471)
{"Diagnostics", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tIPDiagnosticsObj, tIPDiagnosticsParams, NULL, BBFDM_BOTH, NULL, "2.0"},
#endif
{0}

1396
dmtree/tr471/iplayercap.c Normal file

File diff suppressed because it is too large Load diff

31
dmtree/tr471/iplayercap.h Normal file
View file

@ -0,0 +1,31 @@
/*
* Copyright (C) 2023 iopsys Software Solutions AB
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 2.1
* as published by the Free Software Foundation
*
* Author: Suvendhu Hansa <suvendhu.hansa@iopsys.eu>
*
*/
#ifndef __IPLAYERCAP_H
#define __IPLAYERCAP_H
#include "libbbf_api/dmcommon.h"
extern DMOBJ tIPLayerCapacityObj[];
extern DMLEAF tIPLayerCapacityParams[];
extern DMLEAF tIPLayerCapacityModalResultParams[];
extern DMLEAF tIPLayerCapacityIncrementalResultParams[];
int operate_IPDiagnostics_IPLayerCapacity(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int get_operate_args_IPDiagnostics_IPLayerCapacity(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_IPDiagnosticsIPLayerCapacity_SoftwareVersion(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_IPDiagnosticsIPLayerCapacity_MaxConnections(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_IPDiagnosticsIPLayerCapacity_MaxIncrementalResult(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_IPDiagnosticsIPLayerCapacity_ControlProtocolVersion(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_IPDiagnosticsIPLayerCapacity_SupportedMetrics(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
#endif

View file

@ -407,7 +407,8 @@ enum bbf_end_session_enum {
BBF_END_SESSION_TRACEROUTE_DIAGNOSTIC = 1<<9,
BBF_END_SESSION_UDPECHO_DIAGNOSTIC = 1<<10,
BBF_END_SESSION_SERVERSELECTION_DIAGNOSTIC = 1<<11,
BBF_END_SESSION_NEIGBORING_WIFI_DIAGNOSTIC = 1<<12
BBF_END_SESSION_NEIGBORING_WIFI_DIAGNOSTIC = 1<<12,
BBF_END_SESSION_IPLAYERCAPACITY_DIAGNOSTIC = 1<<21
};
enum dm_browse_enum {

View file

@ -53,6 +53,10 @@ char *PowerState[] = {"On", "Power_Save", "Off", "Unsupported", NULL};
char *FW_Mode[] = {"AnyTime", "Immediately", "WhenIdle", "ConfirmationNeeded", NULL};
char *AKMsAllowed[] = {"psk", "dpp", "sae", "psk+sae", "dpp+sae", "dpp+psk+sae", "SuiteSelector", NULL};
char *CellularDataPreference[] = {"Excluded", "Should not use", "Should use", NULL};
char *IPLayerCapacityRole[] = {"Receiver", "Sender", NULL};
char *UDPPayloadContent[] = {"zeroes", "random", NULL};
char *IPLayerCapacityTestType[] = {"Search", "Fixed", NULL};
char *RateAdjAlgorithm[] = {"B", "C", NULL};
char *PIN[] = {"^\\d{4}|\\d{8}$", NULL};
char *DestinationAddress[] = {"^\\d+/\\d+$", NULL};

View file

@ -116,6 +116,10 @@ extern char *PowerState[];
extern char *FW_Mode[];
extern char *AKMsAllowed[];
extern char *CellularDataPreference[];
extern char *IPLayerCapacityRole[];
extern char *UDPPayloadContent[];
extern char *IPLayerCapacityTestType[];
extern char *RateAdjAlgorithm[];
#define CRONTABS_ROOT "/etc/crontabs/root"
#define ACTIVATE_HANDLER_FILE "/usr/share/bbfdm/bbf_activate_handler.sh"

435
scripts/iplayercap Normal file
View file

@ -0,0 +1,435 @@
#!/bin/sh
# Copyright (C) 2023 iopsys Software Solutions AB
# Author: Suvendhu Hansa <suvendhu.hansa@iopsys.eu>
. /usr/share/libubox/jshn.sh
ROOT="$(dirname $0)"
. ${ROOT}/bbf_api
iplayercap_error() {
json_init
json_add_string "Status" "$1"
json_dump
# Store data in dmmap
[ "$2" == "both_proto" ] && {
$UCI_SET_BBF_DMMAP dmmap_diagnostics.iplayercapacity.DiagnosticState="${1}"
$UCI_SET_BBF_DMMAP dmmap_diagnostics.iplayercapacity.SoftwareVersion=""
$UCI_SET_BBF_DMMAP dmmap_diagnostics.iplayercapacity.BOMTime=""
$UCI_SET_BBF_DMMAP dmmap_diagnostics.iplayercapacity.EOMTime=""
$UCI_SET_BBF_DMMAP dmmap_diagnostics.iplayercapacity.TmaxUsed=""
$UCI_SET_BBF_DMMAP dmmap_diagnostics.iplayercapacity.TestInterval=""
$UCI_SET_BBF_DMMAP dmmap_diagnostics.iplayercapacity.TmaxRTTUsed=""
$UCI_SET_BBF_DMMAP dmmap_diagnostics.iplayercapacity.TimestampResolutionUsed=""
$UCI_SET_BBF_DMMAP dmmap_diagnostics.iplayercapacity.MaxIPLayerCapacity=""
$UCI_SET_BBF_DMMAP dmmap_diagnostics.iplayercapacity.TimeOfMax=""
$UCI_SET_BBF_DMMAP dmmap_diagnostics.iplayercapacity.MaxETHCapacityNoFCS=""
$UCI_SET_BBF_DMMAP dmmap_diagnostics.iplayercapacity.MaxETHCapacityWithFCS=""
$UCI_SET_BBF_DMMAP dmmap_diagnostics.iplayercapacity.MaxETHCapacityWithFCSVLAN=""
$UCI_SET_BBF_DMMAP dmmap_diagnostics.iplayercapacity.LossRatioAtMax=""
$UCI_SET_BBF_DMMAP dmmap_diagnostics.iplayercapacity.RTTRangeAtMax=""
$UCI_SET_BBF_DMMAP dmmap_diagnostics.iplayercapacity.PDVRangeAtMax=""
$UCI_SET_BBF_DMMAP dmmap_diagnostics.iplayercapacity.MinOnewayDelayAtMax=""
$UCI_SET_BBF_DMMAP dmmap_diagnostics.iplayercapacity.ReorderedRatioAtMax=""
$UCI_SET_BBF_DMMAP dmmap_diagnostics.iplayercapacity.ReplicatedRatioAtMax=""
$UCI_SET_BBF_DMMAP dmmap_diagnostics.iplayercapacity.InterfaceEthMbpsAtMax=""
$UCI_SET_BBF_DMMAP dmmap_diagnostics.iplayercapacity.IPLayerCapacitySummary=""
$UCI_SET_BBF_DMMAP dmmap_diagnostics.iplayercapacity.LossRatioSummary=""
$UCI_SET_BBF_DMMAP dmmap_diagnostics.iplayercapacity.RTTRangeSummary=""
$UCI_SET_BBF_DMMAP dmmap_diagnostics.iplayercapacity.PDVRangeSummary=""
$UCI_SET_BBF_DMMAP dmmap_diagnostics.iplayercapacity.MinOnewayDelaySummary=""
$UCI_SET_BBF_DMMAP dmmap_diagnostics.iplayercapacity.MinRTTSummary=""
$UCI_SET_BBF_DMMAP dmmap_diagnostics.iplayercapacity.ReorderedRatioSummary=""
$UCI_SET_BBF_DMMAP dmmap_diagnostics.iplayercapacity.ReplicatedRatioSummary=""
$UCI_SET_BBF_DMMAP dmmap_diagnostics.iplayercapacity.InterfaceEthMbpsSummary=""
# Clear all incremental & modal result instances
res=$($UCI_SHOW_BBF_DMMAP dmmap_diagnostics | grep -E "=modalresult$" | cut -d= -f 1)
for i in $res; do
$UCI_DELETE_BBF_DMMAP "${i}"
done
res=$($UCI_SHOW_BBF_DMMAP dmmap_diagnostics | grep -E "=incrementalresult$" | cut -d= -f 1)
for i in $res; do
$UCI_DELETE_BBF_DMMAP "${i}"
done
$UCI_COMMIT_BBF_DMMAP
}
}
iplayercap_launch() {
input="$1"
options=""
json_load "${input}"
json_get_var interface interface
json_get_var role role
json_get_var host host
json_get_var port port
json_get_var jumbo_frames jumbo_frames
json_get_var DSCP DSCP
json_get_var proto_ver proto_ver
json_get_var udp_content udp_content
json_get_var test_type test_type
json_get_var ipdv_enable ipdv_enable
json_get_var rate_index rate_index
json_get_var num_interval num_interval
json_get_var mode_subintervals mode_subintervals
json_get_var test_subinterval test_subinterval
json_get_var feedback_interval feedback_interval
json_get_var seq_err_thresh seq_err_thresh
json_get_var dup_ignore dup_ignore
json_get_var lower_thresh lower_thresh
json_get_var upper_thresh upper_thresh
json_get_var high_speed_delta high_speed_delta
json_get_var algorithm algorithm
json_get_var slow_adj_thresh slow_adj_thresh
json_get_var proto proto
# Fail if host is empty
[ -z "${host}" ] && {
iplayercap_error "Error_Internal" "${proto}"
return
}
# Assign default value
[ -z "${test_type}" ] && test_type="Search"
[ -z "${test_subinterval}" ] && test_subinterval=1000
[ -z "${feedback_interval}" ] && feedback_interval=50
[ -z "${seq_err_thresh}" ] && seq_err_thresh=10
[ -z "${dup_ignore}" ] && dup_ignore=1
[ -z "${lower_thresh}" ] && lower_thresh=30
[ -z "${upper_thresh}" ] && upper_thresh=90
[ -z "${high_speed_delta}" ] && high_speed_delta=10
[ -z "${slow_adj_thresh}" ] && slow_adj_thresh=3
[ -z "${num_interval}" ] && num_interval=10
if [ -z "${role}" ] || [ "${role}" == "Sender" ]; then
options="$options -u"
else
options="$options -d"
fi
if [ -n "${jumbo_frames}" ] && [ "${jumbo_frames}" -eq 0 ]; then
options="$options -j"
fi
if [ -n "${DSCP}" ] && [ ${DSCP} -gt 0 ]; then
options="$options -m $DSCP"
fi
if [ "${proto_ver}" == "IPv4" ]; then
options="$options -4"
elif [ "${proto_ver}" == "IPv6" ]; then
options="$options -6"
fi
if [ "${udp_content}" == "random" ]; then
options="$options -X"
fi
if [ -n "${ipdb_enable}" ] && [ "${ipdv_enable}" -eq 1 ]; then
options="$options -o"
fi
if [ -n "${rate_index}" ]; then
options="$options -I @${rate_index}"
fi
if [ -n "${algorithm}" ]; then
options="$options -A ${algorithm}"
fi
if [ -n "${interface}" ]; then
options="$options -E ${interface}"
fi
if [ -n "${port}" ]; then
options="$options -p ${port}"
fi
test_subinterval=$(( test_subinterval/1000 ))
t_val=$(( test_subinterval*num_interval ))
if [ "${t_val}" -lt 5 ] || [ "${t_val}" -gt 60 ]; then
iplayercap_error "Error_Internal" "${proto}"
return
fi
if [ -n "${mode_subintervals}" ] && [ ${mode_subintervals} -gt 0 ]; then
if [ ${mode_subintervals} -lt ${num_interval} ]; then
options="$options -i ${mode_subintervals}"
else
iplayercap_error "Error_Internal" "${proto}"
return
fi
fi
options="$options -P ${test_subinterval} -t ${t_val} -F ${feedback_interval}"
if [ "${test_type}" == "Search" ]; then
options="$options -q ${seq_err_thresh} -L ${lower_thresh} -U ${upper_thresh} -h ${high_speed_delta} -c ${slow_adj_thresh}"
if [ "${dup_ignore}" -eq 0 ]; then
options="$options -R"
fi
fi
output=$(udpst $options -f jsonf $host 2>&1)
if [ "$?" -eq 127 ] || [ "$?" -eq 255 ]; then
iplayercap_error "Error_Internal" "${proto}"
return
fi
json_init
json_load "$output"
[ "${proto}" == "both_proto" ] && {
json_get_var err ErrorStatus
if [ "${err}" -ne 0 ]; then
iplayercap_error "Error_Internal" "${proto}"
return
fi
json_select IPLayerCapSupported
if [ "$?" -ne 0 ]; then
iplayercap_error "Error_Internal" "${proto}"
return
fi
json_get_var version SoftwareVersion
$UCI_SET_BBF_DMMAP dmmap_diagnostics.iplayercapacity.SoftwareVersion="${version}"
json_select ..
json_select Output
if [ "$?" -ne 0 ]; then
iplayercap_error "Error_Internal" "${proto}"
return
fi
json_get_var Status Status
$UCI_SET_BBF_DMMAP dmmap_diagnostics.iplayercapacity.DiagnosticState="${Status}"
json_get_var BOMTime BOMTime
$UCI_SET_BBF_DMMAP dmmap_diagnostics.iplayercapacity.BOMTime="${BOMTime}"
json_get_var EOMTime EOMTime
$UCI_SET_BBF_DMMAP dmmap_diagnostics.iplayercapacity.EOMTime="${EOMTime}"
json_get_var TmaxUsed TmaxUsed
$UCI_SET_BBF_DMMAP dmmap_diagnostics.iplayercapacity.TmaxUsed="${TmaxUsed}"
json_get_var TestInterval TestInterval
$UCI_SET_BBF_DMMAP dmmap_diagnostics.iplayercapacity.TestInterval="${TestInterval}"
json_get_var TmaxRTTUsed TmaxRTTUsed
$UCI_SET_BBF_DMMAP dmmap_diagnostics.iplayercapacity.TmaxRTTUsed="${TmaxRTTUsed}"
json_get_var TimestampResolutionUsed TimestampResolutionUsed
$UCI_SET_BBF_DMMAP dmmap_diagnostics.iplayercapacity.TimestampResolutionUsed="${TimestampResolutionUsed}"
json_select AtMax
if [ "$?" -ne 0 ]; then
iplayercap_error "Error_Internal" "${proto}"
return
fi
json_get_var MaxIPLayerCapacity MaxIPLayerCapacity
$UCI_SET_BBF_DMMAP dmmap_diagnostics.iplayercapacity.MaxIPLayerCapacity="${MaxIPLayerCapacity}"
json_get_var TimeOfMax TimeOfMax
$UCI_SET_BBF_DMMAP dmmap_diagnostics.iplayercapacity.TimeOfMax="${TimeOfMax}"
json_get_var MaxETHCapacityNoFCS MaxETHCapacityNoFCS
$UCI_SET_BBF_DMMAP dmmap_diagnostics.iplayercapacity.MaxETHCapacityNoFCS="${MaxETHCapacityNoFCS}"
json_get_var MaxETHCapacityWithFCS MaxETHCapacityWithFCS
$UCI_SET_BBF_DMMAP dmmap_diagnostics.iplayercapacity.MaxETHCapacityWithFCS="${MaxETHCapacityWithFCS}"
json_get_var MaxETHCapacityWithFCSVLAN MaxETHCapacityWithFCSVLAN
$UCI_SET_BBF_DMMAP dmmap_diagnostics.iplayercapacity.MaxETHCapacityWithFCSVLAN="${MaxETHCapacityWithFCSVLAN}"
json_get_var LossRatioAtMax LossRatioAtMax
$UCI_SET_BBF_DMMAP dmmap_diagnostics.iplayercapacity.LossRatioAtMax="${LossRatioAtMax}"
json_get_var RTTRangeAtMax RTTRangeAtMax
$UCI_SET_BBF_DMMAP dmmap_diagnostics.iplayercapacity.RTTRangeAtMax="${RTTRangeAtMax}"
json_get_var PDVRangeAtMax PDVRangeAtMax
$UCI_SET_BBF_DMMAP dmmap_diagnostics.iplayercapacity.PDVRangeAtMax="${PDVRangeAtMax}"
json_get_var MinOnewayDelayAtMax MinOnewayDelayAtMax
$UCI_SET_BBF_DMMAP dmmap_diagnostics.iplayercapacity.MinOnewayDelayAtMax="${MinOnewayDelayAtMax}"
json_get_var ReorderedRatioAtMax ReorderedRatioAtMax
$UCI_SET_BBF_DMMAP dmmap_diagnostics.iplayercapacity.ReorderedRatioAtMax="${ReorderedRatioAtMax}"
json_get_var ReplicatedRatioAtMax ReplicatedRatioAtMax
$UCI_SET_BBF_DMMAP dmmap_diagnostics.iplayercapacity.ReplicatedRatioAtMax="${ReplicatedRatioAtMax}"
json_get_var InterfaceEthMbps InterfaceEthMbps
$UCI_SET_BBF_DMMAP dmmap_diagnostics.iplayercapacity.InterfaceEthMbpsAtMax="${InterfaceEthMbps}"
json_select ..
json_select Summary
if [ "$?" -ne 0 ]; then
iplayercap_error "Error_Internal" "${proto}"
return
fi
json_get_var IPLayerCapacitySummary IPLayerCapacitySummary
$UCI_SET_BBF_DMMAP dmmap_diagnostics.iplayercapacity.IPLayerCapacitySummary="${IPLayerCapacitySummary}"
json_get_var LossRatioSummary LossRatioSummary
$UCI_SET_BBF_DMMAP dmmap_diagnostics.iplayercapacity.LossRatioSummary="${LossRatioSummary}"
json_get_var RTTRangeSummary RTTRangeSummary
$UCI_SET_BBF_DMMAP dmmap_diagnostics.iplayercapacity.RTTRangeSummary="${RTTRangeSummary}"
json_get_var PDVRangeSummary PDVRangeSummary
$UCI_SET_BBF_DMMAP dmmap_diagnostics.iplayercapacity.PDVRangeSummary="${PDVRangeSummary}"
json_get_var MinOnewayDelaySummary MinOnewayDelaySummary
$UCI_SET_BBF_DMMAP dmmap_diagnostics.iplayercapacity.MinOnewayDelaySummary="${MinOnewayDelaySummary}"
json_get_var MinRTTSummary MinRTTSummary
$UCI_SET_BBF_DMMAP dmmap_diagnostics.iplayercapacity.MinRTTSummary="${MinRTTSummary}"
json_get_var ReorderedRatioSummary ReorderedRatioSummary
$UCI_SET_BBF_DMMAP dmmap_diagnostics.iplayercapacity.ReorderedRatioSummary="${ReorderedRatioSummary}"
json_get_var ReplicatedRatioSummary ReplicatedRatioSummary
$UCI_SET_BBF_DMMAP dmmap_diagnostics.iplayercapacity.ReplicatedRatioSummary="${ReplicatedRatioSummary}"
json_get_var InterfaceEthMbps InterfaceEthMbps
$UCI_SET_BBF_DMMAP dmmap_diagnostics.iplayercapacity.InterfaceEthMbpsSummary="${InterfaceEthMbps}"
json_select ..
# Clear all existing incremental & modal result instances
res=$($UCI_SHOW_BBF_DMMAP dmmap_diagnostics | grep -E "=modalresult$" | cut -d= -f 1)
for i in $res; do
$UCI_DELETE_BBF_DMMAP "${i}"
done
res=$($UCI_SHOW_BBF_DMMAP dmmap_diagnostics | grep -E "=incrementalresult$" | cut -d= -f 1)
for i in $res; do
$UCI_DELETE_BBF_DMMAP "${i}"
done
failed=0
if json_is_a ModalResult array; then
json_select ModalResult
if [ "$?" -eq 0 ]; then
local idx=1
local inst=0
while json_is_a ${idx} object
do
json_select ${idx}
if ["$?" -ne 0 ]; then
iplayercap_error "Error_Internal" "${proto}"
failed=1
break
fi
json_get_var TimeOfMax TimeOfMax
json_get_var MaxIPLayerCapacity MaxIPLayerCapacity
json_get_var MaxETHCapacityNoFCS MaxETHCapacityNoFCS
json_get_var MaxETHCapacityWithFCS MaxETHCapacityWithFCS
json_get_var MaxETHCapacityWithFCSVLAN MaxETHCapacityWithFCSVLAN
json_get_var LossRatioAtMax LossRatioAtMax
json_get_var RTTRangeAtMax RTTRangeAtMax
json_get_var PDVRangeAtMax PDVRangeAtMax
json_get_var MinOnewayDelayAtMax MinOnewayDelayAtMax
json_get_var ReorderedRatioAtMax ReorderedRatioAtMax
json_get_var ReplicatedRatioAtMax ReplicatedRatioAtMax
json_get_var InterfaceEthMbps InterfaceEthMbps
sec=$($UCI_ADD_BBF_DMMAP dmmap_diagnostics modalresult)
$UCI_RENAME_BBF_DMMAP dmmap_diagnostics.@modalresult[${inst}]="modalresult_${inst}"
$UCI_SET_BBF_DMMAP dmmap_diagnostics.modalresult_${inst}.MaxIPLayerCapacity="${MaxIPLayerCapacity}"
$UCI_SET_BBF_DMMAP dmmap_diagnostics.modalresult_${inst}.TimeOfMax="${TimeOfMax}"
$UCI_SET_BBF_DMMAP dmmap_diagnostics.modalresult_${inst}.MaxETHCapacityNoFCS="${MaxETHCapacityNoFCS}"
$UCI_SET_BBF_DMMAP dmmap_diagnostics.modalresult_${inst}.MaxETHCapacityWithFCS="${MaxETHCapacityWithFCS}"
$UCI_SET_BBF_DMMAP dmmap_diagnostics.modalresult_${inst}.MaxETHCapacityWithFCSVLAN="${MaxETHCapacityWithFCSVLAN}"
$UCI_SET_BBF_DMMAP dmmap_diagnostics.modalresult_${inst}.LossRatioAtMax="${LossRatioAtMax}"
$UCI_SET_BBF_DMMAP dmmap_diagnostics.modalresult_${inst}.RTTRangeAtMax="${RTTRangeAtMax}"
$UCI_SET_BBF_DMMAP dmmap_diagnostics.modalresult_${inst}.PDVRangeAtMax="${PDVRangeAtMax}"
$UCI_SET_BBF_DMMAP dmmap_diagnostics.modalresult_${inst}.MinOnewayDelayAtMax="${MinOnewayDelayAtMax}"
$UCI_SET_BBF_DMMAP dmmap_diagnostics.modalresult_${inst}.ReorderedRatioAtMax="${ReorderedRatioAtMax}"
$UCI_SET_BBF_DMMAP dmmap_diagnostics.modalresult_${inst}.ReplicatedRatioAtMax="${ReplicatedRatioAtMax}"
$UCI_SET_BBF_DMMAP dmmap_diagnostics.modalresult_${inst}.InterfaceEthMbpsAtMax="${InterfaceEthMbps}"
idx=$(( idx + 1 ))
inst=$(( inst + 1))
json_select ..
done
json_select ..
fi
fi
if [ "${failed}" -eq 1 ]; then
return
fi
if json_is_a IncrementalResult array; then
json_select IncrementalResult
if [ "$?" -eq 0 ]; then
local idx=1
local inst=0
while json_is_a ${idx} object
do
json_select ${idx}
if [ "$?" -ne 0 ]; then
iplayercap_error "Error_Internal" "${proto}"
failed=1
break
fi
json_get_var TimeOfSubInterval TimeOfSubInterval
json_get_var IPLayerCapacity IPLayerCapacity
json_get_var LossRatio LossRatio
json_get_var RTTRange RTTRange
json_get_var PDVRange PDVRange
json_get_var MinOnewayDelay MinOnewayDelay
json_get_var ReorderedRatio ReorderedRatio
json_get_var ReplicatedRatio ReplicatedRatio
json_get_var InterfaceEthMbps InterfaceEthMbps
sec=$($UCI_ADD_BBF_DMMAP dmmap_diagnostics incrementalresult)
$UCI_RENAME_BBF_DMMAP dmmap_diagnostics.@incrementalresult[${inst}]="incrementalresult_${inst}"
$UCI_SET_BBF_DMMAP dmmap_diagnostics.incrementalresult_${inst}.IPLayerCapacity="${IPLayerCapacity}"
$UCI_SET_BBF_DMMAP dmmap_diagnostics.incrementalresult_${inst}.TimeOfSubInterval="${TimeOfSubInterval}"
$UCI_SET_BBF_DMMAP dmmap_diagnostics.incrementalresult_${inst}.LossRatio="${LossRatio}"
$UCI_SET_BBF_DMMAP dmmap_diagnostics.incrementalresult_${inst}.RTTRange="${RTTRange}"
$UCI_SET_BBF_DMMAP dmmap_diagnostics.incrementalresult_${inst}.PDVRange="${PDVRange}"
$UCI_SET_BBF_DMMAP dmmap_diagnostics.incrementalresult_${inst}.MinOnewayDelay="${MinOnewayDelay}"
$UCI_SET_BBF_DMMAP dmmap_diagnostics.incrementalresult_${inst}.ReorderedRatio="${ReorderedRatio}"
$UCI_SET_BBF_DMMAP dmmap_diagnostics.incrementalresult_${inst}.ReplicatedRatio="${ReplicatedRatio}"
$UCI_SET_BBF_DMMAP dmmap_diagnostics.incrementalresult_${inst}.InterfaceEthMbps="${InterfaceEthMbps}"
idx=$(( idx + 1 ))
inst=$(( inst + 1))
json_select ..
done
json_select ..
fi
fi
if [ "${failed}" -eq 1 ]; then
return
fi
$UCI_COMMIT_BBF_DMMAP
}
json_dump
}
[ ! -f /etc/bbfdm/dmmap/dmmap_diagnostics ] && touch /etc/bbfdm/dmmap/dmmap_diagnostics
if [ -n "$1" ]; then
iplayercap_launch "$1"
else
iplayercap_error "Error_Internal" "${proto}"
fi