300-435 Question 42
Single answerYou are automating a network configuration using a YANG model for an interface configuration. The YANG model defines the following structure:
module: interface
+--rw interface
+--rw name string
+--rw description? string
+--rw enabled? boolean
You need to create a JSON instance to configure an interface named 'GigabitEthernet0/1' with the description 'Uplink Interface' and enable it. Which JSON instance correctly reflects this configuration?
- A
{ "interface": { "name": "GigabitEthernet0/1", "description": "Uplink Interface", "enabled": true } }
- B
{ "interface": { "name": "GigabitEthernet0/1", "desc": "Uplink Interface", "enabled": true } }
- C
{ "interface": { "name": "GigabitEthernet0/1", "description": "Uplink Interface", "enabled": "true" } }
- D
{ "name": "GigabitEthernet0/1", "description": "Uplink Interface", "enabled": true }
Show answer and explanation
Correct answer: A
Explanation
The correct JSON instance must adhere to the YANG model structure, including proper field names, data types, and hierarchy. The 'interface' container must encapsulate the 'name', 'description', and 'enabled' fields, with 'enabled' being a boolean and the field names matching exactly as defined in the YANG model.
- A. Correct.
This option correctly follows the YANG model structure, using the exact field names ('name', 'description', 'enabled') and correct data types (string for 'name' and 'description', boolean for 'enabled').
- B. Incorrect.
This option incorrectly uses 'desc' instead of 'description', which does not align with the YANG model structure.
- C. Incorrect.
This option uses a string ('"true"') instead of a boolean (true) for the 'enabled' field, which does not conform to the YANG model.
- D. Incorrect.
This option does not encapsulate the fields within the 'interface' container, which violates the YANG model's hierarchy.