Fixed: [cl:creator attribute must be persistent](https://github.com/clicon/clixon-controller/issues/54)

This commit is contained in:
Olof hagsand 2023-11-03 14:06:41 +01:00
parent c703e89bc8
commit 2f88ef3ed6
5 changed files with 97 additions and 38 deletions

View file

@ -368,28 +368,27 @@ xml_diff1(cxobj *x0,
if (cxvec_append(x1c, x1vec, x1veclen) < 0)
goto done;
}
else
if (yc0 && yang_keyword_get(yc0) == Y_LEAF){
/* if x0c and x1c are leafs w bodies, then they may be changed */
b0 = xml_body(x0c);
b1 = xml_body(x1c);
if (b0 == NULL && b1 == NULL)
;
else if (b0 == NULL || b1 == NULL
|| strcmp(b0, b1) != 0
){
if (cxvec_append(x0c, changed_x0, changedlen) < 0)
goto done;
(*changedlen)--; /* append two vectors */
if (cxvec_append(x1c, changed_x1, changedlen) < 0)
goto done;
}
else if (yc0 && yang_keyword_get(yc0) == Y_LEAF){
/* if x0c and x1c are leafs w bodies, then they may be changed */
b0 = xml_body(x0c);
b1 = xml_body(x1c);
if (b0 == NULL && b1 == NULL)
;
else if (b0 == NULL || b1 == NULL
|| strcmp(b0, b1) != 0
){
if (cxvec_append(x0c, changed_x0, changedlen) < 0)
goto done;
(*changedlen)--; /* append two vectors */
if (cxvec_append(x1c, changed_x1, changedlen) < 0)
goto done;
}
else if (xml_diff1(x0c, x1c,
x0vec, x0veclen,
x1vec, x1veclen,
changed_x0, changed_x1, changedlen)< 0)
goto done;
}
else if (xml_diff1(x0c, x1c,
x0vec, x0veclen,
x1vec, x1veclen,
changed_x0, changed_x1, changedlen)< 0)
goto done;
}
x0c = xml_child_each(x0, x0c, CX_ELMNT);
x1c = xml_child_each(x1, x1c, CX_ELMNT);
@ -474,8 +473,8 @@ xml_tree_equal(cxobj *x0,
yang_stmt *yc1;
char *b0;
char *b1;
cxobj *x0c = NULL; /* x0 child */
cxobj *x1c = NULL; /* x1 child */
cxobj *x0c; /* x0 child */
cxobj *x1c; /* x1 child */
int extflag = 0;
/* Traverse x0 and x1 in lock-step */
@ -486,7 +485,7 @@ xml_tree_equal(cxobj *x0,
if (x0c == NULL && x1c == NULL)
goto ok;
else if (x0c == NULL){
/* If cl:gnore-compare extension, return equal */
/* If cl:ignore-compare extension, return equal */
if ((yc1 = xml_spec(x1c)) != NULL){
if (yang_extension_value(yc1, "ignore-compare", CLIXON_LIB_NS, &extflag, NULL) < 0)
goto done;
@ -511,16 +510,12 @@ xml_tree_equal(cxobj *x0,
goto ok;
}
/* Both x0c and x1c exists, check if they are yang-equal. */
eq = xml_cmp(x0c, x1c, 0, 0, NULL);
if (eq < 0){
goto done;
}
else if (eq > 0){
if ((eq = xml_cmp(x0c, x1c, 0, 0, NULL)) != 0){
goto done;
}
else{ /* equal */
/* xml-spec NULL could happen with anydata children for example,
* if so, continute compare children but without yang
* if so, continue compare children but without yang
*/
yc0 = xml_spec(x0c);
yc1 = xml_spec(x1c);