Diagnostics: proto has no effect after new changes affected in icwmp

This commit is contained in:
Amin Ben Ramdhane 2021-01-02 23:24:18 +01:00
parent eef08e0770
commit 3f9767796f
10 changed files with 25 additions and 25 deletions

View file

@ -567,7 +567,7 @@ static char *get_default_gateway_device(void)
return device;
}
int start_upload_download_diagnostic(int diagnostic_type, char *proto)
int start_upload_download_diagnostic(int diagnostic_type)
{
char *url, *interface, *device, *size, *status;
@ -594,7 +594,7 @@ int start_upload_download_diagnostic(int diagnostic_type, char *proto)
// Commit and Free uci_ctx_bbfdm
commit_and_free_uci_ctx_bbfdm(DMMAP_DIAGNOSTIGS);
dmcmd("/bin/sh", 5, DOWNLOAD_DIAGNOSTIC_PATH, "run", proto, url, device);
dmcmd("/bin/sh", 4, DOWNLOAD_DIAGNOSTIC_PATH, "run", url, device);
// Allocate uci_ctx_bbfdm
dmuci_init_bbfdm();
@ -613,7 +613,7 @@ int start_upload_download_diagnostic(int diagnostic_type, char *proto)
// Commit and Free uci_ctx_bbfdm
commit_and_free_uci_ctx_bbfdm(DMMAP_DIAGNOSTIGS);
dmcmd("/bin/sh", 6, UPLOAD_DIAGNOSTIC_PATH, "run", proto, url, device, size);
dmcmd("/bin/sh", 5, UPLOAD_DIAGNOSTIC_PATH, "run", url, device, size);
// Allocate uci_ctx_bbfdm
dmuci_init_bbfdm();

View file

@ -60,7 +60,7 @@ char *get_diagnostics_option_fallback_def(char *sec_name, char *option, char *de
void set_diagnostics_option(char *sec_name, char *option, char *value);
void init_diagnostics_operation(char *sec_name, char *operation_path);
void set_diagnostics_interface_option(struct dmctx *ctx, char *sec_name, char *value);
int start_upload_download_diagnostic(int diagnostic_type, char *proto);
int start_upload_download_diagnostic(int diagnostic_type);
int bbf_config_backup(const char *url, const char *username, const char *password, char *config_name);
int bbf_config_restore(const char *url, const char *username, const char *password, const char *size);

View file

@ -345,7 +345,7 @@ static opr_ret_t ip_diagnostics_ipping(struct dmctx *dmctx, char *path, json_obj
// Commit and Free uci_ctx_bbfdm
commit_and_free_uci_ctx_bbfdm(DMMAP_DIAGNOSTIGS);
dmcmd("/bin/sh", 3, IPPING_PATH, "run", bbfdatamodel_type == BBFDM_CWMP ? "cwmp" : "usp");
dmcmd("/bin/sh", 2, IPPING_PATH, "run");
// Allocate uci_ctx_bbfdm
dmuci_init_bbfdm();
@ -403,7 +403,7 @@ static opr_ret_t ip_diagnostics_traceroute(struct dmctx *dmctx, char *path, json
// Commit and Free uci_ctx_bbfdm
commit_and_free_uci_ctx_bbfdm(DMMAP_DIAGNOSTIGS);
dmcmd("/bin/sh", 3, TRACEROUTE_PATH, "run", bbfdatamodel_type == BBFDM_CWMP ? "cwmp" : "usp");
dmcmd("/bin/sh", 2, TRACEROUTE_PATH, "run");
// Allocate uci_ctx_bbfdm
dmuci_init_bbfdm();
@ -455,7 +455,7 @@ static opr_ret_t ip_diagnostics_download(struct dmctx *dmctx, char *path, json_o
set_diagnostics_option("download", "NumberOfConnections", download.num_of_connections);
set_diagnostics_option("download", "EnablePerConnection", download.enable_per_connection_results);
if (start_upload_download_diagnostic(DOWNLOAD_DIAGNOSTIC, bbfdatamodel_type == BBFDM_CWMP ? "cwmp" : "usp") == -1)
if (start_upload_download_diagnostic(DOWNLOAD_DIAGNOSTIC) == -1)
return FAIL;
download.romtime = get_diagnostics_option("download", "ROMtime");
@ -515,7 +515,7 @@ static opr_ret_t ip_diagnostics_upload(struct dmctx *dmctx, char *path, json_obj
set_diagnostics_option("upload", "NumberOfConnections", upload.num_of_connections);
set_diagnostics_option("upload", "EnablePerConnection", upload.enable_per_connection_results);
if (start_upload_download_diagnostic(UPLOAD_DIAGNOSTIC, bbfdatamodel_type == BBFDM_CWMP ? "cwmp" : "usp") == -1)
if (start_upload_download_diagnostic(UPLOAD_DIAGNOSTIC) == -1)
return FAIL;
upload.romtime = get_diagnostics_option("upload", "ROMtime");
@ -582,7 +582,7 @@ static opr_ret_t ip_diagnostics_udpecho(struct dmctx *dmctx, char *path, json_ob
// Commit and Free uci_ctx_bbfdm
commit_and_free_uci_ctx_bbfdm(DMMAP_DIAGNOSTIGS);
dmcmd("/bin/sh", 3, UDPECHO_PATH, "run", bbfdatamodel_type == BBFDM_CWMP ? "cwmp" : "usp");
dmcmd("/bin/sh", 2, UDPECHO_PATH, "run");
// Allocate uci_ctx_bbfdm
dmuci_init_bbfdm();
@ -633,7 +633,7 @@ static opr_ret_t ip_diagnostics_serverselection(struct dmctx *dmctx, char *path,
// Commit and Free uci_ctx_bbfdm
commit_and_free_uci_ctx_bbfdm(DMMAP_DIAGNOSTIGS);
dmcmd("/bin/sh", 3, SERVERSELECTION_PATH, "run", bbfdatamodel_type == BBFDM_CWMP ? "cwmp" : "usp");
dmcmd("/bin/sh", 2, SERVERSELECTION_PATH, "run");
// Allocate uci_ctx_bbfdm
dmuci_init_bbfdm();
@ -677,7 +677,7 @@ static opr_ret_t ip_diagnostics_nslookup(struct dmctx *dmctx, char *path, json_o
// Commit and Free uci_ctx_bbfdm
commit_and_free_uci_ctx_bbfdm(DMMAP_DIAGNOSTIGS);
dmcmd("/bin/sh", 3, NSLOOKUP_PATH, "run", bbfdatamodel_type == BBFDM_CWMP ? "cwmp" : "usp");
dmcmd("/bin/sh", 2, NSLOOKUP_PATH, "run");
// Allocate uci_ctx_bbfdm
dmuci_init_bbfdm();

View file

@ -19,8 +19,8 @@ download_get() {
download_launch() {
local proto tx_bytes_before rx_bytes_before time1 tx_bytes_after rx_bytes_after time2 periodtime error_code
local url=$2
local device=$3
local url=$1
local device=$2
[ "$url" = "" ] && { $UCI_SET_BBFDM dmmap_diagnostics.download.DiagnosticState=Error_InitConnectionFailed; $UCI_COMMIT_BBFDM; return; }
local protocol=`download_get dmmap_diagnostics.download.ProtocolVersion Any`
if [ "$protocol" == "IPv4" ]; then proto="-4"; elif [ "$protocol" == "IPv6" ]; then proto="-6"; else proto=""; fi
@ -89,7 +89,7 @@ download_stop_diagnostic() {
}
if [ "$1" == "run" ] ; then
download_launch $2 $3 $4
download_launch $2 $3
elif [ "$1" == "stop" ]; then
download_stop_diagnostic
else

View file

@ -113,7 +113,7 @@ ipping_stop_diagnostic() {
}
if [ "$1" == "run" ]; then
ipping_launch $2
ipping_launch
elif [ "$1" == "stop" ]; then
ipping_stop_diagnostic
else

View file

@ -80,7 +80,7 @@ nslookup_launch() {
done <${LOG_FILE}
rm -f ${LOG_FILE}
$UCI_SET_BBFDM dmmap_diagnostics.nslookup.SuccessCount=$success_count
[ "$1" == "cwmp" ] && $UCI_SET_BBFDM dmmap_diagnostics.nslookup.DiagnosticState=Complete
$UCI_SET_BBFDM dmmap_diagnostics.nslookup.DiagnosticState=Complete
$UCI_COMMIT_BBFDM
}
@ -103,7 +103,7 @@ nslookup_stop_diagnostic() {
}
if [ "$1" == "run" ]; then
nslookup_launch $2
nslookup_launch
elif [ "$1" == "stop" ]; then
nslookup_stop_diagnostic
else

View file

@ -119,7 +119,7 @@ serverselection_stop_diagnostic() {
}
if [ "$1" == "run" ]; then
serverselection_launch $2
serverselection_launch
elif [ "$1" == "stop" ]; then
serverselection_stop_diagnostic
else

View file

@ -46,7 +46,7 @@ traceroute_launch() {
rm -f /tmp/traceres
let i++
[ "$1" == "cwmp" ] && $UCI_SET_BBFDM dmmap_diagnostics.traceroute.DiagnosticState=Complete
$UCI_SET_BBFDM dmmap_diagnostics.traceroute.DiagnosticState=Complete
$UCI_SET_BBFDM dmmap_diagnostics.traceroute.NumberOfHops=$i
$UCI_SET_BBFDM dmmap_diagnostics.traceroute.ResponseTime=$($UCI_GET_BBFDM dmmap_diagnostics.@RouteHops[-1].time)
$UCI_COMMIT_BBFDM
@ -72,7 +72,7 @@ traceroute_stop() {
}
if [ "$1" == "run" ]; then
traceroute_launch $2 2>/dev/null
traceroute_launch 2>/dev/null
elif [ "$1" == "stop" ]; then
traceroute_stop 2>/dev/null
else

View file

@ -84,7 +84,7 @@ udpecho_stop_diagnostic() {
}
if [ "$1" == "run" ]; then
udpecho_launch $1
udpecho_launch
elif [ "$1" == "stop" ]; then
udpecho_stop_diagnostic
else

View file

@ -19,9 +19,9 @@ upload_get() {
upload_launch() {
local proto tx_bytes_before rx_bytes_before time1 tx_bytes_after rx_bytes_after time2 res ba stc periodtime
local url=$2
local device=$3
local size=$4
local url=$1
local device=$2
local size=$3
[ "$url" = "" ] && { $UCI_SET_BBFDM dmmap_diagnostics.upload.DiagnosticState=Error_InitConnectionFailed; $UCI_COMMIT_BBFDM; return; }
local protocol=`upload_get dmmap_diagnostics.upload.ProtocolVersion Any`
if [ "$protocol" == "IPv4" ]; then proto="-4"; elif [ "$protocol" == "IPv6" ]; then proto="-6"; else proto=""; fi
@ -113,7 +113,7 @@ upload_stop_diagnostic() {
}
if [ "$1" == "run" ] ; then
upload_launch $2 $3 $4 $5
upload_launch $2 $3 $4
elif [ "$1" == "stop" ]; then
upload_stop_diagnostic
else