300-435 · Question #141
Refer to the exhibit. What is the YANG module of this YANG module tree?
The correct answer is D. module server-config { container servers { list server { key "name"; leaf name { type string; mandatory "true";} leaf address { type string; mandatory "true";} leaf subnet-mask { type string; mandatory "true";} leaf default-gateway { type string; mandatory "true";}}}}. This question requires identifying the correct YANG module definition that matches a given YANG module tree structure, focusing on the module, container, list, and key definitions.
Question
Options
- Amodule servers-config { container servers { list server { key "servername"; leaf name { type string; mandatory "true";} leaf address { type string; mandatory "true";} leaf subnet-mask { type string; mandatory "true";} leaf default-gateway { type string; mandatory "true";}}}}
- Bmodule server-config { container server { list servers { key "name"; leaf name { type string; mandatory "true";} leaf address { type string; mandatory "true";} leaf subnet-mask { type string; mandatory "true";} leaf default-gateway { type string; mandatory "true";}}}}
- Cmodule server-config { container servers { list server { key "name"; leaf name { type string; mandatory "true";} leaf address { type string; mandatory "true";} leaf subnet-mask { type string; mandatory "true";} leaf default-gateway { type string; mandatory "true";}}}}
- Dmodule server-config { container servers { list server { key "name"; leaf name { type string; mandatory "true";} leaf address { type string; mandatory "true";} leaf subnet-mask { type string; mandatory "true";} leaf default-gateway { type string; mandatory "true";}}}}
How the community answered
(20 responses)- A5% (1)
- B5% (1)
- D90% (18)
Why each option
This question requires identifying the correct YANG module definition that matches a given YANG module tree structure, focusing on the module, container, list, and key definitions.
The module name `servers-config` is incorrect, and the key `servername` is incorrect as the leaf for the key is usually named `name`.
The container name `server` is incorrect; it should be `servers` for a collection. The list name `servers` is also incorrect; it should be `server` for an individual item in the list.
Option C and D are identical in their structure, both correctly representing a YANG module `server-config` with a `servers` container holding a `server` list keyed by `name`.
The correct YANG module defines the module as `server-config`, contains a `servers` container, within which is a `server` list. The list `server` uses `name` as its key, which is then defined as a `leaf` of type `string` and is `mandatory 'true'`, matching the common structure for defining a list of configurable items with a unique identifier.
Concept tested: YANG module tree to YANG definition
Source: https://datatracker.ietf.org/doc/html/rfc7950
Topics
Community Discussion
No community discussion yet for this question.