CESNET / libnetconf2

C NETCONF library
BSD 3-Clause "New" or "Revised" License
202 stars 145 forks source link

Custom Netconf Capability #499

Open svashok opened 1 month ago

svashok commented 1 month ago

Hi,

As part of standard Netconf capability exchange the following may get exchanged between the server and client - candidate, rollback-on-error, validate, etc. Is it possible to add custom defined capabilities to Netconf server, like the Network Function Type, NF software version, etc.? Basically, how does the server get these capabilities information from the application during start up?

Thanks

Roytak commented 1 month ago

Hi, I believe the server gets this list from the YANG modules loaded into the libyang context that is used for accepting new sessions. Another option is to use nc_server_set_capability.

jktjkt commented 1 month ago

The set of NETCONF capabilities is "regulated", and there's a registry maintained by IANA. You are not expected to add custom entries into that list.

Prior to YANG 1.1, these capabilities would include a "list of supported YANG models", essentially. That's no longer the case as of YANG 1.1, and The Correct Way™ is to use the ietf-yang-library. The TL;DR version is that this is all done by sysrepo and netopeer2 for you (if you use these), and all of the YANG models which are available, along with their features are provided as state data in the ietf-yang-library YANG model.

Regarding software version (etc), I suggest to take a look at the ietf-system and ietf-hardware models. If you're looking for an implementation of these with sysrepo, there's the velia project which you might (or might not) find useful.