Uploaded image for project: 'genius'
  1. genius
  2. GENIUS-109

TestInterfaceManager.addInterfaceInfo() writes invalid operational state

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Medium Medium
    • Oxygen
    • None
    • General
    • None

      I’m running into an issue porting Netvirt to YANG Tools 2, and I’m not sure how I should go about fixing it. Basically, we have test code which creates an interface like this:

      ParentRefs parentRefs = new ParentRefsBuilder()
              .setDatapathNodeIdentifier(interfaceInfo.getDpId())
              .setParentInterface(interfaceInfo.getInterfaceName())
              .build();

      return new InterfaceBuilder()
              .setKey(new InterfaceKey(interfaceInfo.getInterfaceName()))
              .setName(interfaceInfo.getInterfaceName())
              .setDescription("Vlan interface")
              .setEnabled(true)
              .setType(L2vlan.class)
              .addAugmentation(ParentRefs.class, parentRefs)
              .build();

      (InterfaceBuilder is the version from org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces which doesn’t have statistics.)

      However trying to store this in the datastore blows up with

      java.lang.IllegalArgumentException: Node (urn:ietf:params:xml:ns:yang:ietf-interfaces?revision=2014-05-08)interface[{{

      {(urn:ietf:params:xml:ns:yang:ietf-interfaces?revision=2014-05-08)name=23701c04-1118-4c65-9425-78a80d49a211}

      ] is missing mandatory descendant /(urn:ietf:params:xml:ns:yang:ietf-interfaces?revision=2014-05-08)statistics/discontinuity-time}}
              at com.google.common.base.Preconditions.checkArgument(Preconditions.java:434)
              at org.opendaylight.yangtools.yang.data.impl.schema.tree.MandatoryLeafEnforcer$Strict.enforceOnData(MandatoryLeafEnforcer.java:44)
      {{          at org.opendaylight.yangtools.yang.data.impl.schema.tree.ListEntryModificationStrategy.verifyStructure(ListEntryModificationStrategy.java:34) }}

      Why is it expecting a statistics node here? Isn’t that just for org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state’s version of Interface?

      Is the validator looking at the wrong parent? Presumably https://git.opendaylight.org/gerrit/gitweb?p=mdsal.git;a=blob;f=model/ietf/ietf-interfaces/src/main/yang/ietf-interfaces.yang;h=3689c8920d918465e91bf967ef19bbc2a50b07bd;hb=HEAD is valid but the validator doesn’t distinguish between interface in interfaces v. interface in interfaces-state.

            skitt Stephen Kitt
            skitt Stephen Kitt
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: