Is there any tail-f extension to copy leaf value which is defined outside the container and set the same as value for another leaf present inside the container?
Thanks in advance!
Not sure if you meant something similar to a symbolic link in Linux as opposed to the actual copy operation as YANG is a data modeling language and doesn’t support any operations at runtime.
The Tail-f extension for symbolic link is:
tailf:link target
This statement specifies that the data node should be implemented as a link to another data node, called the target data node. This means that whenever the node is modified, the system modifies the target data node instead, and whenever the data node is read, the system returns the value of target data node.
Hi Waitai,
Thanks for your input!
Here, my source node is a list key and target node is a leaf, as shown below
So I want to understand what value will leaf x(target) hold, if
list 1st instance, if-name(source) is set as ‘ge0/0’
list 2nd instance, if-name(source) is set as ‘fe0/0’
list 3rd instance, if-name(source) is set as ‘ge0/1’
And also, how could we restrict user from entering value for the target(leaf x)? do we need to change its type or add any tailf extension ?
list a{
key "if-name";
leaf if-name {
type leafref { path "./wan:interface/wan:name";}
tailf:link "../c/x";
}
container b{
container c{
leaf x{
type string;
}
}
}
}