On Wed, Oct 01, 2014 at 03:23:49PM -0400, Y. Richard Yang wrote: > On Wed, Oct 1, 2014 at 3:08 AM, Juergen Schoenwaelder < > [email protected]> wrote: > > > On Tue, Sep 30, 2014 at 04:31:03PM -0400, Y. Richard Yang wrote: > > > > > A particular example of using key-value map is the network-map, which is > > > defined as a key-value store to enforce that each named endpoint address > > > group has a unique name. A specific example is in Section 11.2.1.7 of RFC > > > 7285 (http://www.rfc-editor.org/rfc/rfc7285.txt): > > > > > > "network-map" : { > > > "PID1" : { > > > "ipv4" : [ > > > "192.0.2.0/24", > > > "198.51.100.0/25" > > > ] > > > }, > > > "PID2" : { > > > "ipv4" : [ > > > "198.51.100.128/25" > > > ] > > > }, > > > "PID3" : { > > > "ipv4" : [ > > > "0.0.0.0/0" > > > ], > > > "ipv6" : [ > > > "::/0" > > > ] > > > } > > > > Since YANG's native encoding is XML, how would you represent this in > > XML with the restriction that XML element names are defined by the > > data model and all values are in XML elements? > > > > Would you consider this as a limitation of the restriction? > > With the restriction, if we have the YANG data type to introduce key-value > store, for XML, the Mapping Rule may still be that of using two elements > with name and value: pid-name = (or just key as name), pid-value = (or > value). But for json and languages that support maps, the mapping does not. > Make sense? >
I am saying that YANG was designed to model data carried by NETCONF (check the title of RFC 6020) and NETCONF uses XML as its data encoding with a set of restrictions that were found useful to simplify things (all data in XML elements, no mixed content, ...). Several details of the YANG language are related to XML (e.g., much of the type system, the usage of xpath in must/when expressions, instance identifier as a subset of xpath, ...). Alternate _encodings_ are proposed (such as JSON) but the question raised here seems to be whether we want to start an effort to turn YANG into a schema language for JSON (which it is not today and this is by design and not by accident). /js -- Juergen Schoenwaelder Jacobs University Bremen gGmbH Phone: +49 421 200 3587 Campus Ring 1, 28759 Bremen, Germany Fax: +49 421 200 3103 <http://www.jacobs-university.de/> _______________________________________________ alto mailing list [email protected] https://www.ietf.org/mailman/listinfo/alto
