yumapro  20.10-10
YumaPro SDK
YANG Actions

YANG actions are like RPC handlers embedded within YANG data. More...

Collaboration diagram for YANG Actions:

Data Structures

struct  agt_action_cbset_t
 the agt_rpc module stores a set of callbacks for each RPC More...
 

Typedefs

typedef status_t(* agt_action_cb_t) (ses_cb_t *scb, rpc_msg_t *msg, xml_node_t *methnode, val_value_t *actionval)
 Template for Action server callbacks. More...
 

Functions

status_t agt_action_init (void)
 Initialize the Action handler. More...
 
void agt_action_cleanup (void)
 Cleanup the Action handler. More...
 
status_t agt_action_register_action (const xmlChar *defpath, agt_rpc_phase_t phase, agt_action_cb_t action_cb)
 add callback for 1 phase of action processing More...
 
void agt_action_unregister_action (const xmlChar *defpath)
 remove a callback for all phases of action processing More...
 
boolean agt_action_is_action (obj_template_t *rpcobj)
 Check if the specified node is the action. More...
 
status_t agt_action_parse_input (ses_cb_t *scb, rpc_msg_t *msg, xml_node_t *method, obj_template_t *rpcobj, val_value_t **action_val)
 RPC "<action>" received, parse parameters against anydata 'action'. More...
 
boolean agt_action_callback_set (obj_template_t *obj)
 Check if an ACTION callback is registered for this object for SIL-SA usage. More...
 
void agt_action_callback_regdone (obj_template_t *obj)
 Set the ACTION as register done. More...
 
boolean agt_action_callback_is_regdone (obj_template_t *obj)
 Set the ACTION as register done. More...
 
status_t agt_action_register_subsys_callback (const xmlChar *subsys_id, const xmlChar *defpath)
 Register an object specific ACTION callback function. More...
 
void agt_action_unregister_subsys_callback (const xmlChar *subsys_id, const xmlChar *defpath)
 Unregister an object specific ACTION callback function. More...
 
val_value_tagt_action_find_node (val_value_t *val)
 Find the nested node that is an action. More...
 
void agt_action_unload_module (ncx_module_t *mod)
 Check all the action objects from this module and clean any callbacks because the module is being unloaded. More...
 

Detailed Description

YANG actions are like RPC handlers embedded within YANG data.

They use validate and invoke callbacks like RPC callbacks.

Typedef Documentation

typedef status_t(* agt_action_cb_t) (ses_cb_t *scb, rpc_msg_t *msg, xml_node_t *methnode, val_value_t *actionval)

Template for Action server callbacks.

The same template is used for all Action callback phases The callback is expected to validate if needed and then invoke if needed.

The entire input hierarchy for an action is contained in the msg->rpc_input node. The 'actionval' node passed to the callback points at the action node nested in the input (like <ping> in the example below)

   <action xmlns="urn:ietf:params:xml:ns:yang:1">
     <interfaces xmlns="http://netconfcentral.org/ns/t200">
       <interface>
         <name>eth1</name>
         <ping>
           <destination>192.0.2.1</destination>
         </ping>
       </interface>
     </interfaces>
   </action>
Parameters
scbsession invoking the RPC
msgmessage in progress for this <rpc> request
methnodeXML node for the operation, which can be used in error reporting (or ignored)
actionvalthe nested 'action-method-name' node that was parsed within the topval subtree, in the RPC <action> request; this is used to help derive the list keys
Returns
status return status for the phase; an error in validate phase will cancel invoke phase; an rpc-error will be added if an error is returned and the msg error Q is empty

Function Documentation

boolean agt_action_callback_is_regdone ( obj_template_t obj)

Set the ACTION as register done.

Parameters
objobject to set
Returns
TRUE if register done; FALSE otherwise

Here is the call graph for this function:

Here is the caller graph for this function:

void agt_action_callback_regdone ( obj_template_t obj)

Set the ACTION as register done.

Parameters
objobject to set

Here is the call graph for this function:

Here is the caller graph for this function:

boolean agt_action_callback_set ( obj_template_t obj)

Check if an ACTION callback is registered for this object for SIL-SA usage.

Parameters
objobject to check
Returns
TRUE if ACTION callback registered; FALSE if not

Here is the call graph for this function:

Here is the caller graph for this function:

void agt_action_cleanup ( void  )

Cleanup the Action handler.

TBD – put platform-specific agent cleanup here

Here is the call graph for this function:

val_value_t* agt_action_find_node ( val_value_t val)

Find the nested node that is an action.

Parameters
valvalue tree to check
Returns
pointer to first action found

Here is the call graph for this function:

Here is the caller graph for this function:

status_t agt_action_init ( void  )

Initialize the Action handler.

Returns
status of the initialization procedure

Here is the call graph for this function:

Here is the caller graph for this function:

boolean agt_action_is_action ( obj_template_t rpcobj)

Check if the specified node is the action.

Returns
TRUE if this is the action RPC

Here is the call graph for this function:

Here is the caller graph for this function:

status_t agt_action_parse_input ( ses_cb_t scb,
rpc_msg_t msg,
xml_node_t method,
obj_template_t rpcobj,
val_value_t **  action_val 
)

RPC "<action>" received, parse parameters against anydata 'action'.

Parameters
scbsession control block
msgrpc_msg_t in progress
methodmethod node
rpcobjthe object template for <action> found by agt_rpc
action_valaddress of return action value node template to validate as if it were an RPC contents
Return values
*action_valset to subtree within top_val that represents the action-stmt container, which is equivalent to the rpc_input value tree that represents the rpc/input container.
msg->mhdr.errorQmay be set be agt_record_error
Returns
status

Here is the call graph for this function:

Here is the caller graph for this function:

status_t agt_action_register_action ( const xmlChar *  defpath,
agt_rpc_phase_t  phase,
agt_action_cb_t  action_cb 
)

add callback for 1 phase of action processing

Parameters
defpathXpath with default (or no) prefixes defining the object that will get the callbacks
phaseaction server callback phase for this callback
action_cbpointer to callback function
Returns
status of the operation

Here is the call graph for this function:

status_t agt_action_register_subsys_callback ( const xmlChar *  subsys_id,
const xmlChar *  defpath 
)

Register an object specific ACTION callback function.

Parameters
subsys_idsubsystem ID registering the remote callback fn
defpathpath ID for the action
Returns
status

Here is the call graph for this function:

void agt_action_unload_module ( ncx_module_t mod)

Check all the action objects from this module and clean any callbacks because the module is being unloaded.

Parameters
modmodule being removed. This must be a real module not a submodule

Here is the call graph for this function:

void agt_action_unregister_action ( const xmlChar *  defpath)

remove a callback for all phases of action processing

Parameters
defpathXpath with default (or no) prefixes defining the object that will have the callbacks removed

Here is the call graph for this function:

void agt_action_unregister_subsys_callback ( const xmlChar *  subsys_id,
const xmlChar *  defpath 
)

Unregister an object specific ACTION callback function.

Parameters
subsys_idsubsystem ID registering the remote callback fn
defpathaction definition path string

Here is the call graph for this function: