yumapro  24.10-3
YumaPro SDK
Loading...
Searching...
No Matches
YANG Validation

YANG Validation control and instrumentation callbacks. More...

Collaboration diagram for YANG Validation:

Functions

status_t agt_val_rpc_xpath_check (ses_cb_t *scb, rpc_msg_t *rpcmsg, xml_msg_hdr_t *msg, val_value_t *rpcinput, obj_template_t *rpcroot)
 Check for any nodes which are present but have false when-stmts associated with the node. More...
 
status_t agt_val_action_xpath_check (ses_cb_t *scb, rpc_msg_t *rpcmsg, xml_msg_hdr_t *msg, val_value_t *rpcinput, obj_template_t *rpcroot, val_value_t *action_val)
 Check for any nodes which are present but have false when-stmts associated with the node. More...
 
status_t agt_val_instance_check (ses_cb_t *scb, xml_msg_hdr_t *msg, val_value_t *valset, val_value_t *valroot, ncx_layer_t layer)
 Check for the proper number of object instances for the specified value struct. More...
 
status_t agt_val_root_check (ses_cb_t *scb, xml_msg_hdr_t *msghdr, agt_cfg_transaction_t *txcb, val_value_t *root)
 Perform a YANG validation root-check. More...
 
status_t agt_val_validate_write (ses_cb_t *scb, rpc_msg_t *msg, cfg_template_t *target, val_value_t *valroot, op_editop_t editop, boolean with_sil_callbacks)
 Validate the requested <edit-config> write operation. More...
 
status_t agt_val_apply_write (ses_cb_t *scb, rpc_msg_t *msg, cfg_template_t *target, val_value_t *pducfg, op_editop_t editop)
 Apply the requested write operation. More...
 
status_t agt_val_apply_commit (ses_cb_t *scb, rpc_msg_t *msg, cfg_template_t *source, cfg_template_t *target, boolean save_nvstore, boolean save_backup, const xmlChar *backup_source, boolean *save_backup_done, boolean *rootcheck_done, status_t *rootcheck_res)
 Apply the requested commit operation. More...
 
status_t agt_val_check_commit_edits (ses_cb_t *scb, rpc_msg_t *msg, cfg_template_t *source, cfg_template_t *target)
 Check if the requested commit operation would cause any ACM or partial lock violations in the running config. More...
 
status_t agt_val_delete_dead_nodes (ses_cb_t *scb, rpc_msg_t *msg, val_value_t *root)
 Mark nodes deleted for each false when-stmt from <validate> More...
 
status_t agt_val_start_delete_dead_nodes (ses_cb_t *scb, rpc_msg_t *msg, val_value_t *root)
 Mark nodes deleted for each false when-stmt from <validate> More...
 
void agt_val_finish_delete_dead_nodes (rpc_msg_t *msg)
 Finish deleting dead nodes. More...
 
void agt_val_add_module_commit_tests (ncx_module_t *mod, boolean set_augment)
 Invoke module commit tests. More...
 
void agt_val_init_commit_tests (void)
 Initialize commit tests. More...
 
void agt_val_clean_cached_results (void)
 Clean cached results. More...
 
boolean agt_val_edit_was_deleted (agt_cfg_transaction_t *txcb, agt_cfg_undo_rec_t *undo, val_value_t *newnode, val_value_t *curnode, boolean find_real_edit)
 Check if the edit in progress was deleted by delete_dead_nodes. More...
 
status_t agt_val_commit_delete_allowed (ses_cb_t *scb, rpc_msg_t *msg, val_value_t *deleteval, boolean isfirst)
 Check if the current session is allowed to delete the node found in the requested commit delete operation. More...
 
status_t agt_val_setup_remove_node (rpc_msg_t *msg, val_value_t *curnode, val_value_t *newnode_parent, boolean for_extra_delete, boolean for_commit_deletes, agt_cfg_undo_rec_t **ret_undo, agt_cfg_undo_rec_t **ret_parent_undo)
 Setup an edit node for a node that needs to be removed because the module is being unloaded. More...
 
