Use the appropriate YumaPro SDK tool to create your SIL or SIL-SA code from the YANG module you require (details can be found in Section "Development Environment" of the YumaPro Developer Manual). It is best to keep your development in a separate directory, such as "~/modules", so as not to mix your development work in with the standard or Yuma module directories.


For example to generate the IETF Interfaces module SIL code:


   user@system ~/modules$ make_sil_dir_pro --split ietf-interfaces


The --split option creates separate user (u_) and system (y_) files, which is the suggested option. You won't need to touch the y_ files.


An ietf-interfaces sub-directory will be created with all the generated files including the .c & .h files you need to add instrumentation to in the src sub-directory. In this example edit the u_ietf-interfaces.h & u_ietf-interfaces.c files as needed. (See the section of the u_ietf-interfaces.c below for examples of the locations where you need to add instrumentation). Below is the listing of the generated src sub-direectory.



   user@system ~/modules/ietf-interfaces$ ls src/
   Makefile  u_ietf-interfaces.h  y_ietf-interfaces.h u_ietf-interfaces.c  y_ietf-interfaces.c


Once you've added your instrumentation you can build and install the code with:

 

  user@system ~/modules/ietf-interfaces$ make
  user@system ~/modules/ietf-interfaces$ sudo make install

Section of the u_ietf-interfaces.c generated file:

Instrumentation is added in the "validation/manipulation/instrumentation done here" comment sections:


/********************************************************************
* FUNCTION u_ietf_interfaces_interfaces_interface_type_edit
*
* Edit database object callback
* Path: /interfaces/interface/type
* Add object instrumentation in COMMIT phase.
*
* INPUTS:
*    see agt/agt_cb.h for details
*    k_ parameters are ancestor list key values.
*
* RETURNS:
*    error status
********************************************************************/
status_t u_ietf_interfaces_interfaces_interface_type_edit (
    ses_cb_t *scb,
    rpc_msg_t *msg,
    agt_cbtyp_t cbtyp,
    op_editop_t editop,
    val_value_t *newval,
    val_value_t *curval,
    const xmlChar *k_interfaces_interface_name)
{
    status_t res = NO_ERR;
    const val_idref_t *newval_val = (newval) ? VAL_IDREF(newval) : 0;
    const val_idref_t *curval_val = (curval) ? VAL_IDREF(curval) : 0;

    if (LOGDEBUG) {
        log_debug("\nEnter u_ietf_interfaces_interfaces_interface_type_edit callback for %s phase",
            agt_cbtype_name(cbtyp));
    }

    switch (cbtyp) {
    case AGT_CB_VALIDATE:

        /* description-stmt validation here */

        break;
    case AGT_CB_APPLY:

        /* database manipulation done here */

        break;
    case AGT_CB_COMMIT:

        /* device instrumentation done here */

        switch (editop) {
        case OP_EDITOP_LOAD:
            break;
        case OP_EDITOP_MERGE:
            break;
        case OP_EDITOP_REPLACE:
            break;
        case OP_EDITOP_CREATE:
            break;
        case OP_EDITOP_DELETE:
            break;
        default:
            res = SET_ERROR(ERR_INTERNAL_VAL);
        }
        break;
    case AGT_CB_ROLLBACK:
        /* undo device instrumentation here */
        break;
    default:
        res = SET_ERROR(ERR_INTERNAL_VAL);
    }
    return res;


} /* u_ietf_interfaces_interfaces_interface_type_edit */