yumapro  20.10-14
YumaPro SDK
NETCONF Operations

Implements RFC 6241 protocol operations. More...

Collaboration diagram for NETCONF Operations:

Functions

status_t agt_ncx_init (void)
 Initialize the NETCONF Server standard method routines. More...
 
void agt_ncx_cleanup (void)
 Cleanup the NETCONF Server standard method routines. More...
 
status_t agt_ncx_cfg_load (cfg_template_t *cfg, cfg_location_t cfgloc, const xmlChar *cfgparm)
 Load the specifed config from the indicated source. More...
 
status_t agt_ncx_cfg_save_ex (ses_cb_t *scb, rpc_msg_t *msg, cfg_template_t *cfg)
 Save the specified cfg to the its startup source, which should be stored in the cfg struct and invoke the startup_hook callbacks. More...
 
status_t agt_ncx_cfg_save (cfg_template_t *cfg)
 Save the specified cfg to the its startup source, which should be stored in the cfg struct. More...
 
status_t agt_ncx_cfg_save_inline (const xmlChar *source_url, val_value_t *newroot)
 Save the specified cfg to the its startup source, which should be stored in the cfg struct. More...
 
status_t agt_ncx_load_backup (const xmlChar *filespec, cfg_template_t *cfg, ses_id_t use_sid, dlq_hdr_t *errQ)
 Load a backup config into the specified config template. More...
 
boolean agt_ncx_cc_active (void)
 Check if a confirmed-commit is active, and the timeout may need to be processed. More...
 
ses_id_t agt_ncx_cc_ses_id (void)
 Get the confirmed commit session ID. More...
 
void agt_ncx_clear_cc_ses_id (void)
 Clear the confirmed commit session ID. More...
 
const xmlChar * agt_ncx_cc_persist_id (void)
 Get the confirmed commit persist ID. More...
 
void agt_ncx_check_cc_timeout (void)
 Check if a confirmed-commit has timed out, and needs to be canceled. More...
 
void agt_ncx_check_restconf_cc_timeout (void)
 Check if a confirmed-commit has timed out, and needs to be canceled. More...
 
void agt_ncx_cancel_confirmed_commit (ses_cb_t *scb, ncx_confirm_event_t event)
 Cancel the confirmed-commit in progress and rollback to the backup-cfg.xml file. More...
 
status_t agt_ncx_internal_commit (ses_cb_t *scb, rpc_msg_t *msg, boolean write_backup, boolean save_nvstore, ses_id_t rollback_sid, xmlChar **backup_source, boolean *errdone, boolean *rootcheck_done, status_t *rootcheck_res)
 Apply a commit from candidate to running. More...
 
status_t agt_ncx_write_config (const xmlChar *filespec, cfg_template_t *cfg)
 Write the specified cfg->root to the the default backup source. More...
 
status_t agt_ncx_force_write_config (const xmlChar *filespec, cfg_template_t *cfg)
 Write the specified cfg->root to the the default backup source. More...
 
status_t agt_ncx_process_one_loaded_module (ses_cb_t *scb, ncx_module_t *mod)
 process 1 modules just loaded with load or load-bundle More...
 
status_t agt_ncx_final_process_loaded_modules (ses_cb_t *scb, rpc_msg_t *msg)
 post-process all modules just loaded with load or load-bundle More...
 
status_t agt_ncx_check_commit_parms (boolean confirmed, uint32 confirm_timeout, const xmlChar *persist, const xmlChar *persist_id)
 Check the commit parameters from a RESTCONF edit to see if they are valid for the current datastore state and server profile. More...
 
status_t agt_ncx_commit_invoke (ses_cb_t *scb, rpc_msg_t *msg, cfg_template_t *running, const xmlChar *comment_str, boolean confirmed, uint32 confirm_timeout, const xmlChar *persist, const xmlChar *persist_id, agt_ccparm_t *ret_ccparm, boolean *errdone, boolean *save_startup)
 commit : invoke commit or confirmed-commit API More...
 
status_t agt_ncx_load_config_ha (ses_cb_t *scb, rpc_msg_t *msg, val_value_t *config_val, ncx_transaction_id_t txid)
 load-config : validate params callback More...
 
status_t agt_ncx_do_lock_validate (cfg_template_t *cfg)
 lock : validate params common callback More...
 

Detailed Description

Implements RFC 6241 protocol operations.

The yuma-netconf.yang module is used instead of ietf-netconf.yang. This supports extra data and metadata added to the module namespace by the yuma server.

Function Documentation

◆ agt_ncx_cancel_confirmed_commit()

void agt_ncx_cancel_confirmed_commit ( ses_cb_t scb,
ncx_confirm_event_t  event 
)

