yumapro  20.10-13
YumaPro SDK
Core Functions
Collaboration diagram for Core Functions:

Macros

#define SIL_SA   (const xmlChar *)"sil-sa"
 YControl service name.
 
#define SIL_SA_MOD   (const xmlChar *)"yumaworks-sil-sa"
 SIL-SA YANG module.
 
#define SIL_SA_OBJ   (const xmlChar *)"sil-sa"
 sil-sa container
 
#define SIL_REQ_OK(ST)   (ST >= SIL_SA_ST_READY)
 Check if SIL-SA state is ready.
 

Functions

status_t sil_sa_register_service (void)
 Register the SIL-SA service with the YControl layer. More...
 
val_value_t * sil_sa_get_key (rpc_msg_t *msg, uint32 keynum)
 Get a key leaf from the sil_sa_cb backptr in the rpc_msg. More...
 
val_value_t * sil_sa_get_action_key (rpc_msg_t *msg, uint32 keynum)
 Get the key value node for the specified key for ACTION ONLY. More...
 
void sil_sa_queue_notification (agt_not_msg_t *notif)
 Send a notification-event to the main server for queing by the agt_not module. More...
 
void sil_sa_queue_notification_stream (const xmlChar *stream_name, agt_not_msg_t *notif)
 Send a notification-event to a specific stream, to the main server for queing by the agt_not module. More...
 
void sil_sa_notif_test (int8 N1, int16 N2, const xmlChar *N3)
 Send a y_get2_test_get2_notif notification. More...
 
status_t sil_sa_add_library_parm (const xmlChar *libstr)
 Add a library parameter so the SIL-SA libraries will be restricted to just these libraries instead of what is found in the /usr/lib/yumapro directory (or –runpath or YUMAPRO_RUNPATH) More...
 
boolean sil_sa_any_library_parms (void)
 Check if any library parms are set. More...
 
boolean sil_sa_find_library_parm (const xmlChar *libstr)
 Find a library parm name in the library_parmQ. More...
 
const xmlChar * sil_sa_get_username (void)
 Get the user_id value from the message header. More...
 
const xmlChar * sil_sa_get_client_addr (void)
 Get the client address (client_addr value from the message header) More...
 
const xmlChar * sil_sa_get_rpc_msg_id (rpc_msg_t *msg)
 Get the rpc transaction id (txid_str) from the rpc_sil_sa_cb. More...
 
void sil_sa_term_msg_test (uint32 count)
 Send a <term-msg> test notification. More...
 
status_t sil_sa_add_edit (const xmlChar *defpath, val_value_t *edit_value, const xmlChar *edit_operation, const xmlChar *insert_where, const xmlChar *insert_point, boolean skip_cb)
 Add an edit to the current transaction from SIL-SA. More...
 
val_value_t * sil_sa_get_data (ncx_cfg_t cfg_id, const xmlChar *defpath, status_t *retres)
 Get some YANG data from the server. More...
 
sil_sa_child_edit_t * sil_sa_first_child_edit (rpc_msg_t *msg)
 Get the first child edit from the transaction control block. More...
 
sil_sa_child_edit_t * sil_sa_next_child_edit (sil_sa_child_edit_t *curedit)
 Get the next child edit from the transaction control block. More...
 
void sil_sa_child_edit_fields (sil_sa_child_edit_t *child_edit, op_editop_t *editop, val_value_t **newval, val_value_t **curval)
 Get the child edit fields. More...
 

Detailed Description

SIL-SA core functions are used to manage the subagent role in the distributed server. EDIT and GET2 transactions are initiated from the server. The subsystem also handled HOOK and other APIs available during edit transaction processsing.

All functions in this module are user APIs for subsystem use only!

Function Documentation

◆ sil_sa_add_edit()

status_t sil_sa_add_edit ( const xmlChar *  defpath,
val_value_t *  edit_value,
const xmlChar *  edit_operation,
const xmlChar *  insert_where,
const xmlChar *  insert_point,
boolean  skip_cb 
)

Add an edit to the current transaction from SIL-SA.

Save an added edit in the SIL-SA Control block for further hook-response processing

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
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> (NULL if not used)
  • "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
See also
db_api_edit_full2
Here is the call graph for this function:

◆ sil_sa_add_library_parm()

status_t sil_sa_add_library_parm ( const xmlChar *  libstr)

Add a library parameter so the SIL-SA libraries will be restricted to just these libraries instead of what is found in the /usr/lib/yumapro directory (or –runpath or YUMAPRO_RUNPATH)

Parameters
libstrlibrary name (use foo for libfoo_sa.so)
Returns
status
Here is the call graph for this function:

◆ sil_sa_any_library_parms()

boolean sil_sa_any_library_parms ( void  )

Check if any library parms are set.

If any library params set AT ALL then ONLY those libraries will be checked. All other names will be skipped.

TRUE if any parms found; FALSE if not found

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

◆ sil_sa_child_edit_fields()

void sil_sa_child_edit_fields ( sil_sa_child_edit_t *  child_edit,
op_editop_t *  editop,
val_value_t **  newval,
val_value_t **  curval 
)

Get the child edit fields.

SIL-SA EDIT2 MODE

