clixon_util_path did not sort XML properly
This commit is contained in:
parent
a674af6f2c
commit
5831c053fa
6 changed files with 24 additions and 10 deletions
|
|
@ -12,6 +12,11 @@ The directory contains the following files:
|
||||||
start.sh Start containers
|
start.sh Start containers
|
||||||
startsystem.sh Internal start script copied to inside the container (dont run from shell)
|
startsystem.sh Internal start script copied to inside the container (dont run from shell)
|
||||||
|
|
||||||
|
How to run the tests:
|
||||||
|
```
|
||||||
|
$ make test
|
||||||
|
```
|
||||||
|
|
||||||
How to build and start the container (called clixon-system):
|
How to build and start the container (called clixon-system):
|
||||||
```
|
```
|
||||||
$ make docker
|
$ make docker
|
||||||
|
|
@ -60,4 +65,4 @@ You trigger the test scripts inside the container using `make test`.
|
||||||
If you want to edit clixon code so it runs in the container?
|
If you want to edit clixon code so it runs in the container?
|
||||||
You either
|
You either
|
||||||
(1) "persistent": make your changes in the actual clixon code and commit; make clean to remove the local clone; make test again
|
(1) "persistent": make your changes in the actual clixon code and commit; make clean to remove the local clone; make test again
|
||||||
(2) "volatile" edit the local clone; make test.
|
(2) "volatile" edit the local clone, (in the subdir); `make test`.
|
||||||
|
|
|
||||||
|
|
@ -696,8 +696,8 @@ clixon_trim(char *str)
|
||||||
* @param[in] s1 String 1
|
* @param[in] s1 String 1
|
||||||
* @param[in] s2 String 2
|
* @param[in] s2 String 2
|
||||||
* @retval 0 Equal
|
* @retval 0 Equal
|
||||||
* @retval -1 Not equal
|
* @retval <0 s1 is less than s2
|
||||||
* @retval 1 Not equal
|
* @retval >0 s1 is greater than s2
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
clicon_strcmp(char *s1,
|
clicon_strcmp(char *s1,
|
||||||
|
|
|
||||||
|
|
@ -972,7 +972,9 @@ xml_spec_populate(cxobj *x,
|
||||||
if (xml2ns(x, xml_prefix(x), &ns) < 0)
|
if (xml2ns(x, xml_prefix(x), &ns) < 0)
|
||||||
goto done;
|
goto done;
|
||||||
if (xp && (yparent = xml_spec(xp)) != NULL){
|
if (xp && (yparent = xml_spec(xp)) != NULL){
|
||||||
|
#ifdef DEBUG
|
||||||
clicon_debug(1, "%s yang parent:%s", __FUNCTION__, yang_argument_get(yparent));
|
clicon_debug(1, "%s yang parent:%s", __FUNCTION__, yang_argument_get(yparent));
|
||||||
|
#endif
|
||||||
y = yang_find_datanode(yparent, name);
|
y = yang_find_datanode(yparent, name);
|
||||||
}
|
}
|
||||||
else if (yspec){ /* XXX this gives false positives */
|
else if (yspec){ /* XXX this gives false positives */
|
||||||
|
|
|
||||||
|
|
@ -219,14 +219,9 @@ main(int argc,
|
||||||
/* Populate */
|
/* Populate */
|
||||||
if (xml_apply0(x1, CX_ELMNT, xml_spec_populate, yspec) < 0)
|
if (xml_apply0(x1, CX_ELMNT, xml_spec_populate, yspec) < 0)
|
||||||
goto done;
|
goto done;
|
||||||
/* Sort */
|
|
||||||
if (xml_apply0(x1, CX_ELMNT, xml_sort, h) < 0)
|
|
||||||
goto done;
|
|
||||||
/* Add default values */
|
/* Add default values */
|
||||||
if (xml_apply(x1, CX_ELMNT, xml_default, h) < 0)
|
if (xml_apply(x1, CX_ELMNT, xml_default, h) < 0)
|
||||||
goto done;
|
goto done;
|
||||||
if (xml_apply0(x1, -1, xml_sort_verify, h) < 0)
|
|
||||||
clicon_log(LOG_NOTICE, "%s: sort verify failed", __FUNCTION__);
|
|
||||||
if ((ret = xml_yang_validate_all_top(h, x1, &xerr)) < 0)
|
if ((ret = xml_yang_validate_all_top(h, x1, &xerr)) < 0)
|
||||||
goto done;
|
goto done;
|
||||||
if (ret > 0 && (ret = xml_yang_validate_add(h, x1, &xerr)) < 0)
|
if (ret > 0 && (ret = xml_yang_validate_add(h, x1, &xerr)) < 0)
|
||||||
|
|
@ -242,6 +237,10 @@ main(int argc,
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (xml_apply0(x, CX_ELMNT, xml_sort, h) < 0)
|
||||||
|
goto done;
|
||||||
|
if (xml_apply0(x, -1, xml_sort_verify, h) < 0)
|
||||||
|
clicon_log(LOG_NOTICE, "%s: sort verify failed", __FUNCTION__);
|
||||||
}
|
}
|
||||||
if (api_path_p){
|
if (api_path_p){
|
||||||
if ((ret = clixon_xml_find_api_path(x, yspec, &xvec, &xlen, "%s", path)) < 0)
|
if ((ret = clixon_xml_find_api_path(x, yspec, &xvec, &xlen, "%s", path)) < 0)
|
||||||
|
|
@ -264,6 +263,8 @@ main(int argc,
|
||||||
}
|
}
|
||||||
retval = 0;
|
retval = 0;
|
||||||
done:
|
done:
|
||||||
|
if (yspec != NULL)
|
||||||
|
yspec_free(yspec);
|
||||||
if (cb)
|
if (cb)
|
||||||
cbuf_free(cb);
|
cbuf_free(cb);
|
||||||
if (xvec)
|
if (xvec)
|
||||||
|
|
@ -272,7 +273,11 @@ main(int argc,
|
||||||
free(buf);
|
free(buf);
|
||||||
if (x)
|
if (x)
|
||||||
xml_free(x);
|
xml_free(x);
|
||||||
|
if (xcfg)
|
||||||
|
xml_free(xcfg);
|
||||||
if (fd > 0)
|
if (fd > 0)
|
||||||
close(fd);
|
close(fd);
|
||||||
|
if (h)
|
||||||
|
clicon_handle_exit(h);
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -120,8 +120,6 @@ main(int argc,
|
||||||
goto done;
|
goto done;
|
||||||
if (clicon_conf_xml_set(h, xcfg) < 0)
|
if (clicon_conf_xml_set(h, xcfg) < 0)
|
||||||
goto done;
|
goto done;
|
||||||
|
|
||||||
|
|
||||||
xcfg = xml_new("clixon-config", NULL, NULL);
|
xcfg = xml_new("clixon-config", NULL, NULL);
|
||||||
clicon_conf_xml_set(h, xcfg);
|
clicon_conf_xml_set(h, xcfg);
|
||||||
optind = 1;
|
optind = 1;
|
||||||
|
|
@ -264,6 +262,8 @@ main(int argc,
|
||||||
done:
|
done:
|
||||||
if (cbret)
|
if (cbret)
|
||||||
cbuf_free(cbret);
|
cbuf_free(cbret);
|
||||||
|
if (xcfg)
|
||||||
|
xml_free(xcfg);
|
||||||
if (xt)
|
if (xt)
|
||||||
xml_free(xt);
|
xml_free(xt);
|
||||||
if (cb)
|
if (cb)
|
||||||
|
|
|
||||||
|
|
@ -355,6 +355,8 @@ main(int argc,
|
||||||
xml_nsctx_free(nsc);
|
xml_nsctx_free(nsc);
|
||||||
if (xc)
|
if (xc)
|
||||||
ctx_free(xc);
|
ctx_free(xc);
|
||||||
|
if (xcfg)
|
||||||
|
xml_free(xcfg);
|
||||||
if (xv)
|
if (xv)
|
||||||
free(xv);
|
free(xv);
|
||||||
if (buf)
|
if (buf)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue