+ return root.findChild(path);
+ }
+
+ /**
+ * Find a child node as identified by an absolute {@link YangInstanceIdentifier} and return it along with a suitably
+ * initialized {@link SchemaInferenceStack}.
+ *
+ * @param path Path towards the child node
+ * @return A {@link NodeAndStack}, or empty when corresponding child is not found.
+ * @throws NullPointerException if {@code path} is null
+ */
+ public @NonNull CheckedValue<@NonNull NodeAndStack, @NonNull IllegalArgumentException> enterPath(
+ final YangInstanceIdentifier path) {
+ final var stack = SchemaInferenceStack.of((EffectiveModelContext) root.getDataSchemaNode());
+ DataSchemaContextNode<?> node = root;
+ for (var arg : path.getPathArguments()) {
+ final var child = node.enterChild(arg, stack);
+ if (child == null) {
+ return CheckedValue.ofException(new IllegalArgumentException("Failed to find " + arg + " in " + node));
+ }
+ node = child;
+ }
+
+ return CheckedValue.ofValue(new NodeAndStack(node, stack));