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;
}