status_t agt_val_add_edit (ses_cb_t *scb, rpc_msg_t *msg, agt_cfg_transaction_t *txcb, const xmlChar *defpath, val_value_t *edit_value, op_editop_t editop)
 Create new edit based on edit_value. More...
 
status_t agt_val_add_edit_ex (ses_cb_t *scb, rpc_msg_t *msg, agt_cfg_transaction_t *txcb, const xmlChar *defpath, val_value_t *edit_value, const xmlChar *edit_operation, const xmlChar *insert_where, const xmlChar *insert_point)
 Create a new edit based on edit_value. More...
 
status_t agt_val_add_edit_insert (ses_cb_t *scb, rpc_msg_t *msg, agt_cfg_transaction_t *txcb, const xmlChar *defpath, val_value_t *edit_value, yang_patch_op_t patch_op, const xmlChar *insert_where, const xmlChar *insert_point)
 Add Edit Insert function. More...
 
status_t agt_val_add_edit_max (ses_cb_t *scb, rpc_msg_t *msg, agt_cfg_transaction_t *txcb, const xmlChar *defpath, val_value_t *edit_value, const xmlChar *edit_operation, const xmlChar *insert_where, const xmlChar *insert_point, boolean skip_cb)
 Create a new edit based on edit_value. More...
 
val_value_tagt_val_get_data (ncx_cfg_t cfg_id, const xmlChar *defpath, status_t *retres)
 Invoke get data callback. More...
 
boolean agt_val_check_in_reverse_delete (val_value_t *useval, agt_cfg_undo_rec_t *undo)
 Check if currently in reverse deletes. More...
 
status_t agt_val_delete_def_dead_nodes (ses_cb_t *scb, xml_msg_hdr_t *msghdr, val_value_t *startval, val_value_t *curval, val_value_t *root)
 Delete all the default nodes that have false when-stmt exprs. More...
 
status_t agt_val_check_validate_complete (ses_cb_t *scb, rpc_msg_t *msg, val_value_t *source_root, cfg_template_t *target)
 Check if the validate complete callbacks need to be invoked. More...
 
status_t agt_val_rollback_attempt_rollback (ses_cb_t *scb, rpc_msg_t *msg, cfg_template_t *target)
 Attempt to rollback a transaction attempt. More...
 

Detailed Description

YANG Validation control and instrumentation callbacks.

General val_value_t processing

Additional steps to write to a config database

Steps to test for commit-ready

Function Documentation

◆ agt_val_action_xpath_check()

status_t agt_val_action_xpath_check ( ses_cb_t scb,
rpc_msg_t rpcmsg,
xml_msg_hdr_t msg,
val_value_t rpcinput,
obj_template_t rpcroot,
val_value_t action_val 
)

Check for any nodes which are present but have false when-stmts associated with the node.

These are errors and need to be flagged as unknown-element.

Same as agt_val_rpc_xpath_check but an action_val is passed This is the context node within the message tree passed to the server. It is NOT the operational datastore

Parameters
scbsession control block (may be NULL; no session stats)
rpcmsgRPC msg header for audit purposes
[in,out]msgxml_msg_hdr t from msg in progress
  • NULL MEANS NO RPC-ERRORS ARE RECORDED
  • msg->msg_errQ may have rpc_err_rec_t structs added to it which must be freed by the called with the rpc_err_free_record function. Only if msg not NULL.
[in,out]rpcinputRPC input node conceptually under rpcroot except this rpcinput has no parent node so a fake one will be termporarily added to prevent false XPath validation errors
rpcinput if false nodes found under rpcinput they are deleted.
rpcrootRPC method node. The conceptual parent of this node is used as the document root (/rpc /)
action_valthe ACTION node in the message The action INPUT node has been set as the action_val object temporarily. This allows the input to be parsed and the correct tree depth is maintained.
Returns
status of the operation
NO_ERR if no false when or must statements found
Here is the call graph for this function:

