Juniper / netconf-java

Java library for NETCONF
Other
76 stars 63 forks source link

Are there an examples of how to use this API for NETCONF subscriptions/events? #32

Open senderic opened 4 years ago

senderic commented 4 years ago

I am looking to use the Netconf client to subscribe to an event. Basically, whenever a field changes in my sysrepo netconf server, I need my client to know about it. I know there is a spec for this:

https://tools.ietf.org/id/draft-ietf-netconf-netconf-event-notifications-05.html

I am wondering if this Netconf-Java API has that ability to subscribe and if there are examples of it? (I am researching it as I write this, but wanted to throw that question out there just in case).

If this ability is not part of netconf-java, what I may do is just create a loop that simply polls the netconf server every N seconds for updates to the wanted field in sysrepo. Would you consider using the same technique?

peterjhill commented 4 years ago

afaik, I don't think so. We have a poller that queries a db to see if we need to sync a change to our routers. If so, we then make the change.

We use this library to communicate with the router, but put all the logic of what it should do into our own code.

I guess you could map our control plane components to the app and sysrepo engine in the diagram on this page: http://www.sysrepo.org/Sysrepo

That draft rfc has a date of 2017. I don't recall any PRs to add that functionality. I could be wrong. (I could also be answering something completely different than what your are asking.

Hope you are well! Have a good weekend.

ydnath commented 4 years ago

This library does not support NETCONF notifications as yet.

IMO, Polling is not a good technique in this case. Ideal approach would be to add a publish-subscribe mechanism.

murthy-nn commented 3 years ago

afaik, I don't think so. We have a poller that queries a db to see if we need to sync a change to our routers. If so, we then make the change.

We use this library to communicate with the router, but put all the logic of what it should do into our own code.

I guess you could map our control plane components to the app and sysrepo engine in the diagram on this page: http://www.sysrepo.org/Sysrepo

That draft rfc has a date of 2017. I don't recall any PRs to add that functionality. I could be wrong. (I could also be answering something completely different than what your are asking.

Hope you are well! Have a good weekend.

http://www.sysrepo.org

Hello Peter,

Thanks for the response. Please clarify the following queries.

Are you referring to a poller library that is part of the device?

Are you suggesting implementing Netconf notification handling in NMS following the design of this poller?

peterjhill commented 3 years ago

My use case is pushing config down to routers using netconf. The authoritative state of the device is stored in a database. We take info in the database to craft the router config and push it all down to the router. Load override style. So we don't poll any events on the router and then trigger netconf.

So I may not be the best person to answer the question, as it seems it is more about events on the router triggering netconf to do something?