summaryrefslogtreecommitdiff
path: root/lib/yang.h
diff options
context:
space:
mode:
authorChristian Hopps <chopps@labn.net>2024-10-07 03:23:31 +0000
committerChristian Hopps <chopps@labn.net>2024-10-07 03:32:44 +0000
commite8648a0c72f89d4ee5abe271ba079df71c4c1418 (patch)
tree87f1a475ee1ae1157354da6eedfc576605b36aeb /lib/yang.h
parent28a614d17b1061456c387d59ff12296e0830989d (diff)
lib: add flag to have libyang load internal ietf-yang-library module
Mgmtd makes use of libyang's internal ietf-yang-library module to add support for said module to FRR management. Previously, mgmtd was loading this module explicitly; however, that required that libyang's `ietf-yang-library.yang` module definition file be co-located with FRR's yang files so that it (and ietf-datastore.yang) would be found when searched for by libyang using FRRs search path. This isn't always the case depending on how the user compiles and installs libyang so mgmtd was failing to run in some cases. Instead of doing it the above way we simply tell libyang to load it's internal version of ietf-yang-library when we initialize the libyang context. This required adding a boolean to a couple of the init functions which is why so many files are touched (although all the changes are minimal). Signed-off-by: Christian Hopps <chopps@labn.net>
Diffstat (limited to 'lib/yang.h')
-rw-r--r--lib/yang.h10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/yang.h b/lib/yang.h
index c4fc78b8ae..52857ecf00 100644
--- a/lib/yang.h
+++ b/lib/yang.h
@@ -607,9 +607,11 @@ extern struct yang_data *yang_data_list_find(const struct list *list,
* explicit_compile
* True if the caller will later call ly_ctx_compile to compile all loaded
* modules at once.
+ * load_library
+ * Set this to have libyang to load/implement the ietf-yang-library.
*/
-extern struct ly_ctx *yang_ctx_new_setup(bool embedded_modules,
- bool explicit_compile);
+extern struct ly_ctx *yang_ctx_new_setup(bool embedded_modules, bool explicit_compile,
+ bool load_library);
/*
* Enable or disable libyang verbose debugging.
@@ -727,8 +729,10 @@ extern const char *yang_print_errors(struct ly_ctx *ly_ctx, char *buf,
* Specify whether libyang should attempt to look for embedded YANG modules.
* defer_compile
* Hold off on compiling modules until yang_init_loading_complete is called.
+ * load_library
+ * Set this to have libyang to load/implement the ietf-yang-library.
*/
-extern void yang_init(bool embedded_modules, bool defer_compile);
+extern void yang_init(bool embedded_modules, bool defer_compile, bool load_library);
/*
* Should be called after yang_init and all yang_module_load()s have been done,