◆ agt_val_add_edit()

status_t agt_val_add_edit ( ses_cb_t scb,
rpc_msg_t msg,
agt_cfg_transaction_t txcb,
const xmlChar *  defpath,
val_value_t edit_value,
op_editop_t  editop 
)

Create new edit based on edit_value.

if its NULL or invalid the error will be generated.

Only allowed for Set Hooks or Post Set Hook, the rest are ignored. Add_edit is not allowed for default nodes or default NP-contaners

Parameters
scbsession invoking the edit
msgincoming commit rpc_msg_t in progress
txcbtransaction in progress
defpathXPath path of object instance
edit_valueval_value_t representing newnode in transaction only needed for create, merge, replace, not delete
editopedit operation to use
Returns
status
Here is the call graph for this function:

◆ agt_val_add_edit_ex()

status_t agt_val_add_edit_ex ( ses_cb_t scb,
rpc_msg_t msg,
agt_cfg_transaction_t txcb,
const xmlChar *  defpath,
val_value_t edit_value,
const xmlChar *  edit_operation,
const xmlChar *  insert_where,
const xmlChar *  insert_point 
)

Create a new edit based on edit_value.

if its NULL or invalid the error will be generated. (extended)

Move or insertion OP available.

Only allowed for Set Hooks or Post Set Hook, the rest are ignored. Add_edit is not allowed for default nodes or default NP-contaners

Parameters
scbsession invoking the edit
msgincoming commit rpc_msg_t in progress
txcbtransaction in progress
defpathXPath path of object instance
edit_valueval_value_t representing newnode in transaction only needed for create, merge, replace, not delete
edit_operation<operation string>.
  • "create"
  • "delete"
  • "insert"
  • "merge"
  • "move"
  • "replace"
  • "remove"
insert_where<insert enum string>.
  • "before"
  • "after"
  • "first"
  • "last"
  • Will be used only if the operations are "move" or "insert". Ignored otherwise.
insert_pointis a XPath encoded string like the defpath. Only for 'before' or 'after' insert_where paramter. The insert_where must be set to 'before' or 'after' if insert_point specified. Will be used only if the operations are "move" or "insert".
Ignored otherwise.
E.g: "/test3[string.1='entry2'][uint32.1='2']"
Returns
status
Here is the call graph for this function:
Here is the caller graph for this function:

◆ agt_val_add_edit_insert()

status_t agt_val_add_edit_insert ( ses_cb_t scb,
rpc_msg_t msg,
agt_cfg_transaction_t txcb,
const xmlChar *  defpath,
val_value_t edit_value,
yang_patch_op_t  patch_op,
const xmlChar *  insert_where,
const xmlChar *  insert_point 
)

Add Edit Insert function.

This function is intended only for internal use. Use agt_val_add_edit_ex() or _max instead.

Insert or move an edit based on edit_value and insertion parameters

Move or insertion OP available.

Only allowed for Set Hooks or Post Set Hook, the rest are ignored. Add_edit is not allowed for default nodes or default NP-contaners

Validations:

  • Validate Operations (Must be MOVE or INSERT), error otherwise
  • Validate insert point, must be a valid list, must exist
  • Validate insert where, must be a valid string
  • Validate that the defpath target is a list entry
  • Validate that the list is user-ordered

MOVE Operation: Move the target node. Reorder a user-ordered list. The target node must represent an existing data resource. If the 'where' parameter is set to 'before' or 'after', then the 'point' parameter identifies the insertion point to move the target node

Parameters
scbsession invoking the edit
msgincoming commit rpc_msg_t in progress
txcbtransaction in progress
defpathXPath path of object instance
edit_valueval_value_t representing newnode in transaction
MUST be set, otherwise error.
patch_op<YANG Patch operation> Only following operations:
  • "insert"
  • "move"
