+ log_error("datastore_populate_all() failed\n");
+ }
+
+ //subscribe to any changes so the operational is dynamic
+ char **xpaths = 0;
+ char **modules = 0;
+ int xpaths_count = datastore_schema_get_running_xpaths(&xpaths, &modules);
+ if(xpaths_count < 0) {
+ log_error("datastore_schema_get_running_xpaths failed\n");
+ return NTS_ERR_FAILED;
+ }
+
+ for(int i = 0; i < xpaths_count; i++) {
+ //subscribe
+ log_add_verbose(1, "subscribing to %s on module %s... ", xpaths[i], modules[i]);
+ rc = sr_module_change_subscribe(session_running, modules[i], xpaths[i], datastore_dynamic_operational_auto_callback, 0, 0, SR_SUBSCR_DONE_ONLY | SR_SUBSCR_CTX_REUSE, &session_subscription);
+ if(rc != SR_ERR_OK) {
+ log_error("sr_module_change_subscribe error\n");
+ }
+ else {
+ log_add(1, "done\n");
+ }
+
+ free(xpaths[i]);
+ free(modules[i]);