* Fixed [identityref validation fails when using typedef #87](https://github.com/clicon/clixon/issues/87)

This commit is contained in:
Olof hagsand 2019-06-20 15:35:57 +02:00
parent 97529a20a4
commit c90aa8371c
4 changed files with 70 additions and 15 deletions

View file

@ -1206,19 +1206,20 @@ xml_yang_validate_all(clicon_handle h,
/* Special case if leaf is leafref, then first check against
current xml tree
*/
if ((yc = yang_find(ys, Y_TYPE, NULL)) != NULL){
if (strcmp(yc->ys_argument, "leafref") == 0){
if ((ret = validate_leafref(xt, yc, xret)) < 0)
goto done;
if (ret == 0)
goto fail;
}
else if (strcmp(yc->ys_argument, "identityref") == 0){
if ((ret = validate_identityref(xt, ys, yc, xret)) < 0)
goto done;
if (ret == 0)
goto fail;
/* Get base type yc */
if (yang_type_get(ys, NULL, &yc, NULL, NULL, NULL, NULL, NULL) < 0)
goto done;
if (strcmp(yang_argument_get(yc), "leafref") == 0){
if ((ret = validate_leafref(xt, yc, xret)) < 0)
goto done;
if (ret == 0)
goto fail;
}
else if (strcmp(yang_argument_get(yc), "identityref") == 0){
if ((ret = validate_identityref(xt, ys, yc, xret)) < 0)
goto done;
if (ret == 0)
goto fail;
}
break;
default:

View file

@ -1416,13 +1416,14 @@ yang_type_resolve(yang_stmt *yorig,
*
* @code
* yang_stmt *yrestype;
* char *origtype = NULL;
* int options;
* cvec *cvv = NULL;
* cvec *patterns = cvec_new(0);
* cvec *regexps = cvec_new(0);
* uint8_t fraction;
*
* if (yang_type_get(ys, &type, &yrestype, &options, &cvv,
* if (yang_type_get(ys, &origtype, &yrestype, &options, &cvv,
* patterns, regexps, &fraction) < 0)
* goto err;
* if (yrestype == NULL) # unresolved