XML: Add XML_FLAG_ANYDATA to mimic an xml node to be ANYDATA
This commit is contained in:
parent
cafbe7d200
commit
be3001acf5
7 changed files with 19 additions and 14 deletions
|
|
@ -180,6 +180,6 @@ loc:
|
|||
find . -name '*.[chyl]' -type f | xargs wc -l | tail -1 2> /dev/null
|
||||
|
||||
TAGS:
|
||||
find $(srcdir) -name '*.[chyl]' -type f | grep -v \.tab\.[ch] | grep -v lex.*.c | grep -v .yy.c | etags -
|
||||
find $(srcdir) -not \( -type d \( -path './.git' -o -path './docker' -o -path './doc' \) -prune \) -name '*.[chyl]' -type f | grep -v \.tab\.[ch] | grep -v lex.*.c | grep -v .yy.c | etags -
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -202,6 +202,7 @@ enum format_enum{
|
|||
#define XML_FLAG_DEFAULT 0x40 /* Added when a value is set as default @see xml_default */
|
||||
#define XML_FLAG_TOP 0x80 /* Top datastore symbol */
|
||||
#define XML_FLAG_BODYKEY 0x100 /* Text parsing key to be translated from body to key */
|
||||
#define XML_FLAG_ANYDATA 0x200 /* Treat as anydata, eg mount-points before bound */
|
||||
|
||||
/*
|
||||
* Prototypes
|
||||
|
|
|
|||
|
|
@ -816,7 +816,8 @@ text_modify(clicon_handle h,
|
|||
Any "operation" attributes present on subelements of an anyxml
|
||||
node are ignored by the NETCONF server.*/
|
||||
if (yang_keyword_get(y0) == Y_ANYXML ||
|
||||
yang_keyword_get(y0) == Y_ANYDATA){
|
||||
yang_keyword_get(y0) == Y_ANYDATA ||
|
||||
xml_flag(x1, XML_FLAG_ANYDATA)){
|
||||
if (op == OP_NONE)
|
||||
break;
|
||||
if (op==OP_MERGE && !permit && xnacm){
|
||||
|
|
@ -932,7 +933,8 @@ text_modify(clicon_handle h,
|
|||
/* Check if xc is unresolved mountpoint, ie no yang mount binding yet */
|
||||
if ((ismount = xml_yang_mount_get(h, x1c, NULL, &mount_yspec)) < 0)
|
||||
goto done;
|
||||
if (ismount && mount_yspec == NULL){
|
||||
if (ismount && mount_yspec == NULL &&
|
||||
!xml_flag(x1c, XML_FLAG_ANYDATA)){
|
||||
ret = 1;
|
||||
}
|
||||
else{
|
||||
|
|
|
|||
|
|
@ -1585,7 +1585,7 @@ instance_id_resolve(clixon_path *cplist,
|
|||
*
|
||||
* @param[in] xt Top xml-tree where to search
|
||||
* @param[in] yt Yang statement of top symbol (can be yang-spec if top-level)
|
||||
* @param[in] cplist Lisp of clixon-path
|
||||
* @param[in] cplist List of clixon-path
|
||||
* @param[out] xvec Vector of xml-trees. Vector must be free():d after use
|
||||
* @retval 1 OK with found xml nodes in xvec (if any)
|
||||
* @retval 0 Fail fail: eg no yang
|
||||
|
|
@ -1779,10 +1779,10 @@ clixon_xml_find_api_path(cxobj *xt,
|
|||
* @see RFC7950 Sec 9.13
|
||||
*/
|
||||
int
|
||||
clixon_xml_find_instance_id(cxobj *xt,
|
||||
yang_stmt *yt,
|
||||
cxobj ***xvec,
|
||||
int *xlen,
|
||||
clixon_xml_find_instance_id(cxobj *xt,
|
||||
yang_stmt *yt,
|
||||
cxobj ***xvec,
|
||||
int *xlen,
|
||||
const char *format,
|
||||
...)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2228,7 +2228,7 @@ xml_copy_one(cxobj *x0,
|
|||
default:
|
||||
break;
|
||||
}
|
||||
xml_flag_set(x1, xml_flag(x0, XML_FLAG_DEFAULT | XML_FLAG_TOP)); /* Maybe more flags */
|
||||
xml_flag_set(x1, xml_flag(x0, XML_FLAG_DEFAULT | XML_FLAG_TOP | XML_FLAG_ANYDATA)); /* Maybe more flags */
|
||||
retval = 0;
|
||||
done:
|
||||
return retval;
|
||||
|
|
|
|||
|
|
@ -173,8 +173,7 @@ populate_self_parent(cxobj *xt,
|
|||
y = xml_spec(xsibling);
|
||||
goto set;
|
||||
}
|
||||
xp = xml_parent(xt);
|
||||
if (xp == NULL){
|
||||
if ((xp = xml_parent(xt)) == NULL){
|
||||
if (xerr &&
|
||||
netconf_bad_element_xml(xerr, "application", name, "Missing parent") < 0)
|
||||
goto done;
|
||||
|
|
@ -469,8 +468,10 @@ xml_bind_yang0_opt(clicon_handle h,
|
|||
else{
|
||||
if ((ret = yang_schema_yanglib_parse_mount(h, xt)) < 0)
|
||||
goto done;
|
||||
if (ret == 0)
|
||||
if (ret == 0){ /* Special flag if mount-point but no yanglib */
|
||||
xml_flag_set(xt, XML_FLAG_ANYDATA);
|
||||
goto ok;
|
||||
}
|
||||
/* Try again */
|
||||
if ((ret = xml_yang_mount_get(h, xt, NULL, &yspec1)) < 0)
|
||||
goto done;
|
||||
|
|
|
|||
|
|
@ -214,7 +214,7 @@ yang_mount_set(yang_stmt *y,
|
|||
* @param[in] h Clixon handle
|
||||
* @param[in] x XML mount-point node
|
||||
* @param[out] vallevel Do or dont do full RFC 7950 validation if given
|
||||
* @param[out] yspec YANG stmt spec
|
||||
* @param[out] yspec YANG stmt spec of mount-point (if ret is 1)
|
||||
* @retval 1 x is a mount-point: yspec may be set
|
||||
* @retval 0 x is not a mount point
|
||||
* @retval -1 Error
|
||||
|
|
@ -651,7 +651,8 @@ yang_schema_mount_statistics(clicon_handle h,
|
|||
*
|
||||
* @param[in] h Clixon handle
|
||||
* @param[in] xt
|
||||
* @retval 0 OK
|
||||
* @retval 1 OK
|
||||
* @retval 0 No yanglib or problem when parsing yanglib
|
||||
* @retval -1 Error
|
||||
*/
|
||||
int
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue