# Leafref node not found

**URL:** <https://dmap-community.ductus.global/t/leafref-node-not-found/1010>\
**Category:** YANG\
**Created:** [February 9, 2017, 10:56am UTC](https://dmap-community.ductus.global/t/leafref-node-not-found/1010 "2017-02-09T10:56:39Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![vipinallawadhi](https://avatars.discourse-cdn.com/v4/letter/v/c68b51/32.png) [@vipinallawadhi](https://dmap-community.ductus.global/u/vipinallawadhi)\
**Post date:** [February 9, 2017, 10:56am UTC](https://dmap-community.ductus.global/t/leafref-node-not-found/1010/1 "2017-02-09T10:56:40Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![jjohansson](https://avatars.discourse-cdn.com/v4/letter/j/b782af/32.png) [@jjohansson](https://dmap-community.ductus.global/u/jjohansson)\
**Post date:** [February 9, 2017, 2:37pm UTC](https://dmap-community.ductus.global/t/leafref-node-not-found/1010/2 "2017-02-09T14:37:02Z")

</div>

If you add either a full absolute path:

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

```

or a relative path:

```auto
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.

---

<div class="post-metadata">

**Author:** ![per](https://avatars.discourse-cdn.com/v4/letter/p/9f8e36/32.png) [@per](https://dmap-community.ductus.global/u/per)\
**Post date:** [February 9, 2017, 5:10pm UTC](https://dmap-community.ductus.global/t/leafref-node-not-found/1010/3 "2017-02-09T17:10:55Z")

</div>

> [@jjohansson](#):
>
> … compiling d.yang succeeds.

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”.

> [@jjohansson](#):
>
> However, in both cases ConfD fail to start

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?

---

<div class="post-metadata">

**Author:** ![jjohansson](https://avatars.discourse-cdn.com/v4/letter/j/b782af/32.png) [@jjohansson](https://dmap-community.ductus.global/u/jjohansson)\
**Post date:** [February 9, 2017, 5:33pm UTC](https://dmap-community.ductus.global/t/leafref-node-not-found/1010/4 "2017-02-09T17:33:43Z")

</div>

> [@per](#):
>
> 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.

---

<div class="post-metadata">

**Author:** ![cohult](https://yyz2.discourse-cdn.com/flex010/user_avatar/dmap-community.ductus.global/cohult/32/221_2.png) [@cohult](https://dmap-community.ductus.global/u/cohult)\
**Post date:** [February 9, 2017, 6:00pm UTC](https://dmap-community.ductus.global/t/leafref-node-not-found/1010/5 "2017-02-09T18:00:32Z")

</div>

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`

```auto
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.

---

<div class="post-metadata">

**Author:** ![per](https://avatars.discourse-cdn.com/v4/letter/p/9f8e36/32.png) [@per](https://dmap-community.ductus.global/u/per)\
**Post date:** [February 9, 2017, 6:07pm UTC](https://dmap-community.ductus.global/t/leafref-node-not-found/1010/6 "2017-02-09T18:07:18Z")

</div>

> [@jjohansson](#):
>
> I’m using ConfD 6.3. I can try upgrading to 6.3.1 and see if that works better.

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

> [@cohult](#):
>
> besides d.yang did you compile a.yang, b.yang, c.yang to fxs too?

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

```

---

<div class="post-metadata">

**Author:** ![jjohansson](https://avatars.discourse-cdn.com/v4/letter/j/b782af/32.png) [@jjohansson](https://dmap-community.ductus.global/u/jjohansson)\
**Post date:** [February 9, 2017, 6:20pm UTC](https://dmap-community.ductus.global/t/leafref-node-not-found/1010/7 "2017-02-09T18:20:55Z")

</div>

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