Using tailf:link to link two leafs across list within the same container

I’m trying to link the leaf in list B to the leaf in list A, within the same container using tailf:link
After I loaded the values, the list A has entries but list B has no entries.

container link-test {
  tailf:cdb-oper {
    tailf:persistent true;
  }
  config false;

  list A {
    key leaf-1;
    config false;
    tailf:cdb-oper {
      tailf:persistent true;
    }
    leaf leaf-1 {
      type uint16;
      tailf:info "Testing tailflink";
    }
  }
  list B {
    key leaf-1;
    config false;
    tailf:cdb-oper {
      tailf:persistent true;
    }
    leaf leaf-1 {
      type uint16;
      tailf:info "Testing tailflink";
      tailf:link "/gvdtest:link-test/A[leaf-1=current()/../leaf-1]/leaf-1";
    }
  }
}

The CLI output is as follows

root@GVD 06:51:46> show link-test A
LEAF  LEAF
1     2
------------
1     2
10    20

[ok][2019-04-10 06:51:49]
root@GVD 06:51:49> show link-test B
% No entries found.
[ok][2019-04-10 06:51:52]
root@GVD 06:51:52>

Is something wrong in the way the tailf:link is used? Can tailf:link be used in this scenario?

@nabil @mnovak Any help here ???
Thanks

Links can’t be expected to work like this. A link can be used to mirror a leaf or leaf-list value changes, but what you essentialy want it to do is to mirror a list instance creation and deletion - this cannot be done with links. A link statement says that the leaf value must mirror the target leaf value - as long as the leaf’s parent container exists, which in your case is somewhat trivial statement, since both the source and the target leaves are list keys.

In my opinion, if there is a misbehavior on the ConfD side, it is that it does not warn you at the compile time that this kind of link probably does not do what you want it to do.

Forgot to add: if you want to achieve this “list instance mirroring” behavior, you might need to implement a relatively simple data provider.

data provider ~=~ transformation :slight_smile: