CESNET / libnetconf

C NETCONF library
Other
113 stars 83 forks source link

How to install custom datastore? #257

Closed aksenofontova closed 7 years ago

aksenofontova commented 7 years ago

Hello. I'm going to use libnetconf/netopeer on my custom device. As the standard transapi doesn't cover all my needs, I have to use Custom datastore. I have read the libnetconf documentation and have scanned examples project of-config and nuci_datastore.c , but still have questions. Could you give me some help, please. After I create my custom_datastore.c, what i need to do next? Is there any standard tools for use it in netopeer? If I understood correctly, if I enter here https://github.com/CESNET/netopeer/blob/e27e01de053b296e2cacb406b76bef7b6b11f94c/server/src/server.c#L795 some desired flag, the creation and linking of a custom datastore automatically occur.

rkrejci commented 7 years ago

Hi, you are supposed just to call ncds_custom_set_data() function. An example code can be found in #154 or in the of-config implementation.

aksenofontova commented 7 years ago

Hello! Thank you for answer in this issue. Could you answer a few questions, i have some problem whith understanding some functions, and your help will be very usefull for me.

  1. Where transapi/cfginterfaces project called create_datastore function ?
  2. Can I make netopeer work with custom datastore, if, for example, prescribe https://github.com/CESNET/netopeer/blob/e27e01de053b296e2cacb406b76bef7b6b11f94c/transAPI/cfginterfaces/cfginterfaces-init.c#L131 ds = ncds_new (NCDS_TYPE_CUSTOM,. ... if so, what should be done to redefine the communication functions (https://rawgit.com/CESNET/libnetconf/master/doc/doxygen/html/d0/d28/structncds__custom__funcs.html) with custom datastore ?
rkrejci commented 7 years ago

1) I don't understand your question.

2) You can do anything if you code it ;) But cfginterfaces-init.c is a source code for a standalone init application accessing the datastore used by the cfginterfaces transAPI plugin and storing a startup configuration data. It is not running as part of the netopeer server, it is just a single-purpose application supposed to be used once before the first start of the netopeer server with the cfginterfaces transAPi plugin

rkrejci commented 7 years ago

btw, if you are going to implement custom datastore, it probably does not make sense to get ideas from transAPI modules.