[GENIUS-109] TestInterfaceManager.addInterfaceInfo() writes invalid operational state Created: 19/Dec/17  Updated: 19/Apr/18  Resolved: 19/Apr/18

Status: Verified
Project: genius
Component/s: General
Affects Version/s: None
Fix Version/s: Oxygen

Type: Bug Priority: Medium
Reporter: Stephen Kitt Assignee: Stephen Kitt
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

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.



 Comments   
Comment by Robert Varga [ 20/Dec/17 ]

I think we need steps to reproduce here.

Comment by Stephen Kitt [ 20/Dec/17 ]

Indeed, here goes:

Comment by Robert Varga [ 21/Dec/17 ]

The problem is in TestInterfaceManager.addInterfaceInfo(), which is populating the operational data store – which fails because the data does not contain the mandatory leaf.

Comment by Stephen Kitt [ 21/Dec/17 ]

Thanks rovarga. This is fixed by https://git.opendaylight.org/gerrit/66706 which also needs https://git.opendaylight.org/gerrit/66709 in NetVirt.

Generated at Wed Feb 07 19:59:56 UTC 2024 using Jira 8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d.