insert_where<insert enum string>
  • "before"
  • "after"
  • "first"
  • "last"
insert_pointis a XPath encoded string like the defpath. Only for 'before' or 'after' insert_where paramter. The insert_where must be set to 'before' or 'after' if insert_point specified.
E.g: "/test3[string.1='entry2'][uint32.1='2']"
    Example 1:
        defpath        = "/t:test2[name='key1']"
        edit_operation = "insert"
        insert_where   = "after"
        insert_point   = "/t:test2[name='key2']"
        edit_value     = val_value_t representation of defpath:
             <test2 xmlns="http://netconfcentral.org/ns/test">
                <name>key1</name>
                <type>sometype</type>
                <D>someval</D>
             </test2>

    Example 2:
        defpath        = "/t:test2[name='key1']"
        edit_operation = "move"
        insert_where   = "before"
        insert_point   = "/t:test2[name='key2']"
        edit_value     = NULL

Returns
status
Here is the call graph for this function:
Here is the caller graph for this function:

◆ agt_val_add_edit_max()

status_t agt_val_add_edit_max ( ses_cb_t scb,
rpc_msg_t msg,
agt_cfg_transaction_t txcb,
const xmlChar *  defpath,
val_value_t edit_value,
const xmlChar *  edit_operation,
const xmlChar *  insert_where,
const xmlChar *  insert_point,
boolean  skip_cb 
)

Create a new edit based on edit_value.

if its NULL or invalid the error will be generated.

Move or insertion OP available. Skip callbacks for added edits option is available.

Only allowed for Set Hooks or Post Set Hook, the rest are ignored.

Parameters
scbsession invoking the edit
msgincoming commit rpc_msg_t in progress
txcbtransaction in progress
defpathXPath path of object instance
edit_valueval_value_t representing newnode in transaction
only needed for create, merge, replace, not delete
edit_operation<operation string>.
  • "create"
  • "delete"
  • "insert"
  • "merge"
  • "move"
  • "replace"
  • "remove"
insert_where<insert enum string>.
  • "before"
  • "after"
  • "first"
  • "last"
  • Will be used only if the operations are "move" or "insert". Ignored otherwise.
insert_pointis a XPath encoded string like the defpath. Only for 'before' or 'after' insert_where paramter. The insert_where must be set to 'before' or 'after' if insert_point specified. Will be used only if the operations are "move" or "insert".
Ignored otherwise.
E.g: "/test3[string.1='entry2'][uint32.1='2']"
skip_cbTRUE if DO NOT invoke callbacks for an edded edit if any. FALSE if SKIP any callback for added edit including Transaction, EDIT1, EDIT2 callbacks Only when target=running
Returns
status
Here is the call graph for this function:

◆ agt_val_add_module_commit_tests()

void agt_val_add_module_commit_tests ( ncx_module_t mod,
boolean  set_augment 
)

Invoke module commit tests.

!!! Initialize module data node validation !!!
!!! Must call after all modules are initially loaded !!!
Find all the data node objects in the specified module that need some sort database referential integrity test

!!! dynamic features are not supported. Any disabled objects due to false if-feature stmts will be skipped. No support yet to add or remove tests from the commit_testQ when obj_is_enabled() return value changes.

Parameters
modmodule to check and add tests.
object tree testflags and desc_testflags are set
set_augmentTRUE if top-level external augments should be processed; FALSE for just top-level data nodes
Here is the call graph for this function:
Here is the caller graph for this function:

◆ agt_val_apply_commit()

status_t agt_val_apply_commit ( ses_cb_t scb,
rpc_msg_t msg,
cfg_template_t source,
cfg_template_t target,
boolean  save_nvstore,
boolean  save_backup,
const xmlChar *  backup_source,
boolean *  save_backup_done,
boolean *  rootcheck_done,
status_t rootcheck_res 
)

Apply the requested commit operation.

Invoke all the AGT_CB_COMMIT callbacks for a source and target and write operation

