- Yang deviation [deviation statement not yet support #211](https://github.com/clicon/clixon/issues/211)
- Added "depth" parameter to yang_apply - Added extra API function to yang_cardinality to check individual relation
This commit is contained in:
parent
6e5e53e02e
commit
5a72626aa4
7 changed files with 311 additions and 92 deletions
|
|
@ -1074,14 +1074,6 @@ ys_schemanode_check(yang_stmt *ys,
|
|||
}
|
||||
break;
|
||||
}
|
||||
case Y_DEVIATION:
|
||||
if (yang_abs_schema_nodeid(ys, arg, &yres) < 0)
|
||||
goto done;
|
||||
if (yres == NULL){
|
||||
clicon_err(OE_YANG, 0, "schemanode sanity check of %s", arg);
|
||||
goto done;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
@ -1330,21 +1322,27 @@ yang_parse_post(clicon_handle h,
|
|||
for (i=modmin; i<modmax; i++)
|
||||
if (yang_features(h, yang_child_i(yspec, i)) < 0)
|
||||
goto done;
|
||||
|
||||
/* 4: Go through parse tree and populate it with cv types */
|
||||
for (i=modmin; i<modmax; i++){
|
||||
if (ys_populate(yang_child_i(yspec, i), h) < 0) /* Alt: make a yang_apply0 */
|
||||
|
||||
/* 4: Check deviations: not-supported add/delete/replace statements
|
||||
* done after if-features since they may affect deviations but before populate since target yang statements
|
||||
* may be removed or changed
|
||||
*/
|
||||
for (i=modmin; i<modmax; i++) /* Really only under (sub)modules no need to traverse whole tree */
|
||||
if (yang_apply(yang_child_i(yspec, i), -1, yang_deviation, 1, (void*)h) < 0)
|
||||
goto done;
|
||||
if (yang_apply(yang_child_i(yspec, i), -1, ys_populate, (void*)h) < 0)
|
||||
|
||||
/* 5: Go through parse tree and populate it with cv types */
|
||||
for (i=modmin; i<modmax; i++){
|
||||
if (yang_apply(yang_child_i(yspec, i), -1, ys_populate, 0, (void*)h) < 0)
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* 5: Resolve all types: populate type caches. Requires eg length/range cvecs
|
||||
/* 6: Resolve all types: populate type caches. Requires eg length/range cvecs
|
||||
* from ys_populate step.
|
||||
* Must be done using static binding.
|
||||
*/
|
||||
for (i=modmin; i<modmax; i++)
|
||||
if (yang_apply(yang_child_i(yspec, i), Y_TYPE, ys_resolve_type, h) < 0)
|
||||
if (yang_apply(yang_child_i(yspec, i), Y_TYPE, ys_resolve_type, 1, h) < 0)
|
||||
goto done;
|
||||
|
||||
/* Up to here resolving is made in the context they are defined, rather
|
||||
|
|
@ -1354,14 +1352,14 @@ yang_parse_post(clicon_handle h,
|
|||
* single tree as they are used.
|
||||
*/
|
||||
|
||||
/* 6: Macro expansion of all grouping/uses pairs. Expansion needs marking */
|
||||
/* 7: Macro expansion of all grouping/uses pairs. Expansion needs marking */
|
||||
for (i=0; i<ylen; i++){
|
||||
if (yang_expand_grouping(ylist[i]) < 0)
|
||||
goto done;
|
||||
yang_apply(ylist[i], -1, (yang_applyfn_t*)yang_flag_reset, (void*)YANG_FLAG_MARK);
|
||||
yang_apply(ylist[i], -1, (yang_applyfn_t*)yang_flag_reset, 1, (void*)YANG_FLAG_MARK);
|
||||
}
|
||||
|
||||
/* 7: Top-level augmentation of all modules.
|
||||
/* 8: Top-level augmentation of all modules.
|
||||
* Note: Clixon does not implement augment in USES
|
||||
* Note: There is an ordering problem, where an augment in one module depends on an augment in
|
||||
* another module not yet augmented.
|
||||
|
|
@ -1370,21 +1368,21 @@ yang_parse_post(clicon_handle h,
|
|||
if (yang_augment_module(ylist[i]) < 0)
|
||||
goto done;
|
||||
|
||||
/* 4: Go through parse tree and do 2nd step populate (eg default) */
|
||||
/* 9: Go through parse tree and do 2nd step populate (eg default) */
|
||||
for (i=0; i<ylen; i++)
|
||||
if (yang_apply(ylist[i], -1, ys_populate2, (void*)h) < 0)
|
||||
if (yang_apply(ylist[i], -1, ys_populate2, 1, (void*)h) < 0)
|
||||
goto done;
|
||||
|
||||
/* 8: sanity checks of expanded yangs need more here */
|
||||
/* 10: sanity checks of expanded yangs need more here */
|
||||
for (i=0; i<ylen; i++){
|
||||
/* Check schemanode references */
|
||||
if (yang_apply(ylist[i], -1, ys_schemanode_check, NULL) < 0)
|
||||
if (yang_apply(ylist[i], -1, ys_schemanode_check, 1, NULL) < 0)
|
||||
goto done;
|
||||
/* Check list key values */
|
||||
if (ys_list_check(h, ylist[i]) < 0)
|
||||
goto done;
|
||||
}
|
||||
/* 9. Check cardinality a second time after grouping/augment etc */
|
||||
/* 11. Check cardinality a second time after grouping/augment etc */
|
||||
for (i=0; i<ylen; i++)
|
||||
if (yang_cardinality(h, ylist[i], yang_argument_get(ylist[i])) < 0)
|
||||
goto done;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue