removed state path kludge

This commit is contained in:
Olof hagsand 2020-05-05 17:13:38 +02:00
parent bc0eb921d0
commit f9e1fe5de7
8 changed files with 24 additions and 70 deletions

View file

@ -28,6 +28,12 @@ Expected: May 2020
* NACM RFC8341 datanode read and write paths * NACM RFC8341 datanode read and write paths
* This completes the NACM RPC and Data node access checks (only remaining NACM access point is notification) * This completes the NACM RPC and Data node access checks (only remaining NACM access point is notification)
* Added functionality to restart an individual plugin.
* New clixon-lib:restart-plugin RPC
* Two new plugin callbacks added
* ca_daemon: Called just after a server has "daemonized", ie put in background.
* ca_trans_commit_done: Called when all plugin commits have been done.
* Note: If you have used "end" callback and usign transaction data, you should probably use this instead.
### API changes on existing protocol/config features (You may have have to change how you use Clixon) ### API changes on existing protocol/config features (You may have have to change how you use Clixon)
@ -50,8 +56,6 @@ Expected: May 2020
### Minor changes ### Minor changes
* Added functionality to restart an individual plugin.
* New clixon-lib:restart-plugin RPC
* Added option `CLICON_YANG_UNKNOWN_ANYDATA` to treat unknown XML (wrt YANG) as anydata. * Added option `CLICON_YANG_UNKNOWN_ANYDATA` to treat unknown XML (wrt YANG) as anydata.
* This is to be (very) forgiving but you need to accept eg unsynchronized YANG and XML * This is to be (very) forgiving but you need to accept eg unsynchronized YANG and XML
* Compile-time option: `USE_CLIGEN44` for running clixon-45 with cligen-44. * Compile-time option: `USE_CLIGEN44` for running clixon-45 with cligen-44.
@ -65,11 +69,6 @@ Expected: May 2020
* Cleared startup-db cache after restart * Cleared startup-db cache after restart
* Experimental optimzations of yang-bind and sort for large lists * Experimental optimzations of yang-bind and sort for large lists
* Enabled by compile-time options: `OPTIMIZE_45_BIND` and `OPTIMIZE_45_SORT` * Enabled by compile-time options: `OPTIMIZE_45_BIND` and `OPTIMIZE_45_SORT`
* Experimental: restart_plugin
* Two new plugin callbacks added
* ca_daemon: Called just after a server has "daemonized", ie put in background.
* ca_trans_commit_done: Called when all plugin commits have been done.
* Note: If you have used "end" callback and usign transaction data, you should probably use this instead.
* Adapted to CLIgen 4.5 API changes, eg: `cliread()` and `cliread_parse()` * Adapted to CLIgen 4.5 API changes, eg: `cliread()` and `cliread_parse()`
* Renamed utility function `clixon_util_insert()` to `clixon_util_xml_mod()` and added merge functionality. * Renamed utility function `clixon_util_insert()` to `clixon_util_xml_mod()` and added merge functionality.
* Sanity check of duplicates prefixes in Yang modules and submodules as defined in RFC 7950 Sec 7.1.4 * Sanity check of duplicates prefixes in Yang modules and submodules as defined in RFC 7950 Sec 7.1.4

View file

