+ final ListSchemaNode casted = (ListSchemaNode) schemaNode;
+ parsed = parserFactory.getMapEntryNodeParser().parse(elements, casted);
+ if (isPost()) {
+ iiToDataList.add(parsed.getIdentifier());
+ }
+ }
+ // FIXME : add another DataSchemaNode extensions e.g. LeafSchemaNode
+
+ final YangInstanceIdentifier fullIIToData = YangInstanceIdentifier.create(Iterables.concat(
+ pathContext.getInstanceIdentifier().getPathArguments(), iiToDataList));
+
+ outIIContext = new InstanceIdentifierContext<>(fullIIToData, pathContext.getSchemaNode(), pathContext.getMountPoint(),
+ pathContext.getSchemaContext());
+
+ return new NormalizedNodeContext(outIIContext, parsed);
+ }
+
+ private static Deque<Object> findPathToSchemaNodeByName(final DataSchemaNode schemaNode, final String elementName) {
+ final Deque<Object> result = new ArrayDeque<>();
+ final ArrayList<ChoiceSchemaNode> choiceSchemaNodes = new ArrayList<>();
+ final Collection<DataSchemaNode> children = ((DataNodeContainer) schemaNode).getChildNodes();
+ for (final DataSchemaNode child : children) {
+ if (child instanceof ChoiceSchemaNode) {
+ choiceSchemaNodes.add((ChoiceSchemaNode) child);
+ } else if (child.getQName().getLocalName().equalsIgnoreCase(elementName)) {
+ result.push(child);
+ if (child.isAugmenting()) {
+ final AugmentationSchema augment = findCorrespondingAugment(schemaNode, child);
+ if (augment != null) {
+ result.push(augment);
+ }
+ }
+ return result;
+ }
+ }
+
+ for (final ChoiceSchemaNode choiceNode : choiceSchemaNodes) {
+ for (final ChoiceCaseNode caseNode : choiceNode.getCases()) {
+ final Deque<Object> resultFromRecursion = findPathToSchemaNodeByName(caseNode, elementName);
+ if (!resultFromRecursion.isEmpty()) {
+ resultFromRecursion.push(choiceNode);
+ if (choiceNode.isAugmenting()) {
+ final AugmentationSchema augment = findCorrespondingAugment(schemaNode, choiceNode);
+ if (augment != null) {
+ resultFromRecursion.push(augment);
+ }
+ }
+ return resultFromRecursion;
+ }
+ }
+ }
+ return result;
+ }
+
+ private static AugmentationSchema findCorrespondingAugment(final DataSchemaNode parent, final DataSchemaNode child) {
+ if (parent instanceof AugmentationTarget && !(parent instanceof ChoiceSchemaNode)) {
+ for (final AugmentationSchema augmentation : ((AugmentationTarget) parent).getAvailableAugmentations()) {
+ final DataSchemaNode childInAugmentation = augmentation.getDataChildByName(child.getQName());
+ if (childInAugmentation != null) {
+ return augmentation;
+ }
+ }