Parameters
scbsession control block
[in,out]msgincoming commit rpc_msg_t in progress
  • rpc_err_rec_t structs may be malloced and added to the msg->mhdr.errQ
sourcecfg_template_t for the source (candidate)
targetcfg_template_t for the config database to write (running)
save_nvstoreTRUE if the mirrored NV-store should be updated after the commit is done
FALSE if this is the start of a confirmed-commit so the NV-store update is deferred Never save to NV-store if :startup is supported
save_backupTRUE to save the backup file if it is needed
backup_sourcefilespec to use for saving backup if save_backup is TRUE
[out]save_backup_doneaddress of save-backup-done flag
*save_backup_done TRUE if save backup was done
[out]rootcheck_doneaddress of root-check done flag
*rootcheck_done root-check done flag
[out]rootcheck_resaddress of rootcheck status
*rootcheck_res rootcheck status
Returns
status
Here is the call graph for this function:
Here is the caller graph for this function:

◆ agt_val_apply_write()

status_t agt_val_apply_write ( ses_cb_t scb,
rpc_msg_t msg,
cfg_template_t target,
val_value_t pducfg,
op_editop_t  editop 
)

Apply the requested write operation.

Invoke all the AGT_CB_APPLY callbacks for a source and target and write operation

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->mhsr.errQ
targetcfg_template_t for the config database to write
pducfgthe 'root' value struct that represents the tree of changes to apply to the target
editoprequested start-state write operation (usually from the default-operation parameter)
Returns
status
Here is the call graph for this function:
Here is the caller graph for this function:

◆ agt_val_check_commit_edits()

status_t agt_val_check_commit_edits ( ses_cb_t scb,
rpc_msg_t msg,
cfg_template_t source,
cfg_template_t target 
)

Check if the requested commit operation would cause any ACM or partial lock violations in the running config.

Invoke all the AGT_CB_VALIDATE callbacks for a source and target and write operation

Parameters
scbsession control block
[in,out]msgincoming commit rpc_msg_t in progress
  • rpc_err_rec_t structs may be malloced and added to the msg->mhdr.errQ
sourcecfg_template_t for the source (e.g., candidate)
targetcfg_template_t for the config database to write (e.g., running)
Returns
status
Here is the call graph for this function:
Here is the caller graph for this function:

◆ agt_val_check_in_reverse_delete()

boolean agt_val_check_in_reverse_delete ( val_value_t useval,
agt_cfg_undo_rec_t undo 
)

Check if currently in reverse deletes.

YPW-1470: server can invoke callbacks in wrong order during delete-children-first

Check if the server should enter special mode during deletion.

Critiria:

  • If the the current undo is for delete
  • ywx:delete-children-first flag set
  • –sil-prio-reverse-for-deletes flag is TRUE
  • if undo if NOT for leafy node
  • if node does NOT have flag set ywx:no-delete-children-first

If all creatiria are met then the server will enter special mode when it will go throught the whole subtree based on CURNODE and will try to setup all the silcall callbacks and save them in the &undo->nested_silcallQ Queue, that will be reversed in the end of processing.

NOTE: This is a special mode is only for silcalls inside the undo records

Parameters
usevalcurvla node in operation
undocurrent undo rec in progress or NULL if none yet
Returns
TRUE if reverse delete mode should be trun on
FALSE; otherwise.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ agt_val_check_validate_complete()

status_t agt_val_check_validate_complete ( ses_cb_t scb,
rpc_msg_t msg,
val_value_t source_root,
cfg_template_t target 
)

Check if the validate complete callbacks need to be invoked.

The SIL or SIL-SA callbacks for AGT_PH_VALIDATE phase have just been processed.

Called by agt_ncx:load_config_validate_int. Needed for <load-config> operation.

Only run Validation Complete callback if the target is <running>

Parameters
scbsession control block
msgincoming rpc_msg_t in progress
source_rootsource <config> node
targettarget datastore to check
Returns
status
Here is the call graph for this function:

