diff options
| author | vdhingra <vdhingra@vmware.com> | 2020-06-05 00:10:41 -0700 |
|---|---|---|
| committer | vdhingra <vdhingra@vmware.com> | 2020-07-28 00:39:32 -0700 |
| commit | 65de8bc8d0d949f0ea12a84dba9b7963ac1a74f6 (patch) | |
| tree | 642a47a7b0531d130ab31bcf4427d25feaa47cd6 /lib/yang.c | |
| parent | 5677e93f8f577e5a40f3143a08b4dc6712005348 (diff) | |
lib: Add support to load submodules in embedded modules framework
BGP Yang is using sub modules and at present FRR is not processing
submodules in embedded framework yang
Signed-off-by: VishalDhingra <vdhingra@vmware.com>
Diffstat (limited to 'lib/yang.c')
| -rw-r--r-- | lib/yang.c | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/lib/yang.c b/lib/yang.c index 0714ddf7bb..bd749d1f3d 100644 --- a/lib/yang.c +++ b/lib/yang.c @@ -53,22 +53,30 @@ static const char *yang_module_imp_clb(const char *mod_name, { struct yang_module_embed *e; - if (submod_name || submod_rev) - return NULL; - for (e = embeds; e; e = e->next) { - if (strcmp(e->mod_name, mod_name)) - continue; - if (mod_rev && strcmp(e->mod_rev, mod_rev)) - continue; + if (e->sub_mod_name && submod_name) { + if (strcmp(e->sub_mod_name, submod_name)) + continue; + + if (submod_rev && strcmp(e->sub_mod_rev, submod_rev)) + continue; + } else { + if (strcmp(e->mod_name, mod_name)) + continue; + + if (mod_rev && strcmp(e->mod_rev, mod_rev)) + continue; + } *format = e->format; return e->data; } - flog_warn(EC_LIB_YANG_MODULE_LOAD, - "YANG model \"%s@%s\" not embedded, trying external file", - mod_name, mod_rev ? mod_rev : "*"); + flog_warn( + EC_LIB_YANG_MODULE_LOAD, + "YANG model \"%s@%s\" \"%s@%s\"not embedded, trying external file", + mod_name, mod_rev ? mod_rev : "*", + submod_name ? submod_name : "*", submod_rev ? submod_rev : "*"); return NULL; } |
