libnetconf  0.10.0-146_trunk
NETCONF Library
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Datastores Usage

NETCONF defines usage of three datastores: running (mandatory), startup (optional via :startup capability) and candidate (optional via :candidate capability). libnetconf provides all these datastores.

In addition to the described NETCONF point of view, libnetconf divides all datastores (running, startup and candidate) into datastore parts connected with a specific (basic) configuration data model. Each datastore part is created by ncds_new(), ncds_new2() or ncds_new_transapi() function. According to the specified datastore type, server should set up additional datastore settings (see section ds_settings). If some specific validation settings are needed, ncds_set_validation() function can be used (more information about validation can be found at a separated page. Finnaly, to activate datastore and to get its unique identifier, ncds_init() function must be called.

If you want to use some data model that extends (by import or augment statement) any of the used data models, functions ncds_add_model() or ncds_add_models_path() can be used to specify location of the extension data model(s). As ncds_new_transapi() connects base data model, its datastore and transAPI module (for more information about transAPI, see separated page), also an augment model can be connected with a transAPI module using ncds_add_augment_transapi. In both cases, transAPI can be provided not only as a shared object (*.so file), but also statically using ncds_new_transapi_static() for base data model and ncds_add_augment_transapi_static() in case of augment data model.

By default, all features defined in configuration data models are disabled. To enable specific features or all features at once, you can use ncds_feature_enable() and ncds_features_enableall() functions.

To finish changes made to the datastores (adding augment data models, enabling and disabling features, etc.), server MUST call ncds_consolidate() function.

As a next step, device controlled by the server should be initialized. This should includes copying startup configuration data into the running datastore (and applying them to the current device settings).

Datastore Settings

  • Empty Datastore (NCDS_TYPE_EMPTY)

    There is no additional settings for this datastore type.

  • File Datastore (NCDS_TYPE_FILE)

    ncds_file_set_path() to set file to store datastore content.

  • Custom Datastore (NCDS_TYPE_CUSTOM)

    This type of datastore implementation is provided by the server, not by libnetconf.

    ncds_custom_set_data() sets server specific functions implementing the datastore. In this case, server is required to implement functions from ncds_custom_funcs structure.