diff --git a/CHANGELOG.md b/CHANGELOG.md index a24ae9b2..24446d20 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,6 +28,12 @@ Expected: May 2020 * NACM RFC8341 datanode read and write paths * 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) @@ -50,8 +56,6 @@ Expected: May 2020 ### 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. * 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. @@ -65,11 +69,6 @@ Expected: May 2020 * Cleared startup-db cache after restart * Experimental optimzations of yang-bind and sort for large lists * 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()` * 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 diff --git a/apps/backend/backend_plugin.c b/apps/backend/backend_plugin.c index 6706b520..0e6eb281 100644 --- a/apps/backend/backend_plugin.c +++ b/apps/backend/backend_plugin.c @@ -248,20 +248,6 @@ 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 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 */ if (xml_bind_yang(x, YB_MODULE, yspec, NULL) < 0) goto done; @@ -269,10 +255,6 @@ 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/apps/cli/cli_show.c b/apps/cli/cli_show.c index 65867dc3..e8dbf71a 100644 --- a/apps/cli/cli_show.c +++ b/apps/cli/cli_show.c @@ -630,7 +630,7 @@ show_conf_xpath(clicon_handle h, namespace = cv_string_get(cv); if ((nsc = xml_nsctx_init(NULL, namespace)) == NULL) 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) goto done; #else diff --git a/include/clixon_custom.h b/include/clixon_custom.h index 40dbf36f..e49f8850 100644 --- a/include/clixon_custom.h +++ b/include/clixon_custom.h @@ -126,12 +126,3 @@ */ #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 - diff --git a/lib/src/clixon_proto_client.c b/lib/src/clixon_proto_client.c index 9b4f717d..6f154beb 100644 --- a/lib/src/clixon_proto_client.c +++ b/lib/src/clixon_proto_client.c @@ -727,28 +727,15 @@ clicon_rpc_get(clicon_handle h, } else{ 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) - goto done; - if (ret == 0){ - assert(xerr != NULL); - if ((xd = xpath_first(xerr, NULL, "rpc-error")) == NULL){ - clicon_err(OE_XML, ENOENT, "Expected rpc-error tag but none found(internal)"); - goto done; - } - } -#ifdef USE_STATE_PATH_KLUDGE + if ((ret = xml_bind_yang(xd, YB_MODULE, yspec, &xerr)) < 0) + goto done; + if (ret == 0){ + assert(xerr != NULL); + if ((xd = xpath_first(xerr, NULL, "rpc-error")) == NULL){ + clicon_err(OE_XML, ENOENT, "Expected rpc-error tag but none found(internal)"); + goto done; } } -#endif } if (xt){ if (xml_rm(xd) < 0) diff --git a/lib/src/clixon_xml_map.c b/lib/src/clixon_xml_map.c index af9f4afc..3f1428da 100644 --- a/lib/src/clixon_xml_map.c +++ b/lib/src/clixon_xml_map.c @@ -1430,8 +1430,14 @@ xml_merge1(cxobj *x0, /* the target */ nsc = cvec_dup(nscache_get_all(x1)); if (xml_rm(x1) < 0) goto done; - if (xml_insert(x0p, x1, INS_LAST, NULL, NULL) < 0) - 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) + goto done; cv = NULL; while ((cv = cvec_each(nsc, cv)) != NULL){ px = cv_name_get(cv); diff --git a/test/test_perf_state_only.sh b/test/test_perf_state_only.sh index 726b11b8..3335fdde 100755 --- a/test/test_perf_state_only.sh +++ b/test/test_perf_state_only.sh @@ -118,7 +118,8 @@ wait_restconf new "cli get large config" # 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 # Having a large db, get single entries many times diff --git a/yang/clixon/clixon-config@2020-02-22.yang b/yang/clixon/clixon-config@2020-02-22.yang index ee335010..22103e74 100644 --- a/yang/clixon/clixon-config@2020-02-22.yang +++ b/yang/clixon/clixon-config@2020-02-22.yang @@ -727,17 +727,5 @@ 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 - This is a temporary option which will go away in future releases, therefore - marked as obsolete."; - } - } }