New clixon-lib@2023-11-01.yang revision with ignore-compare extension
This commit is contained in:
parent
62348fc9c7
commit
e7313fc9a2
10 changed files with 121 additions and 35 deletions
|
|
@ -476,6 +476,7 @@ xml_tree_equal(cxobj *x0,
|
|||
char *b1;
|
||||
cxobj *x0c = NULL; /* x0 child */
|
||||
cxobj *x1c = NULL; /* x1 child */
|
||||
int extflag = 0;
|
||||
|
||||
/* Traverse x0 and x1 in lock-step */
|
||||
x0c = x1c = NULL;
|
||||
|
|
@ -485,11 +486,30 @@ xml_tree_equal(cxobj *x0,
|
|||
if (x0c == NULL && x1c == NULL)
|
||||
goto ok;
|
||||
else if (x0c == NULL){
|
||||
/* If cl:gnore-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;
|
||||
if (extflag)
|
||||
goto ok;
|
||||
}
|
||||
goto done;
|
||||
}
|
||||
else if (x1c == NULL){
|
||||
if ((yc0 = xml_spec(x0c)) != NULL){
|
||||
if (yang_extension_value(yc0, "ignore-compare", CLIXON_LIB_NS, &extflag, NULL) < 0)
|
||||
goto done;
|
||||
if (extflag)
|
||||
goto ok;
|
||||
}
|
||||
goto done;
|
||||
}
|
||||
if ((yc0 = xml_spec(x0c)) != NULL){
|
||||
if (yang_extension_value(yc0, "ignore-compare", CLIXON_LIB_NS, &extflag, NULL) < 0)
|
||||
goto done;
|
||||
if (extflag)
|
||||
goto ok;
|
||||
}
|
||||
/* Both x0c and x1c exists, check if they are yang-equal. */
|
||||
eq = xml_cmp(x0c, x1c, 0, 0, NULL);
|
||||
if (eq < 0){
|
||||
|
|
|
|||
|
|
@ -3798,7 +3798,7 @@ yang_anydata_add(yang_stmt *yp,
|
|||
* @param[in] name Name of the extension
|
||||
* @param[in] ns The namespace of the module where the extension is defined
|
||||
* @param[out] exist The extension exists.
|
||||
* @param[out] value clispec operator (hide/none) - direct pointer into yang, dont free
|
||||
* @param[out] value Extension value if any
|
||||
* @retval 0 OK: Look in exist and value for return value
|
||||
* @retval -1 Error
|
||||
* This is for extensions with an argument
|
||||
|
|
|
|||
|
|
@ -838,7 +838,7 @@ yang_metadata_init(clicon_handle h)
|
|||
* This function is used where a yang-lib module-set is available to populate
|
||||
* an XML mount-point.
|
||||
* @param[in] h Clixon handle
|
||||
* @param[in] yanglib XML tree on the form <yang-lib>...
|
||||
* @param[in] xyanglib XML tree on the form <yang-lib>...
|
||||
* @param[in] yspec Will be populated with YANGs, is consumed
|
||||
* @retval 1 OK
|
||||
* @retval 0 Parse error
|
||||
|
|
@ -848,7 +848,7 @@ yang_metadata_init(clicon_handle h)
|
|||
*/
|
||||
int
|
||||
yang_lib2yspec(clicon_handle h,
|
||||
cxobj *yanglib,
|
||||
cxobj *xyanglib,
|
||||
yang_stmt *yspec)
|
||||
{
|
||||
int retval = -1;
|
||||
|
|
@ -863,7 +863,7 @@ yang_lib2yspec(clicon_handle h,
|
|||
yang_stmt *yrev;
|
||||
int modmin = 0;
|
||||
|
||||
if (xpath_vec(yanglib, nsc, "module-set/module", &vec, &veclen) < 0)
|
||||
if (xpath_vec(xyanglib, nsc, "module-set/module", &vec, &veclen) < 0)
|
||||
goto done;
|
||||
for (i=0; i<veclen; i++){
|
||||
xi = vec[i];
|
||||
|
|
|
|||
|
|
@ -1129,9 +1129,9 @@ yang_parse_module(clicon_handle h,
|
|||
if (revision)
|
||||
cprintf(cb, "@%s", revision);
|
||||
if (origname)
|
||||
clicon_err(OE_YANG, ENOENT, "No yang files found matching \"%s\" in the list of CLICON_YANG_DIRs when loading %s.yang", cbuf_get(cb), origname);
|
||||
clicon_err(OE_YANG, ENOENT, "Yang \"%s\" not found in the list of CLICON_YANG_DIRs when loading %s.yang", cbuf_get(cb), origname);
|
||||
else
|
||||
clicon_err(OE_YANG, ENOENT, "No yang files found matching \"%s\" in the list of CLICON_YANG_DIRs", cbuf_get(cb));
|
||||
clicon_err(OE_YANG, ENOENT, "Yang \"%s\" not found in the list of CLICON_YANG_DIRs", cbuf_get(cb));
|
||||
goto done;
|
||||
}
|
||||
filename = cbuf_get(fbuf);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue