yumapro
24.10-3
YumaPro SDK
|
Handle YANG validation callbacks for SIL and SIL-SA code. More...
Functions | |
status_t | agt_val_silcall_run_validate_callbacks (ses_cb_t *scb, rpc_msg_t *msg, cfg_template_t *target, op_editop_t editop) |
Run the validate SIL callbacks for the transaction in progress. More... | |
status_t | agt_val_silcall_call_sil_callbacks (agt_cbtyp_t cbtyp, ses_cb_t *scb, rpc_msg_t *msg, cfg_template_t *target, op_editop_t editop) |
Invoke all the mode (AGT_CB_APPLY) callbacks for a source and target and write operation. More... | |
boolean | agt_val_silcall_has_subsys_callbacks (agt_cfg_transaction_t *txcb) |
Check if the transaction needs subsystem callbacks. More... | |
status_t | agt_val_silcall_setup (agt_cbtyp_t cbtyp, op_editop_t editop, ses_cb_t *scb, rpc_msg_t *msg, val_value_t *newnode, val_value_t *curnode, boolean lookparent, boolean indelete, boolean in_reverse_delete, agt_cfg_undo_rec_t *undo) |
Find the correct user callback function and invoke it. More... | |
status_t | agt_val_silcall_setup_ex (agt_cbtyp_t cbtyp, op_editop_t editop, ses_cb_t *scb, rpc_msg_t *msg, val_value_t *newnode, val_value_t *curnode, boolean lookparent, boolean indelete, boolean in_reverse_delete, agt_cfg_undo_rec_t *undo, agt_cfg_transaction_t *txcb) |
Find the correct user callback function and invoke it Extended. More... | |
status_t | agt_val_silcall_reverse_edit (agt_cfg_undo_rec_t *undo, ses_cb_t *scb, rpc_msg_t *msg, op_editop_t editop, val_value_t *newval, val_value_t *curval, boolean lookparent, boolean indelete, agt_cfg_edit_action_t edit_action) |
Attempt SIL callbacks for a reverse edit. More... | |
status_t | agt_val_silcall_invoke_raw (ses_cb_t *scb, rpc_msg_t *msg, agt_cbtyp_t cbtyp, op_editop_t editop, val_value_t *newval, val_value_t *curval) |
Call a SIL callback directly; used in rollback. More... | |
status_t | agt_val_silcall_handle_remote_transaction (agt_cfg_transaction_t *txcb, ses_cb_t *scb, rpc_msg_t *msg, agt_cbtyp_t cbtyp, boolean is_reverse_edit) |
Start a distributed transaction with the agt_sil module This function will not return until the entire callback phase is completed (or times out) More... | |
status_t | agt_val_silcall_invoke (agt_cbtyp_t cbtyp, ses_cb_t *scb, rpc_msg_t *msg, agt_cfg_undo_rec_t *undo) |
Invoke the callbacks recorded in an undo record. More... | |
boolean | agt_val_silcall_is_deepest (rpc_msg_t *msg) |
Check if the current nested SIL callback is at the deepest level for the current edit. More... | |
boolean | agt_val_silcall_deepest_and_last (agt_cfg_nested_silcall_t *silcall) |
Check if the current nested SIL callback is at the deepest level for the current edit and that it is the last sibling in the silcall. More... | |
status_t | agt_val_silcall_check_order_hook (agt_cfg_transaction_t *txcb, op_editop_t editop, val_value_t *newnode, val_value_t *curnode) |
Check if a Set-Order-Hook callback is needed for the current edit; only checked for the list actually being edited. More... | |
Handle YANG validation callbacks for SIL and SIL-SA code.
Handles local and remote transactions for edit transactions.
status_t agt_val_silcall_call_sil_callbacks | ( | agt_cbtyp_t | cbtyp, |
ses_cb_t * | scb, | ||
rpc_msg_t * | msg, | ||
cfg_template_t * | target, | ||
op_editop_t | editop | ||
) |
Invoke all the mode (AGT_CB_APPLY) callbacks for a source and target and write operation.
cbtyp | callback mode |
scb | session control block |
msg | incoming rpc_msg_t in progress |
target | config database target |
editop | operation for the base transaction |
status_t agt_val_silcall_check_order_hook | ( | agt_cfg_transaction_t * | txcb, |
op_editop_t | editop, | ||
val_value_t * | newnode, | ||
val_value_t * | curnode | ||
) |
Check if a Set-Order-Hook callback is needed for the current edit; only checked for the list actually being edited.
txcb | transaction in progress |
editop | edit-config operation attribute value |
newnode | node from PDU |
curnode | node from database (if any) |
boolean agt_val_silcall_deepest_and_last | ( | agt_cfg_nested_silcall_t * | silcall | ) |
Check if the current nested SIL callback is at the deepest level for the current edit and that it is the last sibling in the silcall.
Meaning this is the last silcall for the whole subtree.
Exxample.
container tnest { list tlist { key idx; leaf idx { type int32; } list tlist2 { key idx2; leaf idx2 { type int32; } leaf c1 { type string; } list tlist3 { key idx3; leaf idx3 { type int32; } leaf c2 { type string; } } } } }
In the example above, the code is generated as EDIT2 code so there are no callbacks for leafs
silcall | SIL callback record to check |
It will return FALSE for list 'tlist3' if there are more silcalls for 'tlist3' as a sibling call. Meaning if there are more callbacks for the same list object. Or if there are more the same deepest level silcalls available.
FALSE if there is no current silcall set
status_t agt_val_silcall_handle_remote_transaction | ( | agt_cfg_transaction_t * | txcb, |
ses_cb_t * | scb, | ||
rpc_msg_t * | msg, | ||
agt_cbtyp_t | cbtyp, | ||
boolean | is_reverse_edit | ||
) |
Start a distributed transaction with the agt_sil module This function will not return until the entire callback phase is completed (or times out)
Only present if WITH_YCONTROL=1
txcb | transaction control block to check |
scb | session with username to use for the remote transaction |
msg | RPC message to use |
cbtyp | callback phase to use |
is_reverse_edit | TRUE if reverse-edit after a commit |
boolean agt_val_silcall_has_subsys_callbacks | ( | agt_cfg_transaction_t * | txcb | ) |
Check if the transaction needs subsystem callbacks.
Check if this is a distributed transaction
txcb | transaction control block to check |
status_t agt_val_silcall_invoke | ( | agt_cbtyp_t | cbtyp, |
ses_cb_t * | scb, | ||
rpc_msg_t * | msg, | ||
agt_cfg_undo_rec_t * | undo | ||
) |
Invoke the callbacks recorded in an undo record.
A nested_silcall record should only be recorded if callback found
cbtyp | agent callback type |
scb | session control block invoking the callback !!! This parm should not be NULL because only the !!! agt_val_root_check in agt.c calls with scb==NULL and !!! that never invokes any SIL callbacks |
msg | RPC message in progress callback; FALSE if not |
undo | undo rec to use |
status_t agt_val_silcall_invoke_raw | ( | ses_cb_t * | scb, |
rpc_msg_t * | msg, | ||
agt_cbtyp_t | cbtyp, | ||
op_editop_t | editop, | ||
val_value_t * | newval, | ||
val_value_t * | curval | ||
) |
Call a SIL callback directly; used in rollback.
scb | session control block |
msg | incoming rpc_msg_t in progress |
cbtyp | type of callback |
editop | new edit operation |
newval | newval for edit |
curval | curval for edit |
boolean agt_val_silcall_is_deepest | ( | rpc_msg_t * | msg | ) |
Check if the current nested SIL callback is at the deepest level for the current edit.
Example
container tnest { list tlist { key idx; leaf idx { type int32; } list tlist2 { key idx2; leaf idx2 { type int32; } leaf c1 { type string; } list tlist3 { key idx3; leaf idx3 { type int32; } leaf c2 { type string; } } } } }
In the example above, the code is generated as EDIT2 code so there are no callbacks for leafs
This function would return TRUE for list 'tlist3' and FALSE for all ancestor node callbacks (tnest, tlist, list2)
msg | RPC message to check |
FALSE if the current SIL callback is not at the deepest level for the edit that contains the silcall record. There is at least one nested_silcall involved in the current edit that is at a child level compared to the current node being called
FALSE if there is no current silcall set
status_t agt_val_silcall_reverse_edit | ( | agt_cfg_undo_rec_t * | undo, |
ses_cb_t * | scb, | ||
rpc_msg_t * | msg, | ||
op_editop_t | editop, | ||
val_value_t * | newval, | ||
val_value_t * | curval, | ||
boolean | lookparent, | ||
boolean | indelete, | ||
agt_cfg_edit_action_t | edit_action | ||
) |
Attempt SIL callbacks for a reverse edit.
undo | agt_cfg_undo_rec_t struct to process |
scb | session control block |
msg | incoming rpc_msg_t in progress |
editop | new edit operation |
newval | newval for edit |
curval | curval for edit |
lookparent | TRUE if the parent should be checked for a callback function; FALSE otherwise |
indelete | TRUE if in middle of a sil-delete-children-first callback; FALSE if not |
edit_action | requested edit operation |
status_t agt_val_silcall_run_validate_callbacks | ( | ses_cb_t * | scb, |
rpc_msg_t * | msg, | ||
cfg_template_t * | target, | ||
op_editop_t | editop | ||
) |
Run the validate SIL callbacks for the transaction in progress.
MUST CALL agt_val_validate_write FIRST
scb | session control block | |
[in,out] | msg | incoming rpc_msg_t in progress
|
target | target datastore | |
editop | requested start-state write operation (usually from the default-operation parameter) |
status_t agt_val_silcall_setup | ( | agt_cbtyp_t | cbtyp, |
op_editop_t | editop, | ||
ses_cb_t * | scb, | ||
rpc_msg_t * | msg, | ||
val_value_t * | newnode, | ||
val_value_t * | curnode, | ||
boolean | lookparent, | ||
boolean | indelete, | ||
boolean | in_reverse_delete, | ||
agt_cfg_undo_rec_t * | undo | ||
) |
Find the correct user callback function and invoke it.
cbtyp | agent callback type |
editop | edit operation applied to newnode oand/or curnode |
scb | session control block invoking the callback !!! This parm should not be NULL because only the !!! agt_val_root_check in agt.c calls with scb==NULL and !!! that never invokes any SIL callbacks |
msg | RPC message in progress |
newnode | new node in operation |
curnode | current node in operation |
lookparent | TRUE if the parent should be checked for a callback function; FALSE otherwise |
indelete | TRUE if in middle of a sil-delete-children-first callback; FALSE if not |
in_reverse_delete | TRUE if in the reverse for delete mode. FALSE otherwise |
undo | current undo rec in progress or NULL if none yet |
status_t agt_val_silcall_setup_ex | ( | agt_cbtyp_t | cbtyp, |
op_editop_t | editop, | ||
ses_cb_t * | scb, | ||
rpc_msg_t * | msg, | ||
val_value_t * | newnode, | ||
val_value_t * | curnode, | ||
boolean | lookparent, | ||
boolean | indelete, | ||
boolean | in_reverse_delete, | ||
agt_cfg_undo_rec_t * | undo, | ||
agt_cfg_transaction_t * | txcb | ||
) |
Find the correct user callback function and invoke it Extended.
Extended version, also test undo->edit2_merge = TRUE objects for duplicates in case of complex nested edits with multiple nested list enties.
YPW-840: edit2 SIL callback not invoked for all the instances with different keys for merge
cbtyp | agent callback type |
editop | edit operation applied to newnode oand/or curnode |
scb | session control block invoking the callback !!! This parm should not be NULL because only the !!! agt_val_root_check in agt.c calls with scb==NULL and !!! that never invokes any SIL callbacks |
msg | RPC message in progress |
newnode | new node in operation |
curnode | current node in operation |
lookparent | TRUE if the parent should be checked for a callback function; FALSE otherwise |
indelete | TRUE if in middle of a sil-delete-children-first callback; FALSE if not |
in_reverse_delete | TRUE if in the reverse for delete mode. FALSE otherwise |
undo | current undo rec in progress or NULL if none yet |
txcb | current transaction in progress |