Uploaded image for project: 'yangtools'
  1. yangtools
  2. YANGTOOLS-901

Use SchemaContext to guide NormalizedNode traversal of choices

    XMLWordPrintable

Details

    • Improvement
    • Status: Confirmed
    • Medium
    • Resolution: Unresolved
    • None
    • 14.0.0
    • data-impl
    • None

    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.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            Unassigned Unassigned
            rovarga Robert Varga
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: