Esempio n. 1
0
void tet_mds_startup(void) 
{
/* Using the default mode for startup */
    ncs_agents_startup(); 

    tet_mds_tds_startup();
}
Esempio n. 2
0
/**
 * 
 * 
 * @return unsigned int
 */
unsigned int ntfa_startup(void)
{
	unsigned int rc = NCSCC_RC_SUCCESS;
	pthread_mutex_lock(&ntfa_lock);

	TRACE_ENTER2("ntfa_use_count: %u", ntfa_use_count);
	if (ntfa_use_count > 0) {
		/* Already created, just increment the use_count */
		ntfa_use_count++;
		goto done;
	} else {
		if ((rc = ncs_agents_startup()) != NCSCC_RC_SUCCESS) {
			TRACE("ncs_agents_startup FAILED");
			goto done;
		}

		if ((rc = ntfa_create()) != NCSCC_RC_SUCCESS) {
			ncs_agents_shutdown();
			goto done;
		} else
			ntfa_use_count = 1;
	}

 done:
	pthread_mutex_unlock(&ntfa_lock);
	TRACE_LEAVE2("rc: %u, ntfa_use_count: %u", rc, ntfa_use_count);
	return rc;
}
Esempio n. 3
0
static int __init_dts(void)
{
	NCS_LIB_REQ_INFO lib_create;
	char *env;

	/* Init LIB_CREATE request for Server */
	memset(&lib_create, 0, sizeof(lib_create));
	lib_create.i_op = NCS_LIB_REQ_CREATE;
	lib_create.info.create.argc = 0;
	lib_create.info.create.argv = NULL;

	if (ncs_agents_startup() != NCSCC_RC_SUCCESS)
		return m_LEAP_DBG_SINK(NCSCC_RC_FAILURE);

	/* DTSV default service severity level */
	env = getenv("DTS_LOG_ALL");
	if (env != NULL) {
		if (atoi(env)) {
			TRACE("\nINFO:DTS default service severity = ALL\n");
			gl_severity_filter = GLOBAL_SEVERITY_FILTER_ALL;
		}
	}

	TRACE("\nDTSV:DTS:ON");
	if (dts_lib_req(&lib_create) != NCSCC_RC_SUCCESS) {
		fprintf(stderr, "dts_lib_req FAILED\n");
		return m_LEAP_DBG_SINK(NCSCC_RC_FAILURE);
	}

	return (NCSCC_RC_SUCCESS);
}
Esempio n. 4
0
static int __init_mqnd(void)
{
	NCS_LIB_REQ_INFO lib_create;
	TRACE_ENTER();

	/* Init LIB_CREATE request for Server */
	memset(&lib_create, 0, sizeof(lib_create));
	lib_create.i_op = NCS_LIB_REQ_CREATE;
	lib_create.info.create.argc = 0;
	lib_create.info.create.argv = NULL;

	if (ncs_agents_startup() != NCSCC_RC_SUCCESS) {
		TRACE_4("ncs_agents_startup failed");
		return m_LEAP_DBG_SINK(NCSCC_RC_FAILURE);
	}

	/* Init MQND */
	printf("\nMQSV:MQND:ON");
	if (mqnd_lib_req(&lib_create) != NCSCC_RC_SUCCESS) {
		fprintf(stderr, "mqnd_lib_req FAILED\n");
		return m_LEAP_DBG_SINK(NCSCC_RC_FAILURE);
	}

	TRACE_LEAVE();
	return (NCSCC_RC_SUCCESS);
}
void tet_mbcsv_startup()
{
/* Using the default mode for startup */
    ncs_agents_startup(); 
  
    mbcstm_startup();
    /*change*/
}
Esempio n. 6
0
/**
 * Initialize smfnd
 * 
 * @return uns32
 */