@ -248,20 +248,6 @@ clixon_plugin_statedata_all(clicon_handle h,
if (debug) if (debug)
clicon_log_xml(LOG_DEBUG, x, "%s STATE:", __FUNCTION__); clicon_log_xml(LOG_DEBUG, x, "%s STATE:", __FUNCTION__);
#endif #endif
#ifdef USE_STATE_PATH_KLUDGE
/* This kludge skips all yang binding and validation of paths beginning with a
* specific prefix
* Note that there are many problems with this kludge.
*/
{
char *kpath;
if (xpath &&
(kpath = clicon_option_str(h, "CLICON_STATE_PATH_KLUDGE")) != NULL &&
strncmp(xpath, kpath, strlen(kpath)) == 0){
}
else {
#endif /* USE_STATE_PATH_KLUDGE */
/* XXX: ret == 0 invalid yang binding should be handled as internal error */ /* XXX: ret == 0 invalid yang binding should be handled as internal error */
if (xml_bind_yang(x, YB_MODULE, yspec, NULL) < 0) if (xml_bind_yang(x, YB_MODULE, yspec, NULL) < 0)
goto done; goto done;
@ -269,10 +255,6 @@ clixon_plugin_statedata_all(clicon_handle h,
goto done; goto done;
if (xml_default_recurse(x) < 0) if (xml_default_recurse(x) < 0)
goto done; goto done;
#ifdef USE_STATE_PATH_KLUDGE
}
}
#endif
if ((ret = netconf_trymerge(x, yspec, xret)) < 0) if ((ret = netconf_trymerge(x, yspec, xret)) < 0)
goto done; goto done;
if (ret == 0) if (ret == 0)

View file

@ -630,7 +630,7 @@ show_conf_xpath(clicon_handle h,
namespace = cv_string_get(cv); namespace = cv_string_get(cv);
if ((nsc = xml_nsctx_init(NULL, namespace)) == NULL) if ((nsc = xml_nsctx_init(NULL, namespace)) == NULL)
goto done; goto done;
#if 0 /* Use state get intead of config (XXX: better use this but test_cli.sh fails) */ #if 0 /* Use state get instead of config (XXX: better use this but test_cli.sh fails) */
if (clicon_rpc_get(h, xpath, nsc, CONTENT_ALL, -1, &xt) < 0) if (clicon_rpc_get(h, xpath, nsc, CONTENT_ALL, -1, &xt) < 0)
goto done; goto done;
#else #else

View file

@ -126,12 +126,3 @@
*/ */
#undef USE_CLIGEN44 #undef USE_CLIGEN44
/*! Check runtime CLICON_STATE_PATH_KLUDGE option
* For get state commands, if the select xpath is equal (or its beginning)
* is equal to the path in this option, then yang binding, sorting, default
* values is skipped.
* This is a temporary option which will go away in future releases, therefore
* marked as obsolete.";
*/
#undef USE_STATE_PATH_KLUDGE

View file

@ -727,15 +727,6 @@ clicon_rpc_get(clicon_handle h,
} }
else{ else{
yspec = clicon_dbspec_yang(h); yspec = clicon_dbspec_yang(h);
#ifdef USE_STATE_PATH_KLUDGE
{
char *kpath;
if (xpath &&
(kpath = clicon_option_str(h, "CLICON_STATE_PATH_KLUDGE")) != NULL &&
strncmp(xpath, kpath, strlen(kpath)) == 0){
}
else{
#endif /* USE_STATE_PATH_KLUDGE */
if ((ret = xml_bind_yang(xd, YB_MODULE, yspec, &xerr)) < 0) if ((ret = xml_bind_yang(xd, YB_MODULE, yspec, &xerr)) < 0)
goto done; goto done;
if (ret == 0){ if (ret == 0){
@ -745,10 +736,6 @@ clicon_rpc_get(clicon_handle h,
goto done; goto done;
} }
} }
#ifdef USE_STATE_PATH_KLUDGE
}
}
#endif
} }
if (xt){ if (xt){
if (xml_rm(xd) < 0) if (xml_rm(xd) < 0)

View file

@ -1430,6 +1430,12 @@ xml_merge1(cxobj *x0, /* the target */
nsc = cvec_dup(nscache_get_all(x1)); nsc = cvec_dup(nscache_get_all(x1));
if (xml_rm(x1) < 0) if (xml_rm(x1) < 0)
goto done; goto done;
/* This is to make the anydata case a little more robust, more could be done */
if (xml_spec(x1) == NULL){
if (xml_addsub(x0p, x1) < 0)
goto done;
}
else
if (xml_insert(x0p, x1, INS_LAST, NULL, NULL) < 0) if (xml_insert(x0p, x1, INS_LAST, NULL, NULL) < 0)
goto done; goto done;
cv = NULL; cv = NULL;

View file

@ -118,7 +118,8 @@ wait_restconf
new "cli get large config" new "cli get large config"
# baseline on thinkpad i5-3320M CPU @ 2.60GHz and 500K entries: 39.71s # baseline on thinkpad i5-3320M CPU @ 2.60GHz and 500K entries: 39.71s
$TIMEFN $clixon_cli -1f $cfg show xpath /interfaces urn:example:clixon 2>&1 | awk '/real/ {print $2}' $TIMEFN $clixon_cli -1f $cfg show xpath /interfaces urn:example:clixon 2>&1 > /dev/null | awk '/real/ {print $2}'
# START actual tests # START actual tests
# Having a large db, get single entries many times # Having a large db, get single entries many times

View file

@ -727,17 +727,5 @@ module clixon-config {
data to store before dropping. 0 means no retention"; data to store before dropping. 0 means no retention";
} }
leaf CLICON_STATE_PATH_KLUDGE {
type string;
status obsolete;
description
"For get state commands, if the select xpath is equal (or its beginning)
is equal to the path in this option, then yang binding, sorting, default
values is skipped.
Note you need to set USE_STATE_PATH_KLUDGE compile option
This is a temporary option which will go away in future releases, therefore
marked as obsolete.";
}
} }
} }