◆ agt_val_clean_cached_results()

void agt_val_clean_cached_results ( void  )

Clean cached results.

Clear the xpath_backptr dirty flags and object dirty flags in all the commit_test record; this is done for discard-changes on the candidate.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ agt_val_commit_delete_allowed()

status_t agt_val_commit_delete_allowed ( ses_cb_t scb,
rpc_msg_t msg,
val_value_t deleteval,
boolean  isfirst 
)

Check if the current session is allowed to delete the node found in the requested commit delete operation.

Parameters
scbsession control block
[in,out]msgincoming commit rpc_msg_t in progress
  • msg rpc_err_rec_t structs may be malloced and added to the msg->mhdr.errQ
deletevalvalue struct to check
isfirstTRUE if top-level caller; FALSE if recursive call
Returns
status
Here is the call graph for this function:
Here is the caller graph for this function:

◆ agt_val_delete_dead_nodes()

status_t agt_val_delete_dead_nodes ( ses_cb_t scb,
rpc_msg_t msg,
val_value_t root 
)

Mark nodes deleted for each false when-stmt from <validate>

Parameters
scbsession control block
[in,out]msgincoming validate rpc_msg_t in progress
  • msg rpc_err_rec_t structs may be malloced and added to the msg->mhdr.errQ
rootvalue tree to check for deletions
Returns
status
Here is the caller graph for this function:

◆ agt_val_delete_def_dead_nodes()

status_t agt_val_delete_def_dead_nodes ( ses_cb_t scb,
xml_msg_hdr_t msghdr,
val_value_t startval,
val_value_t curval,
val_value_t root 
)

Delete all the default nodes that have false when-stmt exprs.

Does not return an error in case the false when stmt. The failing deafult node will be removed instead and NO_ERR returned.

Parameters
scbsession control block
msghdrXML message header in progress
startvalcontext node to run test for
curvalurrent node to run test for
rootroot from the target database to use
Returns
status
Here is the call graph for this function:
Here is the caller graph for this function:

◆ agt_val_edit_was_deleted()

boolean agt_val_edit_was_deleted ( agt_cfg_transaction_t txcb,
agt_cfg_undo_rec_t undo,
val_value_t newnode,
val_value_t curnode,
boolean  find_real_edit 
)

Check if the edit in progress was deleted by delete_dead_nodes.

Parameters
txcbtransaction to check
undoundo struct in progress
newnodenew node value
curnodecurrent node value
find_real_editTRUE if the newnode and curnode are not the real edit nodes and they are from the silcall struct in agt_sil.c
FALSE if newnode and curnode are the real nodes in agt_val.c
Returns
TRUE if value for this edit was marked deleted; FALSE if not
Here is the call graph for this function:
Here is the caller graph for this function:

◆ agt_val_finish_delete_dead_nodes()

void agt_val_finish_delete_dead_nodes ( rpc_msg_t msg)

Finish deleting dead nodes.

Parameters
msgincoming validate rpc_msg_t in progress

◆ agt_val_get_data()

val_value_t * agt_val_get_data ( ncx_cfg_t  cfg_id,
const xmlChar *  defpath,
status_t retres 
)

Invoke get data callback.

Parameters
cfg_idconfiguration datastore ID to use
defpathXPath path of object instance
[out]retresaddress of return status; *retres return status
Returns
pointer to data node if found
  • This should be treated as a const pointer
  • Returned pointer is the real data from the target datastore
Here is the call graph for this function:
Here is the caller graph for this function:

◆ agt_val_init_commit_tests()

void agt_val_init_commit_tests ( void  )

Initialize commit tests.

!!! Initialize full database validation !!!
!!! Must call after all modules are initially loaded !!!
!!! Must be called before load_running_config is called !!!
Find all the data node objects that need some sort database referential integrity test For :candidate this is done during the validate of the <commit> RPC For :writable-running, this is done during <edit-config> or <copy-config>

Note: all commit test flags are set in the object tree

