为什么 name 类型的叶节点在 yang 模型中不起作用?
Why leaf node with name type does not work in yang model?
我有这个简单的阳模
leaf type {
type string;
description "some description";
}
这是行不通的。有人可以解释一下字符串 'type' 是否对 yang 中的叶名无效吗?
leaf
语句参数必须是标识符,并且没有限制禁止在需要标识符的地方使用 YANG 关键字(所有内置关键字也是标识符)。 leaf type {...}
和 leaf leaf {...}
都是有效的 YANG 语句。
The "leaf" statement is used to define a leaf node in the schema
tree. It takes one argument, which is an identifier, followed by a
block of substatements that holds detailed leaf information.
规范对标识符的描述如下:
Identifiers are used to identify different kinds of YANG items by
name. Each identifier starts with an uppercase or lowercase ASCII
letter or an underscore character, followed by zero or more ASCII
letters, digits, underscore characters, hyphens, and dots.
Implementations MUST support identifiers up to 64 characters in
length and MAY support longer identifiers. Identifiers are case
sensitive. The identifier syntax is formally defined by the rule
"identifier" in Section 14. Identifiers can be specified as quoted
or unquoted strings.
上述语法规则:
identifier = (ALPHA / "_")
*(ALPHA / DIGIT / "_" / "-" / ".")
下面是关于 leaf
语句的命名空间的说明(命名空间在其范围内强加了唯一的名称要求,目的是防止名称冲突):
o All leafs, leaf-lists, lists, containers, choices, rpcs, actions,
notifications, anydatas, and anyxmls defined (directly or through
a "uses" statement) within a parent node or at the top level of
the module or its submodules share the same identifier namespace.
This namespace is scoped to the parent node or module, unless the
parent node is a case node. In that case, the namespace is scoped
to the closest ancestor node that is not a case or choice node.
我有这个简单的阳模
leaf type {
type string;
description "some description";
}
这是行不通的。有人可以解释一下字符串 'type' 是否对 yang 中的叶名无效吗?
leaf
语句参数必须是标识符,并且没有限制禁止在需要标识符的地方使用 YANG 关键字(所有内置关键字也是标识符)。 leaf type {...}
和 leaf leaf {...}
都是有效的 YANG 语句。
The "leaf" statement is used to define a leaf node in the schema tree. It takes one argument, which is an identifier, followed by a block of substatements that holds detailed leaf information.
规范对标识符的描述如下:
Identifiers are used to identify different kinds of YANG items by name. Each identifier starts with an uppercase or lowercase ASCII letter or an underscore character, followed by zero or more ASCII letters, digits, underscore characters, hyphens, and dots. Implementations MUST support identifiers up to 64 characters in length and MAY support longer identifiers. Identifiers are case sensitive. The identifier syntax is formally defined by the rule "identifier" in Section 14. Identifiers can be specified as quoted or unquoted strings.
上述语法规则:
identifier = (ALPHA / "_")
*(ALPHA / DIGIT / "_" / "-" / ".")
下面是关于 leaf
语句的命名空间的说明(命名空间在其范围内强加了唯一的名称要求,目的是防止名称冲突):
o All leafs, leaf-lists, lists, containers, choices, rpcs, actions, notifications, anydatas, and anyxmls defined (directly or through a "uses" statement) within a parent node or at the top level of the module or its submodules share the same identifier namespace. This namespace is scoped to the parent node or module, unless the parent node is a case node. In that case, the namespace is scoped to the closest ancestor node that is not a case or choice node.