Ticket 14153: DSCP in tr069 datamodell

This commit is contained in:
Feten Besbes 2018-02-26 17:44:46 +01:00
parent 709b001b98
commit b45a55ebcf
5 changed files with 91 additions and 3 deletions

View file

@ -30,7 +30,7 @@ DMLEAF tDownloadDiagnosticsParam[] = {
{"TotalBytesReceived", &DMREAD, DMT_UNINT, get_download_diagnostic_totalbytes, NULL, NULL, NULL},
{"TCPOpenRequestTime", &DMREAD, DMT_TIME, get_download_diagnostic_tcp_open_request_time, NULL, NULL, NULL},
{"TCPOpenResponseTime", &DMREAD, DMT_TIME, get_download_diagnostic_tcp_open_response_time, NULL, NULL, NULL},
//{"DSCP", &DMWRITE, DMT_UNINT, get_download_diagnostics_dscp, set_download_diagnostics_dscp, NULL, NULL},
{"DSCP", &DMWRITE, DMT_UNINT, get_download_diagnostics_dscp, set_download_diagnostics_dscp, NULL, NULL},
//{"Interface", &DMWRITE, DMT_UNINT, get_download_diagnostics_interface, set_download_diagnostics_interface, NULL, NULL},
{0}
};
@ -215,3 +215,31 @@ int get_download_diagnostic_tcp_open_response_time(char *refparam, struct dmctx
*value = "0";
return 0;
}
int get_download_diagnostics_dscp(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
dmuci_get_varstate_string("cwmp", "@downloaddiagnostic[0]", "DSCP", value);
if ((*value)[0] == '\0')
*value = "0";
return 0;
}
int set_download_diagnostics_dscp(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
char *tmp;
struct uci_section *curr_section = NULL;
switch (action) {
case VALUECHECK:
return 0;
case VALUESET:
DOWNLOAD_DIAGNOSTIC_STOP
curr_section = (struct uci_section *)dmuci_walk_state_section("cwmp", "downloaddiagnostic", NULL, NULL, CMP_SECTION, NULL, NULL, GET_FIRST_SECTION);
if(!curr_section)
{
dmuci_add_state_section("cwmp", "downloaddiagnostic", &curr_section, &tmp);
}
dmuci_set_varstate_value("cwmp", "@downloaddiagnostic[0]", "DSCP", value);
return 0;
}
return 0;
}

View file

@ -27,6 +27,8 @@ int get_download_diagnostic_testbytes(char *refparam, struct dmctx *ctx, void *d
int get_download_diagnostic_totalbytes(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_download_diagnostic_tcp_open_request_time(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_download_diagnostic_tcp_open_response_time(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_download_diagnostics_dscp(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_download_diagnostics_dscp(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
extern DMLEAF tDownloadDiagnosticsParam[];
#endif

View file

@ -26,7 +26,7 @@ DMLEAF tIPPingDiagnosticsParam[] = {
{"NumberOfRepetitions", &DMWRITE, DMT_UNINT, get_ipping_repetition_number, set_ipping_repetition_number, NULL, NULL},
{"Timeout", &DMWRITE, DMT_UNINT, get_ipping_timeout, set_ipping_timeout, NULL, NULL},
{"DataBlockSize", &DMWRITE, DMT_UNINT, get_ipping_block_size, set_ipping_block_size, NULL, NULL},
//{"DSCP", &DMWRITE, DMT_UNINT, get_ipping_dscp, set_ipping_dscp, NULL, NULL},
{"DSCP", &DMWRITE, DMT_UNINT, get_ipping_dscp, set_ipping_dscp, NULL, NULL},
{"SuccessCount", &DMREAD, DMT_UNINT, get_ipping_success_count, NULL, NULL, NULL},
{"FailureCount", &DMREAD, DMT_UNINT, get_ipping_failure_count, NULL, NULL, NULL},
{"AverageResponseTime", &DMREAD, DMT_UNINT, get_ipping_average_response_time, NULL, NULL, NULL},
@ -35,6 +35,7 @@ DMLEAF tIPPingDiagnosticsParam[] = {
{0}
};
static inline char *ipping_get(char *option, char *def)
{
char *tmp;
@ -207,6 +208,33 @@ int set_ipping_block_size(char *refparam, struct dmctx *ctx, void *data, char *i
return 0;
}
int get_ipping_dscp(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
*value = ipping_get("DSCP", "0");
return 0;
}
int set_ipping_dscp(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
char *tmp;
struct uci_section *curr_section = NULL;
switch (action) {
case VALUECHECK:
return 0;
case VALUESET:
IPPING_STOP
curr_section = (struct uci_section *)dmuci_walk_state_section("cwmp", "ippingdiagnostic", NULL, NULL, CMP_SECTION, NULL, NULL, GET_FIRST_SECTION);
if(!curr_section)
{
dmuci_add_state_section("cwmp", "ippingdiagnostic", &curr_section, &tmp);
}
dmuci_set_varstate_value("cwmp", "@ippingdiagnostic[0]", "DSCP", value);
}
return 0;
}
int get_ipping_success_count(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
*value = ipping_get("SuccessCount", "0");

View file

@ -30,7 +30,7 @@ DMLEAF tUploadDiagnosticsParam[] = {
{"TotalBytesSent", &DMREAD, DMT_UNINT, get_upload_diagnostic_totalbytes, NULL, NULL, NULL},
{"TCPOpenRequestTime", &DMREAD, DMT_TIME, get_upload_diagnostic_tcp_open_request_time, NULL, NULL, NULL},
{"TCPOpenResponseTime", &DMREAD, DMT_TIME, get_upload_diagnostic_tcp_open_response_time, NULL, NULL, NULL},
//{"DSCP", &DMWRITE, DMT_UNINT, get_upload_diagnostics_dscp, set_upload_diagnostics_dscp, NULL, NULL},
{"DSCP", &DMWRITE, DMT_UNINT, get_upload_diagnostic_dscp, set_upload_diagnostic_dscp, NULL, NULL},
//{"Interface", &DMWRITE, DMT_UNINT, get_upload_diagnostics_interface, set_upload_diagnostics_interface, NULL, NULL},
{0}
};
@ -236,4 +236,32 @@ int get_upload_diagnostic_tcp_open_response_time(char *refparam, struct dmctx *c
*value = "0";
return 0;
}
int get_upload_diagnostic_dscp(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
dmuci_get_varstate_string("cwmp", "@uploaddiagnostic[0]", "DSCP", value);
if ((*value)[0] == '\0')
*value = "0";
return 0;
}
int set_upload_diagnostic_dscp(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
char *tmp;
struct uci_section *curr_section = NULL;
switch (action) {
case VALUECHECK:
return 0;
case VALUESET:
UPLOAD_DIAGNOSTIC_STOP
curr_section = (struct uci_section *)dmuci_walk_state_section("cwmp", "uploaddiagnostic", NULL, NULL, CMP_SECTION, NULL, NULL, GET_FIRST_SECTION);
if(!curr_section)
{
dmuci_add_state_section("cwmp", "uploaddiagnostic", &curr_section, &tmp);
}
dmuci_set_varstate_value("cwmp", "@uploaddiagnostic[0]", "DSCP", value);
return 0;
}
return 0;
}

View file

@ -28,5 +28,7 @@ int set_upload_diagnostic_test_file_length(char *refparam, struct dmctx *ctx, vo
int get_upload_diagnostic_totalbytes(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_upload_diagnostic_tcp_open_request_time(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_upload_diagnostic_tcp_open_response_time(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int get_upload_diagnostic_dscp(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int set_upload_diagnostic_dscp(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
#endif