/************************************************************************** Function: smfd_amf_init Purpose: Function which initializes SMFD with AMF. Input: None Returns: SA_AIS_OK - everything is OK SA_AIS_ERR_* - failure **************************************************************************/ SaAisErrorT smfd_amf_init(smfd_cb_t * cb) { SaAmfCallbacksT amfCallbacks; SaVersionT amf_version; SaAisErrorT result; TRACE_ENTER(); /* Initialize AMF callbacks */ memset(&amfCallbacks, 0, sizeof(SaAmfCallbacksT)); amfCallbacks.saAmfHealthcheckCallback = amf_health_chk_callback; amfCallbacks.saAmfCSISetCallback = amf_csi_set_callback; amfCallbacks.saAmfComponentTerminateCallback = amf_comp_terminate_callback; amfCallbacks.saAmfCSIRemoveCallback = amf_csi_rmv_callback; amf_version.releaseCode = 'B'; amf_version.majorVersion = 0x01; amf_version.minorVersion = 0x01; /* Initialize the AMF library */ result = saAmfInitialize(&cb->amf_hdl, &amfCallbacks, &amf_version); if (result != SA_AIS_OK) { LOG_ER("saAmfInitialize() FAILED: %u", result); goto done; } /* Obtain the AMF selection object to wait for AMF events */ result = saAmfSelectionObjectGet(cb->amf_hdl, &cb->amfSelectionObject); if (result != SA_AIS_OK) { LOG_ER("saAmfSelectionObjectGet() FAILED: %u", result); goto done; } /* Get the component name */ result = saAmfComponentNameGet(cb->amf_hdl, &cb->comp_name); if (result != SA_AIS_OK) { LOG_ER("saAmfComponentNameGet() FAILED: %u", result); goto done; } /* Register component with AMF */ result = saAmfComponentRegister(cb->amf_hdl, &cb->comp_name, (SaNameT *) NULL); if (result != SA_AIS_OK) { LOG_ER("saAmfComponentRegister() FAILED"); goto done; } /* Start AMF healthchecks */ if ((result = amf_healthcheck_start(cb)) != SA_AIS_OK) { LOG_ER("health check start FAILED"); goto done; } done: TRACE_LEAVE(); return result; }
/************************************************************************** Function: lgs_amf_register Purpose: Function which registers LGS with AMF. Input: None Returns: SA_AIS_OK - everything is OK SA_AIS_ERR_* - failure **************************************************************************/ SaAisErrorT lgs_amf_init(lgs_cb_t *cb) { SaAmfCallbacksT amfCallbacks; SaVersionT amf_version; SaAisErrorT error; TRACE_ENTER(); if (cb->nid_started && amf_comp_name_get_set_from_file("LOGD_COMP_NAME_FILE", &cb->comp_name) != NCSCC_RC_SUCCESS) { error = SA_AIS_ERR_NOT_EXIST; goto done; } /* Initialize AMF callbacks */ memset(&amfCallbacks, 0, sizeof(SaAmfCallbacksT)); amfCallbacks.saAmfHealthcheckCallback = amf_health_chk_callback; amfCallbacks.saAmfCSISetCallback = amf_csi_set_callback; amfCallbacks.saAmfComponentTerminateCallback = amf_comp_terminate_callback; amfCallbacks.saAmfCSIRemoveCallback = amf_csi_rmv_callback; amf_version.releaseCode = 'B'; amf_version.majorVersion = 0x01; amf_version.minorVersion = 0x01; /* Initialize the AMF library */ error = saAmfInitialize(&cb->amf_hdl, &amfCallbacks, &amf_version); if (error != SA_AIS_OK) { LOG_ER("saAmfInitialize() FAILED: %u", error); goto done; } /* Obtain the AMF selection object to wait for AMF events */ error = saAmfSelectionObjectGet(cb->amf_hdl, &cb->amfSelectionObject); if (error != SA_AIS_OK) { LOG_ER("saAmfSelectionObjectGet() FAILED: %u", error); goto done; } /* Get the component name */ error = saAmfComponentNameGet(cb->amf_hdl, &cb->comp_name); if (error != SA_AIS_OK) { LOG_ER("saAmfComponentNameGet() FAILED: %u", error); goto done; } /* Register component with AMF */ error = saAmfComponentRegister(cb->amf_hdl, &cb->comp_name, (SaNameT *)NULL); if (error != SA_AIS_OK) { LOG_ER("saAmfComponentRegister() FAILED"); goto done; } /* Start AMF healthchecks */ if ((error = amf_healthcheck_start(cb)) != SA_AIS_OK){ LOG_ER("amf_healthcheck_start() failed with error %u",error); goto done; } done: TRACE_LEAVE(); return error; }