Here is the call graph for this function:
Here is the caller graph for this function:

◆ agt_val_instance_check()

status_t agt_val_instance_check ( ses_cb_t scb,
xml_msg_hdr_t msg,
val_value_t valset,
val_value_t valroot,
ncx_layer_t  layer 
)

Check for the proper number of object instances for the specified value struct.

The top-level value set passed cannot represent a choice or a case within a choice.

This function is intended for validating PDUs (RPC requests) during the PDU processing. It does not check the instance count or must-stmt expressions for any <config> (ncx:root) container. This must be done with the agt_val_root_check function.

Parameters
scbsession control block (may be NULL; no session stats)
[in,out]msgxml_msg_hdr t from msg in progress
  • NULL MEANS NO RPC-ERRORS ARE RECORDED
  • msg->msg_errQ may have rpc_err_rec_t structs added to it which must be freed by the called with the rpc_err_free_record function. Only if msg not NULL.
valsetval_value_t list, leaf-list, or container to check
valrootroot node of the database
layerNCX layer calling this function (for error purposes only)
Returns
status of the operation, NO_ERR if no validation errors found

◆ agt_val_rollback_attempt_rollback()

status_t agt_val_rollback_attempt_rollback ( ses_cb_t scb,
rpc_msg_t msg,
cfg_template_t target 
)

Attempt to rollback a transaction attempt.

  • if commit not tried: All edits have a status of NCX_ERR_SKIPPED
  • if commit tried:
    • There are N edits that succeeded and commit_res == NO_ERR
    • There is 1 edit that the SIL callback rejected with an error
    • There are M edits with a commit_res of NCX_ERR_SKIPPED
Parameters
scbsession control block
msgincoming rpc_msg_t in progress
targetcfg_template_t for the config database to write
Returns
status
Here is the call graph for this function:

◆ agt_val_root_check()

status_t agt_val_root_check ( ses_cb_t scb,
xml_msg_hdr_t msghdr,
agt_cfg_transaction_t txcb,
val_value_t root 
)

Perform a YANG validation root-check.

!!! Full database validation !!! Check for the proper number of object instances for the specified configuration database Check must and when statements Check empty NP containers Check choices (selected case, and it is complete)

Tests are divided into 3 groups:

*    A) top-level nodes (child of conceptual <config> root
*    B) parent data node for child instance tests (mand/min/max)
*    C) data node referential tests (must/unique/leaf)

Test pruning

  • The global variable agt_profile.agt_rootflags is used to determine if any type (A) commit tests are needed
  • The global variable ncx_config_state_t is used to force complete testing; There are 3 states:
    • NCX_CFG_STATE_INIT : running config has not been validated, or validation-in-progress
    • NCX_CFG_STATE_OK : running config has been validated and it passed all validation checks
    • NCX_CFG_STATE_BAD: running config validation has been attempted and it failed; running config is not valid! The server will shutdown if so configured during stqartup.
Parameters
scbsession control block (may be NULL; no session stats)
[in,out]msghdrXML message header in progress
  • NULL MEANS NO RPC-ERRORS ARE RECORDED
  • msghdr->msg_errQ may have rpc_err_rec_t structs added to it which must be freed by the caller with the rpc_err_free_record function. Only if msghdr not NULL.
txcbtransaction control block
rootval_value_t for the target config being checked
Returns
status of the operation, NO_ERR if no validation errors found
Here is the call graph for this function:
Here is the caller graph for this function:

◆ agt_val_rpc_xpath_check()

status_t agt_val_rpc_xpath_check ( ses_cb_t scb,
rpc_msg_t rpcmsg,
xml_msg_hdr_t msg,
val_value_t rpcinput,
obj_template_t rpcroot 
)

Check for any nodes which are present but have false when-stmts associated with the node.

These are errors and need to be flagged as unknown-element.

Any false nodes will be removed from the input PDU and discarded, after the error is recorded. This prevents false positives or negatives in the agt_val_instance_check, called after this function

