summaryrefslogtreecommitdiff
path: root/lib/yang.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/yang.c')
-rw-r--r--lib/yang.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/lib/yang.c b/lib/yang.c
index 93e6db3055..c80bf20306 100644
--- a/lib/yang.c
+++ b/lib/yang.c
@@ -72,13 +72,17 @@ static const char *yang_module_imp_clb(const char *mod_name,
return NULL;
}
+/* clang-format off */
static const char *const frr_native_modules[] = {
"frr-interface",
+ "frr-vrf",
"frr-ripd",
"frr-ripngd",
"frr-isisd",
"frr-vrrpd",
+ "frr-zebra",
};
+/* clang-format on */
/* Generate the yang_modules tree. */
static inline int yang_module_compare(const struct yang_module *a,
@@ -628,7 +632,7 @@ void yang_debugging_set(bool enable)
}
}
-struct ly_ctx *yang_ctx_new_setup(void)
+struct ly_ctx *yang_ctx_new_setup(bool embedded_modules)
{
struct ly_ctx *ctx;
const char *yang_models_path = YANG_MODELS_PATH;
@@ -647,18 +651,21 @@ struct ly_ctx *yang_ctx_new_setup(void)
ctx = ly_ctx_new(yang_models_path, LY_CTX_DISABLE_SEARCHDIR_CWD);
if (!ctx)
return NULL;
- ly_ctx_set_module_imp_clb(ctx, yang_module_imp_clb, NULL);
+
+ if (embedded_modules)
+ ly_ctx_set_module_imp_clb(ctx, yang_module_imp_clb, NULL);
+
return ctx;
}
-void yang_init(void)
+void yang_init(bool embedded_modules)
{
/* Initialize libyang global parameters that affect all containers. */
ly_set_log_clb(ly_log_cb, 1);
ly_log_options(LY_LOLOG | LY_LOSTORE);
/* Initialize libyang container for native models. */
- ly_native_ctx = yang_ctx_new_setup();
+ ly_native_ctx = yang_ctx_new_setup(embedded_modules);
if (!ly_native_ctx) {
flog_err(EC_LIB_LIBYANG, "%s: ly_ctx_new() failed", __func__);
exit(1);