问题描述
我已阅读 https://en.wikipedia.org/wiki/YANG ,但是在理解YANG
的实际使用及其带来的好处方面仍然存在一些问题.据我了解,NETCONF现在不仅仅使用它,就像最初设计的那样. YANG
不是通常意义上的语言,例如C
或python
,即我们在YANG
中编写的任何内容均未编译或翻译;据我了解,它被用作更高级别的库或应用程序的参考模型.那么问题是高级代码如何理解YANG
?
I've read https://en.wikipedia.org/wiki/YANG but still having problems to understand the practical use of YANG
, and the benefits it provides. As I understand, it now is used not only by NETCONF, as was originally designed. YANG
is not a language in a common sense, as C
or python
for instance, i.e. whatever we write in YANG
is not compiled or translated; as I understand is is used as a reference model for a higher level library or application. Then the question is how does the high level code understand YANG
?
推荐答案
YANG是一种专用的模式语言,类似于XSD Schema或RelaxNG,但特定于NETCONF.其目标是对对等体之间的协议会话期间交换的所有内容进行建模,如RFC6020中所述:
YANG is a specialized schema language, akin to XSD Schema or RelaxNG but (was) specific to NETCONF. Its goal is to model all content that is exchanged during protocol sessions between peers, as described in RFC6020:
YANG定义的模型可能会以通常的方式使用-例如代码生成,例如 JAXB 适用于XSD Schema和Java.那里有一些工具和服务器实现,这些工具和服务器实现仅消耗YANG模块集(YANG模型),并可以用作虚拟实现.还有一些工具可以使用该模型来使用户查询设备,而无需实际实现有关该设备的任何特定操作.您可以说一组YANG模块公开了设备提供的接口.您可以完全根据自己的意愿来使用此界面.
The model defined by YANG may be consumed in the usual way - code generation for example, like what JAXB does for XSD Schema and Java. There are tools and server implementations out there that simply consume the YANG module set (a YANG model) and are ready to be used as dummy implementations. There are also tools that use the model to enable users to query a device, without actually implementing anything specific about the device. You could say that a set of YANG modules exposes the interface provided by a device. What you do with this interface is entirely up to you.
我建议阅读规范中提供的高级概述:
I suggest reading the high level overview provided in the specification:
- YANG 1.0 Overview, RFC6020, Section 4
- YANG 1.1 Overview, RFC6020bis-09, Section 4 (draft)
还要检查 ietf-netmod-yang 标记的Wiki页面.
Also check the wiki page of the ietf-netmod-yang tag.
您可能还可以从阅读网络管理体系结构中受益使用NETCONF和YANG 文档.它进一步解释了YANG a所属于的体系结构,包括应用程序开发人员之类的不同角色应如何处理它(在网络管理的上下文中).
You may also benefit from reading the An Architecture for Network Management Using NETCONF and YANG document. It further explains the architecture which YANG a is part of, including how different roles such as application developers should approach it (in the context of network management).
这篇关于了解YANG及其目标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!