Mount-point support for restconf
This commit is contained in:
parent
597cbe882b
commit
2e6d9167f2
9 changed files with 164 additions and 22 deletions
|
|
@ -808,21 +808,21 @@ api_path2xpath_cvv(cvec *api_path,
|
|||
cprintf(xpath, "%s", name);
|
||||
}
|
||||
|
||||
/* If x/y is mountpoint, pass moint yspec to children */
|
||||
/* If x/y is mountpoint, pass mount yspec to children */
|
||||
if ((ret = yang_schema_mount_point(y)) < 0)
|
||||
goto done;
|
||||
if (ret == 1){
|
||||
yang_stmt *y1 = NULL;
|
||||
if (xml_nsctx_yangspec(yspec, &nsc) < 0)
|
||||
goto done;
|
||||
/* cf xml_bind_yang0_opt/xml_yang_mount_get */
|
||||
if (yang_mount_get(y, cbuf_get(xpath), &y1) < 0)
|
||||
goto done;
|
||||
if (y1 == NULL || yang_keyword_get(y1) != Y_SPEC){
|
||||
clicon_err(OE_YANG, 0, "No such mountpoint %s", cbuf_get(xpath));
|
||||
goto done;
|
||||
if (y1 != NULL){
|
||||
y = y1;
|
||||
yspec = y1;
|
||||
root = 1;
|
||||
}
|
||||
yspec = y1;
|
||||
root = 1;
|
||||
}
|
||||
if (prefix){
|
||||
free(prefix);
|
||||
|
|
@ -1151,7 +1151,7 @@ api_path2xml_vec(char **vec,
|
|||
if (xmlns_set(x, NULL, namespace) < 0)
|
||||
goto done;
|
||||
}
|
||||
/* If x/y is mountpoint, pass moint yspec to children */
|
||||
/* If x/y is mountpoint, pass mount yspec to children */
|
||||
if ((ret = yang_schema_mount_point(y)) < 0)
|
||||
goto done;
|
||||
if (ret == 1){
|
||||
|
|
@ -1164,13 +1164,11 @@ api_path2xml_vec(char **vec,
|
|||
clicon_err(OE_YANG, 0, "No xpath from xml");
|
||||
goto done;
|
||||
}
|
||||
if (yang_mount_get(y, xpath, &y1) < 0)
|
||||
/* cf xml_bind_yang0_opt/xml_yang_mount_get */
|
||||
if (yang_mount_get(y, xpath, &y1) < 0)
|
||||
goto done;
|
||||
if (y1 == NULL){
|
||||
clicon_err(OE_YANG, 0, "No such mountpoint %s", xpath);
|
||||
goto done;
|
||||
}
|
||||
y = y1;
|
||||
if (y1 != NULL)
|
||||
y = y1;
|
||||
}
|
||||
if ((retval = api_path2xml_vec(vec+1, nvec-1,
|
||||
x, y,
|
||||
|
|
|
|||
|
|
@ -1105,7 +1105,7 @@ xpath_traverse_canonical(xpath_tree *xs,
|
|||
* if (reason) cbuf_free(reason);
|
||||
* @endcode
|
||||
* @note Unsolvable issue of mountpoints, eg an xpath of //x:foo where foo is under one or several
|
||||
* mointpoints: a well-defined namespace cannot be determined. Therefore just allow
|
||||
* mountpoints: a well-defined namespace cannot be determined. Therefore just allow
|
||||
* inconsistencies and hope that it will be covered by other code
|
||||
* @see xpath2xml
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -153,6 +153,7 @@ yang_mount_get(yang_stmt *y,
|
|||
cvec *cvv = NULL;
|
||||
cg_var *cv;
|
||||
|
||||
clicon_debug(CLIXON_DBG_DEFAULT, "%s %s %p", __FUNCTION__, xpath, y);
|
||||
/* Special value in yang unknown node for mount-points: mapping from xpath->mounted yspec */
|
||||
if ((cvv = yang_cvec_get(y)) != NULL &&
|
||||
(cv = cvec_find(cvv, xpath)) != NULL &&
|
||||
|
|
@ -181,6 +182,7 @@ yang_mount_set(yang_stmt *y,
|
|||
cg_var *cv;
|
||||
cg_var *cv2;
|
||||
|
||||
clicon_debug(CLIXON_DBG_DEFAULT, "%s %s %p", __FUNCTION__, xpath, y);
|
||||
if ((cvv = yang_cvec_get(y)) != NULL &&
|
||||
(cv = cvec_find(cvv, xpath)) != NULL &&
|
||||
(yspec0 = cv_void_get(cv)) != NULL){
|
||||
|
|
@ -210,7 +212,7 @@ yang_mount_set(yang_stmt *y,
|
|||
/*! Get yangspec mount-point
|
||||
*
|
||||
* @param[in] h Clixon handle
|
||||
* @param[in] x XML moint-point node
|
||||
* @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
|
||||
* @retval 1 x is a mount-point: yspec may be set
|
||||
|
|
@ -274,7 +276,7 @@ xml_yang_mount_get(clicon_handle h,
|
|||
/*! Set yangspec mount-point via XML mount-point node
|
||||
*
|
||||
* Stored in a separate structure (not in XML config tree)
|
||||
* @param[in] x XML moint-point node
|
||||
* @param[in] x XML mount-point node
|
||||
* @param[in] yspec Yangspec for this mount-point (consumed)
|
||||
* @retval 0 OK
|
||||
* @retval -1 Error
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue