I cant figure out how to create a "must" for a leaf that makes it unique in a list.
This is list with a leaf in it, this leaf may not have the same value as any other leaf in this list.
Example of code:
list myList {
key name;
leaf name {
type uint32;
}
container myContainer {
leaf myLeaf {
type uint32;
}
must "count(/myList/myContainer/myLeaf = .) > 1" { //Dont know how to create this must function.
error-message "myLeaf needs to be unique in the myList list";
}
}
}
So i want myLeaf to trigger the error-message if there already exist an element in myList with the current value.