sysrepo  1.4.168
YANG datastore
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
Schema API

Functions

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, int feat_count)
 Install a new schema (module) into sysrepo. Deferred until there are no connections! More...
 
int sr_install_module_data (sr_conn_ctx_t *conn, const char *module_name, const char *data, const char *data_path, LYD_FORMAT format)
 Set newly installed module startup and running data. It is necessary in case empty data are not valid for the particular schema (module). More...
 
int sr_remove_module (sr_conn_ctx_t *conn, const char *module_name)
 Remove an installed module from sysrepo. Deferred until there are no connections! 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. Deferred until there are no connections! More...
 
int sr_cancel_update_module (sr_conn_ctx_t *conn, const char *module_name)
 Cancel scheduled update of a module. More...
 
int sr_set_module_replay_support (sr_conn_ctx_t *conn, const char *module_name, int replay_support)
 Change module replay support. More...
 
int sr_set_module_access (sr_conn_ctx_t *conn, const char *module_name, const char *owner, const char *group, mode_t perm)
 Change module filesystem permissions. More...
 
int sr_get_module_access (sr_conn_ctx_t *conn, const char *module_name, char **owner, char **group, mode_t *perm)
 Learn about module filesystem permissions. More...
 
int sr_enable_module_feature (sr_conn_ctx_t *conn, const char *module_name, const char *feature_name)
 Enable a module feature. Deferred until there are no connections! More...
 
int sr_disable_module_feature (sr_conn_ctx_t *conn, const char *module_name, const char *feature_name)
 Disable a module feature. Deferred until there are no connections! More...
 
int sr_get_module_info (sr_conn_ctx_t *conn, struct lyd_node **sysrepo_data)
 Get internal sysrepo data tree, which holds information about installed modules. These data are from the sysrepo module found in modules/sysrepo.yang. More...
 

Detailed Description

Function Documentation

const char* sr_get_repo_path ( void  )

Get the common path prefix for all sysrepo files.

Note
If a specific path was changed during compilation, it does not use this path prefix.
Returns
Sysrepo repository path.
int sr_install_module ( sr_conn_ctx_t conn,
const char *  schema_path,
const char *  search_dirs,
const char **  features,
int  feat_count 
)

Install a new schema (module) into sysrepo. Deferred until there are no connections!

Parameters
[in]connConnection to use.
[in]schema_pathPath to the new schema. Can have either YANG or YIN extension/format.
[in]search_dirsOptional search directories for import schemas, supports the format <dir>[:<dir>]*.
[in]featuresArray of enabled features.
[in]feat_countNumber of enabled features.
Returns
Error code (SR_ERR_OK on success).
int sr_install_module_data ( sr_conn_ctx_t conn,
const char *  module_name,
const char *  data,
const char *  data_path,
LYD_FORMAT  format 
)

Set newly installed module startup and running data. It is necessary in case empty data are not valid for the particular schema (module).

Parameters
[in]connConnection to use.
[in]module_nameName of the module to set startup data.
[in]dataData to set. Must be NULL if data_path is set.
[in]data_pathData file with the data to set. Must be NULL if data is set.
[in]formatFormat of the data/file.
Returns
Error code (SR_ERR_OK on success).
int sr_remove_module ( sr_conn_ctx_t conn,
const char *  module_name 
)

Remove an installed module from sysrepo. Deferred until there are no connections!

Required WRITE access.

Parameters
[in]connConnection to use.
[in]module_nameName of the module to remove.
Returns
Error code (SR_ERR_OK on success).
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. Deferred until there are no connections!

Required WRITE access.

Parameters
[in]connConnection to use.
[in]schema_pathPath to the updated schema. Can have either YANG or YIN extension/format.
[in]search_dirsOptional search directories for import schemas, supports the format <dir>[:<dir>]*.
Returns
Error code (SR_ERR_OK on success).
int sr_cancel_update_module ( sr_conn_ctx_t conn,
const char *  module_name 
)

Cancel scheduled update of a module.

Required WRITE access.

Parameters
[in]connConnection to use.
[in]module_nameName of the module whose update to cancel.
Returns
Error code (SR_ERR_OK on success).
int sr_set_module_replay_support ( sr_conn_ctx_t conn,
const char *  module_name,
int  replay_support 
)

Change module replay support.

Parameters
[in]connConnection to use.
[in]module_nameName of the module to change. NULL to change all the modules.
[in]replay_support0 to disabled, non-zero to enable.
Returns
Error code (SR_ERR_OK on success).
int sr_set_module_access ( sr_conn_ctx_t conn,
const char *  module_name,
const char *  owner,
const char *  group,
mode_t  perm 
)

Change module filesystem permissions.

Required WRITE access.

Parameters
[in]connConnection to use.
[in]module_nameName of the module to change.
[in]ownerIf set, new owner of the module.
[in]groupIf set, new group of the module.
[in]permIf set, new permissions of the module.
Returns
Error code (SR_ERR_OK on success).
int sr_get_module_access ( sr_conn_ctx_t conn,
const char *  module_name,
char **  owner,
char **  group,
mode_t *  perm 
)

Learn about module filesystem permissions.

Required READ access.

Parameters
[in]connConnection to use.
[in]module_nameName of the module to use.
[in,out]ownerIf set, read the owner of the module.
[in,out]groupIf set, read the group of the module.
[in,out]permIf set, read the permissions of the module.
Returns
Error code (SR_ERR_OK on success).
int sr_enable_module_feature ( sr_conn_ctx_t conn,
const char *  module_name,
const char *  feature_name 
)

Enable a module feature. Deferred until there are no connections!

Note that no recursive if-feature checks are performed meaning the feature may still be effectively disabled in case some of its if-features are disabled. This can be checked using sysrepoctl -l.

Required WRITE access.

Parameters
[in]connConnection to use.
[in]module_nameName of the module to change.
[in]feature_nameName of the feature to enable.
Returns
Error code (SR_ERR_OK on success).
int sr_disable_module_feature ( sr_conn_ctx_t conn,
const char *  module_name,
const char *  feature_name 
)

Disable a module feature. Deferred until there are no connections!

Note that this may effectively also disable any dependant features. This can be checked using sysrepoctl -l.

Required WRITE access.

Parameters
[in]connConnection to use.
[in]module_nameName of the module to change.
[in]feature_nameName of the feature to disable.
Returns
Error code (SR_ERR_OK on success).
int sr_get_module_info ( sr_conn_ctx_t conn,
struct lyd_node **  sysrepo_data 
)

Get internal sysrepo data tree, which holds information about installed modules. These data are from the sysrepo module found in modules/sysrepo.yang.

Parameters
[in]connConnection to use.
[out]sysrepo_dataSysrepo internal data tree.
Returns
Error code (SR_ERR_OK on success).