* RESTCONF configuration is unified and moved from clixon-config.yang to clixon-restconf.yang

* Except `CLICON_RESTCONF_DIR` which remains in clixon-config.yang due to bootstrapping
    * -d <dir> option removed
  * This applies to both evhtp and fcgi RESTCONF
    * Both can also read config from backend, and be started from backend
  * You may need to move config as follows (from clixon-config.yang to clixon-restconf.yang)
    * CLICON_RESTCONF_PRETTY -> restconf/pretty
    * CLICON_RESTCONF_PATH -> restconf/fcgi-path
This commit is contained in:
Olof hagsand 2021-02-11 13:46:34 +01:00
parent 72dd31395e
commit c64878fd4a
58 changed files with 293 additions and 199 deletions

View file

@ -461,6 +461,24 @@ clicon_conf_xml_set(clicon_handle h,
return 0;
}
/*! Get local YANG specification for Clixon-restconf.yang tree
*
* That is, get the XML of clixon-config/restconf container of clixon-config.yang
* @param[in] h Clicon handle
* @retval x XML tree containing restconf xml node frm clixon-restconf.yang
* @note The clixon-restconf.yang instance can also be a part of the running datastore if
* CLICON_BACKEND_RESTCONF_PROCESS is true
*/
cxobj *
clicon_conf_restconf(clicon_handle h)
{
cxobj *xconfig = NULL;
if ((xconfig = clicon_conf_xml(h)) != NULL) /* Get local config */
return xpath_first(xconfig, NULL, "restconf");
return NULL;
}
/*! Get authorized user name
* @param[in] h Clicon handle
* @retval username

View file

@ -519,6 +519,19 @@ clicon_options_main(clicon_handle h)
clicon_conf_xml_set(h, xconfig);
#if defined(WITH_RESTCONF) && WITH_RESTCONF == fcgi
/* Enable fcgi feature
* Due to boot-strapping in first load of clixon config, a feature cannot be added
* programmatically after config file load
* It could be added to all clixon config files but since it is a compile time option
* this is a way to not be so intrusive
* If fcgi option gets secondary this should probably be changed
*/
if (clixon_xml_parse_string("<CLICON_FEATURE>clixon-restconf:fcgi</CLICON_FEATURE>",
YB_PARENT, NULL, &xconfig, NULL) < 0)
goto done;
#endif
/* Parse clixon yang spec */
if (yang_spec_parse_module(h, "clixon-config", NULL, yspec) < 0)
goto done;

View file

@ -1964,6 +1964,7 @@ if_feature(yang_stmt *yspec,
*
* @param[in] h Clicon handle
* @param[in] ys Feature yang statement to populate.
* Bootstrapping: A feature is enabled if found in clixon-config
*/
static int
ys_populate_feature(clicon_handle h,
@ -1980,7 +1981,9 @@ ys_populate_feature(clicon_handle h,
char *m;
char *f;
/* get clicon config file in xml form */
/* get clicon config file in xml form.
* Bootstrapping: A feature is enabled if found in clixon-config
*/
if ((x = clicon_conf_xml(h)) == NULL)
goto ok;
if ((ymod = ys_module(ys)) == NULL){