sysrepo
1.4.168
YANG datastore
|
Typedefs | |
typedef enum sr_edit_flag_e | sr_edit_flag_t |
Flags used to override default behavior of data manipulation calls. More... | |
typedef uint32_t | sr_edit_options_t |
Options overriding default behavior of data manipulation calls, it is supposed to be bitwise OR-ed value of any sr_edit_flag_t flags. More... | |
typedef enum sr_move_position_e | sr_move_position_t |
Options for specifying move direction of sr_move_item call. More... | |
Enumerations | |
enum | sr_edit_flag_e { SR_EDIT_DEFAULT = 0, SR_EDIT_NON_RECURSIVE = 1, SR_EDIT_STRICT = 2, SR_EDIT_ISOLATE = 4 } |
Flags used to override default behavior of data manipulation calls. More... | |
enum | sr_move_position_e { SR_MOVE_BEFORE = 0, SR_MOVE_AFTER = 1, SR_MOVE_FIRST = 2, SR_MOVE_LAST = 3 } |
Options for specifying move direction of sr_move_item call. More... | |
Functions | |
int | sr_set_item (sr_session_ctx_t *session, const char *path, const sr_val_t *value, const sr_edit_options_t opts) |
Prepare to set (create) the value of a leaf, leaf-list, list, or presence container. These changes are applied only after calling sr_apply_changes. Data are represented as sr_val_t structures. More... | |
int | sr_set_item_str (sr_session_ctx_t *session, const char *path, const char *value, const char *origin, const sr_edit_options_t opts) |
Prepare to set (create) the value of a leaf, leaf-list, list, or presence container. These changes are applied only after calling sr_apply_changes. Data are represented as pairs of a path and string value. More... | |
int | sr_delete_item (sr_session_ctx_t *session, const char *path, const sr_edit_options_t opts) |
Prepare to selete the nodes matching the specified xpath. These changes are applied only after calling sr_apply_changes. The accepted values are the same as for sr_set_item_str. More... | |
int | sr_move_item (sr_session_ctx_t *session, const char *path, const sr_move_position_t position, const char *list_keys, const char *leaflist_value, const char *origin, const sr_edit_options_t opts) |
Prepare to move/create the instance of an user-ordered list or leaf-list to the specified position. These changes are applied only after calling sr_apply_changes. More... | |
int | sr_edit_batch (sr_session_ctx_t *session, const struct lyd_node *edit, const char *default_operation) |
Provide a prepared edit data tree to be applied. These changes are applied only after calling sr_apply_changes. More... | |
int | sr_validate (sr_session_ctx_t *session, const char *module_name, uint32_t timeout_ms) |
Perform the validation a datastore and any changes made in the current session, but do not apply nor discard them. More... | |
int | sr_apply_changes (sr_session_ctx_t *session, uint32_t timeout_ms, int wait) |
Apply changes made in the current session. In case the changes could not be applied successfully for any reason, they remain intact in the session. More... | |
int | sr_has_changes (sr_session_ctx_t *session) |
Learn whether there are any prepared non-applied changes in the session. More... | |
int | sr_discard_changes (sr_session_ctx_t *session) |
Discard prepared changes made in the current session. More... | |
int | sr_replace_config (sr_session_ctx_t *session, const char *module_name, struct lyd_node *src_config, uint32_t timeout_ms, int wait) |
Replace a datastore with the contents of a data tree. If the module is specified, limit the operation only to the specified module. If it is not specified, the operation is performed on all modules. More... | |
int | sr_copy_config (sr_session_ctx_t *session, const char *module_name, sr_datastore_t src_datastore, uint32_t timeout_ms, int wait) |
Replaces a conventional datastore with the contents of another conventional datastore. If the module is specified, limits the operation only to the specified module. If it is not specified, the operation is performed on all modules. More... | |
typedef enum sr_edit_flag_e sr_edit_flag_t |
Flags used to override default behavior of data manipulation calls.
typedef uint32_t sr_edit_options_t |
Options overriding default behavior of data manipulation calls, it is supposed to be bitwise OR-ed value of any sr_edit_flag_t flags.
typedef enum sr_move_position_e sr_move_position_t |
Options for specifying move direction of sr_move_item call.
enum sr_edit_flag_e |
Flags used to override default behavior of data manipulation calls.
Enumerator | |
---|---|
SR_EDIT_DEFAULT |
Default behavior - non-strict. |
SR_EDIT_NON_RECURSIVE |
Non-recursive behavior: by sr_set_item, all preceding nodes (parents) of the identified element must exist. |
SR_EDIT_STRICT |
Strict behavior: by sr_set_item the identified element must not exist (similar to NETCONF create operation), by sr_delete_item the identified element must exist (similar to NETCONF delete operation). |
SR_EDIT_ISOLATE |
Create new operation separately, independent of all the previous operations. Since all the operations are concatenated into one edit tree, it may happen that 2 incompatible operations are set and an error is observed. This flag can in those cases be used. Also, if an error is returned the previous edit is always left untouched. |
enum sr_move_position_e |
Options for specifying move direction of sr_move_item call.
int sr_set_item | ( | sr_session_ctx_t * | session, |
const char * | path, | ||
const sr_val_t * | value, | ||
const sr_edit_options_t | opts | ||
) |
Prepare to set (create) the value of a leaf, leaf-list, list, or presence container. These changes are applied only after calling sr_apply_changes. Data are represented as sr_val_t structures.
With default options it recursively creates all missing nodes (containers and lists including their key leaves) in the xpath to the specified node (can be turned off with SR_EDIT_NON_RECURSIVE option). If SR_EDIT_STRICT flag is set, the node must not exist (otherwise an error is returned).
To create a list use xpath with key values included and pass NULL as value argument.
Setting of a leaf-list value appends the value at the end of the leaf-list. A value of leaf-list can be specified either by predicate in xpath or by value argument. If both are present, value argument is ignored and xpath predicate is used.
[in] | session | Session (DS-specific) to use. |
[in] | path | Path identifier of the data element to be set. |
[in] | value | Value to be set. xpath member of the sr_val_t structure can be NULL. |
[in] | opts | Options overriding default behavior of this call. |
int sr_set_item_str | ( | sr_session_ctx_t * | session, |
const char * | path, | ||
const char * | value, | ||
const char * | origin, | ||
const sr_edit_options_t | opts | ||
) |
Prepare to set (create) the value of a leaf, leaf-list, list, or presence container. These changes are applied only after calling sr_apply_changes. Data are represented as pairs of a path and string value.
Function provides the same functionality as sr_set_item.
[in] | session | Session (DS-specific) to use. |
[in] | path | Path identifier of the data element to be set. |
[in] | value | String representation of the value to be set. |
[in] | origin | Origin of the value, used only for SR_DS_OPERATIONAL edits. |
[in] | opts | Options overriding default behavior of this call. |
int sr_delete_item | ( | sr_session_ctx_t * | session, |
const char * | path, | ||
const sr_edit_options_t | opts | ||
) |
Prepare to selete the nodes matching the specified xpath. These changes are applied only after calling sr_apply_changes. The accepted values are the same as for sr_set_item_str.
If SR_EDIT_STRICT flag is set the specified node must must exist in the datastore. If the path
includes the list keys/leaf-list value, the specified instance is deleted. If the path
of list/leaf-list does not include keys/value, all instances are deleted.
[in] | session | Session (DS-specific) to use. |
[in] | path | Path identifier of the data element to be deleted. |
[in] | opts | Options overriding default behavior of this call. |
int sr_move_item | ( | sr_session_ctx_t * | session, |
const char * | path, | ||
const sr_move_position_t | position, | ||
const char * | list_keys, | ||
const char * | leaflist_value, | ||
const char * | origin, | ||
const sr_edit_options_t | opts | ||
) |
Prepare to move/create the instance of an user-ordered list or leaf-list to the specified position. These changes are applied only after calling sr_apply_changes.
Item can be moved to the first or last position or positioned relatively to its sibling.
With default options it recursively creates all missing nodes (containers and lists including their key leaves) in the xpath to the specified node (can be turned off with SR_EDIT_NON_RECURSIVE option). If SR_EDIT_STRICT flag is set, the node must not exist (otherwise an error is returned).
[in] | session | Session (DS-specific) to use |
[in] | path | Path identifier of the data element to be moved. |
[in] | position | Requested move direction. |
[in] | list_keys | Predicate identifying the relative list instance (example input [key1="val1"][key2="val2"]... ). |
[in] | leaflist_value | Value of the relative leaf-list instance (example input val1 ) used to determine relative position, needed only if position argument is SR_MOVE_BEFORE or SR_MOVE_AFTER. |
[in] | origin | Origin of the value, used only for SR_DS_OPERATIONAL edits. |
[in] | opts | Options overriding default behavior of this call. |
int sr_edit_batch | ( | sr_session_ctx_t * | session, |
const struct lyd_node * | edit, | ||
const char * | default_operation | ||
) |
Provide a prepared edit data tree to be applied. These changes are applied only after calling sr_apply_changes.
[in] | session | Session (DS-specific) to use. |
[in] | edit | Edit content, similar semantics to NETCONF <edit-config> content. |
[in] | default_operation | Default operation for nodes without operation on themselves or any parent. Possible values are merge , replace , or none (see NETCONF RFC). |
int sr_validate | ( | sr_session_ctx_t * | session, |
const char * | module_name, | ||
uint32_t | timeout_ms | ||
) |
Perform the validation a datastore and any changes made in the current session, but do not apply nor discard them.
Provides only YANG validation, apply-changes subscribers will not be notified in this case.
[in] | session | Session (DS-specific) to use. |
[in] | module_name | If specified, limits the validate operation only to this module and its dependencies. |
[in] | timeout_ms | Operational callback timeout in milliseconds. If 0, default is used. |
int sr_apply_changes | ( | sr_session_ctx_t * | session, |
uint32_t | timeout_ms, | ||
int | wait | ||
) |
Apply changes made in the current session. In case the changes could not be applied successfully for any reason, they remain intact in the session.
Required WRITE access.
[in] | session | Session (DS-specific) to apply changes of. |
[in] | timeout_ms | Configuration callback timeout in milliseconds. If 0, default is used. Note that this timeout is measured separately for each callback meaning this whole function call can easily take more time than this timeout if there are changes applied for several subscribers. |
[in] | wait | Deprecated and ignored, the function always waits until all the events are processed. |
int sr_has_changes | ( | sr_session_ctx_t * | session | ) |
Learn whether there are any prepared non-applied changes in the session.
[in] | session | Session (DS-specific) to check changes in. |
int sr_discard_changes | ( | sr_session_ctx_t * | session | ) |
int sr_replace_config | ( | sr_session_ctx_t * | session, |
const char * | module_name, | ||
struct lyd_node * | src_config, | ||
uint32_t | timeout_ms, | ||
int | wait | ||
) |
Replace a datastore with the contents of a data tree. If the module is specified, limit the operation only to the specified module. If it is not specified, the operation is performed on all modules.
Required WRITE access.
[in] | session | Session (DS-specific - target datastore) to use. |
[in] | module_name | If specified, limits the replace operation only to this module. |
[in] | src_config | Source data to replace the datastore. Is ALWAYS spent and cannot be further used by the application! |
[in] | timeout_ms | Configuration callback timeout in milliseconds. If 0, default is used. |
[in] | wait | Deprecated and ignored, the function always waits until all the events are processed. |
int sr_copy_config | ( | sr_session_ctx_t * | session, |
const char * | module_name, | ||
sr_datastore_t | src_datastore, | ||
uint32_t | timeout_ms, | ||
int | wait | ||
) |
Replaces a conventional datastore with the contents of another conventional datastore. If the module is specified, limits the operation only to the specified module. If it is not specified, the operation is performed on all modules.
Required WRITE access.
[in] | session | Session (DS-specific - target datastore) to use. |
[in] | module_name | Optional module name that limits the copy operation only to this module. |
[in] | src_datastore | Source datastore. |
[in] | timeout_ms | Configuration callback timeout in milliseconds. If 0, default is used. |
[in] | wait | Deprecated and ignored, the function always waits until all the events are processed. |