예제 #1
0
status_t
    y_interfaces_alarms_init (
        const xmlChar *modname,
        const xmlChar *revision)
{
    agt_profile_t *agt_profile;
    status_t res;
    ncx_module_t *mod;

    agt_profile = agt_get_profile();

    res = ncxmod_load_module(
        "interfaces-alarms",
        NULL,
        &agt_profile->agt_savedevQ,
        &mod);
    if (res != NO_ERR) {
        return res;
    }

    res = agt_cb_register_callback(
        "ietf-alarms",
        (const xmlChar *)"/alarms",
        (const xmlChar *)NULL /*"YYYY-MM-DD"*/,
        y_interfaces_alarms_alarms_edit);
    if (res != NO_ERR) {
        return res;
    }

    agt_not_queue_notification_cb_register("intrfaces-alarms", notification_cb);

    return res;
}
예제 #2
0
/********************************************************************
* FUNCTION y_starter_init
* 
* initialize the starter server instrumentation library
* 
* INPUTS:
*    modname == requested module name
*    revision == requested version (NULL for any)
* 
* RETURNS:
*     error status
********************************************************************/
status_t y_starter_init (
    const xmlChar *modname,
    const xmlChar *revision)
{
    status_t res = NO_ERR;
    agt_profile_t *agt_profile = agt_get_profile();

    y_starter_init_static_vars();

    /* change if custom handling done */
    if (xml_strcmp(modname, y_starter_M_starter)) {
        return ERR_NCX_UNKNOWN_MODULE;
    }

    if (revision && xml_strcmp(revision, y_starter_R_starter)) {
        return ERR_NCX_WRONG_VERSION;
    }
    res = ncxmod_load_module(
        y_starter_M_starter,
        y_starter_R_starter,
        &agt_profile->agt_savedevQ,
        &starter_mod);
    if (res != NO_ERR) {
        return res;
    }

    starter_obj = ncx_find_object(
        starter_mod,
        y_starter_N_starter);
    if (starter_mod == NULL) {
        return SET_ERROR(ERR_NCX_DEF_NOT_FOUND);
    }
    starter_start_vnf_obj = ncx_find_object(
        starter_mod,
        y_starter_N_starter_start_vnf);
    if (starter_mod == NULL) {
        return SET_ERROR(ERR_NCX_DEF_NOT_FOUND);
    }
    starter_kill_vnf_obj = ncx_find_object(
        starter_mod,
        y_starter_N_starter_kill_vnf);
    if (starter_mod == NULL) {
        return SET_ERROR(ERR_NCX_DEF_NOT_FOUND);
    }
    starter_get_load_obj = ncx_find_object(
        starter_mod,
        y_starter_N_starter_get_load);
    if (starter_mod == NULL) {
        return SET_ERROR(ERR_NCX_DEF_NOT_FOUND);
    }
    starter_get_processes_obj = ncx_find_object(
        starter_mod,
        y_starter_N_starter_get_processes);
    if (starter_mod == NULL) {
        return SET_ERROR(ERR_NCX_DEF_NOT_FOUND);
    }
    processData_obj = ncx_find_object(
        starter_mod,
        y_starter_N_processData);
    if (starter_mod == NULL) {
        return SET_ERROR(ERR_NCX_DEF_NOT_FOUND);
    }
    processDone_obj = ncx_find_object(
        starter_mod,
        y_starter_N_processDone);
    if (starter_mod == NULL) {
        return SET_ERROR(ERR_NCX_DEF_NOT_FOUND);
    }
    res = agt_rpc_register_method(
        y_starter_M_starter,
        y_starter_N_starter_start_vnf,
        AGT_RPC_PH_VALIDATE,
        y_starter_starter_start_vnf_validate);
    if (res != NO_ERR) {
        return res;
    }

    res = agt_rpc_register_method(
        y_starter_M_starter,
        y_starter_N_starter_start_vnf,
        AGT_RPC_PH_INVOKE,
        y_starter_starter_start_vnf_invoke);
    if (res != NO_ERR) {
        return res;
    }

    res = agt_rpc_register_method(
        y_starter_M_starter,
        y_starter_N_starter_kill_vnf,
        AGT_RPC_PH_VALIDATE,
        y_starter_starter_kill_vnf_validate);
    if (res != NO_ERR) {
        return res;
    }

    res = agt_rpc_register_method(
        y_starter_M_starter,
        y_starter_N_starter_kill_vnf,
        AGT_RPC_PH_INVOKE,
        y_starter_starter_kill_vnf_invoke);
    if (res != NO_ERR) {
        return res;
    }

    res = agt_rpc_register_method(
        y_starter_M_starter,
        y_starter_N_starter_get_load,
        AGT_RPC_PH_VALIDATE,
        y_starter_starter_get_load_validate);
    if (res != NO_ERR) {
        return res;
    }

    res = agt_rpc_register_method(
        y_starter_M_starter,
        y_starter_N_starter_get_load,
        AGT_RPC_PH_INVOKE,
        y_starter_starter_get_load_invoke);
    if (res != NO_ERR) {
        return res;
    }

    res = agt_rpc_register_method(
        y_starter_M_starter,
        y_starter_N_starter_get_processes,
        AGT_RPC_PH_VALIDATE,
        y_starter_starter_get_processes_validate);
    if (res != NO_ERR) {
        return res;
    }

    res = agt_rpc_register_method(
        y_starter_M_starter,
        y_starter_N_starter_get_processes,
        AGT_RPC_PH_INVOKE,
        y_starter_starter_get_processes_invoke);
    if (res != NO_ERR) {
        return res;
    }

    res = agt_cb_register_callback(
        y_starter_M_starter,
        (const xmlChar *)"/starter",
        y_starter_R_starter,
        starter_starter_edit);
    if (res != NO_ERR) {
        return res;
    }

    res = agt_cb_register_callback(
        y_starter_M_starter,
        (const xmlChar *)"/starter/appName",
        y_starter_R_starter,
        starter_starter_appName_edit);
    if (res != NO_ERR) {
        return res;
    }

    res = agt_cb_register_callback(
        y_starter_M_starter,
        (const xmlChar *)"/starter/appParams",
        y_starter_R_starter,
        starter_starter_appParams_edit);
    if (res != NO_ERR) {
        return res;
    }

    res = agt_cb_register_callback(
        y_starter_M_starter,
        (const xmlChar *)"/starter/capabilities",
        y_starter_R_starter,
        starter_starter_capabilities_edit);
    if (res != NO_ERR) {
        return res;
    }

    /* put your module initialization code here */
    
    return res;
} /* y_starter_init */
예제 #3
0
/********************************************************************
* FUNCTION y_simple_yang_test_init
* 
* initialize the simple_yang_test server instrumentation library
* 
* INPUTS:
*    modname == requested module name
*    revision == requested version (NULL for any)
* 
* RETURNS:
*     error status
********************************************************************/
status_t y_simple_yang_test_init (
    const xmlChar *modname,
    const xmlChar *revision)
{
    status_t res = NO_ERR;
    agt_profile_t *agt_profile;

    y_simple_yang_test_init_static_vars();

    /* change if custom handling done */
    if (xml_strcmp(modname, y_simple_yang_test_M_simple_yang_test)) {
        return ERR_NCX_UNKNOWN_MODULE;
    }

    if (revision && xml_strcmp(revision, y_simple_yang_test_R_simple_yang_test)) {
        return ERR_NCX_WRONG_VERSION;
    }

    agt_profile = agt_get_profile();

    res = ncxmod_load_module(
        y_simple_yang_test_M_simple_yang_test,
        y_simple_yang_test_R_simple_yang_test,
        &agt_profile->agt_savedevQ,
        &simple_yang_test_mod);
    if (res != NO_ERR) {
        return res;
    }

    protocol_obj = ncx_find_object(
        simple_yang_test_mod,
        y_simple_yang_test_N_protocol);
    if (simple_yang_test_mod == NULL) {
        return SET_ERROR(ERR_NCX_DEF_NOT_FOUND);
    }
    
    interface_obj = ncx_find_object(
        simple_yang_test_mod,
        y_simple_yang_test_N_interface);
    if (simple_yang_test_mod == NULL) {
        return SET_ERROR(ERR_NCX_DEF_NOT_FOUND);
    }
    
    res = agt_cb_register_callback(
        y_simple_yang_test_M_simple_yang_test,
        (const xmlChar *)"/interface",
        (const xmlChar *)"2011-11-21",
        simple_yang_test_interface_edit);
    if (res != NO_ERR) {
        return res;
    }

    res = agt_cb_register_callback(
        y_simple_yang_test_M_simple_yang_test,
        (const xmlChar *)"/interface/ifMTU",
        (const xmlChar *)"2011-11-21",
        simple_yang_test_interface_ifMTU_edit);
    if (res != NO_ERR) {
        return res;
    }

    res = agt_cb_register_callback(
        y_simple_yang_test_M_simple_yang_test,
        (const xmlChar *)"/interface/ifType",
        (const xmlChar *)"2011-11-21",
        simple_yang_test_interface_ifType_edit);
    if (res != NO_ERR) {
        return res;
    }

    res = agt_cb_register_callback(
        y_simple_yang_test_M_simple_yang_test,
        (const xmlChar *)"/protocol",
        (const xmlChar *)"2011-11-21",
        simple_yang_test_protocol_edit);
    if (res != NO_ERR) {
        return res;
    }

    res = agt_cb_register_callback(
        y_simple_yang_test_M_simple_yang_test,
        (const xmlChar *)"/protocol/name/tcp/tcp",
        (const xmlChar *)"2011-11-21",
        simple_yang_test_protocol_name_tcp_tcp_edit);
    if (res != NO_ERR) {
        return res;
    }

    res = agt_cb_register_callback(
        y_simple_yang_test_M_simple_yang_test,
        (const xmlChar *)"/protocol/name/udp/udp",
        (const xmlChar *)"2011-11-21",
        simple_yang_test_protocol_name_udp_udp_edit);
    if (res != NO_ERR) {
        return res;
    }

    /* put your module initialization code here */
    
    return res;
} /* y_simple_yang_test_init */
예제 #4
0
/********************************************************************
* FUNCTION y_toaster_init
* 
* initialize the toaster server instrumentation library
* 
* INPUTS:
*    modname == requested module name
*    revision == requested version (NULL for any)
* 
* RETURNS:
*     error status
********************************************************************/
status_t
    y_toaster_init (
        const xmlChar *modname,
        const xmlChar *revision)
{
    agt_profile_t *agt_profile;
    status_t res;

    y_toaster_init_static_vars();

    /* change if custom handling done */
    if (xml_strcmp(modname, y_toaster_M_toaster)) {
        return ERR_NCX_UNKNOWN_MODULE;
    }

    if (revision && xml_strcmp(revision, y_toaster_R_toaster)) {
        return ERR_NCX_WRONG_VERSION;
    }

    agt_profile = agt_get_profile();

    res = ncxmod_load_module(
        y_toaster_M_toaster,
        y_toaster_R_toaster,
        &agt_profile->agt_savedevQ,
        &toaster_mod);
    if (res != NO_ERR) {
        return res;
    }
    
    toaster_obj = ncx_find_object(
        toaster_mod,
        y_toaster_N_toaster);
    if (toaster_mod == NULL) {
        return SET_ERROR(ERR_NCX_DEF_NOT_FOUND);
    }
    
    make_toast_obj = ncx_find_object(
        toaster_mod,
        y_toaster_N_make_toast);
    if (toaster_mod == NULL) {
        return SET_ERROR(ERR_NCX_DEF_NOT_FOUND);
    }
    
    cancel_toast_obj = ncx_find_object(
        toaster_mod,
        y_toaster_N_cancel_toast);
    if (toaster_mod == NULL) {
        return SET_ERROR(ERR_NCX_DEF_NOT_FOUND);
    }
    
    toastDone_obj = ncx_find_object(
        toaster_mod,
        y_toaster_N_toastDone);
    if (toaster_mod == NULL) {
        return SET_ERROR(ERR_NCX_DEF_NOT_FOUND);
    }
    
    res = agt_rpc_register_method(
        y_toaster_M_toaster,
        y_toaster_N_make_toast,
        AGT_RPC_PH_VALIDATE,
        y_toaster_make_toast_validate);
    if (res != NO_ERR) {
        return res;
    }
    
    res = agt_rpc_register_method(
        y_toaster_M_toaster,
        y_toaster_N_make_toast,
        AGT_RPC_PH_INVOKE,
        y_toaster_make_toast_invoke);
    if (res != NO_ERR) {
        return res;
    }
    
    res = agt_rpc_register_method(
        y_toaster_M_toaster,
        y_toaster_N_cancel_toast,
        AGT_RPC_PH_VALIDATE,
        y_toaster_cancel_toast_validate);
    if (res != NO_ERR) {
        return res;
    }
    
    res = agt_rpc_register_method(
        y_toaster_M_toaster,
        y_toaster_N_cancel_toast,
        AGT_RPC_PH_INVOKE,
        y_toaster_cancel_toast_invoke);
    if (res != NO_ERR) {
        return res;
    }
    
    res = agt_cb_register_callback(
        y_toaster_M_toaster,
        (const xmlChar *)"/toaster",
        (const xmlChar *)"2009-11-20",
        y_toaster_toaster_edit);
    if (res != NO_ERR) {
        return res;
    }
    
    /* put your module initialization code here */
    
    return res;
} /* y_toaster_init */
예제 #5
0
/********************************************************************
* FUNCTION y_simple_list_test_init
* 
* initialize the simple_list_test server instrumentation library
* 
* INPUTS:
*    modname == requested module name
*    revision == requested version (NULL for any)
* 
* RETURNS:
*     error status
********************************************************************/
status_t y_simple_list_test_init (
    const xmlChar *modname,
    const xmlChar *revision)
{
    status_t res = NO_ERR;
    agt_profile_t *agt_profile = agt_get_profile();

    y_simple_list_test_init_static_vars();

    /* change if custom handling done */
    if (xml_strcmp(modname, y_simple_list_test_M_simple_list_test)) {
        return ERR_NCX_UNKNOWN_MODULE;
    }

    if (revision && xml_strcmp(revision, y_simple_list_test_R_simple_list_test)) {
        return ERR_NCX_WRONG_VERSION;
    }
    res = ncxmod_load_module(
        y_simple_list_test_M_simple_list_test,
        y_simple_list_test_R_simple_list_test,
        &agt_profile->agt_savedevQ,
        &simple_list_test_mod);
    if (res != NO_ERR) {
        return res;
    }

    simple_list_obj = ncx_find_object(
        simple_list_test_mod,
        y_simple_list_test_N_simple_list);
    if (simple_list_test_mod == NULL) {
        return SET_ERROR(ERR_NCX_DEF_NOT_FOUND);
    }
    inc_counter_obj = ncx_find_object(
        simple_list_test_mod,
        y_simple_list_test_N_inc_counter);
    if (simple_list_test_mod == NULL) {
        return SET_ERROR(ERR_NCX_DEF_NOT_FOUND);
    }
    get_counter_obj = ncx_find_object(
        simple_list_test_mod,
        y_simple_list_test_N_get_counter);
    if (simple_list_test_mod == NULL) {
        return SET_ERROR(ERR_NCX_DEF_NOT_FOUND);
    }
    res = agt_rpc_register_method(
        y_simple_list_test_M_simple_list_test,
        y_simple_list_test_N_inc_counter,
        AGT_RPC_PH_VALIDATE,
        y_simple_list_test_inc_counter_validate);
    if (res != NO_ERR) {
        return res;
    }

    res = agt_rpc_register_method(
        y_simple_list_test_M_simple_list_test,
        y_simple_list_test_N_inc_counter,
        AGT_RPC_PH_INVOKE,
        y_simple_list_test_inc_counter_invoke);
    if (res != NO_ERR) {
        return res;
    }

    res = agt_rpc_register_method(
        y_simple_list_test_M_simple_list_test,
        y_simple_list_test_N_get_counter,
        AGT_RPC_PH_VALIDATE,
        y_simple_list_test_get_counter_validate);
    if (res != NO_ERR) {
        return res;
    }

    res = agt_rpc_register_method(
        y_simple_list_test_M_simple_list_test,
        y_simple_list_test_N_get_counter,
        AGT_RPC_PH_INVOKE,
        y_simple_list_test_get_counter_invoke);
    if (res != NO_ERR) {
        return res;
    }

    res = agt_cb_register_callback(
        y_simple_list_test_M_simple_list_test,
        (const xmlChar *)"/simple_list",
        y_simple_list_test_R_simple_list_test,
        simple_list_test_simple_list_edit);
    if (res != NO_ERR) {
        return res;
    }

    res = agt_cb_register_callback(
        y_simple_list_test_M_simple_list_test,
        (const xmlChar *)"/simple_list/theList",
        y_simple_list_test_R_simple_list_test,
        simple_list_test_simple_list_theList_edit);
    if (res != NO_ERR) {
        return res;
    }

    res = agt_cb_register_callback(
        y_simple_list_test_M_simple_list_test,
        (const xmlChar *)"/simple_list/theList/theKey",
        y_simple_list_test_R_simple_list_test,
        simple_list_test_simple_list_theList_theKey_edit);
    if (res != NO_ERR) {
        return res;
    }

    res = agt_cb_register_callback(
        y_simple_list_test_M_simple_list_test,
        (const xmlChar *)"/simple_list/theList/theVal",
        y_simple_list_test_R_simple_list_test,
        simple_list_test_simple_list_theList_theVal_edit);
    if (res != NO_ERR) {
        return res;
    }

    /* put your module initialization code here */
    
    return res;
} /* y_simple_list_test_init */