Description
LeafRefValidation currently includes the following ugly piece:
private void processChildNode(final Set<Object> values, final DataContainerNode<?> parent, final PathArgument arg, final List<QNamePredicate> nodePredicates, final Deque<QNameWithPredicate> path, final YangInstanceIdentifier current) { final Optional<DataContainerChild<?, ?>> child = parent.getChild(arg); if (!child.isPresent()) { for (final DataContainerChild<?, ?> mixin : parent.getValue()) { if (mixin instanceof AugmentationNode || mixin instanceof ChoiceNode) { addValues(values, mixin, nodePredicates, path, current); } } } else { addNextValues(values, child.get(), nodePredicates, path, current); } }
which is fishing through {Augmentation,Choice}Nodes – which is inefficient. Since we have a SchemaContext near, we should be able to capture the guidance to cross ChoiceNodes directly, i.e. by having a QName->List<PathArgument> lookup.
One way of achieving this would be to modify QNameWithPredicate to actually be a PathArgument and have LeafRefPath follow the YangInstanceIdentifier structure.