![](/img/trans.png)
[英]`The standard deviation is zero` error with cor function calling in group_by
[英]Query on yang deviation
我是陽偏的新手。 我寫了一個如下的偏差,但我不確定偏差是否有效。 是否可以在 must 語句中打印文本(xpath 的值)以進行調試? 請幫忙。
deviation "/ns:direction" {
description "Deviation to restrict if the direction is left.";
deviate add
{
must "(<function to print current()>) " {
error-message "Direction is not left.";
description "Direction is not left." ;
}
}
}
檢查您的偏差是否有效的一種典型方法是將您的模塊集提供給 YANG 模式感知驗證器,並簡單地驗證一個實例文檔,以確保您的表達式以所需的方式進行評估。 如果您定制文檔以使您的特定約束失敗,您會期望“沒有離開方向”。 驗證所述文檔期間的錯誤消息。 我想您可以將其稱為 YANG 模式的 YANG 實例文檔測試用例。
module b {
yang-version 1.1;
namespace "b:uri";
prefix b;
container top {
leaf direction {
type enumeration {
enum left;
enum right;
}
}
}
}
module c {
yang-version 1.1;
namespace "c:uri";
prefix "c";
import b {
prefix b;
}
deviation "/b:top/b:direction" {
deviate add {
must ". = 'left'" {
error-message "Direction is not left.";
description "Direction is not left." ;
}
}
}
}
<?xml version="1.0" encoding="utf-8"?>
<config xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
<b:top xmlns:b="b:uri">
<b:direction>right</b:direction>
</b:top>
</config>
Error at (4:5): failed assert at "/nc:config/b:top/b:direction": Direction is not left.
Must 語句是關於實例化數據節點的斷言,因此“調試”它們的唯一方法是將它們扔到實例文檔、設備的配置 + 操作 state、數據存儲內容等。
實際約束是在原始模塊中引入還是在以后通過偏差引入都無關緊要。 偏差只是現有 model 的快速而骯臟的補丁。 您不會在 IETF 發布的模塊中找到任何內容。 如果某些硬件不能支持已發布的 model(硬資源限制)的要求,或者如果您在多個階段實現大型 model,將某些內容標記為“不支持”(尚未),您通常會求助於它們。 他們有幾個注意事項; 它們的應用順序很重要,例如,你應該避免在幾個地方偏離相同的 object,你應該只在只包含偏差的專用模塊(偏差模塊)中定義它們,你應該認為它們是臨時的,等等。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.