static uns32 initialize_smfnd(void)
{
	uns32 rc;

	TRACE_ENTER();

	if (ncs_agents_startup() != NCSCC_RC_SUCCESS) {
		LOG_ER("ncs_agents_startup FAILED");
		rc = NCSCC_RC_FAILURE;
		goto done;
	}

	/* Initialize smfnd control block */
	if (smfnd_cb_init(smfnd_cb) != NCSCC_RC_SUCCESS) {
		TRACE("smfnd_cb_init FAILED");
		rc = NCSCC_RC_FAILURE;
		goto done;
	}

	/* Create the mailbox used for communication with SMFD/SMFA */
	if ((rc = m_NCS_IPC_CREATE(&smfnd_cb->mbx)) != NCSCC_RC_SUCCESS) {
		LOG_ER("m_NCS_IPC_CREATE FAILED %d", rc);
		goto done;
	}

	/* Attach mailbox to this thread */
	if ((rc = m_NCS_IPC_ATTACH(&smfnd_cb->mbx) != NCSCC_RC_SUCCESS)) {
		LOG_ER("m_NCS_IPC_ATTACH FAILED %d", rc);
		goto done;
	}

	/* Create a selection object for USR1 signal handling */
	if ((rc = ncs_sel_obj_create(&smfnd_cb->usr1_sel_obj)) != NCSCC_RC_SUCCESS) {
		LOG_ER("ncs_sel_obj_create failed");
		goto done;
	}

	/* Initialize mds communication */
	if ((rc = smfnd_mds_init(smfnd_cb)) != NCSCC_RC_SUCCESS) {
		TRACE("smfnd_mds_init FAILED %d", rc);
		return rc;
	}

	/* Check if AMF started */
	if (smfnd_cb->nid_started == 0) {
		/* Started by AMF, so let's init AMF */
		if ((rc = smfnd_amf_init(smfnd_cb)) != NCSCC_RC_SUCCESS) {
			LOG_ER("init amf failed");
			goto done;
		}
	}

 done:
	TRACE_LEAVE();
	return (rc);
}
Esempio n. 7
0
/****************************************************************************
* Name          : fm_agents_startup
*
* Description   : Starts NCS agents. 
*
* Arguments     :  None.
*
* Return Values : NCSCC_RC_SUCCESS/NCSCC_RC_FAILURE.
* 
* Notes         : None. 
*****************************************************************************/
static uns32 fm_agents_startup(void)
{
	uns32 rc = NCSCC_RC_SUCCESS;

/* Start agents */
	rc = ncs_agents_startup();
	if (rc != NCSCC_RC_SUCCESS) {
		syslog(LOG_ERR, "ncs_agents_startup failed");
		return rc;
	}

	return rc;
}
void tet_edsv_startup()
{
/* Using the default mode for startup */
     ncs_agents_startup();    

#ifdef TET_SMOKE_TEST
  edsv_smoke_test();
  return;
#endif
   
#ifdef TET_EDSV
  tet_run_edsv_app();
#endif
}
Esempio n. 9
0
/**
 * The main routine for the smfd daemon.
 * @param argc
 * @param argv
 * 
 * @return int
 */
