* Yang Support of submodule, include and belongs-to.

* Improved unknown handling
* Configure option `CLICON_YANG_DIR` is changed from a single directory to a path of directories
    * Note CLIXON_DATADIR (=/usr/local/share/clixon) need to be in the list
This commit is contained in:
Olof hagsand 2018-12-01 18:17:42 +01:00
parent 56da97cb5b
commit 39a5086218
47 changed files with 977 additions and 469 deletions

View file

@ -178,8 +178,16 @@ parse_configfile(clicon_handle h,
__FUNCTION__, name, body);
continue;
}
/* hard-coded exceptions for configure options that are leaf-lists (not leaf)
* They must be accessed directly by looping over clicon_conf_xml(h)
*/
if (strcmp(name,"CLICON_FEATURE")==0)
continue;
if (strcmp(name,"CLICON_YANG_DIR")==0)
continue;
/* Used as an arg to this fn */
if (strcmp(name,"CLICON_CONFIGFILE")==0)
continue;
if (hash_add(copt,
name,
body,
@ -236,14 +244,25 @@ clicon_options_main(clicon_handle h,
clicon_err(OE_CFG, 0, "%s: suffix %s not recognized (Run ./configure --with-config-compat?)", configfile, suffix);
goto done;
}
/* Parse clixon yang spec */
if (yang_parse(h, NULL, "clixon-config", CLIXON_DATADIR, NULL, yspec, NULL) < 0)
goto done;
/* Read configfile */
/* Read configfile first without yangspec, for bootstrapping */
if (parse_configfile(h, configfile, yspec, &xconfig) < 0)
goto done;
if (xml_rootchild(xconfig, 0, &xconfig) < 0)
goto done;
/* Set clixon_conf pointer to handle */
clicon_conf_xml_set(h, xconfig);
/* Parse clixon yang spec */
if (yang_parse(h, NULL, "clixon-config", NULL, yspec, NULL) < 0)
goto done;
clicon_conf_xml_set(h, NULL);
if (xconfig)
xml_free(xconfig);
/* Read configfile second time now with check yang spec */
if (parse_configfile(h, configfile, yspec, &xconfig) < 0)
goto done;
if (xml_rootchild(xconfig, 0, &xconfig) < 0)
goto done;
/* Set clixon_conf pointer to handle */
clicon_conf_xml_set(h, xconfig);
/* Specific option handling */
if (clicon_option_bool(h, "CLICON_XML_SORT") == 1)
@ -638,7 +657,7 @@ clicon_conf_xml(clicon_handle h)
return NULL;
}
/*! Set YANG specification for Clixon system options and features
/*! Set YANG specification for Clixon system options and features
* ys must be a malloced pointer
*/
int