* Performance improvement

* Added ancestor config cache indicating wether the node or an ancestor is config false or true
  * Improved yang cardinality lookup
* Added yang_init(), called from all apps using yang
This commit is contained in:
Olof hagsand 2021-11-18 08:37:54 +01:00
parent 0626de9431
commit b91ce762d5
19 changed files with 415 additions and 63 deletions

View file

@ -759,8 +759,8 @@ cli_auto_show(clicon_handle h,
cli_xml2cli(xc, prefix, gt, cligen_output); /* cli syntax */
break;
case FORMAT_NETCONF:
fprintf(stdout, "<rpc xmlns=\"%s\"><edit-config><target><candidate/></target><config>",
NETCONF_BASE_NAMESPACE);
fprintf(stdout, "<rpc xmlns=\"%s\" %s><edit-config><target><candidate/></target><config>",
NETCONF_BASE_NAMESPACE, NETCONF_MESSAGE_ID_ATTR);
if (pretty)
fprintf(stdout, "\n");
if (isroot)

View file

@ -801,7 +801,7 @@ load_config_file(clicon_handle h,
cxobj *xt = NULL;
cxobj *x;
cbuf *cbxml;
char *formatstr;
char *formatstr = NULL;
enum format_enum format = FORMAT_XML;
if (cvec_len(argv) < 2 || cvec_len(argv) > 4){
@ -908,6 +908,7 @@ save_config_file(clicon_handle h,
char *dbstr;
char *varstr;
cxobj *xt = NULL;
cxobj *x;
cxobj *xerr;
FILE *f = NULL;
enum genmodel_type gt;
@ -970,21 +971,25 @@ save_config_file(clicon_handle h,
goto done;
break;
case FORMAT_TEXT:
cli_xml2txt(xt, cligen_output, 0); /* tree-formed text */
if (xml2txt(f, xt, 0) < 0)
goto done;
break;
case FORMAT_CLI:
if ((gt = clicon_cli_genmodel_type(h)) == GT_ERR)
goto done;
if (xml2cli(f, xt, prefix, gt) < 0)
goto done;
x = NULL;
while ((x = xml_child_each(xt, x, CX_ELMNT)) != NULL) {
if (xml2cli(f, x, prefix, gt) < 0)
goto done;
}
break;
case FORMAT_NETCONF:
fprintf(f, "<rpc xmlns=\"%s\"><edit-config><target><candidate/></target><config>",
NETCONF_BASE_NAMESPACE);
fprintf(f, "<rpc xmlns=\"%s\" %s><edit-config><target><candidate/></target>",
NETCONF_BASE_NAMESPACE, NETCONF_MESSAGE_ID_ATTR);
fprintf(f, "\n");
if (clicon_xml2file(f, xt, 0, pretty) < 0)
goto done;
fprintf(f, "</config></edit-config></rpc>]]>]]>\n");
fprintf(f, "</edit-config></rpc>]]>]]>\n");
break;
} /* switch */
retval = 0;

View file

@ -483,8 +483,8 @@ main(int argc,
* Logs, error and debug to stderr or syslog, set debug level
*/
clicon_log_init(__PROGRAM__, dbg?LOG_DEBUG:LOG_INFO, logdst);
clicon_debug_init(dbg, NULL);
yang_init(h);
/* Find, read and parse configfile */
if (clicon_options_main(h) < 0){
@ -651,7 +651,7 @@ main(int argc,
if ((yspec = yspec_new()) == NULL)
goto done;
clicon_dbspec_yang_set(h, yspec);
/* Load Yang modules
* 1. Load a yang module as a specific absolute filename */
if ((str = clicon_yang_main_file(h)) != NULL){