简体   繁体   English

杨用作Xml或Json?

[英]Yang used as Xml or Json?

i just want to know is yang modeling language specific and can only be used with NetConf protocol, or can it be used to model data like Xml and Json ? 我只想知道yang建模语言是特定的,只能与NetConf协议一起使用,还是可以用于对Xml和Json等数据进行建模?

Thank you 谢谢

YANG was originally intended to model data exchanged between peers in a NETCONF session, but this is no longer the only case. YANG最初旨在对NETCONF会话中的对等方之间交换的数据进行建模,但这不再是唯一的情况。 There are now other protocols that (will) make use of it, such as RESTCONF and CoMI. 现在还有(将)使用它的其他协议,例如RESTCONF和CoMI。

YANG is a data modeling language originally designed to model configuration and state data manipulated by the Network Configuration Protocol (NETCONF), NETCONF Remote Procedure Calls, and NETCONF notifications [RFC6241]. YANG是一种数据建模语言,最初旨在对由网络配置协议(NETCONF),NETCONF远程过程调用和NETCONF通知[RFC6241]操纵的配置和状态数据进行建模。 Since the publication of YANG version 1 [RFC6020], YANG has been used or proposed to be used for other protocols (eg, RESTCONF [RESTCONF] and the Constrained Application Protocol (CoAP) Management Interface (CoMI) [CoMI]). 自YANG版本1 [RFC6020]发布以来,YANG已被或提议用于其他协议(例如RESTCONF [RESTCONF]和约束应用协议(CoAP)管理接口(CoMI)[CoMI])。 Further, encodings other than XML have been proposed (eg, JSON [RFC7951]). 此外,已经提出了除XML之外的其他编码(例如JSON [RFC7951])。

RFC7950, Section 1 RFC7950,第1节

In fact the recent new YANG specification release (1.1) has made a move toward decoupling the model from its encoding. 实际上,最近的新YANG规范版本(1.1)已朝着将模型与编码解耦的方向发展。 In the future, we will probably see separate XML and JSON encoding documents (plus perhaps others) and a single document dealing only with the language specifics. 将来,我们可能会看到单独的XML和JSON编码文档(可能还有其他文档)和仅涉及语言细节的单个文档。

You could use YANG to model data for other more general purposes if you ignore statements like rpc , action , notification , config , etc. Those that are only relevant in specific contexts. 如果您忽略诸如rpcactionnotificationconfig等语句,则可以使用YANG为其他更通用的数据建模。那些仅在特定上下文中相关的语句。 Of course you would have to define the context in which you wish to use the model and what it means to you. 当然,您必须定义希望使用该模型的上下文及其对您的意义。 Some modelers make use of the extension statement to define such requirements, then implement a specialized YANG compiler that recognizes the extensions and acts accordingly - this allows you to make use of the language for things not originally intended by the authors. 一些建模者利用extension语句来定义此类要求,然后实现一个专用的YANG编译器,该编译器可以识别扩展并采取相应的行动-这使您可以将语言用于作者最初不打算使用的语言。

There are some definitions in the specification that could make it harder to make YANG a general purpose modeling language (like what XML Schema is for XML). 规范中有一些定义可能会使将YANG变成通用建模语言更加困难(例如XML的XML Schema)。 Concepts like configuration datastore , configuration data , state data , client , server , etc. are pretty darn specific. 诸如configuration datastoreconfiguration datastate dataclientserver等之类的概念非常具体。 You can always turn a blind eye to those and just make it work for you, however. 但是,您总是可以对这些视而不见,只是让它对您有用。 I believe that is how it is already done in the OpenDaylight project. 我相信这是在OpenDaylight项目中已经完成的方式。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM