Fixed: [NACM paths don't work for mounted YANG models](https://github.com/clicon/clixon-controller/issues/62)

This commit is contained in:
Olof hagsand 2023-11-15 16:47:33 +01:00
parent 2e6d9167f2
commit aaab8a4920
5 changed files with 331 additions and 7 deletions

View file

@ -150,8 +150,8 @@ yang_mount_get(yang_stmt *y,
char *xpath,
yang_stmt **yspec)
{
cvec *cvv = NULL;
cg_var *cv;
cvec *cvv;
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 */
@ -328,6 +328,34 @@ xml_yang_mount_set(clicon_handle h,
return retval;
}
/*! Get any yspec of a mount-point, special function
*
* Get (the first) mounted yspec.
* A more generic way would be to call plugin_mount to get the yanglib and from that get the
* yspec. But there is clixon code that cant call the plugin since h is not available
* @param[in] y Yang container/list containing unknown node
* @param[out] yspec YANG stmt spec
* @retval 1 yspec found and set
* @retval 0 Not found
*/
int
yang_mount_get_yspec_any(yang_stmt *y,
yang_stmt **yspec)
{
cvec *cvv;
cg_var *cv;
void *p;
/* Special value in yang unknown node for mount-points: mapping from xpath->mounted yspec */
if ((cvv = yang_cvec_get(y)) != NULL &&
(cv = cvec_i(cvv, 0)) != NULL &&
(p = cv_void_get(cv)) != NULL){
*yspec = p;
return 1;
}
return 0;
}
/*! Free all yspec yang-mounts
*
* @param[in] cvv Cligen-variable vector containing xpath -> yspec mapping
@ -663,7 +691,7 @@ yang_schema_yanglib_parse_mount(clicon_handle h,
goto done;
}
/*! Check if XML nod is mount-point and return matching YANG child
/*! Check if XML node is mount-point and return matching YANG child
*
* @param[in] h Clixon handle
* @param[in] x1 XML node