Leafref node not found

Hello,

I have following modules:

a.yang:

module a {
      container A {}
}

b.yang:

module b {
   import a;
   augment "a:A" {
      container B {
          leaf name {}
      }
   }
}

c.yang:

module c {
   import a;
   augment "a:A" {
      container C {
          leaf name {}
      }
   }
}

d.yang:

module d {
   import b; import c; import a;
   augment "a:A" {
      container D {
          leaf d1 {
              type leafref {
                  path "b:B/b:name"
              }
          }
          leaf d2 {
              type leafref {
                  path "c:C/c:name"
              }
          }
      }
   }
}

I am getting the following errors:

d.yang : error: b:b in the path for d1 at d.yang is not found
d.yang : error: c:c in the path for d2 at d.yang is not found

please advise what is the issue.

Thanks

If you add either a full absolute path:

type leafref {
  path "/a:A/b:B/b:name"
}

or a relative path:

type leafref {
   path "../../b:B/b:name"
}

… compiling d.yang succeeds.

However, in both cases ConfD fail to start with the error message "Internal error: Startup failed; probably due to incorrect installation" and the error code Daemon died status=19 after loading d.fxs.

It looks like a bug, either in the yang compiler or in the ConfD daemon.

There are many more changes needed for the compilation to succeed, of course - it sure saves time if the actual YANG modules are provided, rather than just an “outline”.

I can’t reproduce this - starting as well as exercising the leafrefs works fine for me:

confd# config 
Entering configuration mode terminal
confd(config)# A B name foo 
confd(config)# A C name bar 
confd(config)# A D d1 foo d2 bar 
confd(config)# commit
Commit complete.
confd(config)# 

(Completion works as expected on the “A D …” line.)

Which version of ConfD are you using?

I’m using ConfD 6.3. I can try upgrading to 6.3.1 and see if that works better.

J, besides d.yang did you compile a.yang, b.yang, c.yang to fxs too?

$ cat a.yang b.yang c.yang d.yang

module a {
   namespace "http://a.com";
   prefix a;
   container A {}
}

module b {
   namespace "http://b.com";
   prefix b;
   import a { prefix a; }
   augment "/a:A" {
      container B {
          leaf name { type string; }
      }
   }
}

module c {
   namespace "http://c.com";
   prefix c;
   import a { prefix a;}
   augment "/a:A" {
      container C {
          leaf name { type string; }
      }
   }
}

module d {
   namespace "http://d.com";
   prefix d;
   import b { prefix b; } 
   import c { prefix c; }
   import a { prefix a; }
   augment "/a:A" {
      container D {
          leaf d1 {
              type leafref {
                  path "../../b:B/b:name";
              }
          }
          leaf d2 {
              type leafref {
                  path "../../c:C/c:name";
              }
          }
      }
   }
}

Works fine just as Per reports.

I used 6.3.1, but 6.3 also works fine for me.

Ah, good catch! Without them I also get the ugly error (though arguably it is an incorrect installation, sort of:-). Fixed in 6.3.1:

The namespace urn:a (referenced by urn:d) could not be found in the loadPath.
Daemon died status=21

Jepp, that’s it. Thank’s Conny!