简体   繁体   English

config=false 节点强制时

[英]config=false node when mandatory

I have a Yang model which defines a config=false node which is mandatory too.我有一个 Yang 模型,它定义了一个 config=false 节点,这也是强制性的。 Should I return that node as an empty XML node in get rpc response, even when my app does not support it?我是否应该在 get rpc 响应中将该节点作为空 XML 节点返回,即使我的应用程序不支持它?

Ideally my app is supposed to support it, but due to limitations we cannot implement the required support.理想情况下,我的应用程序应该支持它,但由于限制,我们无法实现所需的支持。 So what should be the right way to handle such cases?那么处理这种情况的正确方法应该是什么? Should we emit/represent it in get rpc response as an empty XML node?我们应该在 get rpc 响应中发出/表示它作为一个空的 XML 节点吗? I guess if we ignore such nodes, the external controller may fail the get rpc response.我想如果我们忽略这样的节点,外部控制器可能会导致 get rpc 响应失败。

-Ram -内存

If your server implementation does not support a specific node in the original model, you should create a deviation YANG module, which expresses this limitation.如果您的服务器实现不支持原始模型中的特定节点,您应该创建一个偏差 YANG 模块,它表示此限制。 This way clients are informed about it and everyone is happy - you of course advertise your deviation module along with the deviated one.通过这种方式,客户被告知它并且每个人都很高兴 - 您当然可以将您的偏差模块与偏差模块一起宣传。

For example:例如:

module target {
  yang-version 1.1;
  namespace "target:uri";
  prefix "tgt";

  container state {
    config false;
    leaf some-counter {
      type uint64;
      mandatory true;
    }
  }
}

Let's say your device cannot support some-counter leaf above.假设您的设备不能支持上面的some-counter叶子。 You then create create a deviation module, which describes how your implementation differs from a compliant implementation.然后创建偏差模块,该模块描述您的实施与合规实施有何不同。

module target-dev {
  yang-version 1.1;
  namespace "target-dev:uri";
  prefix "tgtd";

  import target {
    prefix tgt;
  }

  deviation "/tgt:state/tgt:some-counter" {
    deviate not-supported;
  }
}

When a get request comes, you return nothing for that leaf, since it does not exist in your implementation's world.当 get 请求到来时,您不会为该叶子返回任何内容,因为它在您的实现世界中不存在。

The details of deviation and deviate statements may be found in RFC7950: deviationdeviate语句的详细信息可以在 RFC7950 中找到:

You should be very careful when relying on this mechanism!依赖此机制时,您应该非常小心! Always create a separate module, which contains only the deviations, possibly deviating a single target module.始终创建一个单独的模块,其中只包含偏差,可能会偏离单个目标模块。 There is a guidelines document you should read just in case.有一份指导文件,您应该阅读以防万一。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM