Hi all,

In any examples I've seen where a YANG model contains a set of leafrefs to a 
multi-key list, or to a list key within a list, the "current()" xpath function 
is only in the 2nd leafref and never the first.

EXAMPLE A - OpenConfig  ACL model

      list acl-set {
        key "name type";

... snip ...

  grouping interface-ingress-acl-config {
    description
      "Configuration data for per-interface ingress ACLs";

    leaf set-name {
      type leafref {
        path "../../../../../../acl-sets/acl-set/config/name";
      }
      description
        "Reference to the ACL set name applied on ingress";
    }

    leaf type {
      type leafref {
        path "../../../../../../acl-sets/acl-set[name=current()/../set-name]" +
          "/config/type";
      }
      description
        "Reference to the ACL set type applied on ingress";
    }
  }

We've tried this type of 2-leaf leafref in some models, and yangLint complains 
(validating instance data) if we instead changed the first one to the following 
(this is just an illustrative example, we actually did a similar thing with our 
own models, not actually with this OpenCOnfig model):

    leaf set-name {
      type leafref {
        path 
"../../../../../../acl-sets/acl-set[type=current()/../type]/config/name";

      }
      description
        "Reference to the ACL set name applied on ingress";
    }

I'm not sure I understand why this wouldn't work. When all is said and done, 
both leafrefs would be satisfied if this is applied atomically. But maybe it is 
some sort of circular chicken-and-egg problem in resolving the value spaces ?

I suspect I'm missing some basic understanding here since:
- Other examples of 2-part leafrefs always only use current() in the 2nd 
leafref, and
- yangLint complains about this (with instance data)

Rgds,
Jason


_______________________________________________
netmod mailing list
[email protected]
https://www.ietf.org/mailman/listinfo/netmod

Reply via email to