OpenClovis Logo

API Usage Examples

Code Examples.

Code Examples.

Reporting fault

Fault Manager provides a mechanism to report faults that occurred in the system through the following two APIs:

Alarm Manager uses clFaultReport() to report non-service impacting alarm to Fault Manager which invokes the action configured by the user corresponding to the alarm category and severity. The following example shows the usage of clFaultReport(). It reports fault for MO \Chassis:0\TestSync2T1:0 belonging to category CL_ALARM_SEVERITY_MINOR.

ClRcT rc;
ClRcT errorCode = CL_OK;
ClNameT compName, moIdName;
ClCorMOIdPtrT hMoId = NULL;
//The value of specificProblem can be anything.
ClAlarmSpecificProblemT specificProblem = 1;
void *pData=NULL;
ClUint32T len=0;
strncpy(compName.value, "cntlrTi1Sys0", sizeof(compName.value));
compName.length = strlen(compName.value);
strncpy(moIdName.value, "\\Chassis:0\\TestSync2T1:0",
sizeof(moIdName.value));
moIdName.length = strlen(moIdName.value);
rc = clCorMoIdNameToMoIdGet(&moIdName, hMoId);
if(CL_OK != rc)
{
//Error occurred. Take appropriate action
clLogError("FLT", "002",
"Error while getting MOId from MOId name, rc=[0x%x]",
rc);
return rc;
}
// Reports a fault on the compName
errorCode =clFaultReport(&compName,
hMoId,
alarmState,
category,
specificProblem,
severity,
cause,
pData,
len);
if(CL_OK != errorCode)
{
//Error occurred. Take appropriate action.
clLogError("FLT", "002",
"Reporting fault failed with error [0x%x]", rc);
return rc;
}
ClAlarmProbableCauseT
This enumeration defines all the probable causes of the alarm based on the categories.
Definition: clAlarmDefinitions.h:189
ClAlarmStateT
The enumeration to depict the state of the alarm that is into.
Definition: clAlarmDefinitions.h:509
ClAlarmSeverityTypeT
Enumeration to depict the severity of the alarm which is specified while modeling and also while publ...
Definition: clAlarmDefinitions.h:142
ClUint32T ClAlarmSpecificProblemT
The type of an identifier to the specific problem of the alarm.
Definition: clAlarmDefinitions.h:126
ClAlarmCategoryTypeT
Enumeration defining the categories of alarms support by alarm server.
Definition: clAlarmDefinitions.h:81
@ CL_ALARM_PROB_CAUSE_VERSION_MISMATCH
There is a mismatch in the version of two communicating entities.
Definition: clAlarmDefinitions.h:310
@ CL_ALARM_STATE_ASSERT
The alarm condition has occured.
Definition: clAlarmDefinitions.h:521
@ CL_ALARM_SEVERITY_MINOR
Alarm with severity level as minor.
Definition: clAlarmDefinitions.h:162
@ CL_ALARM_CATEGORY_PROCESSING_ERROR
Category for alarms that are related to software or processing error.
Definition: clAlarmDefinitions.h:101
ClUint32T ClRcT
Clovis return code type.
Definition: clCommon.h:168
#define CL_OK
Every thing is OK.
Definition: clCommonErrors.h:68
ClRcT clCorMoIdNameToMoIdGet(CL_IN ClNameT *moIdName, CL_OUT ClCorMOIdT *moId)
Retrieves moId in ClCorMOIdT format, when moId is provided in ClNameT format.
ClRcT clFaultReport(CL_IN ClNameT *compName, CL_IN ClCorMOIdPtrT hMoId, CL_IN ClAlarmStateT alarmState, CL_IN ClAlarmCategoryTypeT category, CL_IN ClAlarmSpecificProblemT specificProblem, CL_IN ClAlarmSeverityTypeT severity, CL_IN ClAlarmProbableCauseT cause, CL_IN void *pData, CL_IN ClUint32T len)
Reports a fault to the Fault service.
A name.
Definition: clCommon.h:197
ClUint16T length
Length of the name in bytes excluding '\0'.
Definition: clCommon.h:199
ClCharT value[CL_MAX_NAME_LENGTH]
Actual name represented as a null terminated ASCII string.
Definition: clCommon.h:201
The structure ClCorMOId contains MoId of the object, which is the address of the COR object.
Definition: clCorMetaData.h:918

For service impacting alarms, Alarm Manager(AM) publishes an event which is subscribed by Availability Management Framework(AMF). AMF does service recovery and informs Fault Manager(FM) to take appropriate action. FM invokes the appropriate handler for the alarm. This handler is being defined by the user during modeling of the system. Following example shows the usage of clFaultRepairAction()

ClRcT rc = CL_OK;
ClIocAddressT iocAddress;
// alarmHandle is obtained from the invocation of clAlarmRaise()
ClAlarmHandleT alarmHandle = *(ClAlarmHandleT *)arg;
rc = clFaultRepairAction(iocAddress,
alarmHandle,
CL_AMS_RECOVERY_COMP_RESTART);
if(CL_OK != rc)
{
//Error occurred. Take appropriate action.
clLogError("FLT", "002",
"Fault repair failed with error [0x%x]", rc);
return rc;
}
return CL_OK;
ClUint32T ClAlarmHandleT
The type of the handle for identifying the raised alarm.
Definition: clAlarmDefinitions.h:131
ClRcT clFaultRepairAction(CL_IN ClIocAddressT iocAddress, CL_IN ClAlarmHandleT alarmHandle, CL_IN ClUint32T recoveryActionTaken)
Notifies fault to the "Fault service" for taking repair action.
ClIocNodeAddressT clIocLocalAddressGet(void)
Returns the local IOC node addrress.
ClIocNodeAddressT nodeAddress
The IOC Node address.
Definition: clIocApi.h:388
IOC address.
Definition: clIocApi.h:401
ClIocPhysicalAddressT iocPhyAddress
Physical address.
Definition: clIocApi.h:406

Version Checking

The following API checks for version compatibility of the Application.


Generated on Tue Jan 10 10:29:15 PST 2012 for OpenClovis SDK using Doxygen