Code Examples.
More...
Code Examples.
The provision attributes for a hardware/software resource is specified during the modeling of the system. These resources are mere types and needs to be instantiated before using them. These resources needs to be associated with a component/application which creates the instances on coming up. The following example shows how to create/delete Prov MSO instances.
ClUint32T attrData = 10;
{ NULL,
0x10,
-1,
(ClPtrT)&attrData,
sizeof(ClUint32T) }
}
&attrValue }
#define SM_CFG_TBL_SIM1_TABLE_MO "\\Chassis:0\\smCfgTblSim1Table:0"
strcpy(moIdName.
value, SM_CFG_TBL_SIM1_TABLE_MO);
moIdName.
length = strlen(SM_CFG_TBL_SIM1_TABLE_MO);
return rc;
}
return rc;
}
After the creation of Prov MSO, the Object Implementor (OI) can receive all change notifications like set, delete, create for the resource. Provisioning library on initialization registers its callbacks with Transaction Agent and also registers the OI with Clovis Object Repository(COR) on the creation of Prov objects. Subsequent requests like create, set, delete on this object will invoke the callbacks registered by Prov. Following code segment explains how to handle provisioning attribute change notifications.
{
clLog(CL_LOG_INFO, CL_PROV, CL_PROV_CALL_BACKS,
"Attr ID[0x%x] AttrType[0x%x] AttrDataType [0x%x] Operation[0x%x]",\
{
{
{
{
clLog(CL_LOG_INFO, CL_PROV, CL_PROV_CALL_BACKS,
"Data8[%c]",
break;
}
{
clLog(CL_LOG_INFO, CL_PROV, CL_PROV_CALL_BACKS,
"Data16[%x]",
break;
}
{
clLog(CL_LOG_INFO, CL_PROV, CL_PROV_CALL_BACKS,
"Data32[%x]",
break;
}
{
clLog(CL_LOG_INFO, CL_PROV, CL_PROV_CALL_BACKS,
"Data64[%llx]",
break;
}
}
}
}
ClRcT cl<OIName><MSOName>ProvValidate(CL_OM_PROV_CLASS* pThis,
ClHandleT txnHandle,
{
clLog(CL_LOG_INFO, CL_PROV, CL_PROV_CALL_BACKS,
"Prov Validate");
return rc;
}
ClRcT cl<OIName><MSOName>ProvUpdate(CL_OM_PROV_CLASS* pThis,
ClHandleT txnHandle,
{
{
}
clLog(CL_LOG_INFO, CL_PROV, CL_PROV_CALL_BACKS,
"Prov Update");
clProvTxnInfoPrint(pProvTxnData);
return rc;
}
ClRcT cl<OIName><MSOName>ProvRollback(CL_OM_PROV_CLASS* pThis,
ClHandleT txnHandle,
{
clLog(CL_LOG_INFO, CL_PROV, CL_PROV_CALL_BACKS,
"Prov Rollback");
return rc;
}
Provisioning library registers Read callback with Transaction Agent on initialization. This is being invoked when there is a request to read the attribute value of a resource. This is assuming the fact that the OI has done clCorPrimaryOISet() during its initialization. Following function will be called when get request comes to run-time attribute of given Prov MSO
ClRcT cl<OIName><MSOName>ProvRead(CL_OM_PROV_CLASS* pThis,
ClHandleT txnHandle,
{
ClUint32T tempData = 10;
ClUint32T dataLen = sizeof(tempData);
memcpy((pProvTxnData->
pProvData), &tempData, dataLen);
clLog(CL_LOG_INFO, CL_PROV, CL_PROV_CALL_BACKS,
"Prov Read callback");
}