如果列表在分组中,为什么 pyang 验证允许定义没有有效键的列表?

Why does pyang validation allow to define a list without a valid key if the list is in a grouping?

RFC6020 说:

The "key" statement [...] takes as an argument a string that specifies a space-separated list of leaf identifiers of this list. [...] Each such leaf identifier MUST refer to a child leaf of the list. The leafs can be defined directly in substatements to the list, or in groupings used in the list.

尽管如此,还是有可能在 pyang 中成功验证以下分组:

grouping my-grouping {
    list my-list-in-a-grouping {
        key there-is-no-such-leaf;
    }
}

如果列表在分组之外,或者如果我在没有任何扩充的情况下使用分组,则会出现错误(这是预期的):

error: the key "there-is-no-such-leaf" does not reference an existing leaf

分组需要扩充才能使用有什么意义?

会不会是因为grouping不是数据定义节点,pyang只验证这样的节点?[​​=13=]

The grouping statement is not a data definition statement and, as such, does not define any nodes in the schema tree.

RFC6020

根据相关 RFC 的作者 Martin Bjorklund 的说法,这是 not valid YANG。由于其实现中的错误,Pyang 未能检测到这一点。您在问题中引用的 RFC 文本不允许任何其他解释,并且似乎是有意的。从来没有打算以这种方式使用分组。