300-435 Question 46
Single answerYou are tasked with generating an XML instance based on a YANG model for a network configuration. Using YANG Suite, you have the following YANG model fragment for an interface configuration:
module example-interface {
namespace "urn:example:interface";
prefix "iface";
container interfaces {
list interface {
key "name";
leaf name {
type string;
}
leaf enabled {
type boolean;
}
}
}
}
Which of the following XML instances correctly represents an interface named 'GigabitEthernet1' that is enabled?
- A
GigabitEthernet1 true - B
GigabitEthernet1 True - C
GigabitEthernet1 true - D
true
Show answer and explanation
Correct answer: A
Explanation
The correct XML instance must adhere to the structure defined by the YANG model. The 'interfaces' container wraps the 'interface' list, the 'name' leaf is mandatory as the key, and the 'enabled' leaf must use the correct boolean format ('true' or 'false'). Option 1 is the only XML instance that satisfies all these requirements.
- A. Correct.
This is the correct XML instance as it accurately reflects the YANG model structure. The 'interfaces' container wraps the 'interface' list, and the 'enabled' value is correctly represented as 'true', matching the expected boolean format in XML.
- B. Incorrect.
Although this option looks correct, the 'enabled' value uses 'True' with an uppercase 'T', which does not conform to the standard boolean representation in XML (case-sensitive).
- C. Incorrect.
This option is incorrect because it omits the 'interfaces' container, which is required by the YANG model structure.
- D. Incorrect.
This option is incorrect because it omits the 'name' leaf, which is a required key as per the YANG model.