yumapro  24.10-2
YumaPro SDK
Loading...
Searching...
No Matches
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 *modname, const xmlChar *revision, const xmlChar *defpath)
 Register an object specific ACTION callback function. More...
 
void agt_action_unregister_subsys_callback (const xmlChar *subsys_id, const xmlChar *modname, const xmlChar *revision, 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

◆ agt_action_cb_t

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
scbThe session control block for the session handling the action request.
msgmessage in progress for this <rpc> request, containing the input parameters (if any).
methnodeThe XML-specific node being parsed if available. This can used for error reporting if no 'val' or 'obj' parameters are available (from the request message).
actionvalThe input node represents the start of the specific action being invoked. The auto-generated SIL code can derive all the ancestor keys from this data structure.
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

◆ agt_action_callback_is_regdone()

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:

◆ agt_action_callback_regdone()

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:

◆ agt_action_callback_set()

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:

◆ agt_action_cleanup()

void agt_action_cleanup ( void  )

Cleanup the Action handler.

TBD – put platform-specific agent cleanup here

Here is the call graph for this function:

◆ agt_action_find_node()

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:

◆ agt_action_init()

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:

◆ agt_action_is_action()

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:

◆ agt_action_parse_input()

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
[in,out]msgrpc_msg_t in progress
msg->mhdr.errorQ may be set be agt_record_error
methodmethod node
rpcobjthe object template for <action> found by agt_rpc
[out]action_valaddress of return action value node template to validate as if it were an RPC contents
*action_val set 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.
Returns
status
Here is the call graph for this function:
Here is the caller graph for this function:

◆ agt_action_register_action()

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
  • AGT_PH_VALIDATE(0): validate phase
  • AGT_PH_INVOKE(1): invoke phase
  • AGT_PH_POST_REPLY(2): post-reply phase
action_cbpointer to callback function to register
Returns
status of the operation
Here is the call graph for this function:

◆ agt_action_register_subsys_callback()

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

Register an object specific ACTION callback function.

Parameters
subsys_idsubsystem ID registering the remote callback fn
modnamemodule being loaded
revisionrevision date of module being loaded (may be NULL)
defpathpath ID for the action
Returns
status
Here is the call graph for this function:

◆ agt_action_unload_module()

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:

◆ agt_action_unregister_action()

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:

◆ agt_action_unregister_subsys_callback()

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

Unregister an object specific ACTION callback function.

Parameters
subsys_idsubsystem ID registering the remote callback fn
modnamemodule being loaded
revisionrevision date of module being loaded (may be NULL)
defpathaction definition path string
Here is the call graph for this function: