[NETCONF-631] YangInstanceIdentifierDeserializer fails on choice nodes Created: 11/Jul/19  Updated: 23/Nov/21  Resolved: 04/Nov/21

Status: Resolved
Project: netconf
Component/s: restconf-nb
Affects Version/s: None
Fix Version/s: 2.0.8

Type: Bug Priority: High
Reporter: Ajay Deep Singh Assignee: Robert Varga
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Relates
relates to NETCONF-834 RESTCONF OutOfMemoryError error Resolved

 Description   

I tested below Model and it failed, reason existing Code is not good enough to find Path for Choice Node, while loop in YangInstanceIdentifierDeserializer >> nextContextNode(…) below makes Current Null and throws Null Pointer Exception

Which means MIX Node type like Choice handling is not proper

 

 container interfaces {
   choice interfaces-type {
     container type-gigabyte {
       action reset {
         input {
           leaf reset-at {
             type string;
             mandatory true;
           }
         }
       }
     }
   }
 }

 

Code Snippet where it fails:

YangInstanceIdentifierDeserializer >> In method  : nextContextNode(…) 

 

while (current.isMixin()) {
  path.add(current.getIdentifier());
  current = current.getChild(qname);
  variables.setCurrent(current);
}

return current;

 

 



 Comments   
Comment by Robert Varga [ 16/Sep/21 ]

I think the best approach here is to ditch YangInstanceIdentifierDeserializer in favor of something more maintainable.

The idea is to split dealing with raw strings and percent-encoding into a first step, which results in a nice immutable structure.

We then take that representation and semantically binding it to an EffectiveModelContext, creating the appropriate YangInstanceIdentifier and EffectiveStatementInference to aid parsing request body and other schema/data related interactions.

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