nerdexam
Cisco

200-901 · Question #438

Refer to the exhibit. The YANG module devnet-users shows a data model for user accounts. Which code snippet shows the XML representation of an instantiation of the YANG data model? A. B. C. D.

The correct answer is D. <data xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"> <users xmlns:ex="http://devnet.com/devnet-users"> <ex:person> <ex:name>User One</ex:name> <ex:creationdate>2020-08-24T00:00:00-00:00</ex:creationdate> </ex:person> <ex:person> <ex:name>User Two</ex:name> <ex:creationdate>2020-10-05T07:00:00-00:00</ex:creationdate> </ex:person> </users> </data>. NETCONF XML encoding of YANG data requires proper namespace declaration and consistent application of namespace prefixes to all elements belonging to the YANG module.

Understanding and Using APIs

Question

Refer to the exhibit. The YANG module devnet-users shows a data model for user accounts. Which code snippet shows the XML representation of an instantiation of the YANG data model? A. B. C. D.

Exhibits

200-901 question #438 exhibit 1
200-901 question #438 exhibit 2
200-901 question #438 exhibit 3
200-901 question #438 exhibit 4
200-901 question #438 exhibit 5

Options

  • A<data xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"> <users xmlns="http://devnet.com/devnet-users"> <person> <name>User One</name> <creationdate>2020-08-24T00:00:00-00:00</creationdate> </person> <person> <name>User Two</name> <creationdate>2020-10-05T07:00:00-00:00</creationdate> </person> </users> </data>
  • B<data xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"> <users xmlns="http://devnet.com/devnet-users"> <person> <name>User One</name> <creationdate>2020-08-24T00:00:00-00:00</creationdate> </person> <person> <name>User Two</name> <creationdate>2020-10-05T07:00:00-00:00</creationdate> </person> </users> </data>
  • C<data yang-model="urn:ietf:params:xml:devnet-users"> <users xmlns="http://devnet.com/devnet-users"> <person> <name>User One</name> <creationdate>2020-08-24T00:00:00-00:00</creationdate> </person> <person> <name>User Two</name> <creationdate>2020-10-05T07:00:00-00:00</creationdate> </person> </users> </data>
  • D<data xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"> <users xmlns:ex="http://devnet.com/devnet-users"> <ex:person> <ex:name>User One</ex:name> <ex:creationdate>2020-08-24T00:00:00-00:00</ex:creationdate> </ex:person> <ex:person> <ex:name>User Two</ex:name> <ex:creationdate>2020-10-05T07:00:00-00:00</ex:creationdate> </ex:person> </users> </data>

How the community answered

(23 responses)
  • A
    13% (3)
  • B
    9% (2)
  • C
    4% (1)
  • D
    74% (17)

Why each option

NETCONF XML encoding of YANG data requires proper namespace declaration and consistent application of namespace prefixes to all elements belonging to the YANG module.

A<data xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"> <users xmlns="http://devnet.com/devnet-users"> <person> <name>User One</name> <creationdate>2020-08-24T00:00:00-00:00</creationdate> </person> <person> <name>User Two</name> <creationdate>2020-10-05T07:00:00-00:00</creationdate> </person> </users> </data>

Choice A declares the namespace as a default namespace (xmlns=) on the 'users' element without using an explicit prefix, which differs from the proper explicit prefix notation required by this YANG data model instantiation.

B<data xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"> <users xmlns="http://devnet.com/devnet-users"> <person> <name>User One</name> <creationdate>2020-08-24T00:00:00-00:00</creationdate> </person> <person> <name>User Two</name> <creationdate>2020-10-05T07:00:00-00:00</creationdate> </person> </users> </data>

Choice B repeats the same default namespace structure as A and likewise lacks the explicit namespace prefix notation needed for correct YANG XML representation in this context.

C<data yang-model="urn:ietf:params:xml:devnet-users"> <users xmlns="http://devnet.com/devnet-users"> <person> <name>User One</name> <creationdate>2020-08-24T00:00:00-00:00</creationdate> </person> <person> <name>User Two</name> <creationdate>2020-10-05T07:00:00-00:00</creationdate> </person> </users> </data>

Choice C uses 'yang-model' as an attribute name instead of the standard 'xmlns', which is not valid XML namespace syntax and is unrecognized by NETCONF parsers.

D<data xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"> <users xmlns:ex="http://devnet.com/devnet-users"> <ex:person> <ex:name>User One</ex:name> <ex:creationdate>2020-08-24T00:00:00-00:00</ex:creationdate> </ex:person> <ex:person> <ex:name>User Two</ex:name> <ex:creationdate>2020-10-05T07:00:00-00:00</ex:creationdate> </ex:person> </users> </data>Correct

Choice D correctly binds the module namespace to a prefix (xmlns:ex='http://devnet.com/devnet-users') and explicitly applies 'ex:' to every child element - person, name, and creationdate - unambiguously associating each with the YANG module's namespace. This explicit prefix notation follows RFC 7950 and RFC 6241 conventions for representing YANG-modeled data in XML over NETCONF. It avoids namespace inheritance ambiguity that can occur with default namespace declarations in nested structures.

Concept tested: YANG data model XML instantiation with namespace prefixes

Source: https://www.rfc-editor.org/rfc/rfc7950

Topics

#YANG#XML#Data Modeling

Community Discussion

No community discussion yet for this question.

Full 200-901 Practice