简体   繁体   English

YANG模块可以在分组中包含一个列表吗?

[英]Can the YANG module have a list inside a grouping?

My code is as follows. 我的代码如下。

1. 1。

grouping policy-attributes {
    container qospolicies {
        list qospolicy {
            key "uuid";
            uses attrs:base-attributes;
            uses qos-policy-attributes;
            uses bandwidth-limit-attributes;
            uses dscp-marking-attributes;
        }
    }
}

The grouping with the list 与列表分组

2. 2。

grouping bandwidth-limit-rules-attributes {
    list bandwidth-limit-rule{
    leaf qos-rule-id {
        type yang:uuid;
        description "The rule id of the associated rule";
    }
    leaf max-kbps {
        type uint64;
        description "The maximum KBPS value";
    }
    leaf max-burst-kbps {
        type uint64;
        description "The burst over the maximum KBPS value";
    }
    leaf policy-id {
        type yang:uuid;
        description "The policy id to which the rule is associated";
    }
    }
}

3. 3。

grouping dscp-marking-rules-attributes {
    list dscp-marking-rule{
    leaf qos-rule-id {
        type yang:uuid;
        description "The rule id of the associated rule";
    }
    leaf dscp-mark {
        type uint8{
        range "0 | 8 | 10 | 12 | 14 | 16 | 18 | 20 | 22 | 24 | 26 | 28 | 30 | 32 | 34 | 36 | 38
        | 40 | 46 | 48 | 56 ";}
        description "the value of dscp mark";
    }
    leaf policy-id {
        type yang:uuid;
        description "the policy id to which the rule is associated";
    }
    }
}

The grouping bandwidth-limit-rules-attributes has the list with leaves. 分组bandwidth-limit-rules-attributes具有带叶子的列表。 Also the bandwidth-limit-rules-attributes is used in the grouping policy-attributes . 同样,在分组policy-attributes bandwidth-limit-rules-attributes中使用了bandwidth-limit-rules-attributes policy-attributes I would like to know if it is valid to have the bandwidth-limit-rules-attributes in policy-attributes . 我想知道在policy-attributes具有bandwidth-limit-rules-attributes是否有效。

Yes, you can have a list as a substatement to a grouping . 是的,您可以将list作为grouping的子语句。 Here's the list of possible substatements for a grouping from RFC6020 (YANG 1.0). 这是RFC6020 (YANG 1.0)中grouping的可能子语句的列表。

 +--------------+---------+-------------+
 | substatement | section | cardinality |
 +--------------+---------+-------------+
 | anyxml       | 7.10    | 0..n        |
 | choice       | 7.9     | 0..n        |
 | container    | 7.5     | 0..n        |
 | description  | 7.19.3  | 0..1        |
 | grouping     | 7.11    | 0..n        |
 | leaf         | 7.6     | 0..n        |
 | leaf-list    | 7.7     | 0..n        |
 | list         | 7.8     | 0..n        | <--
 | reference    | 7.19.4  | 0..1        |
 | status       | 7.19.2  | 0..1        |
 | typedef      | 7.3     | 0..n        |
 | uses         | 7.12    | 0..n        |
 +--------------+---------+-------------+

Using the grouping inside your policy-attributes grouping is also valid: policy-attributes分组中使用分组也是有效的:

grouping policy-attributes {
    container qospolicies {
        list qospolicy {
            key uuid;
            /*
            uses attrs:base-attributes;
            uses qos-policy-attributes;
            uses bandwidth-limit-attributes;
            uses dscp-marking-attributes;
            */
            uses bandwidth-limit-rules-attributes;
        }
    }
}

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

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