从YANG数据模型生成XML RPC NETCONF请求的标准方法是什么 [英] What is the standard way to generate XML RPC NETCONF requests from YANG data model

查看:839
本文介绍了从YANG数据模型生成XML RPC NETCONF请求的标准方法是什么的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试寻找一种更好的方式来生成XML RPC请求,该请求将发送到其中带有NETCONF标签的设备.

I am trying to find a better way to generate XML RPC requests to be sent to a device with NETCONF tags in it.

我们知道请求的外观,所以我正在做的就是用其中的占位符对XML-RPC请求XML进行硬编码.以后可以用实际的输入替换那些占位符.

We know how request should look like, so what I am doing is, just hard coding the XML-RPC request XML with placeholders in it. Those placeholders can be replaced with actual input later.

例如:

<rpc message-id="">
  <get-config>
    <source>
      <running/>
    </source>
    <filter type="subtree" base_path="">
      <wing-stats>
        <device>
          <lldp>
            <dev_id/>
            <local_port/>
            <neighborId/>
            <Neighbor_port_id/>
          </lldp>
          <mac>@device_mac</mac>
        </device>
      </wing-stats>
    </filter>
  </get-config>
</rpc>

在此示例中,@ device_mac将在发送请求时被替换.但是有些感觉让我对请求XML进行了硬编码.有没有更好的方法来生成请求XML?

Here in this example, @device_mac will be replaced while send the request. But some how I felt I am hardcoding the request XML. Is there any better way of generating the request XML?

Netconf数据将使用YANG/YIN文件建模.有什么办法可以至少利用这些文件来生成NETCONF请求吗?

Netconf data will be modelled using YANG/YIN files. Is there a way I can make use of these files to generate NETCONF request part atleast?

推荐答案

巴拉,

我想说有两种方法可以做到这一点:您可以使用任何可用的日期模型驱动工具箱,而且我知道其中至少有一个会生成面向模型的API并隐藏详细的XML(DOM )操纵.第二个方向是利用在 RFC 6110 中定义的YANG到DSDL映射. pyang 工具.现在,后一种要求您的工具可以与 DSDL 一起使用,后者实质上是放松NG Schematron .

I'd say there are two ways to do this: you can either use any of the date model driven toolkits that are available and I know that at least one of them generate model-oriented APIs and hide the detailed XML (DOM) manipulation. The second direction is to make use of the YANG to DSDL mapping defined in RFC 6110 as implemented by the pyang tool. Now, the latter one requires that your tools can work with DSDL which is essentially a combination of Relax NG and Schematron.

希望这会有所帮助.

这篇关于从YANG数据模型生成XML RPC NETCONF请求的标准方法是什么的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