300-435 Question 45
Single answerYou are working on a Cisco network automation project and are provided with a YANG model defining the configuration of network interfaces. Using YANG Suite, you generate an XML instance for an interface configuration. Which XML instance correctly conforms to the following YANG model snippet?
module interface-config {
namespace "urn:ietf:params:xml:ns:yang:interface-config";
prefix intf;
container interface {
leaf name {
type string;
}
leaf enabled {
type boolean;
}
}
}
Select the XML instance that matches this model.
- A
GigabitEthernet1 true - B
GigabitEthernet1 true - C
<intf:interface xmlns:intf="urn:ietf:params:xml:ns:yang:interface-config">
GigabitEthernet1 true </intf:interface> - D
intf:interface
GigabitEthernet1 true </intf:interface>
Show answer and explanation
Correct answer: C
Explanation
The correct XML instance must match the structure and naming defined in the YANG model, including the root element, leaf names, and namespace declaration. Option 3 includes the correct namespace declaration, root element ('interface'), and leaf names ('name' and 'enabled'), making it the valid XML instance for the provided YANG model.
- A. Incorrect.
This XML instance is missing the namespace declaration for the YANG module, making it invalid for the given YANG model.
- B. Incorrect.
This XML instance uses the wrong root element 'interface-config' instead of 'interface', and it also lacks the namespace declaration.
- C. Correct.
This XML instance correctly conforms to the YANG model by using the correct root element, the proper namespace declaration, and the appropriate leaf names defined in the model.
- D. Incorrect.
This XML instance uses the wrong leaf name 'status' instead of 'enabled', making it invalid for the given YANG model.