Code Examples.
Code Examples.
The PM MSOs can be configured to be autocreated in IDE in which case COR server will create it when the node is coming up. Otherwise it can be created later by the user explicitly using COR Apis. Please refer COR section in this API reference guide for the usage examples.
The below code shows how to register the resources (or MOs) with the PM library so that the PM operation will be performed on those MOs.
ClCharT* resources[] = {
"\\Chassis:0\\CorFunTestL1:0\\corFunMOCommB1L3:0",
"\\Chassis:0\\CorFunTestL1:0\\corFunMOCommB1L3:2",
"\\Chassis:0\\CorFunTestL1:0\\corFunMOCommB1L3:3",
"\\Chassis:0\\CorFunTestL1:0\\corFunMOCommB1L3:4"
};
ClUint32T count = 4;
ClUint32T i = 0;
for (i=0 ; i<count; i++)
{
{
clLogError("APP", "INT", "Failed to get moId from moId name. rc [0x%x]", rc);
return rc;
}
}
pMoIdList->moIdCnt = count;
{
clLogError("APP", "INT", "Failed to start PM operation on the given Moid list. rc [0x%x]", rc);
return rc;
}
ClUint32T ClRcT
Clovis return code type.
Definition: clCommon.h:168
void clNameSet(ClNameT *name, const char *str)
Load the ClNameT structure.
#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 clCorMoIdServiceSet(CL_INOUT ClCorMOIdPtrT pMoId, CL_IN ClCorMOServiceIdT svc)
Sets the service ID.
ClCorMOIdListT * ClCorMOIdListPtrT
Pointer type to ClCorMOIdListT.
Definition: clCorNotifyApi.h:122
void clHeapFree(CL_IN ClPtrT pAddress)
Frees a pre-allocated memory.
ClPtrT clHeapAllocate(CL_IN ClUint32T size)
Allocates memory of the requested size.
ClRcT clPMStart(ClCorMOIdListPtrT pMoIdList)
Starts the PM operation on the list of MO Ids passed.
A name.
Definition: clCommon.h:197
The structure ClCorMOId contains MoId of the object, which is the address of the COR object.
Definition: clCorMetaData.h:918
Type to store the list of MoIds.
Definition: clCorNotifyApi.h:106
The below code shows the Primary OI implementation for PM Read
{
ClUint32T i = 0;
clLogNotice("APP", "READ", "***Invoking read callback function***");
clLogNotice("APP", "READ", "INFO : MoId :");
clLogNotice(
"APP",
"READ",
"Attr Count : [%u]", pObjectData->
attrCount);
{
clLogNotice("APP", "READ", "--------------------");
clLogNotice(
"APP",
"READ",
"Attr Id : [%d]", pObjectData->
pAttrData[i].
attrId);
clLogNotice(
"APP",
"READ",
"Attr Size : [%u]", pObjectData->
pAttrData[i].
size);
clLogNotice(
"APP",
"READ",
"Attr Index : [%d]", pObjectData->
pAttrData[i].
index);
clLogNotice("APP", "READ", "Return value [%d]", i);
clLogNotice("APP", "READ", "--------------------");
}
}
void clCorMoIdShow(CL_IN ClCorMOIdPtrT pMoId)
Displays the ClCorMOId handle.
ClCorTypeT attrDataType
This contains the actual datatype of the attribute.
Definition: clPMApi.h:94
ClCorAttrIdT attrId
Attribute Id of PM or PM reset attribute.
Definition: clPMApi.h:76
ClUint32T size
Size of the attribute.
Definition: clPMApi.h:107
ClCorAttrTypeT attrType
Type of the attribtute.
Definition: clPMApi.h:89
void * pPMData
This contains the PM reset attribute's value if it is reset from north-bound, or the Primary OI shoul...
Definition: clPMApi.h:102
ClInt32T index
Index of the attribute.
Definition: clPMApi.h:113
This is used to pass the PM object's values to the Primary OI.
Definition: clPMApi.h:134
ClPMAttrDataPtrT pAttrData
This either contains the PM attributes' info or PM reset attributes' info and value.
Definition: clPMApi.h:149
ClCorMOIdPtrT pMoId
The PM Object Identifier.
Definition: clPMApi.h:138
ClUint32T attrCount
This contains the no.
Definition: clPMApi.h:143
The below code shows how to access the PM reset value. The user is supposed to reset all the PM attributes depending on the PM reset value.
{
clLogNotice("APP", "RESET", "***Invoking RESET callback function***");
clLogNotice("APP", "RESET", "--------------------");
clLogNotice("APP", "RESET", "INFO : MoId :");
clLogNotice(
"APP",
"RESET",
"Attr Id : [%d]", pObjectData->
pAttrData[0].
attrId);
clLogNotice(
"APP",
"RESET",
"Attr Size : [%u]", pObjectData->
pAttrData[0].
size);
clLogNotice(
"APP",
"RESET",
"Attr Index : [%d]", pObjectData->
pAttrData[0].
index);
clLogNotice(
"APP",
"RESET",
"Reset Value [%d]", *(ClInt8T *) pObjectData->
pAttrData[0].
pPMData);
clLogNotice("APP", "RESET", "--------------------");
}
The below code shows how to stop PM operation on a particular set of MoIds.
pMoIdList->moIdCnt = 2;
{
clLogError("APP", "RESET", "Failed to stop PM operation on the moId list. rc [0x%x]", rc);
return rc;
}
ClRcT clPMStop(ClCorMOIdListPtrT pMoIdList)
Stops the PM operation on the list of MO Ids passed.