ANSC_STATUS
CosaTSIPInitialize
    (
        ANSC_HANDLE                 hThisObject
    )
{
    ANSC_STATUS                     returnStatus           = ANSC_STATUS_SUCCESS;
    PCOSA_DATAMODEL_TSIP            pMyObject              = (PCOSA_DATAMODEL_TSIP)hThisObject;
    PCOSA_DATAMODEL_FILETRANSFER    pFtObject              = (PCOSA_DATAMODEL_FILETRANSFER)g_pCosaBEManager->hFileTransfer;
    PCOSA_DML_FILETRANSFER_CFG      pCfg                   = (PCOSA_DML_FILETRANSFER_CFG  )&pFtObject->Cfg;
    PANSC_ATOM_TABLE_OBJECT         pAtomNamespace         = NULL;
    PPOAM_IREP_FOLDER_OBJECT        pPoamIrepFoCOSA        = (PPOAM_IREP_FOLDER_OBJECT)NULL;
    PPOAM_IREP_FOLDER_OBJECT        hIrepFolderTSIPSubnet  = (PPOAM_IREP_FOLDER_OBJECT)NULL;
    PPOAM_IREP_FOLDER_OBJECT        hIrepFolderTSIPRule    = (PPOAM_IREP_FOLDER_OBJECT)NULL;
    PSLAP_VARIABLE                  pSlapVariable          = (PSLAP_VARIABLE          )NULL;
    PCOSA_CONTEXT_LINK_OBJECT       pCosaContext           = (PCOSA_CONTEXT_LINK_OBJECT)NULL;
    PCOSA_DML_TSIP_SUBNET_ENTRY     pEntry                 = (PCOSA_DML_TSIP_SUBNET_ENTRY)NULL;
    PCOSA_DML_TSIP_RULE_ENTRY       pEntry2                = (PCOSA_DML_TSIP_RULE_ENTRY)NULL;
    ULONG                           ulEntryCount           = 0;
    ULONG                           ulIndex                = 0;
    ULONG                           ulNextInsNum           = 0;

    /* Initiation all functions */

    CosaDmlTSIPInit(NULL, NULL);

    pMyObject->hFtCfg = (ANSC_HANDLE)pCfg;
    pMyObject->ulSubnetNextInsNum = 1;

    pMyObject->hIrepFolderCOSA = g_GetRegistryRootFolder(g_pDslhDmlAgent);

    /* Load Mapping file */
    pAtomNamespace =
        AnscCreateAtomTable
            (
                (ANSC_HANDLE)NULL,
                (ANSC_HANDLE)NULL,
                NULL
            );

    if ( pAtomNamespace != NULL )
    {
        pMyObject->hAtomNamespace = pAtomNamespace;
    }

    CosaDmlTSIPLoadMappingFile((ANSC_HANDLE)pMyObject);

    /* Initialize Device.X_CISCO_COM_TrueStaticIP. */
    CosaDmlTSIPGetCfg(NULL, &pMyObject->TSIPCfg);

    /* Initiation Device.X_CISCO_COM_TrueStaticIP.Subnet.{i} */
    AnscSListInitializeHeader(&pMyObject->SubnetList);
    CosaDmlAdditionalSubnetLoadPsm((ANSC_HANDLE)pMyObject);


    pPoamIrepFoCOSA = (PPOAM_IREP_FOLDER_OBJECT)pMyObject->hIrepFolderCOSA;
    if ( !pPoamIrepFoCOSA )
    {
        return ANSC_STATUS_FAILURE;
    }
#if 0
    hIrepFolderTSIPSubnet =
        (PPOAM_IREP_FOLDER_OBJECT)pPoamIrepFoCOSA->GetFolder
            (
                (ANSC_HANDLE)pPoamIrepFoCOSA,
                COSA_IREP_FOLDER_NAME_TSIP_SUBNET
            );

    if ( !hIrepFolderTSIPSubnet )
    {
        hIrepFolderTSIPSubnet =
            pPoamIrepFoCOSA->AddFolder
                (
                    (ANSC_HANDLE)pPoamIrepFoCOSA,
                    COSA_IREP_FOLDER_NAME_TSIP_SUBNET,
                    0
                );
    }

    if ( !hIrepFolderTSIPSubnet )
    {
        return ANSC_STATUS_FAILURE;
    }
    else
    {
        pMyObject->hIrepFolderTSIPSubnet = (ANSC_HANDLE)hIrepFolderTSIPSubnet;
    }

    /* Retrieve Next Instance Number */
    
    if ( TRUE )
    {
        pSlapVariable =
            (PSLAP_VARIABLE)hIrepFolderTSIPSubnet->GetRecord
                (
                    (ANSC_HANDLE)hIrepFolderTSIPSubnet,
                    COSA_DML_RR_NAME_TSIP_SUBNETNextInsNunmber,
                    NULL
                );

        if ( pSlapVariable )
        {
            pMyObject->ulSubnetNextInsNum = pSlapVariable->Variant.varUint32;

            SlapFreeVariable(pSlapVariable);
        }
    }
#endif
    /* Initiation Device.X_CISCO_COM_TrueStaticIP.PortManagement.Rule.{i}. */

    AnscSListInitializeHeader(&pMyObject->RuleList);

    pMyObject->ulRuleNextInsNum = 1;

    pPoamIrepFoCOSA = (PPOAM_IREP_FOLDER_OBJECT)pMyObject->hIrepFolderCOSA;
    if ( !pPoamIrepFoCOSA )
    {
        return ANSC_STATUS_FAILURE;
    }

    hIrepFolderTSIPRule =
        (PPOAM_IREP_FOLDER_OBJECT)pPoamIrepFoCOSA->GetFolder
            (
                (ANSC_HANDLE)pPoamIrepFoCOSA,
                COSA_IREP_FOLDER_NAME_TSIP_RULE
            );

    if ( !hIrepFolderTSIPRule )
    {
        hIrepFolderTSIPRule =
            pPoamIrepFoCOSA->AddFolder
                (
                    (ANSC_HANDLE)pPoamIrepFoCOSA,
                    COSA_IREP_FOLDER_NAME_TSIP_RULE,
                    0
                );
    }

    if ( !hIrepFolderTSIPRule )
    {
        return ANSC_STATUS_FAILURE;
    }
    else
    {
        pMyObject->hIrepFolderTSIPRule = (ANSC_HANDLE)hIrepFolderTSIPRule;
    }

    /* Retrieve Next Instance Number */
    
    if ( TRUE )
    {
        pSlapVariable =
            (PSLAP_VARIABLE)hIrepFolderTSIPRule->GetRecord
                (
                    (ANSC_HANDLE)hIrepFolderTSIPRule,
                    COSA_DML_RR_NAME_TSIP_RULENextInsNunmber,
                    NULL
                );

        if ( pSlapVariable )
        {
            pMyObject->ulRuleNextInsNum = pSlapVariable->Variant.varUint32;

            SlapFreeVariable(pSlapVariable);
        }
    }

    /* Initialize middle layer */

    /* CosaDmlTSIPGetCfg(NULL, &pMyObject->TSIPCfg); */

    CosaDmlTSIPPortManagementGetCfg(NULL, &pMyObject->PortManagementCfg);

#if 0
    ulEntryCount = CosaDmlTSIPSubnetGetNumberOfEntries(NULL);

    for ( ulIndex = 0; ulIndex < ulEntryCount; ulIndex++ )
    {
        pEntry = (PCOSA_DML_TSIP_SUBNET_ENTRY)AnscAllocateMemory(sizeof(COSA_DML_TSIP_SUBNET_ENTRY));

        if ( !pEntry )
        {
            return ANSC_STATUS_RESOURCES;
        }
        
        CosaDmlTSIPSubnetGetEntry(NULL, ulIndex, pEntry);

        if ( TRUE )
        {
            pCosaContext = (PCOSA_CONTEXT_LINK_OBJECT)AnscAllocateMemory(sizeof(COSA_CONTEXT_LINK_OBJECT));

            if ( !pCosaContext )
            {
                AnscFreeMemory(pEntry);
                
                return ANSC_STATUS_RESOURCES;
            }

            if ( pEntry->InstanceNumber != 0 )
            {
                pCosaContext->InstanceNumber = pEntry->InstanceNumber;

                if ( pMyObject->ulSubnetNextInsNum <= pEntry->InstanceNumber )
                {
                    pMyObject->ulSubnetNextInsNum = pEntry->InstanceNumber + 1;

                    if ( pMyObject->ulSubnetNextInsNum == 0 )
                    {
                        pMyObject->ulSubnetNextInsNum = 1;
                    }
                }
            }
            else
            {
                pEntry->InstanceNumber = pCosaContext->InstanceNumber = pMyObject->ulSubnetNextInsNum;

                pMyObject->ulSubnetNextInsNum++;

                if ( pMyObject->ulSubnetNextInsNum == 0 )
                {
                    pMyObject->ulSubnetNextInsNum = 1;
                }

                /* Generate Alias */
                _ansc_sprintf(pEntry->Alias, "Subnet%d", pCosaContext->InstanceNumber);

                CosaDmlTSIPSubnetSetValues
                (
                    NULL,
                    ulIndex,
                    pCosaContext->InstanceNumber,
                    pEntry->Alias
                );
            }

            pCosaContext->hContext      = (ANSC_HANDLE)pEntry;
            pCosaContext->hParentTable  = NULL;
            pCosaContext->bNew          = FALSE;
            pCosaContext->hPoamIrepUpperFo = NULL;
            pCosaContext->hPoamIrepFo      = NULL;

            CosaSListPushEntryByInsNum(&pMyObject->SubnetList, pCosaContext);
        }
    }
#endif
    ulEntryCount = CosaDmlTSIPRuleGetNumberOfEntries(NULL);

    for ( ulIndex = 0; ulIndex < ulEntryCount; ulIndex++ )
    {
        pEntry2 = (PCOSA_DML_TSIP_RULE_ENTRY)AnscAllocateMemory(sizeof(COSA_DML_TSIP_RULE_ENTRY));

        if ( !pEntry2 )
        {
            return ANSC_STATUS_RESOURCES;
        }
        
        CosaDmlTSIPRuleGetEntry(NULL, ulIndex, pEntry2);

        if ( TRUE )
        {
            pCosaContext = (PCOSA_CONTEXT_LINK_OBJECT)AnscAllocateMemory(sizeof(COSA_CONTEXT_LINK_OBJECT));

            if ( !pCosaContext )
            {
                AnscFreeMemory(pEntry2);
                
                return ANSC_STATUS_RESOURCES;
            }

            if ( pEntry2->InstanceNumber != 0 )
            {
                pCosaContext->InstanceNumber = pEntry2->InstanceNumber;

                if ( pMyObject->ulRuleNextInsNum <= pEntry2->InstanceNumber )
                {
                    pMyObject->ulRuleNextInsNum = pEntry2->InstanceNumber + 1;

                    if ( pMyObject->ulRuleNextInsNum == 0 )
                    {
                        pMyObject->ulRuleNextInsNum = 1;
                    }
                }
            }
            else
            {
                pEntry2->InstanceNumber = pCosaContext->InstanceNumber = pMyObject->ulRuleNextInsNum;

                pMyObject->ulRuleNextInsNum++;

                if ( pMyObject->ulRuleNextInsNum == 0 )
                {
                    pMyObject->ulRuleNextInsNum = 1;
                }

                /* Generate Alias */
                _ansc_sprintf(pEntry2->Alias, "Rule%d", pCosaContext->InstanceNumber);

                CosaDmlTSIPRuleSetValues
                (
                    NULL,
                    ulIndex,
                    pCosaContext->InstanceNumber,
                    pEntry2->Alias
                );
            }

            pCosaContext->hContext      = (ANSC_HANDLE)pEntry2;
            pCosaContext->hParentTable  = NULL;
            pCosaContext->bNew          = FALSE;
            pCosaContext->hPoamIrepUpperFo = NULL;
            pCosaContext->hPoamIrepFo      = NULL;

            CosaSListPushEntryByInsNum(&pMyObject->RuleList, pCosaContext);
        }
    }

    /* Load the newly added but not yet commited entries, if exist */
#if 0
    CosaTSIPSubnetRegGetInfo((ANSC_HANDLE)pMyObject);
#endif
    CosaTSIPRuleRegGetInfo((ANSC_HANDLE)pMyObject);


    return returnStatus;
}
ANSC_STATUS
CosaTSIPRuleRegAddInfo
    (
        ANSC_HANDLE                 hThisObject,
        ANSC_HANDLE                 hCosaContext
    )
{
    ANSC_STATUS                     returnStatus            = ANSC_STATUS_SUCCESS;
    PCOSA_DATAMODEL_TSIP            pMyObject               = (PCOSA_DATAMODEL_TSIP     )hThisObject;
    PPOAM_IREP_FOLDER_OBJECT        pPoamIrepFoTSIPRule     = (PPOAM_IREP_FOLDER_OBJECT )pMyObject->hIrepFolderTSIPRule;
    PPOAM_IREP_FOLDER_OBJECT        pPoamIrepFoTSIPRuleSp   = (PPOAM_IREP_FOLDER_OBJECT )NULL;
    PCOSA_CONTEXT_LINK_OBJECT       pCosaContext            = (PCOSA_CONTEXT_LINK_OBJECT)hCosaContext;
    PCOSA_DML_TSIP_RULE_ENTRY       pEntry                  = (PCOSA_DML_TSIP_RULE_ENTRY)pCosaContext->hContext;
    PSLAP_VARIABLE                  pSlapVariable           = (PSLAP_VARIABLE           )NULL;

    if ( !pPoamIrepFoTSIPRule )
    {
        return ANSC_STATUS_FAILURE;
    }
    else
    {
        pPoamIrepFoTSIPRule->EnableFileSync((ANSC_HANDLE)pPoamIrepFoTSIPRule, FALSE);
    }

    if ( TRUE )
    {
        SlapAllocVariable(pSlapVariable);

        if ( !pSlapVariable )
        {
            returnStatus = ANSC_STATUS_RESOURCES;

            goto  EXIT1;
        }
    }

    if ( TRUE )
    {
        returnStatus = 
            pPoamIrepFoTSIPRule->DelRecord
                (
                    (ANSC_HANDLE)pPoamIrepFoTSIPRule,
                    COSA_DML_RR_NAME_TSIP_RULENextInsNunmber
                );

        pSlapVariable->Syntax            = SLAP_VAR_SYNTAX_uint32;
        pSlapVariable->Variant.varUint32 = pMyObject->ulRuleNextInsNum;

        returnStatus =
            pPoamIrepFoTSIPRule->AddRecord
                (
                    (ANSC_HANDLE)pPoamIrepFoTSIPRule,
                    COSA_DML_RR_NAME_TSIP_RULENextInsNunmber,
                    SYS_REP_RECORD_TYPE_UINT,
                    SYS_RECORD_CONTENT_DEFAULT,
                    pSlapVariable,
                    0
                );

        SlapCleanVariable(pSlapVariable);
        SlapInitVariable (pSlapVariable);
    }

    if ( TRUE )
    {
        pPoamIrepFoTSIPRuleSp =
            pPoamIrepFoTSIPRule->AddFolder
                (
                    (ANSC_HANDLE)pPoamIrepFoTSIPRule,
                    pEntry->Alias,
                    0
                );

        if ( !pPoamIrepFoTSIPRuleSp )
        {
            returnStatus = ANSC_STATUS_FAILURE;

            goto  EXIT1;
        }

        if ( TRUE )
        {
            pSlapVariable->Syntax            = SLAP_VAR_SYNTAX_uint32;
            pSlapVariable->Variant.varUint32 = pEntry->InstanceNumber;

            returnStatus =
                pPoamIrepFoTSIPRuleSp->AddRecord
                    (
                        (ANSC_HANDLE)pPoamIrepFoTSIPRuleSp,
                        COSA_DML_RR_NAME_TSIP_RULEInsNum,
                        SYS_REP_RECORD_TYPE_UINT,
                        SYS_RECORD_CONTENT_DEFAULT,
                        pSlapVariable,
                        0
                    );

            SlapCleanVariable(pSlapVariable);
            SlapInitVariable (pSlapVariable);
        }

        if ( TRUE )
        {
            pSlapVariable->Syntax            = SLAP_VAR_SYNTAX_string;
            pSlapVariable->Variant.varString = AnscCloneString(pEntry->Alias);

            returnStatus =
                pPoamIrepFoTSIPRuleSp->AddRecord
                    (
                        (ANSC_HANDLE)pPoamIrepFoTSIPRuleSp,
                        COSA_DML_RR_NAME_TSIP_RULEAlias,
                        SYS_REP_RECORD_TYPE_ASTR,
                        SYS_RECORD_CONTENT_DEFAULT,
                        pSlapVariable,
                        0
                    );

            SlapCleanVariable(pSlapVariable);
            SlapInitVariable (pSlapVariable);
        }

        pCosaContext->hPoamIrepUpperFo = (ANSC_HANDLE)pPoamIrepFoTSIPRule;
        pCosaContext->hPoamIrepFo      = (ANSC_HANDLE)pPoamIrepFoTSIPRuleSp;
    }

EXIT1:
    
    if ( pSlapVariable )
    {
        SlapFreeVariable(pSlapVariable);
    }

    pPoamIrepFoTSIPRule->EnableFileSync((ANSC_HANDLE)pPoamIrepFoTSIPRule, TRUE);

    return returnStatus;
}
ANSC_STATUS
DslhDmagntEngage
    (
        ANSC_HANDLE                 hThisObject
    )
{
    ANSC_STATUS                     returnStatus           = ANSC_STATUS_SUCCESS;
    PDSLH_DATAMODEL_AGENT_OBJECT    pMyObject              = (PDSLH_DATAMODEL_AGENT_OBJECT)hThisObject;
    PANSC_ATOM_TABLE_OBJECT         pAtomFunctions         = (PANSC_ATOM_TABLE_OBJECT)pMyObject->hAtomFunctions;
    PDSLH_CPE_CONTROLLER_OBJECT     pDslhCpeController     = (PDSLH_CPE_CONTROLLER_OBJECT)pMyObject->hDslhCpeController;
    PSLAP_OBJECT_DESCRIPTOR         pObjDescriptor         = (PSLAP_OBJECT_DESCRIPTOR    )NULL;
    PPOAM_IREP_FOLDER_OBJECT        pPoamIrepFoRoot        = (PPOAM_IREP_FOLDER_OBJECT   )NULL;
    PPOAM_IREP_FOLDER_OBJECT        pPoamIrepFoProvision   = (PPOAM_IREP_FOLDER_OBJECT   )NULL;
    PPOAM_IREP_FOLDER_OBJECT        pPoamIrepFoCOSA        = (PPOAM_IREP_FOLDER_OBJECT   )pMyObject->hIrepFolderCOSA;

    PDSLH_MWS_INTERFACE             pDslhMwsIf             = (PDSLH_MWS_INTERFACE        )pMyObject->hDslhMwsIf;

    if ( pMyObject->bActive )
    {
        return  ANSC_STATUS_SUCCESS;
    }

    if( pDslhMwsIf != NULL)
    {
        pDslhCpeController->AddInterface(pDslhCpeController, pMyObject->hDslhMwsIf);
    }

    pMyObject->hDslhCcdIf = pDslhCpeController->GetInterfaceByName(pDslhCpeController, CCSP_CCD_INTERFACE_NAME);
    pMyObject->hDslhLcbIf = pDslhCpeController->GetInterfaceByName(pDslhCpeController, CCSP_LIBCBK_INTERFACE_NAME);

    /* register internal apis */
    if( pAtomFunctions == NULL)
    {
        pMyObject->hAtomFunctions =
            AnscCreateAtomTable
                (
                    pMyObject->hContainerContext,
                    (ANSC_HANDLE)pMyObject,
                    NULL
                );

        pAtomFunctions    = (PANSC_ATOM_TABLE_OBJECT)pMyObject->hAtomFunctions;
    }

    if( pAtomFunctions != NULL)
    {                                                                                         
        /* Register the API exported by framework */
        pMyObject->RegisterInternalApi(pMyObject, "COSANotifyValueChange",            COSANotifyValueChange);
        pMyObject->RegisterInternalApi(pMyObject, "COSANotifyDiagComplete",           COSANotifyDiagComplete);
        pMyObject->RegisterInternalApi(pMyObject, "COSAValidateHierarchyInterface",   COSAValidateHierarchyInterface);
        pMyObject->RegisterInternalApi(pMyObject, "COSAGetParamValueBool",            COSAGetParamValueBool);
        pMyObject->RegisterInternalApi(pMyObject, "COSAGetParamValueInt",             COSAGetParamValueInt);
        pMyObject->RegisterInternalApi(pMyObject, "COSAGetParamValueUlong",           COSAGetParamValueUlong);
        pMyObject->RegisterInternalApi(pMyObject, "COSAGetParamValueString",          COSAGetParamValueString);
        pMyObject->RegisterInternalApi(pMyObject, "COSAGetParamValue",                COSAGetParamValue);
        pMyObject->RegisterInternalApi(pMyObject, "COSASetParamValueBool",            COSASetParamValueBool);
        pMyObject->RegisterInternalApi(pMyObject, "COSASetParamValueInt",             COSASetParamValueInt);
        pMyObject->RegisterInternalApi(pMyObject, "COSASetParamValueUlong",           COSASetParamValueUlong);
        pMyObject->RegisterInternalApi(pMyObject, "COSASetParamValueString",          COSASetParamValueString);

        pMyObject->RegisterInternalApi(pMyObject, "COSAGetRegistryRootFolder",        COSAGetRegistryRootFolder);
        pMyObject->RegisterInternalApi(pMyObject, "COSAGetInstanceNumberByIndex",     COSAGetInstanceNumberByIndex);
        pMyObject->RegisterInternalApi(pMyObject, "COSAGetInterfaceByName",           COSAGetInterfaceByName);
        pMyObject->RegisterInternalApi(pMyObject, "COSAGetMessageBusHandle",          COSAGetMessageBusHandle);
        pMyObject->RegisterInternalApi(pMyObject, "COSARegisterCallBackAfterInitDml", COSARegisterCallBackAfterInitDml);
        pMyObject->RegisterInternalApi(pMyObject, "COSAGetSubsystemPrefix",           COSAGetSubsystemPrefix);
        pMyObject->RegisterInternalApi(pMyObject, "COSARepopulateTable",              COSARepopulateTable);
        pMyObject->RegisterInternalApi(pMyObject, "COSAGetParamValueByPathName",      COSAGetParamValueByPathName);
        pMyObject->RegisterInternalApi(pMyObject, "COSASetParamValueByPathName",      COSASetParamValueByPathName);
        pMyObject->RegisterInternalApi(pMyObject, "COSAGetInstanceNumbers",           COSAGetInstanceNumbers);

        /* Register the API  for CCSP Common Components*/
#if 0
        pMyObject->RegisterInternalApi(pMyObject, "CcspComp_GetParamUlongValue",      CcspComp_GetParamUlongValue);
        pMyObject->RegisterInternalApi(pMyObject, "CcspComp_GetParamStringValue",     CcspComp_GetParamStringValue);
#endif
        pMyObject->RegisterInternalApi(pMyObject, "CcspComp_GetBulkParamValues",      CcspComp_GetBulkParamValues);
        pMyObject->RegisterInternalApi(pMyObject, "CcspComp_SetParamBoolValue",       CcspComp_SetParamBoolValue);

        pMyObject->RegisterInternalApi(pMyObject, "CcspLog_GetParamBoolValue",        CcspLog_GetParamBoolValue);
        pMyObject->RegisterInternalApi(pMyObject, "CcspLog_GetParamUlongValue",       CcspLog_GetParamUlongValue);
        pMyObject->RegisterInternalApi(pMyObject, "CcspLog_SetParamBoolValue",        CcspLog_SetParamBoolValue);
        pMyObject->RegisterInternalApi(pMyObject, "CcspLog_SetParamUlongValue",       CcspLog_SetParamUlongValue);
        pMyObject->RegisterInternalApi(pMyObject, "CcspLog_Validate",                 CcspLog_Validate );
        pMyObject->RegisterInternalApi(pMyObject, "CcspLog_Commit",                   CcspLog_Commit );
        pMyObject->RegisterInternalApi(pMyObject, "CcspLog_Rollback",                 CcspLog_Rollback );
        pMyObject->RegisterInternalApi(pMyObject, "CcspMem_GetParamUlongValue",       CcspMem_GetParamUlongValue);
        pMyObject->RegisterInternalApi(pMyObject, "CcspLog_GetBulkParamValues",       CcspLog_GetBulkParamValues);
        pMyObject->RegisterInternalApi(pMyObject, "CcspLog_SetBulkParamValues",       CcspLog_SetBulkParamValues);

    }

    /*
     * Enroll and create PoamIrepFolder object.
     */
    if ( TRUE )
    {

        pPoamIrepFoRoot =
            (PPOAM_IREP_FOLDER_OBJECT)PoamIrepFoCreate(NULL, NULL, ""); 

        if ( !pPoamIrepFoRoot )
        {
            AnscTrace("DslhDataModelAgent: Cannot access Root Folder!!\n");

            returnStatus = ANSC_STATUS_FAILURE;

            goto  EXIT2;
        }

        pPoamIrepFoProvision =
            (PPOAM_IREP_FOLDER_OBJECT)pPoamIrepFoRoot->GetFolder
                (
                    (ANSC_HANDLE)pPoamIrepFoRoot,
                    "Provision"
                );

        if ( !pPoamIrepFoProvision )
        {
            AnscTrace("DslhDataModelAgent: Cannot access /Configuration/Provision folder!!\n");

            returnStatus = ANSC_STATUS_FAILURE;

            goto  EXIT3;
        }

        pPoamIrepFoCOSA =
            (PPOAM_IREP_FOLDER_OBJECT)pPoamIrepFoProvision->GetFolder
                (
                    (ANSC_HANDLE)pPoamIrepFoProvision,
                    COSA_IREP_FOLDER_NAME
                );

        if ( !pPoamIrepFoCOSA )
        {
            pPoamIrepFoCOSA =
                pPoamIrepFoProvision->AddFolder
                    (
                        (ANSC_HANDLE)pPoamIrepFoProvision,
                        COSA_IREP_FOLDER_NAME,
                        0
                    );
        }

        if ( !pPoamIrepFoCOSA )
        {
            AnscTrace("DslhDataModelAgent: Cannot access /Configuration/Provision/%s folder!!\n", COSA_IREP_FOLDER_NAME);

            returnStatus = ANSC_STATUS_FAILURE;

            goto  EXIT4;
        }
        else
        {
            pMyObject->hIrepFolderCOSA = (ANSC_HANDLE)pPoamIrepFoCOSA;
        }
    }

    pMyObject->bActive = TRUE;

    returnStatus = ANSC_STATUS_SUCCESS;


    /******************************************************************
                GRACEFUL ROLLBACK PROCEDURES AND EXIT DOORS
    ******************************************************************/

EXIT4:

    if ( pPoamIrepFoProvision )
    {
        pPoamIrepFoProvision->Remove((ANSC_HANDLE)pPoamIrepFoProvision);
    }

EXIT3:

    if ( pPoamIrepFoRoot )
    {
        pPoamIrepFoRoot->Remove((ANSC_HANDLE)pPoamIrepFoRoot);
    }

EXIT2:

    return  returnStatus;
}