int main(int argc, char *argv[])
{
	/* Determine how this process was started, by NID or AMF */
	if (getenv("SA_AMF_COMPONENT_NAME") != NULL) {
		/* AMF start */
		smfd_cb->nid_started = 0;
	} else {
		/* NID start */
		smfd_cb->nid_started = 1;
	}

	daemonize(argc, argv);

	if (ncs_agents_startup() != NCSCC_RC_SUCCESS) {
		LOG_ER("ncs_agents_startup failed");
		goto done;
	}

	if (initialize_smfd() != NCSCC_RC_SUCCESS) {
		LOG_ER("initialize_smfd failed");
		goto done;
	}

	if (signal(SIGUSR1, usr1_sig_handler) == SIG_ERR) {
		LOG_ER("signal SIGUSR1 failed");
		goto done;
	}

	if (smfd_cb->nid_started == 1) {
		if (nid_notify("SMFD", NCSCC_RC_SUCCESS, NULL) !=
		    NCSCC_RC_SUCCESS)
			LOG_ER("nid_notify failed");
	}

	main_process();

	exit(EXIT_SUCCESS);

 done:
	if (smfd_cb->nid_started == 1) {
		if (nid_notify("SMFD", NCSCC_RC_FAILURE, NULL) !=
		    NCSCC_RC_SUCCESS)
			LOG_ER("nid_notify failed");
	}

	LOG_ER("SMFD failed, exiting...");
	exit(EXIT_FAILURE);
}
Esempio n. 10
0
static int __init_gld(void)
{
    NCS_LIB_REQ_INFO lib_create;

    /* Init LIB_CREATE request for Server */
    memset(&lib_create, 0, sizeof(lib_create));
    lib_create.i_op = NCS_LIB_REQ_CREATE;
    lib_create.info.create.argc = 0;
    lib_create.info.create.argv = NULL;

    if (ncs_agents_startup() != NCSCC_RC_SUCCESS)
        return m_LEAP_DBG_SINK(NCSCC_RC_FAILURE);

    /* Init GLD */
    TRACE("GLSV:GLD:ON");
    if (gld_lib_req(&lib_create) != NCSCC_RC_SUCCESS) {
        fprintf(stderr, "gld_lib_req FAILED\n");
        return m_LEAP_DBG_SINK(NCSCC_RC_FAILURE);
    }

    return (NCSCC_RC_SUCCESS);
}
Esempio n. 11
0
static int __init_eds(void)
{
	NCS_LIB_REQ_INFO lib_create;

	/* Init LIB_CREATE request for Server */
	memset(&lib_create, 0, sizeof(lib_create));
	lib_create.i_op = NCS_LIB_REQ_CREATE;
	lib_create.info.create.argc = 0;
	lib_create.info.create.argv = NULL;

	if (ncs_agents_startup() != NCSCC_RC_SUCCESS) {
		LOG_ER("Agents Startup Failed");
		return NCSCC_RC_FAILURE;
	}
	/* Init EDS */
	if (ncs_edsv_eds_lib_req(&lib_create) != NCSCC_RC_SUCCESS) {
		LOG_ER("EDS Library Request Failed");
		return NCSCC_RC_FAILURE;

	}

	return (NCSCC_RC_SUCCESS);
}
Esempio n. 12
0
/*************************************
TETWARE RELATED : ACTUAL INVOCATION
**************************************/
void tet_mds_tds_startup(void)
{
#if (TET_PATCH==1)

  int no_iterations=1,test_case,i;

  
    int SERV_SUIT=0;
    
  char *tmpprt=NULL;
  tmpprt= (char *) getenv("TET_ITERATION");
  if(tmpprt)
    no_iterations= atoi(tmpprt);
  else
    no_iterations=0;
  
  tmpprt= (char *) getenv("TET_SERV_SUITE");
  if(tmpprt)
    SERV_SUIT= atoi(tmpprt);
  else
    SERV_SUIT=0; 
  tmpprt= (char *) getenv("TET_CASE");
  if(tmpprt)
    test_case = atoi(tmpprt);
  else
    test_case =0; 


  tet_infoline("MDS_Startup : Starting");

    {  
      for(i=1;i<=no_iterations;i++)
        {
          if(i!=1)
            {
              if(ncs_agents_shutdown()!=NCSCC_RC_SUCCESS)
                {
                  perror("\n\n ----- NCS AGENTS SHUTDOWN FAILED ----- \n\n");
                  tet_printf("\n ----- NCS AGENTS SHUTDOWN FAILED ----- \n");
                  break;
                }
              sleep(5);
              if(ncs_agents_startup()!=NCSCC_RC_SUCCESS)
                {
                  perror("\n\n ----- NCS AGENTS START UP FAILED ------- \n\n");
                  tet_printf("\n ----- NCS AGENTS START UP FAILED ------- \n");
                  break;
                }
            }         
          tet_printf("\n--------------  ITERATION %d -----------\n",i);
          
          if(SERV_SUIT)
            {
              /*Starting Service related test cases*/
              tet_test_start(test_case,svc_testlist);
              sleep(1);
              ncs_tmr_whatsout();
            }
        }
    }
  tet_mds_tds_cleanup();
  
  return;
}
Esempio n. 13
0
/**
 * Initialize immd
 * 
 * @return uns32
 */
