Added "canonical" global namespace context: nsctx_global

This commit is contained in:
Olof hagsand 2019-11-15 17:04:13 +01:00
parent 06c2793e79
commit 52629d7b35
11 changed files with 149 additions and 14 deletions

View file

@ -163,6 +163,7 @@ static int
cli_terminate(clicon_handle h)
{
yang_stmt *yspec;
cvec *nsctx;
cxobj *x;
clicon_rpc_close_session(h);
@ -170,6 +171,8 @@ cli_terminate(clicon_handle h)
yspec_free(yspec);
if ((yspec = clicon_config_yang(h)) != NULL)
yspec_free(yspec);
if ((nsctx = clicon_nsctx_global_get(h)) != NULL)
cvec_free(nsctx);
if ((x = clicon_conf_xml(h)) != NULL)
xml_free(x);
cli_plugin_finish(h);
@ -286,6 +289,7 @@ main(int argc, char **argv)
int tabmode;
char *dir;
uint32_t id = 0;
cvec *nsctx_global = NULL; /* Global namespace context */
/* Defaults */
once = 0;
@ -513,6 +517,14 @@ main(int argc, char **argv)
if (netconf_module_load(h) < 0)
goto done;
/* Here all modules are loaded
* Compute and set canonical namespace context
*/
if (xml_nsctx_yangspec(yspec, &nsctx_global) < 0)
goto done;
if (clicon_nsctx_global_set(h, nsctx_global) < 0)
goto done;
/* Create tree generated from dataspec. If no other trees exists, this is
* the only one.
* The following code creates the tree @datamodel