【发布时间】:2016-11-23 10:47:25
【问题描述】:
我不知道如何为叶子创建一个“必须”,使其在列表中独一无二。
这是一个包含叶子的列表,这个叶子可能与这个列表中的任何其他叶子的值不同。
代码示例:
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";
}
}
}
因此,如果 myList 中已经存在具有当前值的元素,我希望 myLeaf 触发错误消息。
【问题讨论】: