Tailf:link to leaves inside a list

I want to create a list, which will link to another list.
a-module.yang contains the main list:

module a-module {
    namespace "http://tail-f.com/ns/example/linked-to";
    prefix a;
    list a-list {
        key a-leaf;
        leaf a-leaf {
            type uint32;
        }
        leaf a-leaf2 {
            type uint32;
            mandatory true;
        }
        leaf a-leaf3 {
            type uint32;
            mandatory true;
        }
    }
}


b-module.yang contains the list which link:

module b-module {
    namespace "http://tail-f.com/ns/example/linked-from";
    prefix b;
    import tailf-common { prefix tailf; }
    import a-module { prefix a; }
    list b-list {
        key b-leaf;
        leaf b-leaf {
            tailf:link "/a:a-list[a-leaf=current()../b-leaf]/a-leaf";
            type uint32;
        }
        leaf b-leaf2 {
            type uint32;
            tailf:link "/a:a-list[a-leaf=current()../b-leaf]/a-leaf2";
            mandatory true;
        }
    }
}

Now,

  1. When I’m trying to commit to b-list I have a problem:

    Aborted: ‘b-list b-leaf2’: destination instance ‘a-list a-leaf2’ does not exist
    Which is true (I think), because it’s not yet created.
    Is there a way to solve it?

  2. When I’m doing show running-config b-list I see no entries (I mean, not the entries I inserted in a-list)

Is this supposed to work? Should I change something?

Thanks

– edit –
I tried using leafref, but for some reason it says:

error: bad argument value "/a:a-list[a-leaf=current()../b-leaf]/a-leaf", should be of type path-arg

See RFC6020 Section 9.9.2 “The path Statement”

tailf:link will not create list instances for you. the tailf:symlink feature is, as I understand your description, what you are looking for. The tailf:symlink feature is for good reasons not recommended to be used however.

As the ConfD UG states in Chapter 10.8. tailf:symlink “The usage of symlink is not recommended. If it is used, use it carefully. It can be made to work in some special cases, but some other use cases, described below, are problematic. In the problematic cases, tailf:link can often be used instead. See Section 10.8.1, “Discussion” for more details.”

1 Like

Conny, I’m using the same link path for tailf:link and for leafref.
tailf:link works while leafref doesn’t.

Should be any difference?

Looks like I follow the path statement rules.

You are almost. You are just missing a “/” after “current()”

I tried that, doesn’t work : (

Hi Cohult,

I would like to know the difference between tailf:link and leafref.

Could you please help!

Thanks in advance!