CESNET / netopeer2

NETCONF toolset
BSD 3-Clause "New" or "Revised" License
290 stars 186 forks source link

How to integrate custom yang with netopeer #1570

Open biswajit84 opened 2 months ago

biswajit84 commented 2 months ago

Hi, I am trying to add example.yang which is part of sysrepo into netopeer which has operational data . As I am new,need guidance in integration. So to integrate it in netopeer-server,do I need to call sr_oper_get_subscribe ? Also on netopeer2-cli application how to invoke the same.

Regards, Biswajit

michalvasko commented 2 months ago

Generally ignore netopeer2, it is just a NETCONF server interface for sysrepo. Learn about its basics in the docs by playing with the plugin example.

biswajit84 commented 2 months ago

Hi, Is there any document available stating how netopeer should follow the sequence to connect with netconf and sysrepo followed by fetching the data.?

Regards, Biswajit

michalvasko commented 2 months ago

I do not understand the question but I suggest you go through the whole sysrepo docs and you should be able to understand all the basic principles.

biswajit84 commented 2 months ago

Hi, Now I am able to integrate the custom yang having operational data with sysrepo and then from other application(client) able to fetch the values. The Current application is just similar to oper_data_pull_example.c and sr_get_items_example

End Objective: The client should be connected over TLS and then its allowed to access the sysrepo. I have few basic doubts:

  1. As netopeer2 application(netopeer2-server & netopeer2-cli) has been generated by using netconf,sysrepo,libyang library. I am bit confused use case of netopeer frame work in real time scenario.
  2. Is it possible so that netopeer2-server can notify the user specific application if there is request of fetching operational data from client connected over TLS.

Regards, Biswajit

michalvasko commented 2 months ago
  1. I do not understand, how has netopeer2 been "generated"? And not sure what you mean by real-time scenario, do you have any specific timing constraints?
  2. It should not matter what client requests the data but you should be able to retrieve NETCONF session ID of the originator session in the oper data callback so it may be possible to learn its transport protocol. Still, seems like a strange requirement that is perhaps the result of a faulty design.
biswajit84 commented 2 months ago

Hi I am extremely sorry for not able to putting my words correctly. After building the netopeer2 package,netopeer2-server and netopeer2-cli binary has been generated. We are trying to develop oran based application in which will act as netconf server. So is there any api support of netopeer2 is there so that using that it can create the netconf TLS session internally and when ever any request from client is there it can invoke our callbacks OR we have use netconf and sysrepo apis to achieve this feature.

Regards, Biswajit

jktjkt commented 2 months ago

You might want to revisit the sysrepo's website and re-read the documentation; doing that will make it clear what the purpose and division of responsibilities between libyang, sysrepo, libnetconf2 and netopeer2 are. The answer to the question which you asked is explained in the documentation.

michalvasko commented 2 months ago

What @jktjkt said although I can also briefly answer. sysrepo is the central library that handles all the local configuration. What netopeer2-server does is only extends the functionality with a remote NETCONF interface so your local applications can ignore it. Whenever a NETCONF request is received, your sysrepo callbacks will automatically be invoked (as long as applicable). Learn more about all kinds of subscriptions sysrepo supports to know what kinds of callbacks can you register.