the order can be solved with display-when statement, e.g.
container main {
leaf l1 {
tailf:display-when "(../l2 and ../l3) or not(../l2)";
type uint32;
}
leaf l2 {
type uint32;
tailf:cli-reset-container;
tailf:display-when "../l1 or ../l3";
}
leaf l3 {
tailf:display-when "(../l2 and ../l1) or not(../l1)";
type uint32;
}
}
This only works before leafs are configured for the first time.
I do not know if there is any way to reset them (as last leaf can be treated as first one).