Skip to content

Commit

Permalink
common UPDATE support changing default datastore plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
Humblesaw committed Apr 9, 2024
1 parent bf79330 commit f1807b8
Show file tree
Hide file tree
Showing 5 changed files with 297 additions and 253 deletions.
8 changes: 8 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,14 @@ else()
endif()
set(INTERNAL_MODULE_DISABLED_RUNNING "" CACHE STRING "List of internal sysrepo or libyang modules that will have their 'running' datastores disabled (always mirroring 'startup'), separated by space. Use '*' for all the modules.")

# default datastore plugins
set(DEFAULT_STARTUP_DS_PLG "JSON DS file" CACHE STRING "Default datastore plugin for storing startup data.")
set(DEFAULT_RUNNING_DS_PLG "JSON DS file" CACHE STRING "Default datastore plugin for storing running data.")
set(DEFAULT_CANDIDATE_DS_PLG "JSON DS file" CACHE STRING "Default datastore plugin for storing candidate data.")
set(DEFAULT_OPERATIONAL_DS_PLG "JSON DS file" CACHE STRING "Default datastore plugin for storing operational data.")
set(DEFAULT_FACTORY_DEFAULT_DS_PLG "JSON DS file" CACHE STRING "Default datastore plugin for storing factory default data.")
set(DEFAULT_NOTIFICATION_DS_PLG "JSON notif" CACHE STRING "Default datastore plugin for storing notifications.")

# ietf-yang-library revision
set(YANGLIB_REVISION "2019-01-04" CACHE STRING
"YANG module ietf-yang-library revision to implement. Only 2019-01-04 and 2016-06-21 are supported.")
Expand Down
26 changes: 13 additions & 13 deletions src/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,24 +77,24 @@ const struct srplg_ntf_s *sr_internal_ntf_plugins[] = {
* @brief Default module DS plugins.
*/
const sr_module_ds_t sr_module_ds_default = {{
"JSON DS file", /**< startup */
"JSON DS file", /**< running */
"JSON DS file", /**< candidate */
"JSON DS file", /**< operational */
"JSON DS file", /**< factory-default */
"JSON notif" /**< notification */
}};
SR_DEFAULT_STARTUP_DS, /**< startup */
SR_DEFAULT_RUNNING_DS, /**< running */
SR_DEFAULT_CANDIDATE_DS, /**< candidate */
SR_DEFAULT_OPERATIONAL_DS, /**< operational */
SR_DEFAULT_FACTORY_DEFAULT_DS, /**< factory-default */
SR_DEFAULT_NOTIFICATION_DS /**< notification */
}};

/**
* @brief Default module DS plugins with 'running' DS disbaled.
*/
const sr_module_ds_t sr_module_ds_disabled_run = {{
"JSON DS file", /**< startup */
NULL, /**< running */
"JSON DS file", /**< candidate */
"JSON DS file", /**< operational */
"JSON DS file", /**< factory-default */
"JSON notif" /**< notification */
SR_DEFAULT_STARTUP_DS, /**< startup */
NULL, /**< running */
SR_DEFAULT_CANDIDATE_DS, /**< candidate */
SR_DEFAULT_OPERATIONAL_DS, /**< operational */
SR_DEFAULT_FACTORY_DEFAULT_DS, /**< factory-default */
SR_DEFAULT_NOTIFICATION_DS /**< notification */
}};

sr_error_info_t *
Expand Down
18 changes: 18 additions & 0 deletions src/config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -134,4 +134,22 @@
/** default permission of data files of internal modules with some data or features */
#define SR_INTMOD_WITHDATA_FILE_PERM 00644

/** default plugin for startup datastore */
#define SR_DEFAULT_STARTUP_DS "@DEFAULT_STARTUP_DS_PLG@"

/** default plugin for running datastore */
#define SR_DEFAULT_RUNNING_DS "@DEFAULT_RUNNING_DS_PLG@"

/** default plugin for candidate datastore */
#define SR_DEFAULT_CANDIDATE_DS "@DEFAULT_CANDIDATE_DS_PLG@"

/** default plugin for operational datastore */
#define SR_DEFAULT_OPERATIONAL_DS "@DEFAULT_OPERATIONAL_DS_PLG@"

/** default plugin for factory default datastore */
#define SR_DEFAULT_FACTORY_DEFAULT_DS "@DEFAULT_FACTORY_DEFAULT_DS_PLG@"

/** default plugin for notification datastore */
#define SR_DEFAULT_NOTIFICATION_DS "@DEFAULT_NOTIFICATION_DS_PLG@"

#endif /* _CONFIG_H */
18 changes: 18 additions & 0 deletions tests/tcommon.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,24 @@
/* path to all compiled executables */
#define SR_BINARY_DIR "@PROJECT_BINARY_DIR@"

/** default plugin for startup datastore */
#define SR_DEFAULT_STARTUP_DS "@DEFAULT_STARTUP_DS_PLG@"

/** default plugin for running datastore */
#define SR_DEFAULT_RUNNING_DS "@DEFAULT_RUNNING_DS_PLG@"

/** default plugin for candidate datastore */
#define SR_DEFAULT_CANDIDATE_DS "@DEFAULT_CANDIDATE_DS_PLG@"

/** default plugin for operational datastore */
#define SR_DEFAULT_OPERATIONAL_DS "@DEFAULT_OPERATIONAL_DS_PLG@"

/** default plugin for factory default datastore */
#define SR_DEFAULT_FACTORY_DEFAULT_DS "@DEFAULT_FACTORY_DEFAULT_DS_PLG@"

/** default plugin for notification datastore */
#define SR_DEFAULT_NOTIFICATION_DS "@DEFAULT_NOTIFICATION_DS_PLG@"

/** implemented ietf-yang-library revision (copied from common.h) */
#define SR_YANGLIB_REVISION @YANGLIB_REVISION@

Expand Down
Loading

0 comments on commit f1807b8

Please sign in to comment.