* Yang Configure options changed
* `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
* CLICON_YANG_MAIN_FILE Provides a filename with a single module filename.
* CLICON_YANG_MAIN_DIR Provides a directory where all yang modules should be loaded.
* Change all @datamodel:tree to @datamodel in all CLI specification files
* If you generate CLI code from the model (CLIXON_CLI_GENMODEL).
* For backward compatibility, define CLICON_CLI_MODEL_TREENAME_PATCH in clixon_custom.h
* Removed return value ymodp from yang parse functions (eg yang_parse()).
* New config option: CLICON_CLI_MODEL_TREENAME defining name of generated syntax tree if CLIXON_CLI_GENMODEL is set.
This commit is contained in:
parent
d09a8c08aa
commit
ac1aa44fc4
21 changed files with 309 additions and 140 deletions
|
|
@ -209,6 +209,30 @@ clixon_str2fn(char *name,
|
|||
return NULL;
|
||||
}
|
||||
|
||||
#ifdef CLICON_CLI_MODEL_TREENAME_PATCH
|
||||
/*! Patch all CLI spec calls to @datamodel:tree to @datamodel.
|
||||
* This is a backward compatible fix for 3.9 for CLIgen specification files
|
||||
* using model generation (CLIXON_CLI_GENMODEL).
|
||||
* All new references should use @datamodel (or CLICON_CLI_MODEL_TREENAME).
|
||||
* whereas older code used @datamodel:tree.
|
||||
*/
|
||||
static int
|
||||
mask_datamodel_fn(cg_obj *co,
|
||||
void *arg)
|
||||
{
|
||||
char *str = "datamodel:";
|
||||
int len = strlen(str);
|
||||
if (co->co_type == CO_REFERENCE){
|
||||
|
||||
if (strlen(co->co_command) > len &&
|
||||
strncmp(co->co_command, "datamodel:", len)==0){
|
||||
co->co_command[len-1] = '\0';
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
#endif /* CLICON_CLI_MODEL_TREENAME_PATCH */
|
||||
|
||||
/*! Append to syntax mode from file
|
||||
* @param[in] h Clixon handle
|
||||
* @param[in] filename Name of file where syntax is specified (in syntax-group dir)
|
||||
|
|
@ -253,7 +277,10 @@ cli_load_syntax(clicon_handle h,
|
|||
goto done;
|
||||
}
|
||||
fclose(f);
|
||||
|
||||
#ifdef CLICON_CLI_MODEL_TREENAME_PATCH
|
||||
if (pt_apply(pt, mask_datamodel_fn, h) < 0)
|
||||
goto done;
|
||||
#endif
|
||||
/* Get CLICON specific global variables */
|
||||
prompt = cvec_find_str(cvv, "CLICON_PROMPT");
|
||||
plgnam = cvec_find_str(cvv, "CLICON_PLUGIN");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue