[MDSAL-308] leaf-ref to InstanceIdentifier Created: 05/Feb/18  Updated: 28/Oct/21  Resolved: 28/Oct/21

Status: Resolved
Project: mdsal
Component/s: Binding runtime
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Medium
Reporter: Claudio David Gasparini Assignee: Unassigned
Resolution: Won't Do Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Relates
relates to MDSAL-17 Simplify InstanceIdentifer creation Resolved

 Description   

Given  the model

leaf role-set {
 type leafref {
 path "/rpol:routing-policy/rpol:defined-sets/role-sets/role-set/role-set-name";
 }
 description "References a defined neighbor roles set";
}

when reading from DS and calling getRoleSet()

where

/**
 * References a defined neighbor roles set
 *
 *
 *
 * @return <code>java.lang.String</code> <code>roleSet</code>, or <code>null</code> if not present
 */
java.lang.String getRoleSet();

 

I was not able to find a tool or way to do a direct conversion from this string 

to an InstanceIdentifier.



 Comments   
Comment by Jie Han [ 02/Mar/18 ]

This feature could be properly provided by mdsal runtime of binding v2 after MDSAL-17.
but the Instance Identifier only identifies a specific TreeNode in the data tree, not a leaf node.

Comment by Robert Varga [ 28/Jun/18 ]

This boils down to resolving leafref types, which really is an XPath query on the data store.

Codegen API contract should change, so that it returns an XPath query (which can be limited in terms of InstanceIdentifier wildcards?). That query then needs to be run against the datastore.

Comment by Robert Varga [ 28/Oct/21 ]

In this particular instance we want the reference to come from:

    grouping role-set {
        description "Data definition for a list of Odl Bgp roles which
            are matched as part of a policy";

        list role-set {
            key role-set-name;
            description "List of the defined role sets";

            leaf role-set-name {
              type string;
              description
                "name / label of the role set -- this is used to
                reference the set in match conditions";
            }

            leaf-list role {
                type rib:peer-role;
                description
                "List of role expressions that are part of the set";
            }
      }
    }

From this follows, that if you want a (Yang)InstanceIdentifier, you want additional proof as to what the role set entry is. Why do we need this?

If the need is to find the role-set, the returned string is what you need to construct RoleSetKey with to point to what the correlation you are making with a particular instantiation.

Comment by Robert Varga [ 28/Oct/21 ]

If there is a gap that needs to be addressed, please reopen.

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