Example: added -m/-M options for testing mount-points

This commit is contained in:
Olof hagsand 2023-08-07 18:06:29 +02:00
parent 27b77b14bc
commit bee30a4ea0
7 changed files with 288 additions and 50 deletions

View file

@ -828,7 +828,7 @@ yang_metadata_init(clicon_handle h)
* @param[in] yspec Will be populated with YANGs, is consumed
* @retval 1 OK
* @retval 0 Parse error
* @retval -1 Error
* @retval -1 Error
* @see xml_schema_add_mount_points
* XXX: Ensure yang-lib is always there otherwise get state dont work for mountpoint
*/
@ -855,8 +855,7 @@ yang_lib2yspec(clicon_handle h,
xi = vec[i];
if ((name = xml_find_body(xi, "name")) == NULL)
continue;
if ((revision = xml_find_body(xi, "revision")) == NULL)
continue;
revision = xml_find_body(xi, "revision");
if ((ymod = yang_find(yspec, Y_MODULE, name)) != NULL ||
(ymod = yang_find(yspec, Y_SUBMODULE, name)) != NULL){
/* Skip if matching or no revision
@ -866,7 +865,7 @@ yang_lib2yspec(clicon_handle h,
modmin++;
continue;
}
if (strcmp(yang_argument_get(yrev), revision) == 0){
if (revision && strcmp(yang_argument_get(yrev), revision) == 0){
modmin++;
continue;
}
@ -875,7 +874,8 @@ yang_lib2yspec(clicon_handle h,
goto fail;
}
#ifdef YANG_SCHEMA_MOUNT_YANG_LIB_FORCE
/* XXX: Ensure yang-lib is always there otherwise get state dont work for mountpoint */
/* Force add ietf-yang-library@2019-01-04 on all mount-points
otherwise get state dont work for mountpoint */
if ((ymod = yang_find(yspec, Y_MODULE, "ietf-yang-library")) != NULL &&
(yrev = yang_find(ymod, Y_REVISION, NULL)) != NULL &&
strcmp(yang_argument_get(yrev), "2019-01-04") == 0){

View file

@ -255,7 +255,6 @@ xml_yang_mount_get(clicon_handle h,
goto done;
}
/*! Set yangspec mount-point via XML mount-point node
*
* Stored in a separate structure (not in XML config tree)
@ -389,6 +388,7 @@ yang_schema_mount_statedata_yanglib(clicon_handle h,
}
if (xml_apply(*xret, CX_ELMNT, find_schema_mounts, cvv) < 0)
goto done;
yspec = clicon_dbspec_yang(h);
cv = NULL;
while ((cv = cvec_each(cvv, cv)) != NULL) {
xmp = cv_void_get(cv);
@ -398,7 +398,6 @@ yang_schema_mount_statedata_yanglib(clicon_handle h,
goto done;
if (yanglib == NULL)
continue;
yspec = clicon_dbspec_yang(h);
if ((ret = xml_bind_yang0(h, yanglib, YB_MODULE, yspec, xerr)) < 0)
goto done;
if (ret == 0)