02-13-2020 07:33 AM
Hello,
I have the following yang file, where I am trying to model the connection between a device and its neighbors:
module cr-art {
list cr-art {
key DEVICE;
leaf DEVICE {
type leafref {
path "/ncs:devices/ncs:device/ncs:name";
}
}
list NEIGHBOR_ROUTER {
key NAME;
leaf NAME {
type leafref {
must "current() != ../../DEVICE"{}
path "/ncs:devices/ncs:device/ncs:name";
}
}
list AGGR_INT {
key NAME_AGGR_INT;
leaf NAME_AGGR_INT {
type leafref {
path "/cr-art:cr-art[DEVICE=current()/../../NAME]/cr-art:NEIGHBOR_ROUTER[NAME=current()/../../../DEVICE]/cr-art:AGGR_INT/cr-art:REMOTE_AGGR_INT";
}
}
leaf REMOTE_AGGR_INT {
type string;
}
}
}
}
}The leafref in "NAME_AGGR_INT" is working as expected, ie, if I am configuring a device, for "NAME_AGGR_INT" I get the list of ""REMOTE_AGGR_INT" previously defined in the neighbor device.
However, that becomes a problem when configuring the 'original' device, since no other router has it configured as a neighbor, so the leafref is empty.
Is there a way to choose "NAME_AGGR_INT" among the "REMOTE_AGGR_INT" configured in the neighbors if there is any, and just type a string if the leafref is empty?
Thanks.
02-13-2020 08:11 AM
02-13-2020 08:41 AM
Hi,
Thanks four your answer.
I will try your suggestion regarding tailf:no-leafref-check / tailf:non-strict-leafref.
I do not think the second approach will work, since I am not able to even configure the first device without having configured its neighbor first.
Best regards.
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide