简体   繁体   English

如何在YANG模型的分组中为每个容器下特定的订单?

[英]How to put specific order for each container inside a grouping in YANG model?

Is there any way to specify the order of containers inside a grouping, instead of letting the system do it randomly? 有什么方法可以指定分组内容器的顺序,而不是让系统随机进行?

Example: 例:

grouping common-config-def {
    container myContent1 {
      uses myContent1-def;
    }
    container myContent2 {
      uses myContent2-def;
    }
    container myContent3 {
      uses myContent3-def;
    }    
}

The answer is no, you have no control over this, but most implementations will probably follow definition order when consuming the model. 答案是否定的,您对此没有控制权,但是使用模型时,大多数实现可能会遵循定义顺序。

Not sure why such a requirement would be needed, but I'm assuming the issue is model-based instance data encoding. 不知道为什么需要这样的要求,但是我假设问题是基于模型的实例数据编码。 When encoding data, the data nodes may appear in any order with the exception of RPC/action input and output data, list key data nodes and "ordered-by user" list entries. 在对数据进行编码时,数据节点可以以任何顺序出现,但RPC /动作输入和输出数据,列表关键数据节点和“按用户排序”列表条目除外。

The specification is quite clear on this, for example, if your grouping were to be used in a container, the following would apply when encoding the data of that container: 例如,如果要在容器中使用您的分组,那么在该容器上使用该分组的规范非常明确:

The container's child nodes are encoded as subelements to the container element. 容器的子节点被编码为容器元素的子元素。 If the container defines RPC or action input or output parameters, these subelements are encoded in the same order as they are defined within the "container" statement. 如果容器定义RPC或操作输入或输出参数,则这些子元素的编码顺序与在“容器”语句中定义的顺序相同。 Otherwise, the subelements are encoded in any order. 否则,子元素将以任何顺序编码。

RFC7950, Section 7.5.7. RFC7950,第7.5.7节。

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

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