[YANGTOOLS-1470] Fail to find unique argument node in augmented list Created: 03/Dec/22  Updated: 23/Dec/22  Resolved: 23/Dec/22

Status: Resolved
Project: yangtools
Component/s: parser
Affects Version/s: 10.0.1, 8.0.9, 9.0.5
Fix Version/s: 8.0.10, 9.0.6, 10.0.3

Type: Bug Priority: Medium
Reporter: Sangwook Ha Assignee: Robert Varga
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

Parser fails to find the argument node of a unique statement if a node is augmented to the list with the unique statement.

For example, in the following example a node (foo-leaf) is augmented to the list (bar-list) with a unique statement (unique bar-leaf2;):

module foo {
  namespace "urn:foo";
  prefix "foo";

  import bar {
    prefix bar;
  }

  container foo {
    uses bar:bar-group;
  }

  augment "/foo:foo/foo:bar-list" {
    leaf foo-leaf {
      type string;
    }
  }
}
module bar {
  namespace "urn:bar";
  prefix "bar";
  
  grouping bar-group {
    list bar-list {
      key bar-leaf1;
      unique bar-leaf2;

      leaf bar-leaf1 {
        type string;
      }
      leaf bar-leaf2 {
        type string;
      }
    }
  }
}  

and parser complains that the argument node bar-leaf2 does not exist.

Caused by: org.opendaylight.yangtools.yang.parser.spi.source.SourceException: Following components of unique statement argument refer to non-existent nodes: [Descendant{qnames=[(urn:bar)bar-leaf2]}] [at /volumes/OpenDaylight/yangtools/parser/yang-parser-rfc7950/target/test-classes/bugs/YT1470/bar.yang:8:7]
	at org.opendaylight.yangtools.yang.parser.rfc7950@10.0.2-SNAPSHOT/org.opendaylight.yangtools.yang.parser.rfc7950.stmt.meta.UniqueStatementSupport$RequireLeafDescendants.prerequisiteFailed(UniqueStatementSupport.java:201)
	at org.opendaylight.yangtools.yang.parser.reactor@10.0.2-SNAPSHOT/org.opendaylight.yangtools.yang.parser.stmt.reactor.ModifierImpl.failModifier(ModifierImpl.java:86)
	at org.opendaylight.yangtools.yang.parser.reactor@10.0.2-SNAPSHOT/org.opendaylight.yangtools.yang.parser.stmt.reactor.SourceSpecificContext.failModifiers(SourceSpecificContext.java:375)
	at org.opendaylight.yangtools.yang.parser.reactor@10.0.2-SNAPSHOT/org.opendaylight.yangtools.yang.parser.stmt.reactor.BuildGlobalContext.addSourceExceptions(BuildGlobalContext.java:307)
	... 50 more

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