CESNET / libnetconf

C NETCONF library
Other
113 stars 84 forks source link

netconf-state in custom datastores #185

Closed ntadas closed 8 years ago

ntadas commented 8 years ago

Hi

When a filtered get is done to the netconf-state datastores we get an empty reply. Looking to the libnetconf code its possible to see this only works for datastore of type FILE

static char* get_state_monitoring(const char* UNUSED(model), const char* UNUSED(running), struct nc_err** UNUSED(e))
{
    char *schemas = NULL, *sessions = NULL, *retval = NULL, *ds_stats = NULL, *ds_startup = NULL, *ds_cand = NULL, *stats = NULL, *aux = NULL;
    struct ncds_ds_list* ds = NULL;
    const struct ncds_lockinfo *info;

    /*
     * datastores
     */
    /* find non-empty datastore implementation */
    for (ds = ncds.datastores; ds != NULL ; ds = ds->next) {
        if (ds->datastore && ds->datastore->type == NCDS_TYPE_FILE) {
            break;
        }
    }

Is it possible to use this also in CUSTOM datastores?

REgards

rkrejci commented 8 years ago

Can you be more specific about your filter? That FILE datastore is used to get information about locks, all other parts of the status monitoring data should be returned.

ntadas commented 8 years ago

using the filter <netconf-state><datastores/></netconf-state> nothing is returned.

thanks Regards

ntadas commented 8 years ago

Now its working, thanks, but I still have an issue: its returning the 3 datastores (running, startup and candidate) but I only have the running datastore. Shouldn't this request be crosschecked with the announced capabilities? or do I have a way to prevent this in the "application" side?

thanks Regards

rkrejci commented 8 years ago

hmm, I'm afraid that there can be more such situations.

libnetconf implements all three datastores and there is no way to switch some of them off (in contrast to e.g. Notifications or NACM). I know that the server can completely change the announced capabilities, which is probably what you did. The problem is that it actually does not switch off the datastores and get_state_monitoring has no idea about capabilities because it doesn't have access to the session.