CESNET / libnetconf2

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

Not read all modules from server via get-schema #489

Closed lorandt1 closed 5 months ago

lorandt1 commented 5 months ago

Hi

I want to ask why it is not possible to only read from server the schemas via get-schema that are essentially needed for the client so for instance those that are stored in CLIENT_SEARCH_DIR.

I see that almost all modules that are reported in yang-library and are not stored in client's CLIENT_SEARCH_DIR are retrieved. My point is that modules like ietf-tls-server, ietf-netconf-server will be retrieved and are really not needed for the client.

Would not be reasonable to add an enhancement to somehow not retrieve modules that are not needed for the client ? The client can express the modules that are interested in via setting the local files but it ends with modules that doesn't need.

michalvasko commented 5 months ago

Would not be reasonable to add an enhancement to somehow not retrieve modules that are not needed for the client ?

How do you decide what modules are "not needed"? If a client wants to modify (or even retrieve) server configuration, it does need these modules. However, you can disable automatic retrieval of any YANG modules using nc_client_set_new_session_context_autofill(). Then you need to load any needed modules yourself.

lorandt1 commented 5 months ago

How about an API to not use get-schema even if the server supports monitoring module? That will make to load only the modules that are locally stored based on what the server reports in hello exchange and yang-library retrieval.

michalvasko commented 5 months ago

I am sorry, but I do not see the value in having all the various combinations and possibilities of how exactly to load YANG modules. You have the option to do it manually the way you want or automatically, that should be enough.