yumapro  23.10T-7
YumaPro SDK
Loading...
Searching...
No Matches
YANG Validation Callbacks

Handle YANG validation callbacks for SIL and SIL-SA code. More...

Collaboration diagram for YANG Validation Callbacks:

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...
 

Detailed Description

Handle YANG validation callbacks for SIL and SIL-SA code.

Handles local and remote transactions for edit transactions.

Function Documentation

◆ agt_val_silcall_call_sil_callbacks()

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.

Parameters
cbtypcallback mode
scbsession control block
msgincoming rpc_msg_t in progress
targetconfig database target
editopoperation for the base transaction
Returns
status
Here is the call graph for this function:
Here is the caller graph for this function:

◆ agt_val_silcall_check_order_hook()

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.

Parameters
txcbtransaction in progress
editopedit-config operation attribute value
newnodenode from PDU
curnodenode from database (if any)
Returns
status
Here is the call graph for this function:

◆ agt_val_silcall_deepest_and_last()

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

Parameters
silcallSIL callback record to check
Returns
This function would return TRUE for list 'tlist3' and FALSE for all ancestor node callbacks (tnest, tlist, list2)

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

◆ agt_val_silcall_handle_remote_transaction()

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

Parameters
txcbtransaction control block to check
scbsession with username to use for the remote transaction
msgRPC message to use
cbtypcallback phase to use
is_reverse_editTRUE if reverse-edit after a commit
Returns
status
Here is the call graph for this function:
Here is the caller graph for this function:

◆ agt_val_silcall_has_subsys_callbacks()

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

Parameters
txcbtransaction control block to check
Returns
TRUE if any subsystems involved in this transaction
FALSE if no subsystems involved in this transaction
Here is the call graph for this function:
Here is the caller graph for this function:

◆ agt_val_silcall_invoke()

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

Parameters
cbtypagent callback type
scbsession 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
msgRPC message in progress callback; FALSE if not
undoundo rec to use
Returns
status of the operation (usually returned from the callback)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ agt_val_silcall_invoke_raw()

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.

Parameters
scbsession control block
msgincoming rpc_msg_t in progress
cbtyptype of callback
editopnew edit operation
newvalnewval for edit
curvalcurval for edit
Returns
status
Here is the call graph for this function:

◆ agt_val_silcall_is_deepest()

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)

Parameters
msgRPC message to check
Returns
TRUE if the current SIL callback is at the deepest level for the edit that contains the silcall record

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

◆ agt_val_silcall_reverse_edit()

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.

Parameters
undoagt_cfg_undo_rec_t struct to process
scbsession control block
msgincoming rpc_msg_t in progress
editopnew edit operation
newvalnewval for edit
curvalcurval for edit
lookparentTRUE if the parent should be checked for a callback function; FALSE otherwise
indeleteTRUE if in middle of a sil-delete-children-first callback; FALSE if not
edit_actionrequested edit operation
Returns
status
Here is the call graph for this function:
Here is the caller graph for this function:

◆ agt_val_silcall_run_validate_callbacks()

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

Parameters
scbsession control block
[in,out]msgincoming rpc_msg_t in progress
  • msg rpc_err_rec_t structs may be malloced and added to the msg->rpc_errQ
targettarget datastore
editoprequested start-state write operation
(usually from the default-operation parameter)
Returns
status of the operation
Here is the call graph for this function:
Here is the caller graph for this function:

◆ agt_val_silcall_setup()

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.

Parameters
cbtypagent callback type
editopedit operation applied to newnode oand/or curnode
scbsession 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
msgRPC message in progress
newnodenew node in operation
curnodecurrent node in operation
lookparentTRUE if the parent should be checked for a callback function; FALSE otherwise
indeleteTRUE if in middle of a sil-delete-children-first callback; FALSE if not
in_reverse_deleteTRUE if in the reverse for delete mode.
FALSE otherwise
undocurrent undo rec in progress or NULL if none yet
Returns
status of the operation (usually returned from the callback) NO USER CALLBACK FOUND NO_ERR
Here is the call graph for this function:
Here is the caller graph for this function:

◆ agt_val_silcall_setup_ex()

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

Parameters
cbtypagent callback type
editopedit operation applied to newnode oand/or curnode
scbsession 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
msgRPC message in progress
newnodenew node in operation
curnodecurrent node in operation
lookparentTRUE if the parent should be checked for a callback function; FALSE otherwise
indeleteTRUE if in middle of a sil-delete-children-first callback; FALSE if not
in_reverse_deleteTRUE if in the reverse for delete mode.
FALSE otherwise
undocurrent undo rec in progress or NULL if none yet
txcbcurrent transaction in progress
Returns
status of the operation (usually returned from the callback) NO USER CALLBACK FOUND NO_ERR
Here is the call graph for this function:
Here is the caller graph for this function: