Subject: [OPSAWG] problems with compiling [email-masked]

From: "M. Ranganathan" <[email-masked]>
Date: Tue, 17 Oct 2017 11:17:05 -0400

I ran into some issues when I tried compiling this module using
opendaylight yangtools. Here is my compile error :

 Failed to find leafref target: ../../../../../../acl/acl-name in module
ietf-access-control-list
(QNameModule{ns=urn:ietf:params:xml:ns:yang:ietf-access-control-list,
rev=2017-10-03})

I am quite new at YANG so it is entirely possible I did some mistake (if
so, any clues would be appreciated).

Thanks,

Ranga

-- 
M. Ranganathan

---

From: "M. Ranganathan" <[email-masked]>
Date: Tue, 17 Oct 2017 12:02:47 -0400

Hello all,

On Tue, Oct 17, 2017 at 11:17 AM, M. Ranganathan <[email-masked]> wrote:

> ietf-access-control-list (QNameModule{ns=urn:ietf:params:xml:ns:yang:ietf-access-control-list,
> rev=2017-10-03})
>

I am not sure if this is the correct thing to be doing as I am quite new to
YANG -- so my mail here may mislead others who are likewise quite new to
YANG.

Anyway, I was able to correct this problem by making the following change:

Here is the diff

@@ -291,7 +291,7 @@ module ietf-access-control-list {

         leaf set-name {
           type leafref {
-            path "/access-lists/acl/acl-name";
+            path "../../../../../../acl/acl-name";
           }
           description
             "Reference to the ACL set name applied on ingress";
@@ -299,7 +299,7 @@ module ietf-access-control-list {

         leaf type {
           type leafref {
-            path "/access-lists/acl/acl-type";
+            path "../../../../../../acl/acl-type";
           }
           description
             "Reference to the ACL set type applied on ingress";
@@ -312,7 +312,7 @@ module ietf-access-control-list {
             "List of access list entries(ACE)";
           leaf rule-name {
             type leafref {
-              path "/access-lists/acl/aces/ace/rule-name";
+              path "../../../../../../../acl/aces/ace/rule-name";
             }
             description
               "The ace rule-name";

=============================================================

Here is the changed portion of the file after applying the diff:

grouping interface-acl {
    description
      "Grouping for per-interface ingress ACL data";

    container acl-sets {
      description
        "Enclosing container the list of ingress ACLs on the
         interface";

      list acl-set {
        key "set-name type";
        ordered-by user;
        description
          "List of ingress ACLs on the interface";

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

        leaf type {
          type leafref {
            path "/access-lists/acl/acl-type";
          }
          description
            "Reference to the ACL set type applied on ingress";
        }

        list ace {
          if-feature "interface-stats or interface-acl-aggregate";
          key "rule-name";
          description
            "List of access list entries(ACE)";
          leaf rule-name {
            type leafref {
              path "/access-lists/acl/aces/ace/rule-name";
            }
            description
              "The ace rule-name";
          }
          uses acl-counters;
        }
      }
    }
  }

Take with a grain of salt. I could be way off mark here.

Thanks,

Ranga

-- 
M. Ranganathan

---

From: Joe Clarke <[email-masked]>
Date: Tue, 17 Oct 2017 22:07:25 -0400

On 10/17/17 12:02, M. Ranganathan wrote:
> I am not sure if this is the correct thing to be doing as I am quite new
> to YANG -- so my mail here may mislead others who are likewise quite new
> to YANG.
> 

It seems the diff below is backwards.  That is, you removed the relative
XPaths and added a fully-qualified one?

I recently received some feedback from a YANG Doctor that unless you're
going one or two levels back, relative XPaths are fraught with issues.
You should use fully-qualified paths as they look cleaner and are easier
to grok.  Therefore, I think your change is a good one.

Of course, as we get YANG Doc feedback on this, I'm sure things like
this will shake out.

Joe

> _______________________________________________
> OPSAWG mailing list
> [email-masked]
> https://www.ietf.org/mailman/listinfo/opsawg
>