use pojos generated from yang to configure device using odl netconf client

痴心易碎 提交于 2019-12-24 01:54:36

问题


I managed to generate Pojos from yang files, using OpenDayLight YangTools.

Next stage i managed to import netconf client to my application (using gradle), how do i use the generated pojos with netconfClient in my application to configure a device?


回答1:


Would be good if you explain what you want to achieve so I can help you more accurately, but if you want to configure your box programmatically using yang, you need to follow the steps below:

  1. From yang models generate your runtime configuration classes (this is what you have now)
  2. Write some logic to call those generated classes and create an object which defines your configuration. For instance, setting up a BGP config, you need to start from the router, bgp, address family, neighbour, and so on. The object will follow your device Yang model, or the 'openconfig' one like here: https://github.com/openconfig/public/blob/master/release/models/bgp/openconfig-bgp.yang
  3. After you have generated your 'configuration instance', then you need to serialise it (convert to XML)
  4. Use a netconf client (look for ncclient) to send it to the box.

If you are not much fussed about the language, I would suggest you use

https://github.com/CiscoDevNet/ydk-py

which has examples already.

A more Opendaylighty approach is,

  1. Start a maven project and yangtools in it, https://wiki.opendaylight.org/view/OpenDaylight_Controller:MD-SAL:Startup_Project_Archetype#Starting_your_.27example.27_project_for_the_first_time
  2. Load netconf southbound application
  3. Add your yang models you want (optional)
  4. Do a maven build so it generates the API for you (you will have access to the device API directly).
  5. Then what extra you can do is to implement the logic where the provider classes are and provide your own API.

Hope this helps



来源:https://stackoverflow.com/questions/51627804/use-pojos-generated-from-yang-to-configure-device-using-odl-netconf-client

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!