sysrepo
2.11.7
YANG-based system repository for all-around configuration management.
|
Functions | |
int | sr_check_module_ds_access (sr_conn_ctx_t *conn, const char *module_name, int mod_ds, int *read, int *write) |
Check whether the current application has read/write access to a module. More... | |
int | sr_disable_module_feature (sr_conn_ctx_t *conn, const char *module_name, const char *feature_name) |
Disable a module feature. More... | |
int | sr_enable_module_feature (sr_conn_ctx_t *conn, const char *module_name, const char *feature_name) |
Enable a module feature. More... | |
int | sr_get_module_ds_access (sr_conn_ctx_t *conn, const char *module_name, int mod_ds, char **owner, char **group, mode_t *perm) |
Learn about module permissions. More... | |
const sr_module_ds_t * | sr_get_module_ds_default (void) |
Get the default datastore plugins. More... | |
int | sr_get_module_info (sr_conn_ctx_t *conn, sr_data_t **sysrepo_data) |
Get internal sysrepo data tree, which holds detailed information about installed modules. It should not be needed except for some specific use-cases. These data are from the sysrepo module found in modules/sysrepo.yang . More... | |
int | sr_get_module_replay_support (sr_conn_ctx_t *conn, const char *module_name, struct timespec *earliest_notif, int *enabled) |
Learn replay support of a module. More... | |
const char * | sr_get_repo_path (void) |
Get the common path prefix for all sysrepo files. More... | |
int | sr_install_module (sr_conn_ctx_t *conn, const char *schema_path, const char *search_dirs, const char **features) |
Install a new schema (module) into sysrepo. More... | |
int | sr_install_module2 (sr_conn_ctx_t *conn, const char *schema_path, const char *search_dirs, const char **features, const sr_module_ds_t *module_ds, const char *owner, const char *group, mode_t perm, const char *data, const char *data_path, LYD_FORMAT format) |
Install a new schema (module) into sysrepo with all the available options. More... | |
int | sr_install_modules (sr_conn_ctx_t *conn, const char **schema_paths, const char *search_dirs, const char ***features) |
Install new schemas (modules) into sysrepo in a batch. More... | |
int | sr_install_modules2 (sr_conn_ctx_t *conn, const sr_install_mod_t *modules, uint32_t module_count, const char *search_dirs, const char *data, const char *data_path, LYD_FORMAT format) |
Install new schemas (modules) into sysrepo in a batch with all the available options. More... | |
int | sr_is_module_internal (const struct lys_module *ly_mod) |
Check whether a module is an internal libyang or sysrepo module. Evaluates to true for all the modules that are installed by default when no modules were explicitly added. More... | |
int | sr_remove_module (sr_conn_ctx_t *conn, const char *module_name, int force) |
Remove an installed module from sysrepo. More... | |
int | sr_remove_modules (sr_conn_ctx_t *conn, const char **module_names, int force) |
Remove installed modules from sysrepo. More... | |
int | sr_set_module_ds_access (sr_conn_ctx_t *conn, const char *module_name, int mod_ds, const char *owner, const char *group, mode_t perm) |
Change module permissions. More... | |
int | sr_set_module_replay_support (sr_conn_ctx_t *conn, const char *module_name, int enable) |
Change module replay support. More... | |
int | sr_update_module (sr_conn_ctx_t *conn, const char *schema_path, const char *search_dirs) |
Update an installed schema (module) to a new revision. More... | |
int | sr_update_modules (sr_conn_ctx_t *conn, const char **schema_paths, const char *search_dirs) |
Update installed schemas (modules) to new revisions in a batch. More... | |
int sr_check_module_ds_access | ( | sr_conn_ctx_t * | conn, |
const char * | module_name, | ||
int | mod_ds, | ||
int * | read, | ||
int * | write | ||
) |
Check whether the current application has read/write access to a module.
[in] | conn | Connection to use. |
[in] | module_name | Name of the module to use. |
[in] | mod_ds | Affected datastore, sr_datastore_t value or SR_MOD_DS_NOTIF. |
[out] | read | Optional, set if read access was granted. |
[out] | write | Optional, set if write access was granted. |
int sr_disable_module_feature | ( | sr_conn_ctx_t * | conn, |
const char * | module_name, | ||
const char * | feature_name | ||
) |
Disable a module feature.
Required WRITE access.
[in] | conn | Connection to use. |
[in] | module_name | Name of the module to change. |
[in] | feature_name | Name of the feature to disable. |
int sr_enable_module_feature | ( | sr_conn_ctx_t * | conn, |
const char * | module_name, | ||
const char * | feature_name | ||
) |
Enable a module feature.
Required WRITE access.
[in] | conn | Connection to use. |
[in] | module_name | Name of the module to change. |
[in] | feature_name | Name of the feature to enable. |
int sr_get_module_ds_access | ( | sr_conn_ctx_t * | conn, |
const char * | module_name, | ||
int | mod_ds, | ||
char ** | owner, | ||
char ** | group, | ||
mode_t * | perm | ||
) |
Learn about module permissions.
[in] | conn | Connection to use. |
[in] | module_name | Name of the module to use. |
[in] | mod_ds | Affected datastore, sr_datastore_t value or SR_MOD_DS_NOTIF. |
[out] | owner | Optional, read the owner of the module. |
[out] | group | Optional, read the group of the module. |
[out] | perm | Optional, read the permissions of the module. |
const sr_module_ds_t* sr_get_module_ds_default | ( | void | ) |
Get the default datastore plugins.
New modules without explicitly set DS plugins will use these plugins. Use sr_install_module2 to install a module with a custom set of datastore plugins.
int sr_get_module_info | ( | sr_conn_ctx_t * | conn, |
sr_data_t ** | sysrepo_data | ||
) |
Get internal sysrepo data tree, which holds detailed information about installed modules. It should not be needed except for some specific use-cases. These data are from the sysrepo module found in modules/sysrepo.yang
.
[in] | conn | Connection to use. |
[out] | sysrepo_data | Sysrepo internal data tree. |
int sr_get_module_replay_support | ( | sr_conn_ctx_t * | conn, |
const char * | module_name, | ||
struct timespec * | earliest_notif, | ||
int * | enabled | ||
) |
Learn replay support of a module.
[in] | conn | Connection to use. |
[in] | module_name | Name of the module to check. |
[out] | earliest_notif | Optional timestamp of the earliest stored notification, zeroed if none are stored. Can be set even if enabled is false when replay was enabled in the past. |
[out] | enabled | Whether replay support is enabled or disabled. |
const char* sr_get_repo_path | ( | void | ) |
Get the common path prefix for all sysrepo files.
int sr_install_module | ( | sr_conn_ctx_t * | conn, |
const char * | schema_path, | ||
const char * | search_dirs, | ||
const char ** | features | ||
) |
Install a new schema (module) into sysrepo.
For all datastores and notifications the default plugins are used.
[in] | conn | Connection to use. |
[in] | schema_path | Path to the new schema. Can have either YANG or YIN extension/format. |
[in] | search_dirs | Optional search directories for import schemas, supports the format <dir>[:<dir>]* . |
[in] | features | Optional array of enabled features ended with NULL. Feature '*' enables them all. |
int sr_install_module2 | ( | sr_conn_ctx_t * | conn, |
const char * | schema_path, | ||
const char * | search_dirs, | ||
const char ** | features, | ||
const sr_module_ds_t * | module_ds, | ||
const char * | owner, | ||
const char * | group, | ||
mode_t | perm, | ||
const char * | data, | ||
const char * | data_path, | ||
LYD_FORMAT | format | ||
) |
Install a new schema (module) into sysrepo with all the available options.
If a libyang import callback is set for conn
context, it will be used when installing the modules.
Any initial data are used as running
, startup
, and factory-default
datastore data. If not set, the datastore plugin will be used to get the initial data for each datastore, which should generally be empty but may not be for custom DS plugins.
[in] | conn | Connection to use. |
[in] | schema_path | Path to the new schema. Can have either YANG or YIN extension/format. |
[in] | search_dirs | Optional search directories for import schemas, supports the format <dir>[:<dir>]* . |
[in] | features | Optional array of enabled features ended with NULL, all disabled by default. Feature '*' enables them all. |
[in] | module_ds | Optional datastore implementation plugin names for each datastore, NULL for all defaults. If only SR_DS_RUNNING plugin name is NULL, it is disabled and effectively always mirrors SR_DS_STARTUP. |
[in] | owner | Optional initial owner of the module data, process user by default. |
[in] | group | Optional initial group of the module data, process group by default. |
[in] | perm | Optional initial permissions of the module data, otherwise system defaults are applied. |
[in] | data | Optional initial data in format to set, only if data_path is not set. |
[in] | data_path | Optional path to an initial data file in format to set, only if data is not set. |
[in] | format | Format of data or data_path file. |
int sr_install_modules | ( | sr_conn_ctx_t * | conn, |
const char ** | schema_paths, | ||
const char * | search_dirs, | ||
const char *** | features | ||
) |
Install new schemas (modules) into sysrepo in a batch.
For all datastores and notifications the default plugins are used.
[in] | conn | Connection to use. |
[in] | schema_paths | Array of paths to the new schemas terminated by NULL. Can have either YANG or YIN extension/format. |
[in] | search_dirs | Optional search directories for import schemas, supports the format <dir>[:<dir>]* . |
[in] | features | Array of the same length as schema_paths (minus the last NULL). Each item is an array of enabled features ended with NULL for the schema_paths on the same index. Can be NULL for leaving all the features disabled. |
int sr_install_modules2 | ( | sr_conn_ctx_t * | conn, |
const sr_install_mod_t * | modules, | ||
uint32_t | module_count, | ||
const char * | search_dirs, | ||
const char * | data, | ||
const char * | data_path, | ||
LYD_FORMAT | format | ||
) |
Install new schemas (modules) into sysrepo in a batch with all the available options.
See sr_install_module2 for details.
[in] | conn | Connection to use. |
[in] | modules | Array of new modules to be installed with all their information. |
[in] | module_count | Count of modules . |
[in] | search_dirs | Optional search directories for import schemas, supports the format <dir>[:<dir>]* . |
[in] | data | Optional initial data of all the modules in format to set, only if data_path is not set. |
[in] | data_path | Optional path to an initial data file of all the modules in format to set, only if data is not set. |
[in] | format | Format of data or data_path file. |
int sr_is_module_internal | ( | const struct lys_module * | ly_mod | ) |
Check whether a module is an internal libyang or sysrepo module. Evaluates to true for all the modules that are installed by default when no modules were explicitly added.
[in] | ly_mod | Module to check. |
int sr_remove_module | ( | sr_conn_ctx_t * | conn, |
const char * | module_name, | ||
int | force | ||
) |
Remove an installed module from sysrepo.
Required WRITE access.
[in] | conn | Connection to use. |
[in] | module_name | Name of the module to remove. |
[in] | force | If there are other installed modules depending on module_name , remove them, too. |
int sr_remove_modules | ( | sr_conn_ctx_t * | conn, |
const char ** | module_names, | ||
int | force | ||
) |
Remove installed modules from sysrepo.
Required WRITE access.
[in] | conn | Connection to use. |
[in] | module_names | Array of names of modules to remove terminated by NULL. |
[in] | force | If there are other installed modules depending on module_names , remove them, too. |
int sr_set_module_ds_access | ( | sr_conn_ctx_t * | conn, |
const char * | module_name, | ||
int | mod_ds, | ||
const char * | owner, | ||
const char * | group, | ||
mode_t | perm | ||
) |
Change module permissions.
[in] | conn | Connection to use. |
[in] | module_name | Name of the module to change, NULL for all the modules. |
[in] | mod_ds | Affected datastore, sr_datastore_t value or SR_MOD_DS_NOTIF. |
[in] | owner | Optional, new owner of the module. |
[in] | group | Optional, new group of the module. |
[in] | perm | Optional, new permissions of the module. |
int sr_set_module_replay_support | ( | sr_conn_ctx_t * | conn, |
const char * | module_name, | ||
int | enable | ||
) |
Change module replay support.
[in] | conn | Connection to use. |
[in] | module_name | Name of the module to change. NULL to change all the modules. |
[in] | enable | 0 to disable, non-zero to enable. |
int sr_update_module | ( | sr_conn_ctx_t * | conn, |
const char * | schema_path, | ||
const char * | search_dirs | ||
) |
Update an installed schema (module) to a new revision.
Required WRITE access.
[in] | conn | Connection to use. |
[in] | schema_path | Path to the updated schema. Can have either YANG or YIN extension/format. |
[in] | search_dirs | Optional search directories for import schemas, supports the format <dir>[:<dir>]* . |
int sr_update_modules | ( | sr_conn_ctx_t * | conn, |
const char ** | schema_paths, | ||
const char * | search_dirs | ||
) |
Update installed schemas (modules) to new revisions in a batch.
Required WRITE access.
[in] | conn | Connection to use. |
[in] | schema_paths | Array of paths to the new schemas terminated by NULL. Can have either YANG or YIN extension/format. |
[in] | search_dirs | Optional search directories for import schemas, supports the format <dir>[:<dir>]* . |