11-05-2018 04:24 PM - edited 03-01-2019 04:14 AM
Based on YANG 1.1, you can make a container and all the leafs under the container as mandatory, eg:
container rsp {
mandatory true;
leaf interface {
type string;
}
leaf logicalInterfaceId {
type uint16;
}
}
But I got error when try to run the make:
error: unexpected keyword 'mandatory'
So how to make a container and all the leaf under the container as mandatory in NSO?
Solved! Go to Solution.
11-06-2018 12:46 AM
I might be mistake, but RFC7950 states:
7.5.2. The container's Substatements
+--------------+---------+-------------+
| substatement | section | cardinality |
+--------------+---------+-------------+
| action | 7.15 | 0..n |
| anydata | 7.10 | 0..n |
| anyxml | 7.11 | 0..n |
| choice | 7.9 | 0..n |
| config | 7.21.1 | 0..1 |
| container | 7.5 | 0..n |
| description | 7.21.3 | 0..1 |
| grouping | 7.12 | 0..n |
| if-feature | 7.20.2 | 0..n |
| leaf | 7.6 | 0..n |
| leaf-list | 7.7 | 0..n |
| list | 7.8 | 0..n |
| must | 7.5.3 | 0..n |
| notification | 7.16 | 0..n |
| presence | 7.5.5 | 0..1 |
| reference | 7.21.4 | 0..1 |
| status | 7.21.2 | 0..1 |
| typedef | 7.3 | 0..n |
| uses | 7.13 | 0..n |
| when | 7.21.5 | 0..1 |
+--------------+---------+-------------+
I do not see a mandatory statement there. Am I missing some later revision of the standard?
Anyhow, a (non-presence) container is mandatory if at least one leaf is mandatory, so you can achieve the same effect by making all leafs in the container mandatory.
11-06-2018 12:46 AM
I might be mistake, but RFC7950 states:
7.5.2. The container's Substatements
+--------------+---------+-------------+
| substatement | section | cardinality |
+--------------+---------+-------------+
| action | 7.15 | 0..n |
| anydata | 7.10 | 0..n |
| anyxml | 7.11 | 0..n |
| choice | 7.9 | 0..n |
| config | 7.21.1 | 0..1 |
| container | 7.5 | 0..n |
| description | 7.21.3 | 0..1 |
| grouping | 7.12 | 0..n |
| if-feature | 7.20.2 | 0..n |
| leaf | 7.6 | 0..n |
| leaf-list | 7.7 | 0..n |
| list | 7.8 | 0..n |
| must | 7.5.3 | 0..n |
| notification | 7.16 | 0..n |
| presence | 7.5.5 | 0..1 |
| reference | 7.21.4 | 0..1 |
| status | 7.21.2 | 0..1 |
| typedef | 7.3 | 0..n |
| uses | 7.13 | 0..n |
| when | 7.21.5 | 0..1 |
+--------------+---------+-------------+
I do not see a mandatory statement there. Am I missing some later revision of the standard?
Anyhow, a (non-presence) container is mandatory if at least one leaf is mandatory, so you can achieve the same effect by making all leafs in the container mandatory.
11-06-2018 02:24 PM
Hi Vleijon,
Thank you very much for your reply!
The container's mandatory statement seems someone's suggestion to the standard:
https://www.ietf.org/mail-archive/web/netmod/current/msg09786.html
Somehow it makes sense to me.
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide