コード例 #1
0
ファイル: ietf-interfaces.c プロジェクト: RIFTIO/yuma123
status_t
    y_ietf_interfaces_init (
        const xmlChar *modname,
        const xmlChar *revision)
{
    agt_profile_t *agt_profile;
    status_t res;

    agt_profile = agt_get_profile();

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

    interfaces_state_obj = ncx_find_object(
        ietf_interfaces_mod,
        "interfaces-state");
    if (interfaces_state_obj == NULL) {
        return SET_ERROR(ERR_NCX_DEF_NOT_FOUND);
    }
    
    return res;
}
コード例 #2
0
ファイル: agt_time_filter.c プロジェクト: 0xDEC0DE8/OpenYuma
/********************************************************************
* FUNCTION y_yuma_time_filter_init
* 
* initialize the yuma-time-filter server instrumentation library
* 
* INPUTS:
*    modname == requested module name
*    revision == requested version (NULL for any)
* 
* RETURNS:
*     error status
********************************************************************/
status_t
    y_yuma_time_filter_init (
        const xmlChar *modname,
        const xmlChar *revision)
{
    agt_profile_t *agt_profile;
    status_t res;

    y_yuma_time_filter_init_static_vars();

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

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

    agt_profile = agt_get_profile();

    res = ncxmod_load_module(
        y_yuma_time_filter_M_yuma_time_filter,
        y_yuma_time_filter_R_yuma_time_filter,
        &agt_profile->agt_savedevQ,
        &yuma_time_filter_mod);
    if (res != NO_ERR) {
        return res;
    }
    
    /* put your module initialization code here */
    
    return res;
} /* y_yuma_time_filter_init */
コード例 #3
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;
}
コード例 #4
0
ファイル: agt_ses.c プロジェクト: fredericoschardong/escape
/********************************************************************
* FUNCTION agt_ses_init
*
* INIT 1:
*   Initialize the session manager module data structures
*
* INPUTS:
*   none
* RETURNS:
*   status
*********************************************************************/
status_t
    agt_ses_init (void)
{

    agt_profile_t   *agt_profile;
    status_t         res;
    uint32           i;

    if (agt_ses_init_done) {
        return ERR_INTERNAL_INIT_SEQ;
    }

#ifdef AGT_STATE_DEBUG
    log_debug2("\nagt: Loading netconf-state module");
#endif

    agt_profile = agt_get_profile();

    for (i=0; i<AGT_SES_MAX_SESSIONS; i++) {
        agtses[i] = NULL;
    }
    next_sesid = 1;
    mysesmod = NULL;

    agttotals = ses_get_total_stats();
    memset(agttotals, 0x0, sizeof(ses_total_stats_t));
    tstamp_datetime(agttotals->startTime);
    (void)time(&last_timeout_check);
    agt_ses_init_done = TRUE;

    /* load the netconf-state module */
    res = ncxmod_load_module(AGT_SES_MODULE, 
                             NULL, 
                             &agt_profile->agt_savedevQ,
                             &mysesmod);
    if (res != NO_ERR) {
        return res;
    }

    /* set up get-my-session RPC operation */
    res = agt_rpc_register_method(AGT_SES_MODULE,
                                  AGT_SES_GET_MY_SESSION,
                                  AGT_RPC_PH_INVOKE,
                                  get_my_session_invoke);
    if (res != NO_ERR) {
        return SET_ERROR(res);
    }

    /* set up set-my-session RPC operation */
    res = agt_rpc_register_method(AGT_SES_MODULE,
                                  AGT_SES_SET_MY_SESSION,
                                  AGT_RPC_PH_INVOKE,
                                  set_my_session_invoke);
    if (res != NO_ERR) {
        return SET_ERROR(res);
    }

    return res;

}  /* agt_ses_init */
コード例 #5
0
ファイル: netconfd.c プロジェクト: LukasRypl/OpenYuma
/********************************************************************
 * FUNCTION load_base_schema 
 * 
 * RETURNS:
 *     status
 *********************************************************************/
static status_t load_base_schema (void)
{
    status_t res;

    /* load in the NETCONF data types and RPC methods */
    res = ncxmod_load_module( NCXMOD_YUMA_NETCONF, NULL, NULL, NULL );
    if (res != NO_ERR) {
        return res;
    }

    /* load in the server boot parameter definition file */
    res = ncxmod_load_module( NCXMOD_NETCONFD, NULL, NULL, NULL );
    if (res != NO_ERR) {
        return res;
    }

    return res;
}   /* load_base_schema */
コード例 #6
0
ファイル: netconfd.c プロジェクト: LukasRypl/OpenYuma
/********************************************************************
 * FUNCTION load_core_schema 
 * 
 * RETURNS:
 *     status
 *********************************************************************/
