From 911594ead1b11ed3a8fe1b3063c0025aadb4dd01 Mon Sep 17 00:00:00 2001 From: Olof hagsand Date: Thu, 29 Aug 2024 17:52:53 +0200 Subject: [PATCH] Fixed show mem total yang output Fixed log message for mount error --- apps/cli/cli_show.c | 4 ++-- lib/clixon/clixon_yang_module.h | 2 +- lib/src/clixon_yang_module.c | 4 +++- lib/src/clixon_yang_schema_mount.c | 2 +- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/apps/cli/cli_show.c b/apps/cli/cli_show.c index cb732001..e47de917 100644 --- a/apps/cli/cli_show.c +++ b/apps/cli/cli_show.c @@ -550,7 +550,7 @@ expand_yang_list(void *h, * @param[in] argv * @retval 0 OK * @retval -1 Error -*/ + */ int show_yang(clixon_handle h, cvec *cvv, @@ -2008,7 +2008,7 @@ cli_show_statistics(clixon_handle h, cligen_output(stdout, "YANG-total-nr: %" PRIu64 "\n", sz); } else { - translatenumber(sz, &u64, &unit); + translatenumber(tsz, &u64, &unit); cligen_output(stdout, "%-25s %" PRIu64 "%-10s\n", "YANG Total", u64, unit); } tnr0 = tnr; diff --git a/lib/clixon/clixon_yang_module.h b/lib/clixon/clixon_yang_module.h index f8fd069f..c2edf278 100644 --- a/lib/clixon/clixon_yang_module.h +++ b/lib/clixon/clixon_yang_module.h @@ -79,6 +79,6 @@ yang_stmt *yang_find_module_by_name_revision(yang_stmt *yspec, const char *name, yang_stmt *yang_find_module_by_name(yang_stmt *yspec, char *name); int yang_metadata_annotation_check(cxobj *x, yang_stmt *ymod, int *ismeta); int yang_metadata_init(clixon_handle h); -int yang_lib2yspec(clixon_handle h, cxobj *yanglib, yang_stmt *yspec); +int yang_lib2yspec(clixon_handle h, cxobj *yanglib, char *mntpnt, yang_stmt *yspec); #endif /* _CLIXON_YANG_MODULE_H_ */ diff --git a/lib/src/clixon_yang_module.c b/lib/src/clixon_yang_module.c index 83718a43..c9c35cd1 100644 --- a/lib/src/clixon_yang_module.c +++ b/lib/src/clixon_yang_module.c @@ -852,6 +852,7 @@ yang_metadata_init(clixon_handle h) * an XML mount-point. * @param[in] h Clixon handle * @param[in] xyanglib XML tree on the form ... + * @param[in] mntpnt Name of mount-point for logs * @param[in] yspec Will be populated with YANGs, is consumed * @retval 1 OK * @retval 0 Parse error @@ -862,6 +863,7 @@ yang_metadata_init(clixon_handle h) int yang_lib2yspec(clixon_handle h, cxobj *xyanglib, + char *mntpnt, yang_stmt *yspec) { int retval = -1; @@ -907,7 +909,7 @@ yang_lib2yspec(clixon_handle h, (ymod = yang_find(yspec, Y_MODULE, name)) != NULL && (ns2 = yang_find_mynamespace(ymod)) != NULL && strcmp(ns, ns2) != 0) { - clixon_log(h, LOG_WARNING, "Module:%s namespace mismatch %s vs %s", name, ns, ns2); + clixon_log(h, LOG_WARNING, "Mount:%s module %s namespace mismatch %s announced vs %s in loaded module", mntpnt, name, ns, ns2); } } #ifdef YANG_SCHEMA_MOUNT_YANG_LIB_FORCE diff --git a/lib/src/clixon_yang_schema_mount.c b/lib/src/clixon_yang_schema_mount.c index f1065739..fc2d94c3 100644 --- a/lib/src/clixon_yang_schema_mount.c +++ b/lib/src/clixon_yang_schema_mount.c @@ -936,7 +936,7 @@ yang_schema_yanglib_parse_mount(clixon_handle h, if ((yspec = yspec_new(h, xpath)) == NULL) goto done; clixon_debug(CLIXON_DBG_YANG, "new yang-spec: %p", yspec); - if ((ret = yang_lib2yspec(h, xyanglib, yspec)) < 0) + if ((ret = yang_lib2yspec(h, xyanglib, xpath, yspec)) < 0) goto done; if (ret == 0) goto anydata;