Autocli optimization feature for generating smaller CLISPECs for large YANGs using treerefs

New `grouping-treeref` option added to clixon-autocli.yang
Default is disabled, set to true to generate smaller memory footprint of clixon_cl
Add prefix "mtpoint:" to cli api-paths to identify change of yang schemas
This commit is contained in:
Olof hagsand 2023-07-23 15:11:34 +02:00
parent d48442960e
commit f526d5b7a0
14 changed files with 668 additions and 64 deletions

View file

@ -384,6 +384,49 @@ autocli_completion(clicon_handle h,
return retval;
}
/*! Return autocli grouping treeref option
*
* When false replaces uses with grouping, when true use tree reference
* @param[in] h Clixon handle
* @param[out] treeref grouping using treerefs enabled
* @retval -1 Error
* @retval 0 OK
*/
int
autocli_grouping_treeref(clicon_handle h,
int *treeref)
{
int retval = -1;
char *str;
uint8_t val;
char *reason = NULL;
int ret;
cxobj *xautocli;
if (treeref == NULL){
clicon_err(OE_YANG, EINVAL, "Argument is NULL");
goto done;
}
if ((xautocli = clicon_conf_autocli(h)) == NULL){
clicon_err(OE_YANG, 0, "No clixon-autocli");
goto done;
}
if ((str = xml_find_body(xautocli, "grouping-treeref")) == NULL){
clicon_err(OE_XML, EINVAL, "No grouping-treeref rule");
goto done;
}
if ((ret = parse_bool(str, &val, &reason)) < 0){
clicon_err(OE_CFG, errno, "parse_bool");
goto done;
}
*treeref = val;
retval = 0;
done:
if (reason)
free(reason);
return retval;
}
/*! Return default autocli list keyword setting
*
* Currently only returns list-keyword-default, could be extended to rules