static status_t load_core_schema ( agt_profile_t *profile )
{
    log_debug2("\nnetconfd: Loading NCX Module");

    /* load in the with-defaults extension module */
    status_t res = ncxmod_load_module( NCXMOD_WITH_DEFAULTS, NULL, 
                                      &profile->agt_savedevQ, NULL );
    if (res != NO_ERR) {
        return res;
    }


#ifdef NETCONFD_DEBUG_LOAD_TEST
    res = load_debug_test_module( profile );
#endif

    return res;

}  /* load_core_schema */
コード例 #7
0
ファイル: netconfd.c プロジェクト: LukasRypl/OpenYuma
/********************************************************************
 * FUNCTION load_debug_test_module 
 * 
 * RETURNS:
 *     status
 *********************************************************************/
static status_t load_debug_test_module( agt_profile_t* profile )
{
#define TESTMOD             (const xmlChar *)"test"
#define TESTFEATURE1        (const xmlChar *)"feature1"
#define TESTFEATURE2        (const xmlChar *)"feature2"
#define TESTFEATURE3        (const xmlChar *)"feature3"
#define TESTFEATURE4        (const xmlChar *)"feature4"

    log_debug2("\nnetconfd: Loading Debug Test Module");

    /* Load test module */
    status_t res = ncxmod_load_module( TESTMOD, NULL, 
                                       &profile->agt_savedevQ, NULL );

    if (res != NO_ERR) {
        return res;
    } else {
        agt_enable_feature(TESTMOD, TESTFEATURE1);
        agt_disable_feature(TESTMOD, TESTFEATURE2);
        agt_enable_feature(TESTMOD, TESTFEATURE3);
        agt_disable_feature(TESTMOD, TESTFEATURE4);
    }
}
コード例 #8
0
ファイル: starter.c プロジェクト: fredericoschardong/escape
/********************************************************************
* 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 */
コード例 #9
0
ファイル: simple_yang_test.c プロジェクト: 0xDEC0DE8/OpenYuma
/********************************************************************
* 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 */
コード例 #10
0
ファイル: agt.c プロジェクト: 0xDEC0DE8/OpenYuma
/********************************************************************
* FUNCTION agt_init2
* 
* Initialize the Server Library
* The agt_profile is set and the object database is
* ready to have YANG modules loaded
*
* RPC and data node callbacks should be installed
* after the module is loaded, and before the running config
* is loaded.
*
* RETURNS:
*   status
*********************************************************************/
status_t 
    agt_init2 (void)
{
    val_value_t        *clivalset;
    ncx_module_t       *retmod;
    val_value_t        *val;
    agt_dynlib_cb_t    *dynlib;
    xmlChar            *savestr, *revision, savechar;
    cfg_template_t     *cfg;
    status_t            res;
    uint32              modlen;
    boolean             startup_loaded;

    log_debug3("\nServer Init-2 Starting...");

    startup_loaded = FALSE;

    /* init user callback support */
    agt_cb_init();
    agt_commit_complete_init();
    agt_commit_validate_init();
    agt_not_queue_notification_cb_init();

    /* initial signal handler first to allow clean exit */
    agt_signal_init();

    /* initialize the server timer service */
    agt_timer_init();
    
    /* initialize the RPC server callback structures */
    res = agt_rpc_init();
    if (res != NO_ERR) {
        log_debug3("\nError in rpc_init");
        return res;
    }

    /* initialize the NCX connect handler */
    res = agt_connect_init();
    if (res != NO_ERR) {
        log_debug3("\nError in agt_connect_init");
        return res;
    }

    /* initialize the NCX hello handler */
    res = agt_hello_init();
    if (res != NO_ERR) {
        log_debug3("\nError in agt_hello_init");
        return res;
    }

    /* setup an empty <running> config 
     * The config state is still CFG_ST_INIT
     * so no user access can occur yet (except OP_LOAD by root)
     */
    res = cfg_init_static_db(NCX_CFGID_RUNNING);
    if (res != NO_ERR) {
        return res;
    }

    /* set the 'ordered-by system' sorted/not-sorted flag */
    ncx_set_system_sorted(agt_profile.agt_system_sorted);

    /* set the 'top-level mandatory objects allowed' flag */
    ncx_set_top_mandatory_allowed(!agt_profile.agt_running_error);

    /*** All Server profile parameters should be set by now ***/

    /* must set the server capabilities after the profile is set */
    res = agt_cap_set_caps(agt_profile.agt_targ, 
                           agt_profile.agt_start,
                           agt_profile.agt_defaultStyle);
    if (res != NO_ERR) {
        return res;
    }

    /* setup the candidate config if it is used */
    if (agt_profile.agt_targ==NCX_AGT_TARG_CANDIDATE) {
        res = cfg_init_static_db(NCX_CFGID_CANDIDATE);
        if (res != NO_ERR) {
            return res;
        }
    }

    /* setup the startup config if it is used */
    if (agt_profile.agt_start==NCX_AGT_START_DISTINCT) {
        res = cfg_init_static_db(NCX_CFGID_STARTUP);
        if (res != NO_ERR) {
            return res;
        }
    }

    /* initialize the server access control model */
    res = agt_acm_init();
    if (res != NO_ERR) {
        return res;
    }

    /* initialize the session handler data structures */
    agt_ses_init();

    /* load the system module */
    res = agt_sys_init();
    if (res != NO_ERR) {
        return res;
    }

    /* load the NETCONF state monitoring data model module */
    res = agt_state_init();
    if (res != NO_ERR) {
        return res;
    }

    /* load the NETCONF Notifications data model module */
    res = agt_not_init();
    if (res != NO_ERR) {
        return res;
    }

    /* load the NETCONF /proc monitoring data model module */
    res = agt_proc_init();
    if (res != NO_ERR) {
        return res;
    }

    /* load the partial lock module */
    res = y_ietf_netconf_partial_lock_init
        (y_ietf_netconf_partial_lock_M_ietf_netconf_partial_lock,
         NULL);
    if (res != NO_ERR) {
        return res;
    }
#if 0  // OpenClovis: we do not want this by default
    /* load the NETCONF interface monitoring data model module */
    res = agt_if_init();
    if (res != NO_ERR) {
        return res;
    }
#endif
    /* initialize the NCX server core callback functions.
     * the schema (yuma-netconf.yang) for these callbacks was 
     * already loaded in the common ncx_init
     * */
    res = agt_ncx_init();
    if (res != NO_ERR) {
        return res;
    }

    /* load the yuma-time-filter module */
    res = y_yuma_time_filter_init
        (y_yuma_time_filter_M_yuma_time_filter, NULL);
    if (res != NO_ERR) {
        return res;
    }

    /* load the yuma-arp module */
    res = y_yuma_arp_init(y_yuma_arp_M_yuma_arp, NULL);
    if (res != NO_ERR) {
        return res;
    }

    /* check the module parameter set from CLI or conf file
     * for any modules to pre-load
     */
    res = NO_ERR;
    clivalset = agt_cli_get_valset();
    if (clivalset) {

        if (LOGDEBUG) {
            log_debug("\n\nnetconfd final CLI + .conf parameters:\n");
            val_dump_value_max(clivalset, 0, NCX_DEF_INDENT, DUMP_VAL_LOG,
                               NCX_DISPLAY_MODE_PLAIN, FALSE, /* withmeta */
                               TRUE /* config only */);
            log_debug("\n");
        }

        /* first check if there are any deviations to load */
        val = val_find_child(clivalset, NCXMOD_NETCONFD, NCX_EL_DEVIATION);
        while (val) {
            res = ncxmod_load_deviation(VAL_STR(val), 
                                        &agt_profile.agt_savedevQ);
            if (res != NO_ERR) {
                return res;
            } else {
                val = val_find_next_child(clivalset,
                                          NCXMOD_NETCONFD,
                                          NCX_EL_DEVIATION,
                                          val);
            }
        }

        val = val_find_child(clivalset, NCXMOD_NETCONFD, NCX_EL_MODULE);

        /* attempt all dynamically loaded modules */
        while (val && res == NO_ERR) {
            /* see if the revision is present in the
             * module parameter or not
             */
            modlen = 0;
            revision = NULL;
            savestr = NULL;
            savechar = '\0';

            if (yang_split_filename(VAL_STR(val), &modlen)) {
                savestr = &(VAL_STR(val)[modlen]);
                savechar = *savestr;
                *savestr = '\0';
                revision = savestr + 1;
            }

#ifdef STATIC_SERVER
            /* load just the module
             * SIL initialization is assumed to be
             * handled elsewhere
             */
             res = ncxmod_load_module(VAL_STR(val),
                                     revision,
                                     &agt_profile.agt_savedevQ,
                                     &retmod);
            }
            
#else
            /* load the SIL and it will load its own module */
            res = agt_load_sil_code(VAL_STR(val), revision, FALSE);
            if (res == ERR_NCX_SKIPPED) {
                log_warn("\nWarning: SIL code for module '%s' not found",
                         VAL_STR(val));
                res = ncxmod_load_module(VAL_STR(val),
                                         revision,
                                         &agt_profile.agt_savedevQ,
                                         &retmod);
            }
#endif

            if (savestr != NULL) {
                *savestr = savechar;
            }

            if (res == NO_ERR) {
                val = val_find_next_child(clivalset,
                                          NCXMOD_NETCONFD,
                                          NCX_EL_MODULE,
                                          val);
            }
        }
    }
