我的模型有两个属性:
我想具体说明的是:
我该如何用 yang 来表达这个意思?
YANG 中没有条件default
值 -default
对于两个defaults
具有不同值的语句,您需要两个语句,并且单个语句leaf
可能只有一个子default
语句。不过,您可以解决这个问题。也许通过使用 apresence container
而不是您的协议leaf
:
module conditional-default {
namespace "http://example.com/conditional-default";
prefix "excd";
grouping common {
leaf port {
type int32;
}
}
container config {
container ssh {
presence "If this container is present, ssh is configured.";
uses common {
refine port {
default 22;
}
}
}
container http {
presence "If this container is present, http is configured.";
uses common {
refine port {
default 80;
}
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
来自 RFC6020,7.5.5:
“存在”语句为数据树中容器的存在赋予含义。它采用一个字符串作为参数,其中包含节点存在含义的文本描述。
归档时间: |
|
查看次数: |
2520 次 |
最近记录: |