300-435 Question 40
Single answerYou are using Cisco YANG Suite to interact with a network device configured with a YANG model. You need to retrieve interface details in JSON format. Which JSON instance below correctly represents the data based on the YANG model for an interface configuration?
- A
{ "interfaces": { "interface": [ { "name": "GigabitEthernet1", "description": "Uplink", "enabled": true } ] } }
- B
{ "interfaces": { "interface": { "name": "GigabitEthernet1", "description": "Uplink", "status": "enabled" } } }
- C
{ "interface": [ { "name": "GigabitEthernet1", "description": "Uplink", "enabled": true } ] }
- D
{ "interface": { "name": "GigabitEthernet1", "description": "Uplink" } }
Show answer and explanation
Correct answer: A
Explanation
The correct JSON instance must adhere to the hierarchy and structure defined by the YANG model. In this case, the parent container 'interfaces' and the array 'interface' are mandated by the YANG model for representing interface configurations. Furthermore, all required keys, such as 'name', 'description', and 'enabled', must be included.
- A. Correct.
This is the correct JSON instance as it properly adheres to the YANG model structure, including the correct hierarchy and naming conventions for the interface configuration.
- B. Incorrect.
This JSON instance is incorrect because the 'status' key is not valid according to the YANG model, and the 'interface' key should be an array, not an object.
- C. Incorrect.
This JSON instance is incorrect because it lacks the parent 'interfaces' container, which is required by the YANG model.
- D. Incorrect.
This JSON instance is incorrect because it is missing the required 'enabled' key and does not follow the YANG model hierarchy.