300-435 Question 52
Single answerYou are analyzing a YANG module tree generated per RFC8340. The tree includes the following structure:
module: example-module
+--rw devices
+--rw device* [name]
+--rw name string
+--rw ip-address inet:ipv4-address
+--rw config
+--rw hostname string
Based on this structure, which statement is true about the device list and its attributes?
- A
The
devicelist is keyed using thenameattribute, which must be unique. - B
The
ip-addressunderdeviceis used as the unique key for the list. - C
The
hostnameattribute is mandatory for all devices in the list. - D
The
configcontainer withindeviceis a read-only element.
Show answer and explanation
Correct answer: A
Explanation
The YANG module tree indicates that the device list uses the name attribute as its key, as denoted by * [name]. Keys in YANG lists must be unique to differentiate entries. Other elements, such as ip-address and hostname, are data nodes or part of containers but do not serve as keys. Furthermore, the config container is explicitly marked as read-write (rw), confirming it is not read-only.
- A. Correct.
Correct: The
devicelist is keyed using thenameattribute, as indicated by the* [name]notation in the YANG module tree. This means that eachdeviceentry must have a uniquenamevalue. - B. Incorrect.
Incorrect: The
ip-addressis not a key for thedevicelist. It is simply a data node within the list and does not determine uniqueness. - C. Incorrect.
Incorrect: The
hostnameattribute is part of theconfigcontainer and is not mandatory unless explicitly enforced by additional constraints, which are not shown in the provided tree. - D. Incorrect.
Incorrect: The
configcontainer is marked as read-write (rw), meaning it is writable and not read-only.