SIL-SA Analogue agt_cfg_child_edit_fields() API. Get the child edit fields from the child_edit record

Parameters
child_editchild_edit record that was returned from the server
editopaddress of return editop
newvaladdress of return new value
curvaladdress of return current value
Return values
*editopreturn editop
*newvalreturn new value
*curvalreturn current value

◆ sil_sa_find_library_parm()

boolean sil_sa_find_library_parm ( const xmlChar *  libstr)

Find a library parm name in the library_parmQ.

Parameters
libstrlibrary name (use foo for libfoo_sa.so)
Returns
TRUE if found; FALSE if not found
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sil_sa_first_child_edit()

sil_sa_child_edit_t* sil_sa_first_child_edit ( rpc_msg_t *  msg)

Get the first child edit from the transaction control block.

SIL-SA EDIT2 MODE

SIL-SA Analogue agt_cfg_first_child_edit() API. Get the first child node edit record

Parameters
msgrpc msg to use to find keys
Returns
pointer to the first child edit

◆ sil_sa_get_action_key()

val_value_t* sil_sa_get_action_key ( rpc_msg_t *  msg,
uint32  keynum 
)

Get the key value node for the specified key for ACTION ONLY.

Parameters
msgrpc msg to use to find keys FOR ACTION ONLY
keynumkey index to get – 1 to N
Returns
pointer to the Nth key

◆ sil_sa_get_client_addr()

const xmlChar* sil_sa_get_client_addr ( void  )

Get the client address (client_addr value from the message header)

This is the external client address, not the SIL-SA peer address. Time-sensitive API. Each message received by a user will cause the saved state to be updated.

Returns
client_addr value or NULL

◆ sil_sa_get_data()

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

Get some YANG data from the server.

Get the val_value based on Xpath of object instance This function will return value only if there is existing node in the datastore or there is defaults for the node.

Parameters
cfg_idconfiguration datastore ID to use
defpathXPath path of object instance
retresaddress of return status
Return values
*retresreturn status
Returns
pointer to malloced data node if found. Must free with val_free_value.
Here is the call graph for this function:

◆ sil_sa_get_key()

val_value_t* sil_sa_get_key ( rpc_msg_t *  msg,
uint32  keynum 
)

Get a key leaf from the sil_sa_cb backptr in the rpc_msg.

Parameters
msgrpc msg to use to find keys
keynumkey index to get – 1 to N
Returns
pointer to the Nth key

◆ sil_sa_get_rpc_msg_id()

const xmlChar* sil_sa_get_rpc_msg_id ( rpc_msg_t *  msg)

Get the rpc transaction id (txid_str) from the rpc_sil_sa_cb.

This function is only available to EDIT callbacks! It is NULL for GET2 callbacks.

Parameters
msgrpc msg to retrive rpc msg id from
Returns
txid_str value or NULL

◆ sil_sa_get_username()

const xmlChar* sil_sa_get_username ( void  )

Get the user_id value from the message header.

Time-sensitive API. Each message received by a user will cause the saved state to be updated.

Returns
user_id value or NULL

◆ sil_sa_next_child_edit()

sil_sa_child_edit_t* sil_sa_next_child_edit ( sil_sa_child_edit_t *  curedit)

Get the next child edit from the transaction control block.

SIL-SA EDIT2 MODE

SIL-SA Analogue agt_cfg_next_child_edit() API. Get the next child node edit

Parameters
cureditpointer to the current child edit
Returns
pointer to next child node edit
NULL if none found

◆ sil_sa_notif_test()

void sil_sa_notif_test ( int8  N1,
int16  N2,
const xmlChar *  N3 
)

Send a y_get2_test_get2_notif notification.

FOR DEBUGGING ONLY!

Called by your code when notification event occurs. Used in regression testing. NOT A REAL API!

Parameters
N1YANG parameter 1
N2YANG parameter 2
N3YANG parameter 3
Here is the call graph for this function:

◆ sil_sa_queue_notification()

void sil_sa_queue_notification ( agt_not_msg_t *  notif)

Send a notification-event to the main server for queing by the agt_not module.

Parameters
notifnotification struct to send
Will be consumed and freed even if there is an error
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sil_sa_queue_notification_stream()

void sil_sa_queue_notification_stream ( const xmlChar *  stream_name,
agt_not_msg_t *  notif 
)

Send a notification-event to a specific stream, to the main server for queing by the agt_not module.

Use this API for hard-wired event streams only! If the module-to-stream mappings are used then DO NOT use this API because the mappings will be ignored.

Parameters
stream_nameoptional stream name (NULL = use NETCONF)
notifnotification struct to send
Will be consumed and freed even if there is an error
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sil_sa_register_service()

status_t sil_sa_register_service ( void  )

Register the SIL-SA service with the YControl layer.

Must be called before any other SIL-SA function can be used.

Returns
status
Here is the call graph for this function:

◆ sil_sa_term_msg_test()

void sil_sa_term_msg_test ( uint32  count)

Send a <term-msg> test notification.

DEBUG ONLY.

Create a dummy message using the count variable. Used for regression testing only.

Parameters
countcurrent loop count to add to data
Here is the call graph for this function: