简体   繁体   English

如何从YANG语言中的分组中细化节点的强制属性?

[英]How to refine the mandatory property of nodes from a grouping in YANG language?

I defined a grouping which has a leaf with mandatory property set to false. 我定义了一个分组,其叶子的强制属性设置为false。 But in some cases, I would like to use this grouping and specify that the leaf should be mandatory. 但在某些情况下,我想使用此分组并指定叶子应该是必需的。 How do I achieve this in YANG? 我如何在YANG实现这一目标?

You would use the refine statement when specifying a use of your grouping. 在指定分组的使用时,您将使用refine语句。

module mandatory-and-grouping {
  namespace "org:example:mandatory-and-grouping";
  prefix "mag";

  grouping my-grouping {
    leaf my-leaf {
      type string;
    }
  }

  container top {
    uses my-grouping {
      refine my-leaf {
        mandatory true;
      }
    }
  }
}

7.13.2. 7.13.2。 The "refine" Statement “精炼”声明

Some of the properties of each node in the grouping can be refined with the "refine" statement. 可以使用“精简”语句来细化分组中每个节点的一些属性。 The argument is a string that identifies a node in the grouping. 参数是一个字符串,用于标识分组中的节点。 This node is called the refine's target node. 此节点称为精简的目标节点。 If a node in the grouping is not present as a target node of a "refine" statement, it is not refined and thus is used exactly as it was defined in the grouping. 如果分组中的节点不作为“精炼”语句的目标节点存在,则它不会被细化,因此完全按照在分组中定义的方式使用。

The argument string is a descendant schema node identifier (see Section 6.5 ). 参数字符串是后代模式节点标识符(参见第6.5节 )。

The following refinements can be done: 可以进行以下改进:

  • A leaf or choice node may get a default value, or a new default value if it already had one. 叶子或选择节点可能会获得默认值,如果已有,则可以获得新的默认值。

  • A leaf-list node may get a set of default values, or a new set of default values if it already had defaults; 叶子列表节点可以获得一组默认值,或者一组新的默认值(如果它已经有默认值); ie, the set of refined default values replaces the defaults already given. 即,一组精炼的默认值替换已经给出的默认值。

  • Any node may get a specialized "description" string. 任何节点都可以获得专门的“描述”字符串。

  • Any node may get a specialized "reference" string. 任何节点都可以获得专门的“引用”字符串。

  • Any node may get a different "config" statement. 任何节点都可能获得不同的“config”语句。

  • A leaf, anydata, anyxml, or choice node may get a different "mandatory" statement. leaf,anydata,anyxml或choice节点可能会获得不同的“强制”语句。

  • A container node may get a "presence" statement. 容器节点可以获得“存在”语句。

  • A leaf, leaf-list, list, container, anydata, or anyxml node may get additional "must" expressions. 叶子,叶子列表,列表,容器,anydata或anyxml节点可能会获得其他“必须”表达式。

  • A leaf-list or list node may get a different "min-elements" or "max-elements" statement. 叶列表或列表节点可以获得不同的“min-elements”或“max-elements”语句。

  • A leaf, leaf-list, list, container, choice, case, anydata, or anyxml node may get additional "if-feature" expressions. leaf,leaf-list,list,container,choice,case,anydata或anyxml节点可能会获得额外的“if-feature”表达式。

  • Any node can get refined extensions, if the extension allows refinement. 如果扩展允许细化,任何节点都可以获得精炼扩展。 See Section 7.19 for details. 详细信息请参见第7.19节

RFC7950, Section 7.13.2 RFC7950,第7.13.2节

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

相关问题 在Opendaylight中将YANG Tools用作MD-SAL的Java代码生成器 - Use YANG Tools as a Java code generator for MD-SAL in Opendaylight Struts 2 如何从请求中读取参数 - How does Struts 2 read parameters from request Struts 2 中从 SuperAction 到 SubAction 方法的动作类层次结构链 - Action classes hierarchy chaining from SuperAction to SubAction methods in Struts 2 使用复杂对象将Struts2数据从Jsp转移到Action - Struts2 data tranfer from Jsp to Action using Complex Objects 如何在Struts 2中使用ModelDriven提供两种形式 - How to provide two forms using ModelDriven in Struts 2 如何使用 Struts2 REST 插件创建自定义方法 - How to create custom methods using Struts2 REST plugin 如何在CakePHP中的第三个n..n(hasAndBelongsToMany)关系中联接两个表? - How do I join two tables in a third n..n (hasAndBelongsToMany) relationship in CakePHP? Struts 2 ModelDriven用于不同的请求参数名称和bean属性名称 - Struts 2 ModelDriven for different request parameter name and bean property name 出现错误TypeError:无法读取Angular 5模板形式的undefined属性'valid' - getting ERROR TypeError: Cannot read property 'valid' of undefined for Angular 5 template form 如何在 ModelDriven 拦截器中设置 refreshModelBeforeResult? - How to set refreshModelBeforeResult in ModelDriven interceptor?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM