是否可以在我们可以使用算术运算的 YANG 文件中包含 must 语句?
Is it possible to have a must statement in a YANG file where we can use arithmetic operations?
我可以在 YANG 文件的 must 语句中使用算术运算吗?
示例:
container interface {
leaf ifNumber{
type uint32;
}
must "ifNumber" % 8 = 0 {
error-message "Must be multiple of 8";
}
}
是的,这是可能的。你可以使用 mod 关键字吗?
参见 link:https://www.w3.org/TR/1999/REC-xpath-19991116/#NT-AdditiveExpr
章节:3.5 数字
container interface {
leaf ifNumber{
type uint32;
}
must "number(ifNumber) mod 8 = 0" {
error-message "Must be multiple of 8";
}
}
我可以在 YANG 文件的 must 语句中使用算术运算吗? 示例:
container interface {
leaf ifNumber{
type uint32;
}
must "ifNumber" % 8 = 0 {
error-message "Must be multiple of 8";
}
}
是的,这是可能的。你可以使用 mod 关键字吗? 参见 link:https://www.w3.org/TR/1999/REC-xpath-19991116/#NT-AdditiveExpr 章节:3.5 数字
container interface {
leaf ifNumber{
type uint32;
}
must "number(ifNumber) mod 8 = 0" {
error-message "Must be multiple of 8";
}
}