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

时间:2016-06-15 22:58:08

标签: ietf-netmod-yang

我的代码如下。

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;
        }
    }
}

使用列表进行分组

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

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";
    }
    }
}

分组bandwidth-limit-rules-attributes包含带叶子的列表。此外,bandwidth-limit-rules-attributes用于分组policy-attributes。我想知道bandwidth-limit-rules-attributes中的policy-attributes是否有效。

1 个答案:

答案 0 :(得分:0)

是的,您可以list作为grouping的子语句。以下是来自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        |
 +--------------+---------+-------------+

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;
        }
    }
}