Cancel the confirmed-commit in progress and rollback to the backup-cfg.xml file.

Parameters
scbsession control block making this change, may be NULL
eventconfirmEvent enumeration value to use
Here is the call graph for this function:
Here is the caller graph for this function:

◆ agt_ncx_cc_active()

boolean agt_ncx_cc_active ( void  )

Check if a confirmed-commit is active, and the timeout may need to be processed.

Returns
TRUE if confirmed-commit is active
FALSE otherwise
Here is the caller graph for this function:

◆ agt_ncx_cc_persist_id()

const xmlChar* agt_ncx_cc_persist_id ( void  )

Get the confirmed commit persist ID.

Returns
session ID for the confirmed commit

◆ agt_ncx_cc_ses_id()

ses_id_t agt_ncx_cc_ses_id ( void  )

Get the confirmed commit session ID.

Returns
session ID for the confirmed commit
Here is the caller graph for this function:

◆ agt_ncx_cfg_load()

status_t agt_ncx_cfg_load ( cfg_template_t cfg,
cfg_location_t  cfgloc,
const xmlChar *  cfgparm 
)

Load the specifed config from the indicated source.

Called just once from agt.c at boot or reload time!

This function should only be used to load an empty config in CFG_ST_INIT state

Parameters
cfgConfig template to load data into
cfglocenum for the config source location
cfgparmstring parameter used in different ways depending on the cfgloc value
For cfgloc==CFG_LOC_FILE, this is a system-dependent filespec
Returns
overall status; may be the last of multiple error conditions

◆ agt_ncx_cfg_save()

status_t agt_ncx_cfg_save ( cfg_template_t cfg)

Save the specified cfg to the its startup source, which should be stored in the cfg struct.

Parameters
cfgConfig template to save from
Returns
status
Here is the call graph for this function:
Here is the caller graph for this function:

◆ agt_ncx_cfg_save_ex()

status_t agt_ncx_cfg_save_ex ( ses_cb_t scb,
rpc_msg_t msg,
cfg_template_t cfg 
)

Save the specified cfg to the its startup source, which should be stored in the cfg struct and invoke the startup_hook callbacks.

Parameters
cfgConfig template to save from
scbsession control block
msgrpc message input
Returns
status
Here is the call graph for this function:
Here is the caller graph for this function:

◆ agt_ncx_cfg_save_inline()

status_t agt_ncx_cfg_save_inline ( const xmlChar *  source_url,
val_value_t newroot 
)

Save the specified cfg to the its startup source, which should be stored in the cfg struct.

Parameters
source_urlfilespec where to save newroot
newrootvalue root to save
Returns
status

◆ agt_ncx_check_cc_timeout()

void agt_ncx_check_cc_timeout ( void  )

Check if a confirmed-commit has timed out, and needs to be canceled.

Called by the server after a CC procedure has been started by a client.

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

◆ agt_ncx_check_commit_parms()

status_t agt_ncx_check_commit_parms ( boolean  confirmed,
uint32  confirm_timeout,
const xmlChar *  persist,
const xmlChar *  persist_id 
)

Check the commit parameters from a RESTCONF edit to see if they are valid for the current datastore state and server profile.

Parameters
confirmedconfirmed=1 query param; TRUE if set
confirm_timeoutconfirm-timeout query param or default
persistpersist questry parameter
persist_idpersist-id questry parameter
Returns
status
Here is the call graph for this function:
Here is the caller graph for this function:

◆ agt_ncx_check_restconf_cc_timeout()

void agt_ncx_check_restconf_cc_timeout ( void  )

Check if a confirmed-commit has timed out, and needs to be canceled.

RESTCONF sessionless check. It's getting called only from CC background thread, the only thread that is available after restconf session is gone for CC.

Here is the call graph for this function:

◆ agt_ncx_cleanup()

void agt_ncx_cleanup ( void  )

Cleanup the NETCONF Server standard method routines.

Called by the server during shutdown.

◆ agt_ncx_clear_cc_ses_id()

void agt_ncx_clear_cc_ses_id ( void  )

Clear the confirmed commit session ID.

This will be called by agt_ses when the current session exits during a persistent confirmed-commit

◆ agt_ncx_commit_invoke()

status_t agt_ncx_commit_invoke ( ses_cb_t scb,
rpc_msg_t msg,
cfg_template_t running,
const xmlChar *  comment_str,
boolean  confirmed,
uint32  confirm_timeout,
const xmlChar *  persist,
const xmlChar *  persist_id,
agt_ccparm_t ret_ccparm,
boolean *  errdone,
boolean *  save_startup 
)

commit : invoke commit or confirmed-commit API

