Added CLICON_STATE_PATH_KLUDGE

This commit is contained in:
Olof hagsand 2020-05-01 21:39:18 +02:00
parent 442e96bdf0
commit 703d1a2b08
4 changed files with 44 additions and 2 deletions

View file

@ -248,6 +248,21 @@ clixon_plugin_statedata_all(clicon_handle h,
if (debug)
clicon_log_xml(LOG_DEBUG, x, "%s STATE:", __FUNCTION__);
#endif
#ifdef USE_STATE_PATH_KLUDGE
/* This kludge skips all yang binding and validation of paths begining 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){
if (strncmp(xpath, kpath, strlen(kpath)) == 0)
;
}
else {
#endif /* USE_STATE_PATH_KLUDGE */
/* XXX: ret == 0 invalid yang binding should be handled as internal error */
if (xml_bind_yang(x, YB_MODULE, yspec, NULL) < 0)
goto done;
@ -255,6 +270,10 @@ clixon_plugin_statedata_all(clicon_handle h,
goto done;
if (xml_default_recurse(x) < 0)
goto done;
#ifdef USE_STATE_PATH_KLUDGE
}
}
#endif
if ((ret = netconf_trymerge(x, yspec, xret)) < 0)
goto done;
if (ret == 0)

View file

@ -118,10 +118,19 @@
/*! Clixon 4.5 optimizing experiments for sorting yang-bound XML trees
* Primarily for large lists
*/
#undef OPTIMIZE_45_SORT
#define OPTIMIZE_45_SORT
/*! Use cligen 4.4 instead of master / cligen 4.5.pre
* Temporary fix
*/
#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.";
*/
#define USE_STATE_PATH_KLUDGE

View file

@ -48,6 +48,8 @@ cat <<EOF > $cfg
</clixon-config>
EOF
# Note, there is a commented default statement below. It may be useful, bit for a
# clean performance setup, adding default values may be a fringe case?
cat <<EOF > $fyang
module $APPNAME{
yang-version 1.1;
@ -71,7 +73,7 @@ module $APPNAME{
}
leaf enabled {
type boolean;
default true;
/* default true; */
}
leaf status {
type string;

View file

@ -719,5 +719,17 @@ module clixon-config {
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 to use this.
This is a temporary option which will go away in future releases, therefore
marked as obsolete.";
}
}
}