From 703d1a2b089f25c24b58fe5883609580a08fe993 Mon Sep 17 00:00:00 2001 From: Olof hagsand Date: Fri, 1 May 2020 21:39:18 +0200 Subject: [PATCH] Added CLICON_STATE_PATH_KLUDGE --- apps/backend/backend_plugin.c | 19 +++++++++++++++++++ include/clixon_custom.h | 11 ++++++++++- test/test_perf_state_only.sh | 4 +++- yang/clixon/clixon-config@2020-02-22.yang | 12 ++++++++++++ 4 files changed, 44 insertions(+), 2 deletions(-) diff --git a/apps/backend/backend_plugin.c b/apps/backend/backend_plugin.c index 407cf192..1d361473 100644 --- a/apps/backend/backend_plugin.c +++ b/apps/backend/backend_plugin.c @@ -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) diff --git a/include/clixon_custom.h b/include/clixon_custom.h index cd9e5e1d..fde0bb04 100644 --- a/include/clixon_custom.h +++ b/include/clixon_custom.h @@ -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 + diff --git a/test/test_perf_state_only.sh b/test/test_perf_state_only.sh index 0de661d1..8752abaa 100755 --- a/test/test_perf_state_only.sh +++ b/test/test_perf_state_only.sh @@ -48,6 +48,8 @@ cat < $cfg 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 < $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; diff --git a/yang/clixon/clixon-config@2020-02-22.yang b/yang/clixon/clixon-config@2020-02-22.yang index 0281ec10..8cbfc43e 100644 --- a/yang/clixon/clixon-config@2020-02-22.yang +++ b/yang/clixon/clixon-config@2020-02-22.yang @@ -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."; + } + } }