/****************************************************************************** * Application Life Cycle Management Functions *****************************************************************************/ ClRcT clCompAlarmEvtCallbackFunc(const ClAlarmHandleInfoT* pAlarmInfo) { ClRcT rc = CL_OK; ClNameT moIdName = {0}; ClCorMOIdT moId ; ClIocAddressT iocAddress = {{0}}; memcpy(&moId, &pAlarmInfo->alarmInfo.moId, sizeof(ClCorMOIdT)); rc = clCorMoIdToMoIdNameGet(&moId, &moIdName); if(CL_OK == rc) clOsalPrintf(" The MSO for which the alarm is raised [%s]. ", moIdName.value); clOsalPrintf(" The component which has raised the alarm [%s] ", pAlarmInfo->alarmInfo.compName.value); clOsalPrintf("Probable Cause:%d\n",pAlarmInfo->alarmInfo.probCause); clOsalPrintf("Alarm Handle :%d\n",pAlarmInfo->alarmHandle); clOsalPrintf("Alarm State:%d\n",pAlarmInfo->alarmInfo.alarmState); if(pAlarmInfo->alarmInfo.len != 0) clOsalPrintf("Alarm payload :%s\n",pAlarmInfo->alarmInfo.buff); iocAddress.iocPhyAddress.nodeAddress = 2; clEoMyEoIocPortGet(&iocAddress.iocPhyAddress.portId); rc = clFaultRepairAction(iocAddress, pAlarmInfo->alarmHandle, SA_AMF_COMPONENT_RESTART); if (CL_OK != rc) { clOsalPrintf("Failed while reporting the alarm to the fault..... . rc[0x%x] \n", rc); return rc; } clOsalPrintf("################ Successfully reported the alarm to the fault. ..... \n"); return rc; }
ClRcT alarm_event_subscribe_callback(const ClAlarmHandleInfoT* pAlarmInfo) { ClRcT rc = CL_OK; SaNameT moIdName = {0}; ClCorMOIdT moId = pAlarmInfo->alarmInfo.moId; ClAlarmUtilPayLoadListPtrT pPayloadList = NULL; rc = clCorMoIdToMoIdNameGet(&moId, &moIdName); if (CL_OK != rc) { clprintf(CL_LOG_SEV_ERROR,"[%s]:Failed while getting the moId from MOId Name. rc[0x%x] ", appname, rc); return rc; } rc = clAlarmUtilPayLoadExtract((ClUint8T *)pAlarmInfo->alarmInfo.buff, pAlarmInfo->alarmInfo.len, &pPayloadList); if (CL_OK != rc) { clprintf(CL_LOG_SEV_ERROR,"[%s]: Failed while extracting the payload information. rc[0x%x] ", appname, rc); return rc; } clprintf(CL_LOG_SEV_INFO,"______________________________________________________"); clprintf(CL_LOG_SEV_INFO,"The alarm is [%s] ", pAlarmInfo->alarmInfo.alarmState ?"RAISED":"CLEARED"); clprintf(CL_LOG_SEV_INFO,"The alarm Raised on the resource [%s] ", moIdName.value); clprintf(CL_LOG_SEV_INFO,"Component which has raised the alarm is [%s] ", pAlarmInfo->alarmInfo.compName.value); clprintf(CL_LOG_SEV_INFO,"Probable cause of the alarm is [%d] ", pAlarmInfo->alarmInfo.probCause); clprintf(CL_LOG_SEV_INFO,"Severity of the alarm is [%d] ", pAlarmInfo->alarmInfo.severity); clprintf(CL_LOG_SEV_INFO,"The payload information : [%s] ", (char*)pPayloadList->pPayload[0].pTlv[0].value); clprintf(CL_LOG_SEV_INFO,"______________________________________________________"); clAlarmUtilPayloadListFree(pPayloadList); return rc; }
/** * This function is called by the provisioning library whenever the object * modification operation is done on the resource being managed. For a single job * request, this function is called if the validate function is failed. For a * multiple job request, on encountering a validate failure, this function is * called to rollback all the jobs before the one (including) on which the * validation failure is reported. * * The pThis is a pointer to the provisioning class. * The txnHandle is the unique handle for all the jobs which are part of same session. So for * a session containing multiple jobs, then it is unique of all the jobs and it can be used * to identify them. * * The pProvTxnData is a pointer to the ClProvTxnDataT structure which contains * the information about the job being performed on the managed resource. * The pProvTxnData->provCmd stores the operation type which can be * CL_COR_OP_CREATE_AND_SET, CL_COR_OP_CREATE, CL_COR_OP_SET or CL_COR_OP_DELETE * based on what is the operation happening on the resource. * In the case of set operation, the various fields of pProvTxnData provide the * the details about the operation which is happening on the resource. It contain * MOID of the managed resource and information about the attribute on which set * operation is done. For a create, create-set and delete operation, the pProvTxnData * contains the MOID of the resource on which the given operation is done. * * ** Note : This function is being deprecated, if clProvObjectRollback() callback * is filled in the constructor, then that callback function will be called * instead of this to group rollback all the requests. */ ClRcT clProvisioningTIMESETTABLEProvRollback(CL_OM_PROV_CLASS* pThis, ClHandleT txnHandle, ClProvTxnDataT* pProvTxnData) { ClRcT rc = CL_OK; /* * ---BEGIN_APPLICATION_CODE--- */ ClNameT moIdName = {0}; clprintf(CL_LOG_SEV_INFO, "Inside the function %s", __FUNCTION__); if (pProvTxnData == NULL) { clOsalPrintf("[%s]: Null pointer detected for pProvTxnData. \n", appname); return CL_ERR_NULL_POINTER; } rc = clCorMoIdToMoIdNameGet((ClCorMOIdPtrT)pProvTxnData->pMoId, &moIdName); if (CL_OK != rc) { clOsalPrintf("[%s]: Failed while getting the name of the MO. rc[0x%x]", appname, rc); return rc; } switch (pProvTxnData->provCmd) { case CL_COR_OP_CREATE : case CL_COR_OP_CREATE_AND_SET: break; case CL_COR_OP_SET: if (pProvTxnData->pProvData == NULL) { clOsalPrintf("[%s]: The value for the AttrId [0x%x], MO [%s] \n", appname, pProvTxnData->attrId, moIdName.value); return CL_ERR_NULL_POINTER; } switch (pProvTxnData->attrId) { case TIMESETTABLE_TIMESETHOUR : { clOsalPrintf("[%s]: Rolling back AttrId [TIMESETTABLE_TIMESETHOUR: 0x%x] of MO [%s] \n", appname, pProvTxnData->attrId, moIdName.value); } break; case TIMESETTABLE_TIMESETMINUTE: { clOsalPrintf("[%s]: Rolling back AttrId [TIMESETTABLE_TIMESETMINUTE: 0x%x] of MO [%s] \n", appname, pProvTxnData->attrId, moIdName.value); } break; case TIMESETTABLE_TIMESETSECOND: { clOsalPrintf("[%s]: Rolling back AttrId [TIMESETTABLE_TIMESETSECOND: 0x%x] of MO [%s] \n", appname, pProvTxnData->attrId, moIdName.value); } break; default: clOsalPrintf("[%s]: Do nothing. \n", appname); } break; default: clprintf (CL_LOG_SEV_ERROR, "Prov command is not proper"); } /* * ---END_APPLICATION_CODE--- */ return rc; }
/** * This function is called by the provisioning library whenever the object modification * operation is done on the resource being managed. This is called to update the jobs * after being validated in validate phase. * * The pThis is a pointer to the provisioning class. * The txnHandle is the unique handle for all the jobs which are part of same session. So for * a session containing multiple jobs, then it is unique of all the jobs and it can be used * to identify them. * * The pProvTxnData is a pointer to the ClProvTxnDataT structure which contains * the information about the job being performed on the managed resource. * The pProvTxnData->provCmd stores the operation type which can be * CL_COR_OP_CREATE_AND_SET, CL_COR_OP_CREATE, CL_COR_OP_SET or CL_COR_OP_DELETE * based on what is the operation happening on the resource. * In the case of set operation, the various fields of pProvTxnData provide the * the details about the operation which is happening on the resource. It contain * MOID of the managed resource and information about the attribute on which set * operation is done. For a create, create-set and delete operation, the pProvTxnData * contains the MOID of the resource on which the given operation is done. * * ** Note : This function is being deprecated, if clProvObjectUpdate() callback * is filled in the constructor, then that callback function will be called * instead of this to group update all the requests. */ ClRcT clcsa105CompCSA105RESProvUpdate(CL_OM_PROV_CLASS* pThis, ClHandleT txnHandle, ClProvTxnDataT* pProvTxnData) { ClRcT rc = CL_OK; /* * ---BEGIN_APPLICATION_CODE--- */ clprintf(CL_LOG_SEV_INFO, "Inside the function %s", __FUNCTION__); ClNameT moIdName = {0}; rc = clCorMoIdToMoIdNameGet((ClCorMOIdPtrT)pProvTxnData->pMoId, &moIdName); if (CL_OK != rc) { clprintf(CL_LOG_SEV_ERROR,"%s: Failed while getting the MOId Name from moid. rc[0x%x] ", appname, rc); return rc; } /* * ---END_APPLICATION_CODE--- */ switch (pProvTxnData->provCmd) { case CL_COR_OP_CREATE : case CL_COR_OP_CREATE_AND_SET: /* * ---BEGIN_APPLICATION_CODE--- */ clprintf(CL_LOG_SEV_ERROR,"%s: Inside create request for the object [%s] ", appname, moIdName.value); /* * ---END_APPLICATION_CODE--- */ break; case CL_COR_OP_SET: /* * ---BEGIN_APPLICATION_CODE--- */ switch (pProvTxnData->attrId) { case CSA105RES_DELTA_T: delta_t = *(ClUint32T *)pProvTxnData->pProvData; clprintf(CL_LOG_SEV_NOTICE,"%s: The delta time is now [%d] ", appname, delta_t); break; case CSA105RES_COUNTER_THRESH: counter_threshold = *(ClUint32T *)pProvTxnData->pProvData; clprintf(CL_LOG_SEV_NOTICE,"%s: The counter threshold is now [%d] ", appname, counter_threshold); } /* * ---END_APPLICATION_CODE--- */ break; case CL_COR_OP_DELETE: /* * ---BEGIN_APPLICATION_CODE--- */ /* * ---END_APPLICATION_CODE--- */ break; default: clprintf (CL_LOG_SEV_ERROR, "Prov command is not proper"); } /* * ---BEGIN_APPLICATION_CODE--- */ /* * ---END_APPLICATION_CODE--- */ return rc; }
ClRcT clAmfNodeSet(ClAmsMgmtHandleT mgmtHandle, const ClProvTxnDataT *pProvTxnData) { ClAmsEntityT entity = {0}; ClRcT rc = CL_OK; if(!mgmtHandle) return CL_OK; if(!pProvTxnData || !pProvTxnData->pProvData || !pProvTxnData->pMoId) return CL_AMS_RC(CL_ERR_INVALID_PARAMETER); entity.type = CL_AMS_ENTITY_TYPE_NODE; rc = clAmsMgmtOIGet(pProvTxnData->pMoId, &entity); if(rc != CL_OK) { SaNameT moidName = {0}; if(clCorMoIdToMoIdNameGet(pProvTxnData->pMoId, &moidName) == CL_OK) clLogError("OI", "READ", "AMF entity not found for moid [%.*s]", moidName.length, moidName.value); return rc; } switch (pProvTxnData->attrId) { case SAAMFNODETABLE_SAAMFNODEADMINSTATETRIGGER: { ClAmsNodeConfigT *pNodeConfig = NULL; ClInt32T adminState = *(ClInt32T *)pProvTxnData->pProvData; rc = clAmsMgmtEntityGetConfig(mgmtHandle, &entity, (ClAmsEntityConfigT**)&pNodeConfig); if (rc != CL_OK) { clLogError("OI", "WRITE", "Node [%s] config returned [%#x]", entity.name.value, rc); return rc; } if (pProvTxnData->size != (ClUint32T)sizeof(pNodeConfig->adminState)) { clLogError("OI", "WRITE", "Read size [%d] doesnt match expected size [%d]", pProvTxnData->size, (ClUint32T)pNodeConfig->adminState); clHeapFree(pNodeConfig); return CL_AMS_RC(CL_ERR_INVALID_PARAMETER); } switch (adminState) { case SAAMFNODEADMINSTATETRIGGER_STABLE: { return CL_OK; } case SAAMFNODEADMINSTATETRIGGER_UNLOCKINSTANTIATION: case SAAMFNODEADMINSTATETRIGGER_LOCK: { rc = clAmsMgmtEntityLockAssignment(mgmtHandle, &entity); break; } case SAAMFNODEADMINSTATETRIGGER_UNLOCK: { if(clAmsMgmtEntityLockAssignment(mgmtHandle, &entity) == CL_OK) sleep(1); rc = clAmsMgmtEntityUnlock(mgmtHandle, &entity); break; } case SAAMFNODEADMINSTATETRIGGER_LOCKINSTANTIATION: { /* * Careful. If snmp subagent is running on only 1 node * and is not redundant, then the snmp query would timeout * as it would take down the subagent as well. */ if(clAmsMgmtEntityLockAssignment(mgmtHandle, &entity) == CL_OK) sleep(1); rc = clAmsMgmtEntityLockInstantiation(mgmtHandle, &entity); break; } } clHeapFree(pNodeConfig); break; } case SAAMFNODETABLE_SAAMFNODEAUTOREPAIROPTION: { break; } case SAAMFNODETABLE_SAAMFNODECLMNODE: { break; } case SAAMFNODETABLE_SAAMFNODENAME: { break; } case SAAMFNODETABLE_SAAMFNODEREPAIR: { break; } case SAAMFNODETABLE_SAAMFNODESUFAILOVERPROB: { break; } default: { break; } } return rc; }
/** * This function is called to perform a get operation on the transient attribute * which is owned by the primary object implementer (OI). As the COR doesn't have * the latest value of the transient attribute, it is obtained from the OI. This * function is called in the OI's context which it can use to fill the latest * value of the runtime or transient attribute. * * The pThis is pointer to the provisioning class. * The txnHandle is used to identify the jobs which are part of same bundle request. * For single request this field is of not much significance, but for a multiple job * request, this feild is used to identify all the jobs which are part of same * bundle request sent by COR. * * The pProvTxnData contains the information about the attribute jobs. It contains * the MOId of the managed resource, the attribute identifier, its type (array or * simple), its basic type (data type), index (in case it is array attriubte), * size and the pointer (allocated by the library) to the memory on which the * data can be copied. * * For a request containing only single job, this function is called only once. But * for a multiple job request, this is called for all the attributes one at a time. * * ** Note : This function is being deprecated, if clProvObjectRead() callback is filled * in the constructor, then that callback function will be called instead of this * to group read all the requests. */ ClRcT clamfMgmtSAAMFSITABLEProvRead(CL_OM_PROV_CLASS* pThis, ClHandleT txnHandle, ClProvTxnDataT* pProvTxnData) { ClRcT rc = CL_OK; /* * ---BEGIN_APPLICATION_CODE--- */ ClAmsEntityT entity = {0}; clprintf(CL_LOG_SEV_INFO, "Inside the function %s", __FUNCTION__); if(!gClAmsMgmtHandle) return CL_AMS_RC(CL_ERR_NOT_INITIALIZED); if(!pProvTxnData || !pProvTxnData->pProvData || !pProvTxnData->pMoId) return CL_AMS_RC(CL_ERR_INVALID_PARAMETER); entity.type = CL_AMS_ENTITY_TYPE_SI; rc = clAmsMgmtOIGet(pProvTxnData->pMoId, &entity); if(rc != CL_OK) { ClNameT moidName = {0}; if(clCorMoIdToMoIdNameGet(pProvTxnData->pMoId, &moidName) == CL_OK) clLogError("OI", "READ", "AMF entity not found for moid [%.*s]", moidName.length, moidName.value); return rc; } switch(pProvTxnData->attrId) { case SAAMFSITABLE_SAAMFSIADMINSTATE: { ClAmsSIConfigT *pSIConfig = NULL; rc = clAmsMgmtEntityGetConfig(gClAmsMgmtHandle, &entity, (ClAmsEntityConfigT**)&pSIConfig); if(rc != CL_OK) { clLogError("OI", "READ", "SI [%s] config get returned [%#x]", entity.name.value, rc); return rc; } if(pProvTxnData->size != (ClUint32T)sizeof(pSIConfig->adminState)) { clLogError("OI", "READ", "Read size [%d] doesnt match expected size [%d]", pProvTxnData->size, (ClUint32T)sizeof(pSIConfig->adminState)); clHeapFree(pSIConfig); return CL_AMS_RC(CL_ERR_INVALID_PARAMETER); } memcpy(pProvTxnData->pProvData, &pSIConfig->adminState, pProvTxnData->size); clHeapFree(pSIConfig); } break; case SAAMFSITABLE_SAAMFSINUMCURRACTIVEASSIGNMENTS: case SAAMFSITABLE_SAAMFSINUMCURRSTANDBYASSIGNMENTS: { ClAmsSIStatusT *pSIStatus = NULL; rc = clAmsMgmtEntityGetStatus(gClAmsMgmtHandle, &entity, (ClAmsEntityStatusT**)&pSIStatus); if(rc != CL_OK) { clLogError("OI", "READ", "SI [%s] status returned [%#x]", entity.name.value, rc); return rc; } if(pProvTxnData->size != (ClUint32T)sizeof(pSIStatus->numActiveAssignments)) { clLogError("OI", "READ", "Read size [%d] doesnt match expected size [%d]", pProvTxnData->size, (ClUint32T)sizeof(pSIStatus->numActiveAssignments)); clHeapFree(pSIStatus); return CL_AMS_RC(CL_ERR_INVALID_PARAMETER); } if(pProvTxnData->attrId == SAAMFSITABLE_SAAMFSINUMCURRACTIVEASSIGNMENTS) memcpy(pProvTxnData->pProvData, &pSIStatus->numActiveAssignments, pProvTxnData->size); else memcpy(pProvTxnData->pProvData, &pSIStatus->numStandbyAssignments, pProvTxnData->size); clHeapFree(pSIStatus); } break; default: return CL_AMS_RC(CL_ERR_NOT_SUPPORTED); } /* * ---END_APPLICATION_CODE--- */ return rc; }
ClRcT clComponentCallBack(void *arg) { ClRcT rc = CL_OK; struct timeval alarmTime; ClAlarmHandleT alarmHandle; ClNameT moidName = {strlen("\\Chassis:0\\GigeBlade:0"), "\\Chassis:0\\GigeBlade:0"}; ClNameT moidName2 = {strlen("\\Chassis:0\\GigeBlade:0\\GigePort:0"), "\\Chassis:0\\GigeBlade:0\\GigePort:0"}; ClAlarmInfoT *pAlarmInfo; ClCorMOIdT moId; ClNameT moIdName = {0}; pAlarmInfo = clHeapAllocate(sizeof(ClAlarmInfoT)+strlen("HelloHelloHelloHelloHelloHelloHelloHello")+1); if(pAlarmInfo == NULL) { clOsalPrintf("Failed while allocating the memory for the alamr information."); return CL_ALARM_RC(CL_ERR_NO_MEMORY); } clCpmComponentNameGet(0,&(pAlarmInfo->compName)); CL_DEBUG_PRINT(CL_DEBUG_ERROR, (" CompName : %s\n", pAlarmInfo->compName.value)); clCorMoIdNameToMoIdGet(&moidName,&(pAlarmInfo->moId)); pAlarmInfo->alarmState = CL_ALARM_STATE_ASSERT; pAlarmInfo->category = CL_ALARM_CATEGORY_QUALITY_OF_SERVICE; pAlarmInfo->specificProblem = 0; pAlarmInfo->severity = CL_ALARM_SEVERITY_CRITICAL; gettimeofday(&alarmTime,NULL); pAlarmInfo->eventTime = alarmTime.tv_sec; pAlarmInfo->len = strlen("HelloHelloHelloHelloHelloHelloHelloHello")+1; memcpy(pAlarmInfo->buff,"HelloHelloHelloHelloHelloHelloHelloHello",pAlarmInfo->len); ClEoExecutionObjT* peoObj=(ClEoExecutionObjT *)arg; if ( (rc = clEoMyEoObjectSet(peoObj)) != CL_OK) { CL_DEBUG_PRINT(CL_DEBUG_ERROR, (" clEoMyEoObjectSet failed, rc:0x%x \n", rc)); return rc; } /** * Raising alarm for : * MOId - /Chassis:0/GigeBlade:0 * Category - CL_ALARM_CATEGORY_QUALITY_OF_SERVICE * Probable Cause - CL_ALARM_PROB_CAUSE_BANDWIDTH_REDUCED */ CL_DEBUG_PRINT(CL_DEBUG_ERROR,("Raising alarm for [%s] and the probable cause\ [%d]", moidName.value, CL_ALARM_PROB_CAUSE_LOSS_OF_FRAME)); pAlarmInfo->probCause = CL_ALARM_PROB_CAUSE_BANDWIDTH_REDUCED; rc = clAlarmRaise(pAlarmInfo,&alarmHandle); /** * Raising alarm for : * MOId - /Chassis:0/GigeBlade:0 * Category - CL_ALARM_CATEGORY_QUALITY_OF_SERVICE * Probable Cause - CL_ALARM_PROB_CAUSE_RESPONSE_TIME_EXCESSIVE */ pAlarmInfo->probCause = CL_ALARM_PROB_CAUSE_RESPONSE_TIME_EXCESSIVE; CL_DEBUG_PRINT(CL_DEBUG_ERROR,("Raising alarm for [%s] and the probable \ cause [%d]", moidName.value, CL_ALARM_PROB_CAUSE_RESPONSE_TIME_EXCESSIVE)); rc = clAlarmRaise(pAlarmInfo,&alarmHandle); CL_DEBUG_PRINT(CL_DEBUG_ERROR, ("Alarm Category : %d \n",pAlarmInfo->category )); CL_DEBUG_PRINT(CL_DEBUG_ERROR, ("Alarm severity: %d \n",pAlarmInfo->severity)); rc = clAlarmClientResourceInfoGet(alarmHandle, &moId); if ( CL_OK != rc) { clOsalPrintf("Failed while asking the moid for the alarm handle [%d]. rc[0x%x] \n", alarmHandle, rc); return rc; } rc = clCorMoIdToMoIdNameGet(&moId, &moIdName); if(CL_OK != rc) { clOsalPrintf("Failed while getting the mOId name from moid . rc[0x%x]", rc) ; return rc; } clOsalPrintf("The MOID for the alarm handle is [%d] is [%s]\n", alarmHandle, moIdName.value); /** * Raising alarm for : * MOId - /Chassis:0/GigeBlade:0/GigePort:0 * Category - CL_ALARM_CATEGORY_QUALITY_OF_SERVICE * Probable Cause - CL_ALARM_PROB_CAUSE_LOSS_OF_FRAME */ CL_DEBUG_PRINT(CL_DEBUG_ERROR,("Raising alarm for [%s] and the probable \ cause [%d]", moidName2.value, CL_ALARM_PROB_CAUSE_LOSS_OF_FRAME)); pAlarmInfo->probCause = CL_ALARM_PROB_CAUSE_LOSS_OF_FRAME; clCorMoIdNameToMoIdGet(&moidName2,&(pAlarmInfo->moId)); rc = clAlarmRaise(pAlarmInfo,&alarmHandle); CL_DEBUG_PRINT(CL_DEBUG_ERROR, ("Alarm Category : %d \n",pAlarmInfo->category )); CL_DEBUG_PRINT(CL_DEBUG_ERROR, ("Alarm severity: %d \n",pAlarmInfo->severity)); rc = clAlarmClientResourceInfoGet(alarmHandle, &moId); if ( CL_OK != rc) { clOsalPrintf("Failed while asking the moid for the alarm handle [%d]. rc[0x%x] \n", alarmHandle, rc); return rc; } rc = clCorMoIdToMoIdNameGet(&moId, &moIdName); if(CL_OK != rc) { clOsalPrintf("Failed while getting the mOId name from moid . rc[0x%x]", rc) ; return rc; } clOsalPrintf("The MOID for the alarm handle is [%d] is [%s]\n", alarmHandle, moIdName.value); /** * Raising alarm for : * MOId - /Chassis:0/GigeBlade:0/GigePort:0 * Category - CL_ALARM_CATEGORY_QUALITY_OF_SERVICE * Probable Cause - CL_ALARM_PROB_CAUSE_MULTIPLEXER_PROBLEM */ CL_DEBUG_PRINT(CL_DEBUG_ERROR,("Raising alarm for [%s] and the probable \ cause [%d]", moidName2.value, CL_ALARM_PROB_CAUSE_MULTIPLEXER_PROBLEM)); pAlarmInfo->probCause = CL_ALARM_PROB_CAUSE_MULTIPLEXER_PROBLEM; clCorMoIdNameToMoIdGet(&moidName2,&(pAlarmInfo->moId)); rc = clAlarmRaise(pAlarmInfo,&alarmHandle); CL_DEBUG_PRINT(CL_DEBUG_ERROR, ("Alarm Category : %d \n",pAlarmInfo->category )); CL_DEBUG_PRINT(CL_DEBUG_ERROR, ("Alarm severity: %d \n",pAlarmInfo->severity)); /** * Clearing alarm for : * MOId - /Chassis:0/GigeBlade:0/GigePort:0 * Category - CL_ALARM_CATEGORY_QUALITY_OF_SERVICE * Probable Cause - CL_ALARM_PROB_CAUSE_MULTIPLEXER_PROBLEM */ CL_DEBUG_PRINT(CL_DEBUG_ERROR,("Clearing alarm for [%s] and the probable \ cause [%d]", moidName.value, CL_ALARM_PROB_CAUSE_MULTIPLEXER_PROBLEM)); pAlarmInfo->alarmState = CL_ALARM_STATE_CLEAR; clCorMoIdNameToMoIdGet(&moidName2,&(pAlarmInfo->moId)); rc = clAlarmRaise(pAlarmInfo,&alarmHandle); CL_DEBUG_PRINT(CL_DEBUG_ERROR, ("Alarm Category : %d \n",pAlarmInfo->category )); CL_DEBUG_PRINT(CL_DEBUG_ERROR, ("Alarm severity: %d \n",pAlarmInfo->severity)); /** * Clearing alarm for : * MOId - /Chassis:0/GigeBlade:0/GigePort:0 * Category - CL_ALARM_CATEGORY_QUALITY_OF_SERVICE * Probable Cause - CL_ALARM_PROB_CAUSE_LOSS_OF_FRAME */ CL_DEBUG_PRINT(CL_DEBUG_ERROR,("Raising alarm for [%s] and the probable \ cause [%d]", moidName.value, CL_ALARM_PROB_CAUSE_LOSS_OF_FRAME)); pAlarmInfo->probCause = CL_ALARM_PROB_CAUSE_LOSS_OF_FRAME; rc = clAlarmRaise(pAlarmInfo,&alarmHandle); CL_DEBUG_PRINT(CL_DEBUG_ERROR, ("Alarm Category : %d \n",pAlarmInfo->category )); CL_DEBUG_PRINT(CL_DEBUG_ERROR, ("Alarm severity: %d \n",pAlarmInfo->severity)); return rc; }
ClRcT clCpmSlotInfoGet(ClCpmSlotInfoFieldIdT flag, ClCpmSlotInfoT *slotInfo) { ClRcT rc = CL_OK; ClIocNodeAddressT masterIocAddress = 0; ClCpmSlotInfoRecvT slotInfoRecv = { CL_CPM_SLOT_ID}; ClUint32T bufSize = 0; /* make a SYNC RMD to CPM/G master */ rc = clCpmMasterAddressGet(&masterIocAddress); if (rc != CL_OK) goto failure; slotInfoRecv.flag = flag; switch(slotInfoRecv.flag) { case CL_CPM_SLOT_ID: { slotInfoRecv.slotId = slotInfo->slotId; break; } case CL_CPM_IOC_ADDRESS: { slotInfoRecv.nodeIocAddress = slotInfo->nodeIocAddress; break; } #ifdef USE_COR case CL_CPM_NODE_MOID: { slotInfoRecv.nodeMoIdStr.length = 0; slotInfoRecv.nodeMoIdStr.value[0] = 0; rc = clCorMoIdToMoIdNameGet(&slotInfo->nodeMoId, &slotInfoRecv.nodeMoIdStr); CPM_CLIENT_CHECK(CL_LOG_SEV_ERROR,("MoIdToMoIdNameGet Failed, rc=[0x%x]\n", rc), rc); break; } #endif case CL_CPM_NODENAME: { memcpy(&slotInfoRecv.nodeName, &slotInfo->nodeName, sizeof(SaNameT)); break; } default: { rc = CL_CPM_RC(CL_ERR_INVALID_PARAMETER); clLogError(CPM_LOG_AREA_CPM,CL_LOG_CONTEXT_UNSPECIFIED, "Invalid flag passed, rc=[0x%x]\n", rc); goto failure; break; } } rc = clCpmClientRMDSyncNew(masterIocAddress, CPM_SLOT_INFO_GET, (ClUint8T *) &slotInfoRecv, sizeof(ClUint32T), (ClUint8T *) &slotInfoRecv, &bufSize, CL_RMD_CALL_NEED_REPLY, 0, 0, 0, MARSHALL_FN(ClCpmSlotInfoRecvT, 4, 0, 0), UNMARSHALL_FN(ClCpmSlotInfoRecvT, 4, 0, 0)); CPM_CLIENT_CHECK(CL_LOG_SEV_ERROR, ("Unable to find information about given entity, rc=[0x%x]\n", rc), rc); switch(slotInfoRecv.flag) { case CL_CPM_SLOT_ID: { slotInfo->nodeIocAddress = slotInfoRecv.nodeIocAddress; #ifdef USE_COR rc = clCorMoIdNameToMoIdGet(&slotInfoRecv.nodeMoIdStr, &slotInfo->nodeMoId); CPM_CLIENT_CHECK(CL_LOG_SEV_ERROR, ("MoIdNameToMoIdGet Failed, rc=[0x%x]\n", rc), rc); #endif memcpy(&slotInfo->nodeName, &slotInfoRecv.nodeName, sizeof(SaNameT)); break; } case CL_CPM_IOC_ADDRESS: { slotInfo->slotId = slotInfoRecv.slotId; #ifdef USE_COR rc = clCorMoIdNameToMoIdGet(&slotInfoRecv.nodeMoIdStr, &slotInfo->nodeMoId); CPM_CLIENT_CHECK(CL_LOG_SEV_ERROR, ("MoIdNameToMoIdGet Failed, rc=[0x%x]\n", rc), rc); #endif memcpy(&slotInfo->nodeName, &slotInfoRecv.nodeName, sizeof(SaNameT)); break; } case CL_CPM_NODE_MOID: { slotInfo->slotId = slotInfoRecv.slotId; slotInfo->nodeIocAddress = slotInfoRecv.nodeIocAddress; memcpy(&slotInfo->nodeName, &slotInfoRecv.nodeName, sizeof(SaNameT)); break; } case CL_CPM_NODENAME: { slotInfo->slotId = slotInfoRecv.slotId; slotInfo->nodeIocAddress = slotInfoRecv.nodeIocAddress; #ifdef USE_COR rc = clCorMoIdNameToMoIdGet(&slotInfoRecv.nodeMoIdStr, &slotInfo->nodeMoId); CPM_CLIENT_CHECK(CL_LOG_SEV_ERROR, ("MoIdNameToMoIdGet Failed, rc=[0x%x]\n", rc), rc); #endif break; } default: { rc = CL_CPM_RC(CL_ERR_INVALID_PARAMETER); clLogError(CPM_LOG_AREA_CPM,CL_LOG_CONTEXT_UNSPECIFIED, "Invalid flag passed, rc=[0x%x]\n", rc); goto failure; break; } } return rc; failure: return rc; }