clixon-config@2024-01-01.yang: Changed semantics of CLICON_VALIDATE_STATE_XML

Minor optimizations
This commit is contained in:
Olof hagsand 2024-02-22 09:23:09 +01:00
parent a8773fad82
commit 278def125c
6 changed files with 24 additions and 11 deletions

View file

@ -13,7 +13,7 @@ Expected: February 2024
### Minor features
* Added us resolution to logs via stderr/stdout
* Added micro-second resolution to logs via stderr/stdout
* New command-line debug mechanism
* Separation between subject-area and details
* Multiple subject-areas
@ -25,6 +25,7 @@ Expected: February 2024
* All clixon applications added command-line option `-V` for printing version
* New ca_version callback for customized version output
* Optimization:
* Removed reply sanity if `CLICON_VALIDATE_STATE_XML` not set
* Improved performance of GET and PUT operations
* Optimized datastore access by ensuring REPORT_ALL in memory and EXPLICIT in file
* Added mountpoint cache as yang flag `YANG_FLAG_MTPOINT_POTENTIAL`
@ -41,6 +42,8 @@ Users may have to change how they access the system
* New `clixon-lib@2024-01-01.yang` revision
* Replaced container creators to grouping/uses
* New `clixon-config@2024-01-01.yang` revision
* Changed semantics:
* `CLICON_VALIDATE_STATE_XML` - disable return sanity checks if false
* Marked as obsolete:
* `CLICON_DATASTORE_CACHE` Replaced with enhanced datastore read API
* `CLICON_NETCONF_CREATOR_ATTR` reverting 6.5 functionality

View file

@ -884,8 +884,8 @@ get_common(clixon_handle h,
/* Read configuration */
switch (content){
case CONTENT_CONFIG: /* config data only */
/* specific xpath */
if (xmldb_get0(h, db, YB_MODULE, nsc, xpath?xpath:"/", 1, wdef, &xret, NULL, NULL) < 0) {
/* specific xpath. with-default gets masked in get_nacm_and_reply */
if (xmldb_get0(h, db, YB_MODULE, nsc, xpath?xpath:"/", 1, WITHDEFAULTS_REPORT_ALL, &xret, NULL, NULL) < 0) {
if ((cbmsg = cbuf_new()) == NULL){
clixon_err(OE_UNIX, errno, "cbuf_new");
goto done;
@ -900,7 +900,7 @@ get_common(clixon_handle h,
case CONTENT_NONCONFIG: /* state data only */
if (clicon_option_bool(h, "CLICON_VALIDATE_STATE_XML")){
/* Whole config tree, for validate debug */
if (xmldb_get0(h, "running", YB_MODULE, nsc, NULL, 1, wdef, &xret, NULL, NULL) < 0) {
if (xmldb_get0(h, "running", YB_MODULE, nsc, NULL, 1, WITHDEFAULTS_REPORT_ALL, &xret, NULL, NULL) < 0) {
if ((cbmsg = cbuf_new()) == NULL){
clixon_err(OE_UNIX, errno, "cbuf_new");
goto done;
@ -913,7 +913,7 @@ get_common(clixon_handle h,
}
else if (content == CONTENT_ALL){
/* specific xpath */
if (xmldb_get0(h, db, YB_MODULE, nsc, xpath?xpath:"/", 1, wdef, &xret, NULL, NULL) < 0) {
if (xmldb_get0(h, db, YB_MODULE, nsc, xpath?xpath:"/", 1, WITHDEFAULTS_REPORT_ALL, &xret, NULL, NULL) < 0) {
if ((cbmsg = cbuf_new()) == NULL){
clixon_err(OE_UNIX, errno, "cbuf_new");
goto done;

View file

@ -254,7 +254,7 @@ flogtime(FILE *f)
gettimeofday(&tv, NULL);
localtime_r((time_t*)&tv.tv_sec, &tm);
fprintf(f, "%s %2d %02d:%02d:%02d.%06d: ",
fprintf(f, "%s %2d %02d:%02d:%02d.%06ld: ",
mon2name(tm.tm_mon), tm.tm_mday,
tm.tm_hour, tm.tm_min, tm.tm_sec,
tv.tv_usec);

View file

@ -1292,7 +1292,9 @@ rpc_callback_call(clixon_handle h,
rc = NEXTQ(rpc_callback_t *, rc);
} while (rc != ms->ms_rpc_callbacks);
/* action reply checked in action_callback_call */
if (nr && !xml_rpc_isaction(xe)){
if (nr &&
clicon_option_bool(h, "CLICON_VALIDATE_STATE_XML") &&
!xml_rpc_isaction(xe)){
if ((ret = rpc_reply_check(h, name, cbret)) < 0)
goto done;
if (ret == 0)

View file

@ -3538,14 +3538,18 @@ int
yang_config_ancestor(yang_stmt *ys)
{
yang_stmt *yp;
enum rfc_6020 keyw;
yp = ys;
do {
if (yang_flag_get(yp, YANG_FLAG_STATE_LOCAL) != 0)
return 0;
else if (yang_keyword_get(yp) == Y_INPUT || yang_keyword_get(yp) == Y_OUTPUT || yang_keyword_get(yp) == Y_NOTIFICATION){
else {
keyw = yang_keyword_get(yp);
if (keyw == Y_INPUT || keyw == Y_OUTPUT || keyw == Y_NOTIFICATION){
return 0;
}
}
} while((yp = yang_parent_get(yp)) != NULL);
return 1;
}

View file

@ -51,9 +51,12 @@ module clixon-config {
revision 2024-01-01 {
description
"Makred as obsolete:
"Changed semantics:
CLICON_VALIDATE_STATE_XML - disable return sanity checks if false
Marked as obsolete:
CLICON_DATASTORE_CACHE
CLICON_NETCONF_CREATOR_ATTR
Changed semantics of
Released in Clixon 6.6";
}
revision 2023-11-01 {
@ -1013,6 +1016,7 @@ module clixon-config {
default false;
description
"Validate user state callback content.
AND NETCONF reply sanity (misnomer)
Users may register state callbacks using ca_statedata callback
When set, the XML returned from the callback is validated after merging with
the running db. If it fails, an internal error is returned to the originating