【发布时间】:2019-01-25 16:00:34
【问题描述】:
我的 CLI 限制存在问题。我一直在调查 yang RFC7950 (https://www.rfc-editor.org/rfc/rfc7950),但什么也没找到。
这是一个例子。
grouping httpGroup {
list http-list{
key "value";
leaf value {
status current { yexte:preliminary; }
description "value to match";
must "(not(../protocol)) and (not(../network-port)))" {
error-message "Not compatible with protocol or non-TCP ports";
}
type string { length "1..255"; }
}
}
}
该组将包含在具有以下结构的多个组中:
list and {
leaf-list protocol { ..... }
uses A;
list or {
leaf-list protocol { ..... }
uses A;
}
}
grouping A {
status{}
leaf-list protocol { ..... }
leaf-list X { ..... }
uses httpGroup;
}
我需要在 httpGroup 中包含这个必须条件来验证协议值是否未在层次结构的任何级别中配置。
我已经添加了更多的亲戚路径来搜索这个节点:
// same level
not(../protocol)
// next level
not(../and/protocol)
not(../or/protocol)
// previous level
not(../../protocol)
not(../../protocol)
//recursively down previous level
not(../../and/protocol)
not(../../or/protocol)
// third level
not(../and/or/protocol)
not(../and/and/protocol)
如您所见,这根本不是一个干净的解决方案。
有什么方法可以为整个层次结构完成,例如:
if protocol node exists and http-list exists then error.
提前谢谢你。
【问题讨论】:
-
您的结构示例没有意义。您不能在列表
and中使用分组A,因为它试图定义重复的protocol叶列表子级。请澄清这一点。
标签: ietf-netmod-yang