300-435 Question 50
Single answerYou are working with a YANG module for configuring network interfaces, and you have generated a YANG module tree as per RFC8340. The output is as follows:
module: example-interface +--rw interfaces +--rw interface* [name] +--rw name string +--rw description? string +--rw enabled? boolean +--rw ipv4 +--rw address* string
Based on this tree, which statement is correct about the 'interface' list?
- A
The 'interface' list contains mandatory nodes that must always be configured.
- B
The 'interface' list is indexed by the 'name' node, which is a key.
- C
The 'ipv4' container must always be configured for each interface.
- D
The 'description' node is optional and may not always be present.
Show answer and explanation
Correct answer: B
Explanation
The YANG module tree generated per RFC8340 uses the '[name]' notation to indicate that 'name' is the key for the 'interface' list. Therefore, the list is indexed by the 'name' node. Understanding how YANG modules define keys and optional nodes is crucial for interpreting YANG module trees in network automation.
- A. Incorrect.
This is incorrect because the YANG module tree indicates optional nodes (e.g., 'description' and 'enabled'), which means not all nodes are mandatory for the 'interface' list.
- B. Correct.
This is correct because the '[name]' notation in the YANG tree specifies that the 'interface' list uses 'name' as the key for each item.
- C. Incorrect.
This is incorrect because the 'ipv4' container is not marked as mandatory in the YANG module tree and therefore does not need to be configured for every interface.
- D. Incorrect.
This is incorrect because while 'description' is indeed optional, it does not explain the indexing of the 'interface' list, which is the focus of the question.