static uns32 immd_initialize(void)
{
	uns32 rc = NCSCC_RC_SUCCESS;

	TRACE_ENTER();

	if (ncs_agents_startup() != NCSCC_RC_SUCCESS) {
		LOG_ER("ncs_agents_startup FAILED");
		goto done;
	}

	if ((rc = rda_get_role(&immd_cb->ha_state)) != NCSCC_RC_SUCCESS) {
		LOG_ER("rda_get_role FAILED");
		goto done;
	}

	if ((rc = rda_register_callback(0, rda_cb)) != NCSCC_RC_SUCCESS) {
		LOG_ER("rda_register_callback FAILED %u", rc);
		goto done;
	}

	/* Init the EDU Handle */
	m_NCS_EDU_HDL_INIT(&immd_cb->edu_hdl);

	if ((rc = immd_cb_db_init(immd_cb)) != NCSCC_RC_SUCCESS) {
		LOG_ER("immd_cb_db_init FAILED");
		goto done;
	}

	/* Create a mail box */
	if ((rc = m_NCS_IPC_CREATE(&immd_cb->mbx)) != NCSCC_RC_SUCCESS) {
		LOG_ER("m_NCS_IPC_CREATE FAILED");
		goto done;
	}

	/* Attach the IPC to mail box */
	if ((rc = m_NCS_IPC_ATTACH(&immd_cb->mbx)) != NCSCC_RC_SUCCESS) {
		LOG_ER("m_NCS_IPC_ATTACH FAILED");
		goto done;
	}

	if ((rc = immd_mds_register(immd_cb)) != NCSCC_RC_SUCCESS) {
		LOG_ER("immd_mds_register FAILED %d", rc);
		goto done;
	}

	/* Initialise with the MBCSV service  */
	if ((rc = immd_mbcsv_register(immd_cb)) != NCSCC_RC_SUCCESS) {
		LOG_ER("immd_mbcsv_register FAILED %d", rc);
		goto done;
	}

	if ((rc = immd_mbcsv_chgrole(immd_cb)) != NCSCC_RC_SUCCESS) {
		LOG_ER("immd_mbcsv_chgrole FAILED %d", rc);
		goto done;
	}

	/* Create a selection object */
	if ((rc = ncs_sel_obj_create(&immd_cb->usr1_sel_obj)) != NCSCC_RC_SUCCESS) {
		LOG_ER("ncs_sel_obj_create failed");
		goto done;
	}

	/*
	 * Initialize a signal handler that will use the selection object.
	 * The signal is sent from our script when AMF does instantiate.
	 */
	if ((signal(SIGUSR1, sigusr1_handler)) == SIG_ERR) {
		LOG_ER("signal USR1 failed: %s", strerror(errno));
		rc = NCSCC_RC_FAILURE;
		goto done;
	}

	syslog(LOG_INFO, "Initialization Success, role %s",
	       (immd_cb->ha_state == SA_AMF_HA_ACTIVE) ? "ACTIVE" : "STANDBY");

done:
	if (nid_notify("IMMD", rc, NULL) != NCSCC_RC_SUCCESS) {
		LOG_ER("nid_notify failed");
		rc = NCSCC_RC_FAILURE;
	}

	TRACE_LEAVE();
	return rc;
}
Esempio n. 14
0
/**
 * Initialize clm
 * 
 * @return uns32
 */
static uint32_t clms_init(void)
{
	uint32_t rc = NCSCC_RC_FAILURE;

	TRACE_ENTER();

	/* Determine how this process was started, by NID or AMF */
	if (getenv("SA_AMF_COMPONENT_NAME") == NULL)
		clms_cb->nid_started = true;

	if (ncs_agents_startup() != NCSCC_RC_SUCCESS) {
		TRACE("ncs_core_agents_startup FAILED");
		goto done;
	}

	/* Initialize clms control block */
	if ((rc = clms_cb_init(clms_cb)) != NCSCC_RC_SUCCESS) {
		LOG_ER("clms_cb_init FAILED");
		goto done;
	}

	if ((rc = rda_get_role(&clms_cb->ha_state)) != NCSCC_RC_SUCCESS) {
		LOG_ER("rda_get_role FAILED");
		goto done;
	}
	TRACE("Current RDA Role %d", clms_cb->ha_state);

	if ((rc = rda_register_callback(0, rda_cb)) != NCSCC_RC_SUCCESS) {
		LOG_ER("rda_register_callback FAILED %u", rc);
		goto done;
	}

	/* Create the mailbox used for communication with CLMS */
	if ((rc = m_NCS_IPC_CREATE(&clms_cb->mbx)) != NCSCC_RC_SUCCESS) {
		LOG_ER("m_NCS_IPC_CREATE FAILED %d", rc);
		goto done;
	}

	/* Attach mailbox to this thread */
	if ((rc = m_NCS_IPC_ATTACH(&clms_cb->mbx) != NCSCC_RC_SUCCESS)) {
		LOG_ER("m_NCS_IPC_ATTACH FAILED %d", rc);
		goto done;
	}

	/*Initialize mds */
	if ((rc = clms_mds_init(clms_cb)) != NCSCC_RC_SUCCESS) {
		LOG_ER("clms_mds_init FAILED %d", rc);
		goto done;
	}

	/* Initialize with MBCSV */
	if ((rc = clms_mbcsv_init(clms_cb)) != NCSCC_RC_SUCCESS) {
		LOG_ER("clms_mbcsv_init FAILED");
		goto done;
	}

	/* Initialize with IMMSv */
	if ((rc = clms_imm_init(clms_cb)) != NCSCC_RC_SUCCESS) {
		LOG_ER("clms_imm_init FAILED");
		goto done;
	}

	/* Declare as implementer && Read configuration data from IMM */
	if ((rc = clms_imm_activate(clms_cb)) != SA_AIS_OK) {
		LOG_ER("clms_imm_activate FAILED");
		goto done;
	}

	if ((rc = clms_ntf_init(clms_cb)) != SA_AIS_OK) {
		LOG_ER("clms_ntf_init FAILED");
		goto done;
	}

#ifdef ENABLE_AIS_PLM
	if ((rc = clms_plm_init(clms_cb)) != SA_AIS_OK) {
		LOG_ER("clms_plm_init FAILED");
		goto done;
	}
#endif

	/*Self Node update */
	if ((rc = clms_self_node_info()) != NCSCC_RC_SUCCESS)
		goto done;

	/* Create a selection object */
	if (clms_cb->nid_started &&
		(rc = ncs_sel_obj_create(&usr1_sel_obj)) != NCSCC_RC_SUCCESS) {
		LOG_ER("ncs_sel_obj_create failed");
		goto done;
	}

	/*
	 ** Initialize a signal handler that will use the selection object.
	 ** The signal is sent from our script when AMF does instantiate.
	 */
	if (clms_cb->nid_started &&
		signal(SIGUSR1, sigusr1_handler) == SIG_ERR) {
		LOG_ER("signal USR1 failed: %s", strerror(errno));
		goto done;
	}

	if (!clms_cb->nid_started &&
		clms_amf_init(clms_cb) != NCSCC_RC_SUCCESS) {
		LOG_ER("AMF Initialization failed");
		goto done;
	}

	/* Initialize with saflog. This is necessary to avoid
	 *  getting blocked by LOG during role change (switchover/failover)
	 */
	saflog_init();

	rc = NCSCC_RC_SUCCESS;

 done:
	if (clms_cb->nid_started &&
		nid_notify("CLMD", rc, NULL) != NCSCC_RC_SUCCESS) {
		LOG_ER("nid_notify failed");
		rc = NCSCC_RC_FAILURE;
	}

	TRACE_LEAVE();
	return rc;
}
Esempio n. 15
0
/**
 * Initialize smfd
 * 
 * @return uns32
 */
