300-435 Question 44
Single answerYou are tasked with automating the configuration of a network device using a YANG model. You are provided with a JSON instance to validate against the YANG model. Which of the following JSON instances correctly adheres to a YANG model for configuring an interface with the name 'GigabitEthernet1' and an IP address of '192.168.1.1/24'?
- A
{ "interface": { "name": "GigabitEthernet1", "config": { "ip-address": "192.168.1.1", "subnet-mask": "255.255.255.0" } } }
- B
{ "interface": { "name": "GigabitEthernet1", "config": { "address": "192.168.1.1/24" } } }
- C
{ "interfaces": { "interface": [ { "name": "GigabitEthernet1", "config": { "ip-address": "192.168.1.1/24" } } ] } }
- D
{ "interfaces": { "interface": [ { "name": "GigabitEthernet1", "config": { "address": "192.168.1.1", "prefix-length": "24" } } ] } }
Show answer and explanation
Correct answer: C
Explanation
YANG models define a specific structure for data modeling in network configurations. In this case, the correct JSON instance ('Option 3') adheres to the expected YANG model structure, which includes a top-level 'interfaces' container, a list of 'interface' objects, and a nested 'config' object where the 'ip-address' field combines both the IP address and prefix length.
- A. Incorrect.
This JSON instance incorrectly specifies separate 'ip-address' and 'subnet-mask' fields, which do not align with the common YANG models that combine address and prefix length.
- B. Incorrect.
While the structure is close, it uses 'address' as a single field without adhering to the standard 'interfaces' container and 'interface' list structure expected in many YANG models.
- C. Correct.
This is the correct JSON instance as it aligns with the common YANG model structure, which includes 'interfaces' as a container, 'interface' as a list, and properly nests the 'config' object with the 'ip-address' field.
- D. Incorrect.
This JSON instance incorrectly specifies separate 'address' and 'prefix-length' fields, which do not align with the typical YANG model structure that combines the address and prefix length into a single field.