Parameters
scbsession doing commit
msgmessage in progress
runningrunning datastore
comment_strcommit comment (NULL if not used)
confirmedconfirmed parameter for ccommit
confirm_timeoutconfirm-timeout parameter for ccommit
persistpersist parameter for ccommit
persist_idpersist-id parameter for ccommit
ret_ccparmaddress of return error parameter
errdoneaddress of return errdone flag
save_startupaddress of return save startup flag
Return values
*ret_ccparmreturn error parameter (if any)
*errdoneerdone flag
*save_startupTRUE if need to save startup
Returns
status
Here is the call graph for this function:

◆ agt_ncx_do_lock_validate()

status_t agt_ncx_do_lock_validate ( cfg_template_t cfg)

lock : validate params common callback

Parameters
cfgconfig to check
Returns
status
Here is the call graph for this function:

◆ agt_ncx_final_process_loaded_modules()

status_t agt_ncx_final_process_loaded_modules ( ses_cb_t scb,
rpc_msg_t msg 
)

post-process all modules just loaded with load or load-bundle

Thew msg->rpc_txcb needs to be allocated

Parameters
scbsession to use
msgmessage in progress (will be dummy msg for agt_sil)
Returns
status
Here is the call graph for this function:

◆ agt_ncx_force_write_config()

status_t agt_ncx_force_write_config ( const xmlChar *  filespec,
cfg_template_t cfg 
)

Write the specified cfg->root to the the default backup source.

Do not use this function to save the running config to startup Used to save backup-cfg.xml. Will ignore the no-startup and no-nvstore parameters

Parameters
filespeccomplete path for the output file
cfgconfig template to write to XML file
Returns
status
Here is the caller graph for this function:

◆ agt_ncx_init()

status_t agt_ncx_init ( void  )

Initialize the NETCONF Server standard method routines.

Returns
status of the initialization procedure

◆ agt_ncx_internal_commit()

status_t agt_ncx_internal_commit ( ses_cb_t scb,
rpc_msg_t msg,
boolean  write_backup,
boolean  save_nvstore,
ses_id_t  rollback_sid,
xmlChar **  backup_source,
boolean *  errdone,
boolean *  rootcheck_done,
status_t rootcheck_res 
)

Apply a commit from candidate to running.

Internal access for YANG-API. All validation should have already been done

Parameters
scbsession control block doing commit
msgRPC message in progress
write_backupTRUE to save the backup config first
save_nvstoreTRUE to write the ruinning config to NV-storage
rollback_sidsession ID to use for the load-backup in case the commit fails and the undo fails
backup_sourceaddress of backup filename string var
errdoneaddress of return error done flag
rootcheck_doneaddress of root-check done flag
rootcheck_resaddress of rootcheck status
Return values
*backup_sourceset to malloced file spec if it was NULL or else the string already set will be used for the backup target
*errdoneTRUE if errors were already recorded
*rootcheck_doneroot-check done flag
*rootcheck_resrootcheck status
Returns
status
Here is the call graph for this function:
Here is the caller graph for this function:

◆ agt_ncx_load_backup()

status_t agt_ncx_load_backup ( const xmlChar *  filespec,
cfg_template_t cfg,
ses_id_t  use_sid,
dlq_hdr_t *  errQ 
)

Load a backup config into the specified config template.

Parameters
filespeccomplete path for the input file
cfgconfig template to load
use_sidsession ID of user to use
errQoptional Q of rpc_err_rec_t for error reporting
if NULL then use the cfg->load_errQ
Returns
status

◆ agt_ncx_load_config_ha()

status_t agt_ncx_load_config_ha ( ses_cb_t scb,
rpc_msg_t msg,
val_value_t config_val,
ncx_transaction_id_t  txid 
)

load-config : validate params callback

Loading a full config in YP-HA Standby mode

Parameters
scbsession control block (from YP-HA YControl)
msgcontructed RPC message for load-config
config_val<config> to load
txidconfig ID to use for a rerun transaction
Returns
status
Here is the call graph for this function:

◆ agt_ncx_process_one_loaded_module()

status_t agt_ncx_process_one_loaded_module ( ses_cb_t scb,
ncx_module_t mod 
)

process 1 modules just loaded with load or load-bundle

Parameters
scbsession to use
modmodule to process
Returns
status
Here is the call graph for this function:

◆ agt_ncx_write_config()

status_t agt_ncx_write_config ( const xmlChar *  filespec,
cfg_template_t cfg 
)

Write the specified cfg->root to the the default backup source.

Do not use this function to save the running config to startup

Parameters
filespeccomplete path for the output file
cfgconfig template to write to XML file
Returns
status