コード例 #11
0
ファイル: agt_plock.c プロジェクト: 0xDEC0DE8/OpenYuma
/********************************************************************
* FUNCTION y_ietf_netconf_partial_lock_init
* 
* initialize the ietf-netconf-partial-lock server instrumentation library
* 
* INPUTS:
*    modname == requested module name
*    revision == requested version (NULL for any)
* 
* RETURNS:
*     error status
********************************************************************/
status_t
    y_ietf_netconf_partial_lock_init (
        const xmlChar *modname,
        const xmlChar *revision)
{
    agt_profile_t *agt_profile;
    status_t res;

    y_ietf_netconf_partial_lock_init_static_vars();

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

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

    agt_profile = agt_get_profile();

    res = ncxmod_load_module(
        y_ietf_netconf_partial_lock_M_ietf_netconf_partial_lock,
        y_ietf_netconf_partial_lock_R_ietf_netconf_partial_lock,
        &agt_profile->agt_savedevQ,
        &ietf_netconf_partial_lock_mod);
    if (res != NO_ERR) {
        return res;
    }

    agt_plock_init_done = TRUE;

    partial_lock_obj = ncx_find_object(
        ietf_netconf_partial_lock_mod,
        y_ietf_netconf_partial_lock_N_partial_lock);
    if (ietf_netconf_partial_lock_mod == NULL) {
        return SET_ERROR(ERR_NCX_DEF_NOT_FOUND);
    }
    
    partial_unlock_obj = ncx_find_object(
        ietf_netconf_partial_lock_mod,
        y_ietf_netconf_partial_lock_N_partial_unlock);
    if (ietf_netconf_partial_lock_mod == NULL) {
        return SET_ERROR(ERR_NCX_DEF_NOT_FOUND);
    }
    
    res = agt_rpc_register_method(
        y_ietf_netconf_partial_lock_M_ietf_netconf_partial_lock,
        y_ietf_netconf_partial_lock_N_partial_lock,
        AGT_RPC_PH_VALIDATE,
        y_ietf_netconf_partial_lock_partial_lock_validate);
    if (res != NO_ERR) {
        return res;
    }
    
    res = agt_rpc_register_method(
        y_ietf_netconf_partial_lock_M_ietf_netconf_partial_lock,
        y_ietf_netconf_partial_lock_N_partial_lock,
        AGT_RPC_PH_INVOKE,
        y_ietf_netconf_partial_lock_partial_lock_invoke);
    if (res != NO_ERR) {
        return res;
    }
    
    res = agt_rpc_register_method(
        y_ietf_netconf_partial_lock_M_ietf_netconf_partial_lock,
        y_ietf_netconf_partial_lock_N_partial_unlock,
        AGT_RPC_PH_VALIDATE,
        y_ietf_netconf_partial_lock_partial_unlock_validate);
    if (res != NO_ERR) {
        return res;
    }
    
    res = agt_rpc_register_method(
        y_ietf_netconf_partial_lock_M_ietf_netconf_partial_lock,
        y_ietf_netconf_partial_lock_N_partial_unlock,
        AGT_RPC_PH_INVOKE,
        y_ietf_netconf_partial_lock_partial_unlock_invoke);
    if (res != NO_ERR) {
        return res;
    }
    
    /* put your module initialization code here */
    
    return res;
} /* y_ietf_netconf_partial_lock_init */
コード例 #12
0
ファイル: toaster.c プロジェクト: pikagrue/test-repository-2
/********************************************************************
* 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 */
コード例 #13
0
ファイル: simple_list_test.c プロジェクト: 0xDEC0DE8/OpenYuma
/********************************************************************
* 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 */