static uns32 initialize_smfd(void)
{
	uns32 rc;

	TRACE_ENTER();

	/* Set the behaviour of SMF-IMM interactions */
	immutilWrapperProfile.errorsAreFatal = 0;   /* False, no reboot when fail */
	immutilWrapperProfile.nTries         = 500; /* Times */
	immutilWrapperProfile.retryInterval  = 400; /* MS */

	if (ncs_agents_startup() != NCSCC_RC_SUCCESS) {
		LOG_ER("ncs_agents_startup FAILED");
		rc = NCSCC_RC_FAILURE;
		goto done;
	}

	/* Initialize smfd control block */
	if (smfd_cb_init(smfd_cb) != NCSCC_RC_SUCCESS) {
		TRACE("smfd_cb_init FAILED");
		rc = NCSCC_RC_FAILURE;
		goto done;
	}

	/* Create the mailbox used for communication with SMFND */
	if ((rc = m_NCS_IPC_CREATE(&smfd_cb->mbx)) != NCSCC_RC_SUCCESS) {
		LOG_ER("m_NCS_IPC_CREATE FAILED %d", rc);
		goto done;
	}

	/* Attach mailbox to this thread */
	if ((rc = m_NCS_IPC_ATTACH(&smfd_cb->mbx) != NCSCC_RC_SUCCESS)) {
		LOG_ER("m_NCS_IPC_ATTACH FAILED %d", rc);
		goto done;
	}

	/* Create a selection object for USR1 signal handling */
	if ((rc =
	     ncs_sel_obj_create(&smfd_cb->usr1_sel_obj)) != NCSCC_RC_SUCCESS) {
		LOG_ER("ncs_sel_obj_create failed");
		goto done;
	}

	/* Init mds communication */
	if ((rc = smfd_mds_init(smfd_cb)) != NCSCC_RC_SUCCESS) {
		TRACE("smfd_mds_init FAILED %d", rc);
		return rc;
	}

	/* Init campaign OI */
	if ((rc = campaign_oi_init(smfd_cb)) != NCSCC_RC_SUCCESS) {
		TRACE("campaign_oi_init FAILED %d", rc);
		return rc;
	}

	/* Check if AMF started */
	if (smfd_cb->nid_started == 0) {
		/* Started by AMF, so let's init AMF */
		if ((rc = smfd_amf_init(smfd_cb)) != NCSCC_RC_SUCCESS) {
			LOG_ER("init amf failed");
			goto done;
		}
	}

 done:
	TRACE_LEAVE();
	return (rc);
}