From 47708d34dfe91cc6ba7ab9a1f2d935fed1cf9394 Mon Sep 17 00:00:00 2001 From: Suvendhu Hansa Date: Fri, 4 Oct 2024 19:18:33 +0530 Subject: [PATCH] self-diagnostics: Align with VendorLogFiles update --- self-diagnostics/files/usr/sbin/self-diagnostics | 2 +- self-diagnostics/src/selftest.c | 16 +++++++++------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/self-diagnostics/files/usr/sbin/self-diagnostics b/self-diagnostics/files/usr/sbin/self-diagnostics index e52cc622e..ebd0f03c0 100755 --- a/self-diagnostics/files/usr/sbin/self-diagnostics +++ b/self-diagnostics/files/usr/sbin/self-diagnostics @@ -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="" diff --git a/self-diagnostics/src/selftest.c b/self-diagnostics/src/selftest.c index 5bd997d54..638ef938a 100644 --- a/self-diagnostics/src/selftest.c +++ b/self-diagnostics/src/selftest.c @@ -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} };