Also checks any false must-stmts for nodes which are present (after false when removal) These are flagged as 'must-violation' errors as per YANG, 13.4

Parameters
scbsession control block (may be NULL; no session stats)
rpcmsgRPC msg header for audit purposes
[in,out]msgxml_msg_hdr t from msg in progress
  • NULL MEANS NO RPC-ERRORS ARE RECORDED
  • msg->msg_errQ may have rpc_err_rec_t structs added to it which must be freed by the called with the rpc_err_free_record function. Only if msg not NULL.
[in,out]rpcinputRPC input node conceptually under rpcroot except this rpcinput has no parent node so a fake one will be termporarily added to prevent false XPath validation errors
rpcinput if false nodes found under rpcinput they are deleted.
rpcrootRPC method node. The conceptual parent of this node is used as the document root (/rpc /)
Returns
status of the operation
NO_ERR if no false when or must statements found
Here is the call graph for this function:

◆ agt_val_setup_remove_node()

status_t agt_val_setup_remove_node ( rpc_msg_t msg,
val_value_t curnode,
val_value_t newnode_parent,
boolean  for_extra_delete,
boolean  for_commit_deletes,
agt_cfg_undo_rec_t **  ret_undo,
agt_cfg_undo_rec_t **  ret_parent_undo 
)

Setup an edit node for a node that needs to be removed because the module is being unloaded.

Parameters
msgincoming commit rpc_msg_t in progress
curnodevalue struct to remove
newnode_parentvalue struct of newval parent if any; used when called from commit_deletes
for_extra_delete== TRUE if this call is to add an undo for an extra_delete from an edit; FALSE for normal call
for_commit_deletes== TRUE if this call is to add an undo for commit_deletes; FALSE otherwise
[out]ret_undoaddress of return undo node
*ret_undo malloced undo record
[out]ret_parent_undoaddress of return parent undo node
*ret_parent_undo malloced parent undo record
Returns
status
Here is the call graph for this function:

◆ agt_val_start_delete_dead_nodes()

status_t agt_val_start_delete_dead_nodes ( ses_cb_t scb,
rpc_msg_t msg,
val_value_t root 
)

Mark nodes deleted for each false when-stmt from <validate>

DOES ONLY THE VAL_DELETED(V) STEP DOES NOT ACUTUALLY DELETE ANY VALNODES

Parameters
scbsession control block
msgincoming validate rpc_msg_t in progress
rootvalue tree to check for deletions
Return values
msgrpc_err_rec_t structs may be malloced and added to the msg->mhdr.errQ
Returns
status

◆ agt_val_validate_write()

status_t agt_val_validate_write ( ses_cb_t scb,
rpc_msg_t msg,
cfg_template_t target,
val_value_t valroot,
op_editop_t  editop,
boolean  with_sil_callbacks 
)

Validate the requested <edit-config> write operation.

Check all the embedded operation attributes against the default-operation and maintained current operation.

Invoke all the user AGT_CB_VALIDATE callbacks for a 'new value' and 'existing value' pairs, for a given write operation,

These callbacks are invoked bottom-up, so the first step is to step through all the child nodes and traverse the 'new' data model (from the PDU) all the way to the leaf nodes

The operation attribute is checked against the real data model on the way down the tree, and the user callbacks are invoked bottom-up on the way back. This way, the user callbacks can share sub-tree validation routines, and perhaps add additional <rpc-error> information, based on the context and specific errors reported from 'below'.

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
targetcfg_template_t for the config database to write
NULL for no actual write acess (validate only)
valrootthe val_value_t struct containing the root (NCX_BT_CONTAINER, ncx:root)
datatype representing the config root with proposed changes to the target
editoprequested start-state write operation
(usually from the default-operation parameter)
with_sil_callbacksTRUE call SIL now; FALSE to skip now
Returns
status of the operation
Here is the call graph for this function:
Here is the caller graph for this function: