Refactoring for better performance of large auto-cli specs
* Fixed: [very slow execution of load_set_file #288](https://github.com/clicon/clixon/issues/288) * New `clixon-lib@2021-11-11.yang` revision * Modified option: RPC stats extended with YANG stats * Modified `clixon-config@2021-11-11.yang` revision * Added option: * CLICON_PLUGIN_CALLBACK_CHECK * Enable to make plugin context check before and after all callbacks. * Added statistics for YANG: number of objects and memory used * Use the treeref no-copy option of CLIgen to reduce memory * Refactored cli-generation/autocli-start code * Refactored cligen glue functions to use cligen_eval directly (remove clicon_eval,clixon_cligen_eval)
This commit is contained in:
parent
b91ce762d5
commit
5388aace12
29 changed files with 760 additions and 451 deletions
|
|
@ -80,9 +80,9 @@
|
|||
static char *
|
||||
co2apipath(cg_obj *co)
|
||||
{
|
||||
struct cg_callback *cb;
|
||||
cvec *cvv;
|
||||
cg_var *cv;
|
||||
cg_callback *cb;
|
||||
cvec *cvv;
|
||||
cg_var *cv;
|
||||
|
||||
if (co == NULL)
|
||||
return NULL;
|
||||
|
|
@ -467,10 +467,19 @@ cli_auto_edit(clicon_handle h,
|
|||
clicon_err(OE_PLUGIN, 0, "No such parsetree header: %s", treename);
|
||||
goto done;
|
||||
}
|
||||
/* Find the matching cligen object */
|
||||
if ((co = cligen_co_match(cli_cligen(h))) != NULL &&
|
||||
(coorig = co->co_treeref_orig) != NULL)
|
||||
cligen_ph_workpoint_set(ph, coorig);
|
||||
/* Find the matching cligen object
|
||||
* Note, is complictead: either an instantiated tree (co_treeref_orig)
|
||||
* or actual tree (co_ref)
|
||||
*/
|
||||
if ((co = cligen_co_match(cli_cligen(h))) != NULL){
|
||||
if ((coorig = co->co_treeref_orig) != NULL ||
|
||||
(coorig = co->co_ref) != NULL)
|
||||
cligen_ph_workpoint_set(ph, coorig);
|
||||
else {
|
||||
clicon_err(OE_YANG, EINVAL, "No workpoint found");
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
else{
|
||||
clicon_err(OE_YANG, EINVAL, "No workpoint found");
|
||||
goto done;
|
||||
|
|
@ -500,7 +509,7 @@ cli_auto_edit(clicon_handle h,
|
|||
/*! CLI callback: Working point tree up to parent
|
||||
* @param[in] h CLICON handle
|
||||
* @param[in] cvv Vector of variables from CLIgen command-line
|
||||
* @param[in] argv Vector oif user-supplied keywords
|
||||
* @param[in] argv Vector of user-supplied keywords
|
||||
* Format of argv:
|
||||
* <treename> Name of generated cligen parse-tree, eg "datamodel"
|
||||
*/
|
||||
|
|
@ -991,7 +1000,7 @@ cli_auto_sub_enter(clicon_handle h,
|
|||
}
|
||||
/* Find the point in the generated clispec tree where workpoint should be set */
|
||||
fa.fa_str = api_path_fmt;
|
||||
if (pt_apply(cligen_ph_parsetree_get(ph), cli_auto_findpt, &fa) < 0)
|
||||
if (pt_apply(cligen_ph_parsetree_get(ph), cli_auto_findpt, INT32_MAX, &fa) < 0)
|
||||
goto done;
|
||||
if (fa.fa_co == NULL){
|
||||
clicon_err(OE_PLUGIN, ENOENT, "No such cligen object found %s", api_path);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue