self-diagnostics: Align with VendorLogFiles update

This commit is contained in:
Suvendhu Hansa 2024-10-04 19:18:33 +05:30 committed by Vivek Kumar Dutta
parent ab322f1194
commit 47708d34df
2 changed files with 10 additions and 8 deletions

View file

@ -5,7 +5,7 @@
JSON_OUT=0
SPEC_DIR="/usr/share/self-diagnostics/spec"
SPEC_EXT_DIR="/etc/self-diagnostics/spec"
REPORT_DIR="$(mktemp -d)"
REPORT_DIR="$(mktemp -p /var/log/ -d)"
REPORT_NAME="self-test-diagnostics"
VERBOSE=0
COMPOPTS=""

View file

@ -17,8 +17,9 @@ static char *get_selftest_log_instance(struct dmctx *ctx)
{
char *file_name = NULL;
char *path = NULL;
char *file_uri = NULL;
struct uci_section *s = get_origin_section_from_config("system", "system", "self_test_log");
struct uci_section *s = get_origin_section_from_dmmap("dmmap_logmngr", "self_test", "self_test_log");
if (s == NULL)
goto err;
@ -26,7 +27,8 @@ static char *get_selftest_log_instance(struct dmctx *ctx)
if (DM_STRLEN(file_name) == 0)
goto err;
_bbfdm_get_references(ctx, "Device.DeviceInfo.VendorLogFile.", "Name", file_name, &path);
dmasprintf(&file_uri, "file://%s", file_name);
_bbfdm_get_references(ctx, "Device.DeviceInfo.VendorLogFile.", "Name", file_uri, &path);
err:
return path ? path : dmstrdup("");
@ -65,15 +67,15 @@ int operate_Device_SelfTest(char *refparam, struct dmctx *ctx, void *data, char
if (!file_exists(output))
goto err;
/* Add in vendor log */
struct uci_section *s = get_origin_section_from_config("system", "system", "self_test_log");
/* Add in dmmap_logmngr */
struct uci_section *s = get_origin_section_from_dmmap("dmmap_logmngr", "self_test", "self_test_log");
if (s == NULL) {
dmuci_add_section("system", "system", &s);
dmuci_add_section_bbfdm("dmmap_logmngr", "self_test", &s);
dmuci_rename_section_by_section(s, "self_test_log");
}
dmuci_set_value_by_section(s, "log_file", output);
dmuci_commit_package("system");
dmuci_commit_package_bbfdm("dmmap_logmngr");
/* Get self test log instance */
char *result = get_selftest_log_instance(ctx);
@ -133,7 +135,7 @@ static int get_SelfTest_Results(char *refparam, struct dmctx *ctx, void *data, c
DMLEAF tSelfTestParams[] = {
/* PARAM, permission, type, getvalue, setvalue, bbfdm_type*/
{"DiagnosticsState", &DMWRITE, DMT_STRING, get_SelfTest_DiagnosticsState, set_SelfTest_DiagnosticsState, BBFDM_CWMP},
{"Results", &DMREAD, DMT_STRING, get_SelfTest_Results, NULL, BBFDM_CWMP},
{"Results", &DMREAD, DMT_STRING, get_SelfTest_Results, NULL, BBFDM_CWMP, DM_FLAG_REFERENCE},
{0}
};