-
- /**
- * Test if node has augmenting flag set to expected value. In case this is
- * DataNodeContainer/ChoiceNode, check its child nodes/case nodes too.
- *
- * @param node
- * node to check
- * @param expected
- * expected value
- */
- public static void checkIsAugmenting(final DataSchemaNode node, final boolean expected) {
- assertEquals(expected, node.isAugmenting());
- if (node instanceof DataNodeContainer) {
- for (DataSchemaNode child : ((DataNodeContainer) node).getChildNodes()) {
- checkIsAugmenting(child, expected);
- }
- } else if (node instanceof ChoiceSchemaNode) {
- for (CaseSchemaNode caseNode : ((ChoiceSchemaNode) node).getCases()) {
- checkIsAugmenting(caseNode, expected);
- }
- }
- }
-
- public static EffectiveModelContext parseYangSource(final String... yangSourceFilePath) throws Exception {
- final var reactor = RFC7950Reactors.defaultReactor().newBuild();
- for (var resourcePath : yangSourceFilePath) {
- reactor.addSource(sourceForResource(resourcePath));
- }
- return reactor.buildEffective();
- }
-
- public static YangStatementStreamSource sourceForResource(final String resourceName) throws Exception {
- return YangStatementStreamSource.create(YangTextSchemaSource.forPath(Path.of(
- TestUtils.class.getResource(resourceName).toURI())));
- }