diff --git a/OneM2M_Testcases_CSE_Release_4.ttcn b/OneM2M_Testcases_CSE_Release_4.ttcn index 0928c70928fc6fd19bfbf95af3a3945c7c321382..674cc6ee88183d5f4bd4f55cd85d48216dc9351a 100644 --- a/OneM2M_Testcases_CSE_Release_4.ttcn +++ b/OneM2M_Testcases_CSE_Release_4.ttcn @@ -7695,6 +7695,4147 @@ module OneM2M_Testcases_CSE_Release_4 { } // Basic_Operation } // Service_Subscription_User_Profile + group Service_Subscription_Profile { + group Basic_Operation { + + /** + * @desc Check that the IUT successfully performs operations on resource m2mServiceSubscriptionProfile for authorized AE + * + */ + testcase TC_CSE_SSM_SSP_001_CRE() runs on Tester system CseSystem { + var AeSimu v_ae1 := AeSimu.create("AE1") alive; + + v_ae1.start(f_CSE_SSM_SSP_001_CRE()); + v_ae1.done; + } + + function f_CSE_SSM_SSP_001_CRE() runs on AeSimu system CseSystem { + + var template RequestPrimitive v_createServiceSubscriptionProfile := m_createM2mServiceSubscriptionProfileMaxValue1; + var RequestPrimitive v_request; + + var integer v_resourceIndex := -1; + + // create ServiceSubscriptionProfile directly on CSEBase from superAE + v_request := f_getCreateRequestPrimitive(int11, v_createServiceSubscriptionProfile, -1); + f_send(e_mcaPort, m_request(v_request)); + + tc_ac.start; + alt { + [] mcaPort.receive(mw_response(mw_responsePrimitive(int2001))) -> value vc_response { + tc_ac.stop; + setverdict(pass, __SCOPE__ & ": Resource type ServiceSubscriptionProfile created successfully"); + f_checkAttributesToBeSaved(int11, v_request, vc_response.primitive.responsePrimitive); + v_resourceIndex := f_setResource(vc_response.primitive.responsePrimitive.primitiveContent, int11, -1); + } + [] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value vc_response { + tc_ac.stop; + setverdict(fail, __SCOPE__ & ": Wrong response status code"); + } + [] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value vc_response { + tc_ac.stop; + setverdict(fail, __SCOPE__ & ": Error while creating resource type ServiceSubscriptionProfile"); + } + [] tc_ac.timeout { + setverdict(fail, __SCOPE__ & ": No answer while creating resource type ServiceSubscriptionProfile"); + } + } + + //Check to see if the resource is present or not + if (f_cse_isResourcePresent(v_resourceIndex)){ + setverdict(pass, __SCOPE__ & ":INFO: Resource created"); + } else { + setverdict(fail, __SCOPE__ & ":ERROR: Resource not created"); + } + + + + + + f_checkAeSimuStatus(); + + // Postamble + f_cse_postamble_deleteResources(); + + // Tear down + f_cf01Down(); + }//f_CSE_SSM_SSP_001_CRE + + + /** + * @desc Check that the IUT successfully performs operations on resource m2mServiceSubscriptionProfile for authorized AE + * + */ + testcase TC_CSE_SSM_SSP_001_RET() runs on Tester system CseSystem { + var AeSimu v_ae1 := AeSimu.create("AE1") alive; + + v_ae1.start(f_CSE_SSM_SSP_001_RET()); + v_ae1.done; + } + + function f_CSE_SSM_SSP_001_RET() runs on AeSimu system CseSystem { + + var integer v_subscriptionProfileIndex := -1; + var template RequestPrimitive v_createServiceSubscriptionProfile := m_createM2mServiceSubscriptionProfileMaxValue2; + var template PrimitiveContent v_contentResponse; + var MsgIn v_response; + + var RequestPrimitive v_request; + + // create ServiceSubscriptionProfile directly on CSEBase from superAE + v_subscriptionProfileIndex := f_cse_createResource(int11, v_createServiceSubscriptionProfile, -1); + + v_contentResponse.m2mServiceSubscriptionProfile := mw_contentServiceSubscriptionProfileBase; + + + // Retrieve ServiceSubscriptionProfile from super AE + f_send(e_mcaPort, m_request(m_retrieve(f_getResourceAddress(v_subscriptionProfileIndex), f_getOriginator(-1)))); + + tc_ac.start; + alt { + [] mcaPort.receive(mw_response(mw_responsePrimitive(int2000, v_contentResponse))) -> value v_response { + tc_ac.stop; + setverdict(pass, __SCOPE__ & ": serviceSubscribedAppRule successfully retrived."); + + } + [] mcaPort.receive(mw_response(mw_responsePrimitiveInverse(int2000))) -> value vc_response{ + tc_ac.stop; + setverdict(fail, __SCOPE__ & ": Error while retrieving serviceSubscribedAppRule with status code " & int2str(enum2int(vc_response.primitive.responsePrimitive.responseStatusCode))); + } + [] tc_ac.timeout { + setverdict(fail, __SCOPE__ & ": No answer from IUT for the last Request!"); + } + } + + f_checkAeSimuStatus(); + + // Postamble + f_cse_postamble_deleteResources(); + + // Tear down + f_cf01Down(); + } + + /** + * @desc Check that the IUT successfully performs operations on resource m2mServiceSubscriptionProfile for authorized AE + * + */ + testcase TC_CSE_SSM_SSP_001_UPD() runs on Tester system CseSystem { + var AeSimu v_ae1 := AeSimu.create("AE1") alive; + + v_ae1.start(f_CSE_SSM_SSP_001_UPD()); + v_ae1.done; + } + + function f_CSE_SSM_SSP_001_UPD() runs on AeSimu system CseSystem { + + var integer v_subscriptionProfileIndex := -1; + var template RequestPrimitive v_createServiceSubscriptionProfile := m_createM2mServiceSubscriptionProfileMaxValue1; + var RequestPrimitive v_updateRequest; + var template RequestPrimitive v_updateRequestPrimitive := m_updateServiceSubscriptionProfileMaxValue2; + + // directly on CSEBase from superAE + v_subscriptionProfileIndex := f_cse_createResource(int11, v_createServiceSubscriptionProfile, -1); + + // Update ServiceSubscriptionProfile + v_updateRequest := f_getUpdateRequestPrimitive(int11, v_subscriptionProfileIndex, v_updateRequestPrimitive); + f_send(e_mcaPort, m_request(v_updateRequest)); + + tc_ac.start; + alt { + [] mcaPort.receive(mw_response(mw_responsePrimitive(int2004))) { + tc_ac.stop; + setverdict(pass, __SCOPE__ & ": m2mServiceSubscriptionProfile successfully retrived."); + } + [] mcaPort.receive(mw_response(mw_responsePrimitiveInverse(int2004))) -> value vc_response{ + tc_ac.stop; + setverdict(fail, __SCOPE__ & ": Error while retrieving m2mServiceSubscriptionProfile with status code " & int2str(enum2int(vc_response.primitive.responsePrimitive.responseStatusCode))); + } + [] tc_ac.timeout { + setverdict(fail, __SCOPE__ & ": No answer while retrieving resource"); + } + } + + f_checkAeSimuStatus(); + + // Verifiy that the ServiceSubscriptionProfile resource has been updated + vc_primitiveContentRetrievedResource := f_cse_retrieveResource(v_subscriptionProfileIndex); + + if(not(match(v_updateRequestPrimitive.primitiveContent.m2mServiceSubscriptionProfile.maxNumAEs, vc_primitiveContentRetrievedResource.m2mServiceSubscriptionProfile.maxNumAEs))) { + setverdict(fail, __SCOPE__&":INFO: Retrived ServiceSubscriptionProfile does not match with updated content."); + } else { + setverdict(pass, __SCOPE__ & ": Retrived ServiceSubscriptionProfile matched with updated content."); + } + + // Postamble + f_cse_postamble_deleteResources(); + + // Tear down + f_cf01Down(); + } + + /** + * @desc Check that the IUT successfully performs operations on resource m2mServiceSubscriptionProfile for authorized AE + * + */ + testcase TC_CSE_SSM_SSP_001_DEL() runs on Tester system CseSystem { + var AeSimu v_ae1 := AeSimu.create("AE1") alive; + + v_ae1.start(f_CSE_SSM_SSP_001_DEL()); + v_ae1.done; + } + + function f_CSE_SSM_SSP_001_DEL() runs on AeSimu system CseSystem { + + var integer v_subscriptionProfileIndex := -1; + var template RequestPrimitive v_createServiceSubscriptionProfile := m_createM2mServiceSubscriptionProfileMaxValue1; + + // directly on CSEBase from superAE + v_subscriptionProfileIndex := f_cse_createResource(int11, v_createServiceSubscriptionProfile, -1); + + // Delete ServiceSubscribedUserProfile + f_send(e_mcaPort, m_request(m_delete(f_getResourceAddress(v_subscriptionProfileIndex), f_getOriginator(v_subscriptionProfileIndex)))); + + tc_ac.start; + alt { + [] mcaPort.receive(mw_response(mw_responsePrimitive(int2002))) { + tc_ac.stop; + setverdict(pass, __SCOPE__ & ": m2mServiceSubscriptionProfile successfully deleted."); + } + [] mcaPort.receive(mw_response(mw_responsePrimitiveInverse(int2002))) -> value vc_response{ + tc_ac.stop; + setverdict(fail, __SCOPE__ & ": Error while deleting m2mServiceSubscriptionProfile with status code " & int2str(enum2int(vc_response.primitive.responsePrimitive.responseStatusCode))); + } + [] tc_ac.timeout { + setverdict(fail, __SCOPE__ & ": No answer while deleting resource"); + } + } + + f_checkAeSimuStatus(); + + // Verify that m2mServiceSubscriptionProfile is not present + if (f_cse_isResourceNotPresent(-1, f_getResourceName(vc_resourcesList[v_subscriptionProfileIndex].resource))){ + setverdict(pass, __SCOPE__ & ":INFO: Resource deleted"); + } else { + setverdict(fail, __SCOPE__ & ":ERROR: Resource not deleted"); + } + + // Postamble + f_cse_postamble_deleteResources(); + + // Tear down + f_cf01Down(); + } + + + /** + * @desc Check that the IUT responds with an SERVICE_SUBSCRIPTION_NOT_ESTABLISHED error when the AE + * not having service subscription tries to perform OPERATION on the resource + * + */ + testcase TC_CSE_SSM_SSP_002_CRE() runs on Tester system CseSystem { + var AeSimu v_ae1 := AeSimu.create("AE1") alive; + + v_ae1.start(f_CSE_SSM_SSP_002_CRE()); + v_ae1.done; + } + + function f_CSE_SSM_SSP_002_CRE() runs on AeSimu system CseSystem { + + var RequestPrimitive v_request; + + v_request := f_getCreateRequestPrimitive(int3, m_createContainerBase, -1); + v_request.from_ := "S-AEWithoutSSP"; // Random Ae without ServiceSubscriptionProfile (SSP) + + f_send(e_mcaPort, m_request(v_request)); + + tc_ac.start; + alt { + [] mcaPort.receive(mw_response(mw_responsePrimitive(int4128))) { //SERVICE_SUBSCRIPTION_NOT_ESTABLISHED(4128) + tc_ac.stop; + setverdict(pass, __SCOPE__ & ": Operation properly rejected with 4128 (SERVICE_SUBSCRIPTION_NOT_ESTABLISHED)"); + } + [] mcaPort.receive(mw_response(mw_responsePrimitiveInverse(int4128))) -> value vc_response{ + tc_ac.stop; + setverdict(fail, __SCOPE__ & ": Wrong response status code " & int2str(enum2int(vc_response.primitive.responsePrimitive.responseStatusCode))); + } + [] tc_ac.timeout { + setverdict(fail, __SCOPE__ & ": No answer while creating resource"); + } + } + + f_checkAeSimuStatus(); + + // Postamble + f_cse_postamble_deleteResources(); + + // Tear down + f_cf01Down(); + }//f_CSE_SSM_SSP_002_CRE + + + /** + * @desc Check that the IUT responds with an SERVICE_SUBSCRIPTION_NOT_ESTABLISHED error when the AE + * not having service subscription tries to perform OPERATION on the resource + * + */ + testcase TC_CSE_SSM_SSP_002_RET() runs on Tester system CseSystem { + var AeSimu v_ae1 := AeSimu.create("AE1") alive; + + v_ae1.start(f_CSE_SSM_SSP_002_RET()); + v_ae1.done; + } + + function f_CSE_SSM_SSP_002_RET() runs on AeSimu system CseSystem { + + var integer v_containerIndex := -1; + + // create Container directly on CSEBase from superAE + v_containerIndex := f_cse_createResource(int3, m_createContainerBase, -1); + + // Retrieve Container from S-AEWithoutSSP + f_send(e_mcaPort, m_request(m_retrieve(f_getResourceAddress(v_containerIndex), "S-AEWithoutSSP"))); + + tc_ac.start; + alt { + [] mcaPort.receive(mw_response(mw_responsePrimitive(int4128))) { //SERVICE_SUBSCRIPTION_NOT_ESTABLISHED(4128) + tc_ac.stop; + setverdict(pass, __SCOPE__ & ": Operation properly rejected with 4128 (SERVICE_SUBSCRIPTION_NOT_ESTABLISHED)"); + } + [] mcaPort.receive(mw_response(mw_responsePrimitiveInverse(int4128))) -> value vc_response{ + tc_ac.stop; + setverdict(fail, __SCOPE__ & ": Wrong response status code " & int2str(enum2int(vc_response.primitive.responsePrimitive.responseStatusCode))); + } + [] tc_ac.timeout { + setverdict(fail, __SCOPE__ & ": No answer while creating resource"); + } + } + + f_checkAeSimuStatus(); + + // Postamble + f_cse_postamble_deleteResources(); + + // Tear down + f_cf01Down(); + } + + /** + * @desc Check that the IUT responds with an SERVICE_SUBSCRIPTION_NOT_ESTABLISHED error when the AE + * not having service subscription tries to perform OPERATION on the resource + * + */ + testcase TC_CSE_SSM_SSP_002_UPD() runs on Tester system CseSystem { + var AeSimu v_ae1 := AeSimu.create("AE1") alive; + + v_ae1.start(f_CSE_SSM_SSP_002_UPD()); + v_ae1.done; + } + + function f_CSE_SSM_SSP_002_UPD() runs on AeSimu system CseSystem { + + var integer v_containerIndex := -1; + var RequestPrimitive v_updateRequest; + var template RequestPrimitive v_updateRequestPrimitive := m_updateContainerBase; + + // create Container directly on CSEBase from superAE + v_containerIndex := f_cse_createResource(int3, m_createContainerBase, -1); + + v_updateRequest := f_getUpdateRequestPrimitive(int3, v_containerIndex, v_updateRequestPrimitive); + v_updateRequest.from_ := "S-AEWithoutSSP"; //Update Container from AE without ServiceSubscriptionProfile (SSP) + + f_send(e_mcaPort, m_request(v_updateRequest)); + + tc_ac.start; + alt { + [] mcaPort.receive(mw_response(mw_responsePrimitive(int4128))) { //SERVICE_SUBSCRIPTION_NOT_ESTABLISHED(4128) + tc_ac.stop; + setverdict(pass, __SCOPE__ & ": Operation properly rejected with 4128 (SERVICE_SUBSCRIPTION_NOT_ESTABLISHED)"); + } + [] mcaPort.receive(mw_response(mw_responsePrimitiveInverse(int4128))) -> value vc_response{ + tc_ac.stop; + setverdict(fail, __SCOPE__ & ": Wrong response status code " & int2str(enum2int(vc_response.primitive.responsePrimitive.responseStatusCode))); + } + [] tc_ac.timeout { + setverdict(fail, __SCOPE__ & ": No answer while creating resource"); + } + } + + f_checkAeSimuStatus(); + + // Postamble + f_cse_postamble_deleteResources(); + + // Tear down + f_cf01Down(); + } + + /** + * @desc Check that the IUT responds with an SERVICE_SUBSCRIPTION_NOT_ESTABLISHED error when the AE + * not having service subscription tries to perform OPERATION on the resource + * + */ + testcase TC_CSE_SSM_SSP_002_DEL() runs on Tester system CseSystem { + var AeSimu v_ae1 := AeSimu.create("AE1") alive; + + v_ae1.start(f_CSE_SSM_SSP_002_DEL()); + v_ae1.done; + } + + function f_CSE_SSM_SSP_002_DEL() runs on AeSimu system CseSystem { + + var integer v_containerIndex := -1; + + // create Container directly on CSEBase from superAE + v_containerIndex := f_cse_createResource(int3, m_createContainerBase, -1); + + // Delete Container from S-AEWithoutSSP + f_send(e_mcaPort, m_request(m_delete(f_getResourceAddress(v_containerIndex), "S-AEWithoutSSP"))); + + tc_ac.start; + alt { + [] mcaPort.receive(mw_response(mw_responsePrimitive(int4128))) { //SERVICE_SUBSCRIPTION_NOT_ESTABLISHED(4128) + tc_ac.stop; + setverdict(pass, __SCOPE__ & ": Operation properly rejected with 4128 (SERVICE_SUBSCRIPTION_NOT_ESTABLISHED)"); + } + [] mcaPort.receive(mw_response(mw_responsePrimitiveInverse(int4128))) -> value vc_response{ + tc_ac.stop; + setverdict(fail, __SCOPE__ & ": Wrong response status code " & int2str(enum2int(vc_response.primitive.responsePrimitive.responseStatusCode))); + } + [] tc_ac.timeout { + setverdict(fail, __SCOPE__ & ": No answer while creating resource"); + } + } + + f_checkAeSimuStatus(); + + // Postamble + f_cse_postamble_deleteResources(); + + // Tear down + f_cf01Down(); + } + + /** + * @desc Check that the IUT responds with an error when the AE having + * inactive service subscription tries to perform a request + * + */ + testcase TC_CSE_SSM_SSP_003_CRE() runs on Tester system CseSystem { + var AeSimu v_ae1 := AeSimu.create("AE1") alive; + + v_ae1.start(f_CSE_SSM_SSP_003_CRE()); + v_ae1.done; + } + + function f_CSE_SSM_SSP_003_CRE() runs on AeSimu system CseSystem { + + var RequestPrimitive v_request; + + var integer v_subscriptionProfileIndex := -1; + + var template RequestPrimitive v_createServiceSubscriptionProfile := m_createM2mServiceSubscriptionProfileDeactivated; + var template RequestPrimitive v_createRequestContainer := m_createContainerBase; + + // directly on CSEBase from superAE, Create serviceSubscriptionProfile with INACTIVE status + v_subscriptionProfileIndex := f_cse_createResource(int11, v_createServiceSubscriptionProfile, -1); + + // register one AE + // TODO: Link this AE to Subscription Profile created above + // NOTE: Its assumed that the CSE has the mapping of this AE with ServiceSubscriptionProfile + vc_ae2.start(f_cse_createResource(int2, m_createAe(vc_aeSimuDesc.appId, omit, PX_ALLOWED_C_AE_IDS[0]), -1)); + f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2); + + // Create a container resource from same AE + v_request := f_getCreateRequestPrimitive(int3, v_createRequestContainer, -1); + v_request.from_ := PX_ALLOWED_C_AE_IDS[0]; + + f_send(e_mcaPort, m_request(v_request)); + + tc_ac.start; + alt { + + //SERVICE_SUBSCRIPTION_NOT_ACTIVE + [] mcaPort.receive(mw_response(mw_responsePrimitive(int4139))) { + tc_ac.stop; + setverdict(pass, __SCOPE__ & ": Request rejected successfully as SERVICE_SUBSCRIPTION_NOT_ACTIVE (4139)"); + } + [] mcaPort.receive(mw_response(mw_responsePrimitiveInverse(int4139))) -> value vc_response{ + tc_ac.stop; + setverdict(fail, __SCOPE__ & ": Request should be rejected with 4139 as SERVICE_SUBSCRIPTION_NOT_ACTIVE instead of " & int2str(enum2int(vc_response.primitive.responsePrimitive.responseStatusCode))); + } + [] tc_ac.timeout { + setverdict(fail, __SCOPE__ & ": No answer while creating resource"); + } + } + + f_checkAeSimuStatus(); + + // Postamble + f_cse_postamble_deleteResources(); + + // Tear down + f_cf01Down(); + }//f_CSE_SSM_SSP_003_CRE + + + /** + * @desc Check that the IUT responds with an error when the AE having + * inactive service subscription tries to perform a request + * + */ + testcase TC_CSE_SSM_SSP_003_RET() runs on Tester system CseSystem { + var AeSimu v_ae1 := AeSimu.create("AE1") alive; + + v_ae1.start(f_CSE_SSM_SSP_003_RET()); + v_ae1.done; + } + + function f_CSE_SSM_SSP_003_RET() runs on AeSimu system CseSystem { + + + var integer v_subscriptionProfileIndex := -1; + var integer v_aeIndex := -1; + + var template RequestPrimitive v_createServiceSubscriptionProfile := m_createM2mServiceSubscriptionProfileDeactivated; + + // directly on CSEBase from superAE, Create serviceSubscriptionProfile with INACTIVE status + v_subscriptionProfileIndex := f_cse_createResource(int11, v_createServiceSubscriptionProfile, -1); + + // register one AE + // TODO: Link this AE to Subscription Profile created above + // NOTE: Its assumed that the CSE has the mapping of this AE with ServiceSubscriptionProfile + vc_ae2.start(f_cse_createResource(int2, m_createAe(vc_aeSimuDesc.appId, omit, PX_ALLOWED_C_AE_IDS[0]), -1)); + f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2); + v_aeIndex := f_getLatestResourceIndex(vc_ae2); + + // Retrieve AE + f_send(e_mcaPort, m_request(m_retrieve(f_getResourceAddress(v_aeIndex), PX_ALLOWED_C_AE_IDS[0]))); + + tc_ac.start; + alt { + + //SERVICE_SUBSCRIPTION_NOT_ACTIVE + [] mcaPort.receive(mw_response(mw_responsePrimitive(int4139))) { + tc_ac.stop; + setverdict(pass, __SCOPE__ & ": Request rejected successfully as SERVICE_SUBSCRIPTION_NOT_ACTIVE (4139)"); + } + [] mcaPort.receive(mw_response(mw_responsePrimitiveInverse(int4139))) -> value vc_response{ + tc_ac.stop; + setverdict(fail, __SCOPE__ & ": Request should be rejected with 4139 as SERVICE_SUBSCRIPTION_NOT_ACTIVE instead of " & int2str(enum2int(vc_response.primitive.responsePrimitive.responseStatusCode))); + } + [] tc_ac.timeout { + setverdict(fail, __SCOPE__ & ": No answer while creating resource"); + } + } + + f_checkAeSimuStatus(); + + // Postamble + f_cse_postamble_deleteResources(); + + // Tear down + f_cf01Down(); + }//f_CSE_SSM_SSP_003_RET + + /** + * @desc Check that the IUT responds with an error when the AE having + * inactive service subscription tries to perform a request + * + */ + testcase TC_CSE_SSM_SSP_003_UPD() runs on Tester system CseSystem { + var AeSimu v_ae1 := AeSimu.create("AE1") alive; + + v_ae1.start(f_CSE_SSM_SSP_003_UPD()); + v_ae1.done; + } + + function f_CSE_SSM_SSP_003_UPD() runs on AeSimu system CseSystem { + + + var integer v_subscriptionProfileIndex := -1; + var integer v_aeIndex := -1; + + var template RequestPrimitive v_createServiceSubscriptionProfile := m_createM2mServiceSubscriptionProfileDeactivated; + + var template RequestPrimitive v_updateAeRequestPrimitive := m_updateAeBase; + var RequestPrimitive v_updateRequest; + + var Labels v_labels_1:= {"VALUE_1"}; + + // directly on CSEBase from superAE, Create serviceSubscriptionProfile with INACTIVE status + v_subscriptionProfileIndex := f_cse_createResource(int11, v_createServiceSubscriptionProfile, -1); + + // register one AE + // TODO: Link this AE to Subscription Profile created above + // NOTE: Its assumed that the CSE has the mapping of this AE with ServiceSubscriptionProfile + vc_ae2.start(f_cse_createResource(int2, m_createAe(vc_aeSimuDesc.appId, omit, PX_ALLOWED_C_AE_IDS[0]), -1)); + f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2); + v_aeIndex := f_getLatestResourceIndex(vc_ae2); + + //Update AE + v_updateAeRequestPrimitive.primitiveContent.aE.labels := v_labels_1; + v_updateRequest := f_getUpdateRequestPrimitive(int2, v_aeIndex, v_updateAeRequestPrimitive); + v_updateRequest.from_ := PX_ALLOWED_C_AE_IDS[0]; + + + f_send(e_mcaPort, m_request(v_updateRequest)); + + tc_ac.start; + alt { + + //SERVICE_SUBSCRIPTION_NOT_ACTIVE + [] mcaPort.receive(mw_response(mw_responsePrimitive(int4139))) { + tc_ac.stop; + setverdict(pass, __SCOPE__ & ": Request rejected successfully as SERVICE_SUBSCRIPTION_NOT_ACTIVE (4139)"); + } + [] mcaPort.receive(mw_response(mw_responsePrimitiveInverse(int4139))) -> value vc_response{ + tc_ac.stop; + setverdict(fail, __SCOPE__ & ": Request should be rejected with 4139 as SERVICE_SUBSCRIPTION_NOT_ACTIVE instead of " & int2str(enum2int(vc_response.primitive.responsePrimitive.responseStatusCode))); + } + [] tc_ac.timeout { + setverdict(fail, __SCOPE__ & ": No answer while creating resource"); + } + } + + f_checkAeSimuStatus(); + + // Postamble + f_cse_postamble_deleteResources(); + + // Tear down + f_cf01Down(); + }//f_CSE_SSM_SSP_003_UPD + + /** + * @desc Check that the IUT responds with an error when the AE having + * inactive service subscription tries to perform a request + * + */ + testcase TC_CSE_SSM_SSP_003_DEL() runs on Tester system CseSystem { + var AeSimu v_ae1 := AeSimu.create("AE1") alive; + + v_ae1.start(f_CSE_SSM_SSP_003_DEL()); + v_ae1.done; + } + + /** + * @desc + * @verdict + */ + function f_CSE_SSM_SSP_003_DEL() runs on AeSimu system CseSystem { + + + var integer v_subscriptionProfileIndex := -1; + var integer v_aeIndex := -1; + + var template RequestPrimitive v_createServiceSubscriptionProfile := m_createM2mServiceSubscriptionProfileDeactivated; + + // directly on CSEBase from superAE, Create serviceSubscriptionProfile with INACTIVE status + v_subscriptionProfileIndex := f_cse_createResource(int11, v_createServiceSubscriptionProfile, -1); + + // register one AE + // TODO: Link this AE to Subscription Profile created above + // NOTE: Its assumed that the CSE has the mapping of this AE with ServiceSubscriptionProfile + vc_ae2.start(f_cse_createResource(int2, m_createAe(vc_aeSimuDesc.appId, omit, PX_ALLOWED_C_AE_IDS[0]), -1)); + f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2); + v_aeIndex := f_getLatestResourceIndex(vc_ae2); + + f_send(e_mcaPort, m_request(m_delete(f_getResourceAddress(v_aeIndex), PX_ALLOWED_C_AE_IDS[0]))); + + tc_ac.start; + alt { + + //SERVICE_SUBSCRIPTION_NOT_ACTIVE + [] mcaPort.receive(mw_response(mw_responsePrimitive(int4139))) { + tc_ac.stop; + setverdict(pass, __SCOPE__ & ": Request rejected successfully as SERVICE_SUBSCRIPTION_NOT_ACTIVE (4139)"); + } + [] mcaPort.receive(mw_response(mw_responsePrimitiveInverse(int4139))) -> value vc_response{ + tc_ac.stop; + setverdict(fail, __SCOPE__ & ": Request should be rejected with 4139 as SERVICE_SUBSCRIPTION_NOT_ACTIVE instead of " & int2str(enum2int(vc_response.primitive.responsePrimitive.responseStatusCode))); + } + [] tc_ac.timeout { + setverdict(fail, __SCOPE__ & ": No answer while creating resource"); + } + } + + f_checkAeSimuStatus(); + + // Postamble + f_cse_postamble_deleteResources(); + + // Tear down + f_cf01Down(); + }//f_CSE_SSM_SSP_003_DEL + + + /** + * @desc Check that the IUT processes the request when the AE having an active service subscription tries to perform a request + * + */ + testcase TC_CSE_SSM_SSP_004() runs on Tester system CseSystem { + var AeSimu v_ae1 := AeSimu.create("AE1") alive; + + v_ae1.start(f_CSE_SSM_SSP_004()); + v_ae1.done; + } + + function f_CSE_SSM_SSP_004() runs on AeSimu system CseSystem { + + + var integer v_subscriptionProfileIndex := -1; + var integer v_aeIndex := -1; + + var template RequestPrimitive v_createServiceSubscriptionProfile := m_createM2mServiceSubscriptionProfileDeactivated; + var template RequestPrimitive v_updateServiceSubscriptionProfile := m_updateServiceSubscriptionProfileActivated; + + // directly on CSEBase from superAE, Create serviceSubscriptionProfile with INACTIVE status + v_subscriptionProfileIndex := f_cse_createResource(int11, v_createServiceSubscriptionProfile, -1); + + // Update ServiceSubscriptionProfile with activate = true + f_cse_updateResource(int11, v_subscriptionProfileIndex, v_updateServiceSubscriptionProfile); + + // register one AE + // TODO: Link this AE to Subscription Profile created above + // NOTE: Its assumed that the CSE has the mapping of this AE with ServiceSubscriptionProfile + vc_ae2.start(f_cse_createResource(int2, m_createAe(vc_aeSimuDesc.appId, omit, PX_ALLOWED_C_AE_IDS[0]), -1)); + f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2); + v_aeIndex := f_getLatestResourceIndex(vc_ae2); + + // Retrieve AE successfully beacuse serviceSubscription ACTIVE now + f_send(e_mcaPort, m_request(m_retrieve(f_getResourceAddress(v_aeIndex), PX_ALLOWED_C_AE_IDS[0]))); + + tc_ac.start; + alt { + + //200 OK + [] mcaPort.receive(mw_response(mw_responsePrimitive(int2000))) { + tc_ac.stop; + setverdict(pass, __SCOPE__ & ": Request successfully retrieved resource 200 OK)"); + } + [] mcaPort.receive(mw_response(mw_responsePrimitiveInverse(int2000))) -> value vc_response{ + tc_ac.stop; + setverdict(fail, __SCOPE__ & ": Request should successfully retrieve with 200 OK instead of " & int2str(enum2int(vc_response.primitive.responsePrimitive.responseStatusCode))); + } + [] tc_ac.timeout { + setverdict(fail, __SCOPE__ & ": No answer while creating resource"); + } + } + + f_checkAeSimuStatus(); + + // Postamble + f_cse_postamble_deleteResources(); + + // Tear down + f_cf01Down(); + }//f_CSE_SSM_SSP_004 + + /** + * @desc Check that the IUT responds with an error when the authorized AE tries to perform OPERATION on the + * resource TARGET_RESOURCE_ADDRESS and it exceeds the limit for ATTRIBUTE_NAME in its + * m2mServiceSubscriptionProfile resource + * + */ + testcase TC_CSE_SSM_SSP_007_MAE() runs on Tester system CseSystem { + var AeSimu v_ae1 := AeSimu.create("AE1") alive; + + v_ae1.start(f_CSE_SSM_SSP_007_MAE()); + v_ae1.done; + } + + function f_CSE_SSM_SSP_007_MAE() runs on AeSimu system CseSystem { + + var integer v_subscriptionProfileIndex := -1; + + var template RequestPrimitive v_createServiceSubscriptionProfile := m_createM2mServiceSubscriptionProfileMaxValue1; // maxNumAEs 1 + var template RequestPrimitive v_request; + + // directly on CSEBase from superAE + v_subscriptionProfileIndex := f_cse_createResource(int11, v_createServiceSubscriptionProfile, -1); + + // register one AE + // TODO: Link this AE to Subscription Profile created above + // NOTE: Its assumed that the CSE has the mapping of this AE with ServiceSubscriptionProfile + vc_ae2.start(f_cse_createResource(int2, m_createAe(vc_aeSimuDesc.appId, omit, PX_ALLOWED_C_AE_IDS[0]), -1)); + f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2); + + + //Create another Ae : Max 1 allowed as per SSP created above + //Assumtption: PX_ALLOWED_C_AE_IDS: [1]Its assumed that the CSE has the mapping of this AE with ServiceSubscriptionProfile + v_request := f_getCreateRequestPrimitive(int2, m_createAe(vc_aeSimuDesc.appId, omit, PX_ALLOWED_C_AE_IDS[1]), -1); + f_send(e_mcaPort, m_request(v_request)); + + tc_ac.start; + alt { + + // SERVICE_SUBSCRIPTION_LIMITS_EXCEEDED + [] mcaPort.receive(mw_response(mw_responsePrimitive(int4141))) -> value vc_response { + + tc_ac.stop; + setverdict(pass, __SCOPE__ & ": Request successfully Rejected"); + + } + + [] mcaPort.receive(mw_response(mw_responsePrimitiveInverse(int4141))) -> value vc_response{ + tc_ac.stop; + setverdict(fail, __SCOPE__ & ": Request should be rejected with 4141 (SERVICE_SUBSCRIPTION_LIMITS_EXCEEDED) instead of " & int2str(enum2int(vc_response.primitive.responsePrimitive.responseStatusCode))); + } + [] tc_ac.timeout { + setverdict(fail, __SCOPE__ & ": No answer while retrieving resource"); + } + } + + f_checkAeSimuStatus(); + + // Postamble + f_cse_postamble_deleteResources(); + + // Tear down + f_cf01Down(); + } + + + /** + * @desc Check that the IUT responds with an error when the authorized AE tries to perform OPERATION on the + * resource TARGET_RESOURCE_ADDRESS and it exceeds the limit for ATTRIBUTE_NAME in its + * m2mServiceSubscriptionProfile resource + * + */ + testcase TC_CSE_SSM_SSP_007_MNC() runs on Tester system CseSystem { + var AeSimu v_ae1 := AeSimu.create("AE1") alive; + + v_ae1.start(f_CSE_SSM_SSP_007_MNC()); + v_ae1.done; + } + + function f_CSE_SSM_SSP_007_MNC() runs on AeSimu system CseSystem { + + var integer v_subscriptionProfileIndex := -1; + var integer v_aeIndex := -1; + var RequestPrimitive v_updateRequest; + + var template RequestPrimitive v_createServiceSubscriptionProfile := m_createM2mServiceSubscriptionProfileMaxValue1; + var template RequestPrimitive v_requestContainerCreate; + v_requestContainerCreate + // directly on CSEBase from superAE, Create serviceSubscriptionProfile with maxNumContainers = 1 + v_subscriptionProfileIndex := f_cse_createResource(int11, v_createServiceSubscriptionProfile, -1); + + // register one AE + // TODO: Link this AE to Subscription Profile created above + // NOTE: Its assumed that the CSE has the mapping of this AE with ServiceSubscriptionProfile + vc_ae2.start(f_cse_createResource(int2, m_createAe(vc_aeSimuDesc.appId, omit, PX_ALLOWED_C_AE_IDS[0]), -1)); + f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2); + + // Create one container + v_aeIndex := f_getLatestResourceIndex(vc_ae2); + vc_ae2.start(f_cse_createResource(int3, m_createContainerBase, v_aeIndex)); + f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2); + + // Create another container from same AE. maxNumContainers allowed 1 + v_requestContainerCreate := f_getCreateRequestPrimitive(int3, m_createContainerBase, v_aeIndex); + f_send(e_mcaPort, m_request(v_requestContainerCreate)); + + tc_ac.start; + alt { + + // SERVICE_SUBSCRIPTION_LIMITS_EXCEEDED + [] mcaPort.receive(mw_response(mw_responsePrimitive(int4141))) -> value vc_response { + + tc_ac.stop; + setverdict(pass, __SCOPE__ & ": Request successfully Rejected"); + + } + + [] mcaPort.receive(mw_response(mw_responsePrimitiveInverse(int4141))) -> value vc_response{ + tc_ac.stop; + setverdict(fail, __SCOPE__ & ": Request should be rejected with 4141 (SERVICE_SUBSCRIPTION_LIMITS_EXCEEDED) instead of " & int2str(enum2int(vc_response.primitive.responsePrimitive.responseStatusCode))); + } + [] tc_ac.timeout { + setverdict(fail, __SCOPE__ & ": No answer while retrieving resource"); + } + } + + f_checkAeSimuStatus(); + + // Postamble + f_cse_postamble_deleteResources(); + + // Tear down + f_cf01Down(); + } + + /** + * @desc Check that the IUT responds with an error when the authorized AE tries to perform OPERATION on the + * resource TARGET_RESOURCE_ADDRESS and it exceeds the limit for ATTRIBUTE_NAME in its + * m2mServiceSubscriptionProfile resource + * + */ + testcase TC_CSE_SSM_SSP_007_MIC_CRE() runs on Tester system CseSystem { + var AeSimu v_ae1 := AeSimu.create("AE1") alive; + + v_ae1.start(f_CSE_SSM_SSP_007_MIC_CRE()); + v_ae1.done; + } + + function f_CSE_SSM_SSP_007_MIC_CRE() runs on AeSimu system CseSystem { + + var integer v_subscriptionProfileIndex := -1; + var integer v_aeIndex := -1; + var integer v_containerIndex := -1; + + var template RequestPrimitive v_createServiceSubscriptionProfile := m_createM2mServiceSubscriptionProfileMaxValue1; + var template RequestPrimitive v_createContentInstanceRequest := m_createContentInstanceBase; + var template RequestPrimitive v_request; + + // directly on CSEBase from superAE, Create serviceSubscriptionProfile with maxNumInstancesPerContainer = 1 + v_subscriptionProfileIndex := f_cse_createResource(int11, v_createServiceSubscriptionProfile, -1); + + // register one AE + // TODO: Link this AE to Subscription Profile created above + // NOTE: Its assumed that the CSE has the mapping of this AE with ServiceSubscriptionProfile + vc_ae2.start(f_cse_createResource(int2, m_createAe(vc_aeSimuDesc.appId, omit, PX_ALLOWED_C_AE_IDS[0]), -1)); + f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2); + + // Create one container + v_aeIndex := f_getLatestResourceIndex(vc_ae2); + vc_ae2.start(f_cse_createResource(int3, m_createContainerBase, v_aeIndex)); + f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2); + + // Create 1 content instance under + v_containerIndex := f_getLatestResourceIndex(vc_ae2); + vc_ae2.start(f_cse_createResource(int4, m_createContentInstanceBase, v_containerIndex)); + f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2); + + // Create another content instance from same AE. maxNumInstancesPerContainer allowed 1 + v_createContentInstanceRequest.primitiveContent.contentInstance.resourceName := c_defaultContentInstanceResourceName & int2str(2); + v_request := f_getCreateRequestPrimitive(int4, v_createContentInstanceRequest, v_containerIndex); + f_send(e_mcaPort, m_request(v_request)); + + tc_ac.start; + alt { + + // SERVICE_SUBSCRIPTION_LIMITS_EXCEEDED + [] mcaPort.receive(mw_response(mw_responsePrimitive(int4141))) -> value vc_response { + + tc_ac.stop; + setverdict(pass, __SCOPE__ & ": Request successfully Rejected"); + + } + + [] mcaPort.receive(mw_response(mw_responsePrimitiveInverse(int4141))) -> value vc_response{ + tc_ac.stop; + setverdict(fail, __SCOPE__ & ": Request should be rejected with 4141 (SERVICE_SUBSCRIPTION_LIMITS_EXCEEDED) instead of " & int2str(enum2int(vc_response.primitive.responsePrimitive.responseStatusCode))); + } + [] tc_ac.timeout { + setverdict(fail, __SCOPE__ & ": No answer while retrieving resource"); + } + } + + f_checkAeSimuStatus(); + + // Postamble + f_cse_postamble_deleteResources(); + + // Tear down + f_cf01Down(); + } + + /** + * @desc Check that the IUT responds with an error when the authorized AE tries to perform OPERATION on the + * resource TARGET_RESOURCE_ADDRESS and it exceeds the limit for ATTRIBUTE_NAME in its + * m2mServiceSubscriptionProfile resource + * + */ + testcase TC_CSE_SSM_SSP_007_MNT() runs on Tester system CseSystem { + var AeSimu v_ae1 := AeSimu.create("AE1") alive; + + v_ae1.start(f_CSE_SSM_SSP_007_MNT()); + v_ae1.done; + } + + function f_CSE_SSM_SSP_007_MNT() runs on AeSimu system CseSystem { + + var integer v_subscriptionProfileIndex := -1; + var integer v_aeIndex := -1; + + var RequestPrimitive v_request; + + var template RequestPrimitive v_createServiceSubscriptionProfile := m_createM2mServiceSubscriptionProfileMaxValue1; + var template RequestPrimitive v_createTimeSeriesRequest := m_createTimeSeriesBase; + + // directly on CSEBase from superAE, Create serviceSubscriptionProfile with maxNumTimeSeries = 1 + v_subscriptionProfileIndex := f_cse_createResource(int11, v_createServiceSubscriptionProfile, -1); + + // register one AE + // TODO: Link this AE to Subscription Profile created above + // NOTE: Its assumed that the CSE has the mapping of this AE with ServiceSubscriptionProfile + vc_ae2.start(f_cse_createResource(int2, m_createAe(vc_aeSimuDesc.appId, omit, PX_ALLOWED_C_AE_IDS[0]), -1)); + f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2); + + // Create one TimeSeries container + v_aeIndex := f_getLatestResourceIndex(vc_ae2); + vc_ae2.start(f_cse_createResource(int29, m_createTimeSeriesBase, v_aeIndex)); + f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2); + + // Create another TimeSeries container. maxNumTimeSeries allowed 1 + v_createTimeSeriesRequest.primitiveContent.resourceName := c_defaultTimeSeriesResourceName & int2str(2); + v_request := f_getCreateRequestPrimitive(int29, v_createTimeSeriesRequest, v_aeIndex); + f_send(e_mcaPort, m_request(v_request)); + + tc_ac.start; + alt { + + // SERVICE_SUBSCRIPTION_LIMITS_EXCEEDED + [] mcaPort.receive(mw_response(mw_responsePrimitive(int4141))) -> value vc_response { + + tc_ac.stop; + setverdict(pass, __SCOPE__ & ": Request successfully Rejected"); + + } + + [] mcaPort.receive(mw_response(mw_responsePrimitiveInverse(int4141))) -> value vc_response{ + tc_ac.stop; + setverdict(fail, __SCOPE__ & ": Request should be rejected with 4141 (SERVICE_SUBSCRIPTION_LIMITS_EXCEEDED) instead of " & int2str(enum2int(vc_response.primitive.responsePrimitive.responseStatusCode))); + } + [] tc_ac.timeout { + setverdict(fail, __SCOPE__ & ": No answer while retrieving resource"); + } + } + + f_checkAeSimuStatus(); + + // Postamble + f_cse_postamble_deleteResources(); + + // Tear down + f_cf01Down(); + } + + + /** + * @desc Check that the IUT responds with an error when the authorized AE tries to perform OPERATION on the + * resource TARGET_RESOURCE_ADDRESS and it exceeds the limit for ATTRIBUTE_NAME in its + * m2mServiceSubscriptionProfile resource + * + */ + testcase TC_CSE_SSM_SSP_007_MMG_CRE() runs on Tester system CseSystem { + var AeSimu v_ae1 := AeSimu.create("AE1") alive; + + v_ae1.start(f_CSE_SSM_SSP_007_MMG_CRE()); + v_ae1.done; + } + + function f_CSE_SSM_SSP_007_MMG_CRE() runs on AeSimu system CseSystem { + + var integer v_subscriptionProfileIndex := -1; + var integer v_aeIndex := -1; + var integer v_containerOneIndex := -1; + var integer v_containerTwoIndex := -1; + + var RequestPrimitive v_request; + var ListOfURIs v_memberIDs; + + var template RequestPrimitive v_createServiceSubscriptionProfile := m_createM2mServiceSubscriptionProfileMaxValue1; + + // directly on CSEBase from superAE, Create serviceSubscriptionProfile with maxMembersPerGroup = 1 + v_subscriptionProfileIndex := f_cse_createResource(int11, v_createServiceSubscriptionProfile, -1); + + // register one AE + // TODO: Link this AE to Subscription Profile created above + // NOTE: Its assumed that the CSE has the mapping of this AE with ServiceSubscriptionProfile + vc_ae2.start(f_cse_createResource(int2, m_createAe(vc_aeSimuDesc.appId, omit, PX_ALLOWED_C_AE_IDS[0]), -1)); + f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2); + + // Create one container + v_aeIndex := f_getLatestResourceIndex(vc_ae2); + vc_ae2.start(f_cse_createResource(int3, m_createContainerBase, v_aeIndex)); + f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2); + v_containerOneIndex := f_getLatestResourceIndex(vc_ae2); + + // Create another container from same AE + vc_ae2.start(f_cse_createResource(int3, m_createContainerBase, v_aeIndex)); + f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2); + v_containerTwoIndex := f_getLatestResourceIndex(vc_ae2); + + // Create one Group resource with 2 containers above as members + v_memberIDs := { + f_getResourceId(vc_resourcesList[v_containerOneIndex].resource), + f_getResourceId(vc_resourcesList[v_containerTwoIndex].resource) + }; + + v_request := f_getCreateRequestPrimitive(int9, m_createGroup(2, v_memberIDs, omit, int2, -, omit,-), -1); + v_request.from_ := PX_ALLOWED_C_AE_IDS[0]; + + f_send(e_mcaPort, m_request(v_request)); + + + tc_ac.start; + alt { + + // SERVICE_SUBSCRIPTION_LIMITS_EXCEEDED + [] mcaPort.receive(mw_response(mw_responsePrimitive(int4141))) -> value vc_response { + + tc_ac.stop; + setverdict(pass, __SCOPE__ & ": Request successfully Rejected"); + + } + + [] mcaPort.receive(mw_response(mw_responsePrimitiveInverse(int4141))) -> value vc_response{ + tc_ac.stop; + setverdict(fail, __SCOPE__ & ": Request should be rejected with 4141 (SERVICE_SUBSCRIPTION_LIMITS_EXCEEDED) instead of " & int2str(enum2int(vc_response.primitive.responsePrimitive.responseStatusCode))); + } + [] tc_ac.timeout { + setverdict(fail, __SCOPE__ & ": No answer while retrieving resource"); + } + } + + f_checkAeSimuStatus(); + + // Postamble + f_cse_postamble_deleteResources(); + + // Tear down + f_cf01Down(); + } + + /** + * @desc Check that the IUT responds with an error when the authorized AE tries to perform OPERATION on the + * resource TARGET_RESOURCE_ADDRESS and it exceeds the limit for ATTRIBUTE_NAME in its + * m2mServiceSubscriptionProfile resource + * + */ + testcase TC_CSE_SSM_SSP_007_MNB() runs on Tester system CseSystem { + var AeSimu v_ae1 := AeSimu.create("AE1") alive; + + v_ae1.start(f_CSE_SSM_SSP_007_MNB()); + v_ae1.done; + } + + function f_CSE_SSM_SSP_007_MNB() runs on AeSimu system CseSystem { + + var integer v_subscriptionProfileIndex := -1; + var integer v_aeIndex := -1; + var integer v_containerIndex := -1; + + var RequestPrimitive v_request; + + var template RequestPrimitive v_createServiceSubscriptionProfile := m_createM2mServiceSubscriptionProfileMaxNumBytes100; + var template RequestPrimitive v_createRequestContentInstance; + + var XSD.String v_instanceData := any2unistr(int2oct(1, 200)); //200Bytes + + // directly on CSEBase from superAE, Create serviceSubscriptionProfile with maxNumTimeSeries = 2 + v_subscriptionProfileIndex := f_cse_createResource(int11, v_createServiceSubscriptionProfile, -1); + + // register one AE + // TODO: Link this AE to Subscription Profile created above + // NOTE: Its assumed that the CSE has the mapping of this AE with ServiceSubscriptionProfile + vc_ae2.start(f_cse_createResource(int2, m_createAe(vc_aeSimuDesc.appId, omit, PX_ALLOWED_C_AE_IDS[0]), -1)); + f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2); + + // Create one container + v_aeIndex := f_getLatestResourceIndex(vc_ae2); + vc_ae2.start(f_cse_createResource(int3, m_createContainerBase, v_aeIndex)); + f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2); + + // Create another content instance with 200 bytes size. Max allowed 100 bytes + v_containerIndex := f_getLatestResourceIndex(vc_ae2); + v_createRequestContentInstance := m_createContentInstance(c_defaultContentInstanceResourceName, v_instanceData); + v_request := f_getCreateRequestPrimitive(int4, v_createRequestContentInstance, v_containerIndex); + f_send(e_mcaPort, m_request(v_request)); + + tc_ac.start; + alt { + + // SERVICE_SUBSCRIPTION_LIMITS_EXCEEDED + [] mcaPort.receive(mw_response(mw_responsePrimitive(int4141))) -> value vc_response { + + tc_ac.stop; + setverdict(pass, __SCOPE__ & ": Request successfully Rejected"); + + } + + [] mcaPort.receive(mw_response(mw_responsePrimitiveInverse(int4141))) -> value vc_response{ + tc_ac.stop; + setverdict(fail, __SCOPE__ & ": Request should be rejected with 4141 (SERVICE_SUBSCRIPTION_LIMITS_EXCEEDED) instead of " & int2str(enum2int(vc_response.primitive.responsePrimitive.responseStatusCode))); + } + [] tc_ac.timeout { + setverdict(fail, __SCOPE__ & ": No answer while retrieving resource"); + } + } + + f_checkAeSimuStatus(); + + // Postamble + f_cse_postamble_deleteResources(); + + // Tear down + f_cf01Down(); + } + + + + /** + * @desc Check that the IUT responds with an error when the authorized AE tries to perform OPERATION on the + * resource TARGET_RESOURCE_ADDRESS and it exceeds the limit for ATTRIBUTE_NAME in its + * m2mServiceSubscriptionProfile resource + * + */ + testcase TC_CSE_SSM_SSP_007_MND() runs on Tester system CseSystem { + var AeSimu v_ae1 := AeSimu.create("AE1") alive; + + v_ae1.start(f_CSE_SSM_SSP_007_MND()); + v_ae1.done; + } + + function f_CSE_SSM_SSP_007_MND() runs on AeSimu system CseSystem { + + var integer v_subscriptionProfileIndex := -1; + var RequestPrimitive v_request; + var integer v_aeIndex := -1; + + var template RequestPrimitive v_createServiceSubscriptionProfile := m_createM2mServiceSubscriptionProfileMaxValue1; + var template RequestPrimitive v_createNodeRequest := m_createNodeBase; + + // directly on CSEBase from superAE, Create serviceSubscriptionProfile with maxNumNodes = 1 + v_subscriptionProfileIndex := f_cse_createResource(int11, v_createServiceSubscriptionProfile, -1); + + // register one AE + // TODO: Link this AE to Subscription Profile created above + // NOTE: Its assumed that the CSE has the mapping of this AE with ServiceSubscriptionProfile + vc_ae2.start(f_cse_createResource(int2, m_createAe(vc_aeSimuDesc.appId, omit, PX_ALLOWED_C_AE_IDS[0]), -1)); + f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2); + + // Create 1 Node resource under CSEBase + v_createNodeRequest.primitiveContent.node.resourceName := c_defaultNodeResourceName; + v_createNodeRequest.from_ := PX_ALLOWED_C_AE_IDS[0]; + + vc_ae2.start(f_CSE_DMR_CRE_001(int14, v_createNodeRequest, -));//Node + f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2); + + // Create another Node resource under CSEBase and maxNumNodes set to 1 + v_createNodeRequest.primitiveContent.node.resourceName := c_defaultNodeResourceName & int2str(2); + v_request := f_getCreateRequestPrimitive(int14, v_createNodeRequest, -1); + v_request.from_ := PX_ALLOWED_C_AE_IDS[0]; + f_send(e_mcaPort, m_request(v_request)); + + + tc_ac.start; + alt { + + // SERVICE_SUBSCRIPTION_LIMITS_EXCEEDED + [] mcaPort.receive(mw_response(mw_responsePrimitive(int4141))) -> value vc_response { + + tc_ac.stop; + setverdict(pass, __SCOPE__ & ": Request successfully Rejected"); + + } + + [] mcaPort.receive(mw_response(mw_responsePrimitiveInverse(int4141))) -> value vc_response{ + tc_ac.stop; + setverdict(fail, __SCOPE__ & ": Request should be rejected with 4141 (SERVICE_SUBSCRIPTION_LIMITS_EXCEEDED) instead of " & int2str(enum2int(vc_response.primitive.responsePrimitive.responseStatusCode))); + } + [] tc_ac.timeout { + setverdict(fail, __SCOPE__ & ": No answer while retrieving resource"); + } + } + + + f_checkAeSimuStatus(); + + // Postamble + f_cse_postamble_deleteResources(); + + // Tear down + f_cf01Down(); + } + + /** + * @desc Check that the IUT responds with an error when the authorized AE tries to perform OPERATION on the + * resource TARGET_RESOURCE_ADDRESS and it exceeds the limit for ATTRIBUTE_NAME in its + * m2mServiceSubscriptionProfile resource + * + */ + testcase TC_CSE_SSM_SSP_007_MNU() runs on Tester system CseSystem { + var AeSimu v_ae1 := AeSimu.create("AE1") alive; + + v_ae1.start(f_CSE_SSM_SSP_007_MNU()); + v_ae1.done; + } + + function f_CSE_SSM_SSP_007_MNU() runs on AeSimu system CseSystem { + + var integer v_subscriptionProfileIndex := -1; + var RequestPrimitive v_request; + var integer v_aeIndex := -1; + + var template RequestPrimitive v_createServiceSubscriptionProfile := m_createM2mServiceSubscriptionProfileMaxValue1; + var template RequestPrimitive v_createServiceSubscribedUserProfile := m_createServiceSubscribedUserProfileMaxValue1; + + // directly on CSEBase from superAE, Create serviceSubscriptionProfile with maxNumUsers = 1 + v_subscriptionProfileIndex := f_cse_createResource(int11, v_createServiceSubscriptionProfile, -1); + + // register one AE + // TODO: Link this AE to Subscription Profile created above + // NOTE: Its assumed that the CSE has the mapping of this AE with ServiceSubscriptionProfile + vc_ae2.start(f_cse_createResource(int2, m_createAe(vc_aeSimuDesc.appId, omit, PX_ALLOWED_C_AE_IDS[0]), -1)); + f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2); + + + //// Create 1 ServiceSubscriptionUserProfile i.e 1 user associated with this Service Subscription Profile + v_createServiceSubscribedUserProfile.from_ := PX_ALLOWED_C_AE_IDS[0]; + vc_ae2.start(f_cse_createResource(int52, v_createServiceSubscribedUserProfile, v_subscriptionProfileIndex)); + f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2); + + //// Create another ServiceSubscriptionUserProfile, max allowed users associated with this Service Subscription Profile is 1 + v_createServiceSubscribedUserProfile.primitiveContent.serviceSubscribedUserProfile.resourceName := c_defaultServiceSubscribedUserProfileResourceName & int2str(2); + v_request := f_getCreateRequestPrimitive(int52, v_createServiceSubscribedUserProfile, v_subscriptionProfileIndex); + f_send(e_mcaPort, m_request(v_request)); + + tc_ac.start; + alt { + + // SERVICE_SUBSCRIPTION_LIMITS_EXCEEDED + [] mcaPort.receive(mw_response(mw_responsePrimitive(int4141))) -> value vc_response { + + tc_ac.stop; + setverdict(pass, __SCOPE__ & ": Request successfully Rejected"); + + } + + [] mcaPort.receive(mw_response(mw_responsePrimitiveInverse(int4141))) -> value vc_response{ + tc_ac.stop; + setverdict(fail, __SCOPE__ & ": Request should be rejected with 4141 (SERVICE_SUBSCRIPTION_LIMITS_EXCEEDED) instead of " & int2str(enum2int(vc_response.primitive.responsePrimitive.responseStatusCode))); + } + [] tc_ac.timeout { + setverdict(fail, __SCOPE__ & ": No answer while retrieving resource"); + } + } + + f_checkAeSimuStatus(); + + // Postamble + f_cse_postamble_deleteResources(); + + // Tear down + f_cf01Down(); + } + + /** + * @desc Check that the IUT processes the request when the authorized AE + * having not exceeded the limit for ATTRIBUTE_NAME in its m2mServiceSubscriptionProfile resource + * tries to perform OPERATION on the resource TARGET_RESOURCE_ADDRESS + * + */ + testcase TC_CSE_SSM_SSP_008_MAE() runs on Tester system CseSystem { + var AeSimu v_ae1 := AeSimu.create("AE1") alive; + + v_ae1.start(f_CSE_SSM_SSP_008_MAE()); + v_ae1.done; + } + + function f_CSE_SSM_SSP_008_MAE() runs on AeSimu system CseSystem { + + var integer v_subscriptionProfileIndex := -1; + + var template RequestPrimitive v_createServiceSubscriptionProfile := m_createM2mServiceSubscriptionProfileMaxValue1; // maxNumAEs 1 + var template RequestPrimitive v_request; + + // directly on CSEBase from superAE + v_subscriptionProfileIndex := f_cse_createResource(int11, v_createServiceSubscriptionProfile, -1); + + //Create Ae : Max 1 allowed as per SSP created above + //Assumtption/TODO: PX_ALLOWED_C_AE_IDS[0] is Linked to Subscription Profile created above + // NOTE: Its assumed that the CSE has the mapping of this AE with ServiceSubscriptionProfile + v_request := f_getCreateRequestPrimitive(int2, m_createAe(vc_aeSimuDesc.appId, omit, PX_ALLOWED_C_AE_IDS[0]), -1); + f_send(e_mcaPort, m_request(v_request)); + + tc_ac.start; + alt { + + // SUCCESSFULL CREATION + [] mcaPort.receive(mw_response(mw_responsePrimitive(int2001))) -> value vc_response { + + tc_ac.stop; + setverdict(pass, __SCOPE__ & ": Resource successfully created"); + + } + + [] mcaPort.receive(mw_response(mw_responsePrimitiveInverse(int2001))) -> value vc_response{ + tc_ac.stop; + setverdict(fail, __SCOPE__ & ": Request should successfully create instead of " & int2str(enum2int(vc_response.primitive.responsePrimitive.responseStatusCode))); + } + [] tc_ac.timeout { + setverdict(fail, __SCOPE__ & ": No answer while retrieving resource"); + } + } + + f_checkAeSimuStatus(); + + // Postamble + f_cse_postamble_deleteResources(); + + // Tear down + f_cf01Down(); + } + + + /** + * @desc Check that the IUT processes the request when the authorized AE + * having not exceeded the limit for ATTRIBUTE_NAME in its m2mServiceSubscriptionProfile resource + * tries to perform OPERATION on the resource TARGET_RESOURCE_ADDRESS + * + */ + testcase TC_CSE_SSM_SSP_008_MNC() runs on Tester system CseSystem { + var AeSimu v_ae1 := AeSimu.create("AE1") alive; + + v_ae1.start(f_CSE_SSM_SSP_008_MNC()); + v_ae1.done; + } + + function f_CSE_SSM_SSP_008_MNC() runs on AeSimu system CseSystem { + + var integer v_subscriptionProfileIndex := -1; + var integer v_aeIndex := -1; + var RequestPrimitive v_updateRequest; + + var template RequestPrimitive v_createServiceSubscriptionProfile := m_createM2mServiceSubscriptionProfileMaxValue1; + var template RequestPrimitive v_requestContainerCreate; + v_requestContainerCreate + // directly on CSEBase from superAE, Create serviceSubscriptionProfile with maxNumContainers = 1 + v_subscriptionProfileIndex := f_cse_createResource(int11, v_createServiceSubscriptionProfile, -1); + + // register one AE + // TODO: Link this AE to Subscription Profile created above + // NOTE: Its assumed that the CSE has the mapping of this AE with ServiceSubscriptionProfile + vc_ae2.start(f_cse_createResource(int2, m_createAe(vc_aeSimuDesc.appId, omit, PX_ALLOWED_C_AE_IDS[0]), -1)); + f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2); + + // Create container from same AE. maxNumContainers allowed 1 + v_aeIndex := f_getLatestResourceIndex(vc_ae2); + v_requestContainerCreate := f_getCreateRequestPrimitive(int3, m_createContainerBase, v_aeIndex); + v_requestContainerCreate.from_ := PX_ALLOWED_C_AE_IDS[0]; + + f_send(e_mcaPort, m_request(v_requestContainerCreate)); + + tc_ac.start; + alt { + + // SUCCESSFULL CREATION + [] mcaPort.receive(mw_response(mw_responsePrimitive(int2001))) -> value vc_response { + + tc_ac.stop; + setverdict(pass, __SCOPE__ & ": Resource successfully created"); + + } + + [] mcaPort.receive(mw_response(mw_responsePrimitiveInverse(int2001))) -> value vc_response{ + tc_ac.stop; + setverdict(fail, __SCOPE__ & ": Request should successfully create instead of " & int2str(enum2int(vc_response.primitive.responsePrimitive.responseStatusCode))); + } + [] tc_ac.timeout { + setverdict(fail, __SCOPE__ & ": No answer while retrieving resource"); + } + } + + f_checkAeSimuStatus(); + + // Postamble + f_cse_postamble_deleteResources(); + + // Tear down + f_cf01Down(); + } + + /** + * @desc Check that the IUT processes the request when the authorized AE + * having not exceeded the limit for ATTRIBUTE_NAME in its m2mServiceSubscriptionProfile resource + * tries to perform OPERATION on the resource TARGET_RESOURCE_ADDRESS + * + */ + testcase TC_CSE_SSM_SSP_008_MIC_CRE() runs on Tester system CseSystem { + var AeSimu v_ae1 := AeSimu.create("AE1") alive; + + v_ae1.start(f_CSE_SSM_SSP_008_MIC_CRE()); + v_ae1.done; + } + + function f_CSE_SSM_SSP_008_MIC_CRE() runs on AeSimu system CseSystem { + + var integer v_subscriptionProfileIndex := -1; + var integer v_aeIndex := -1; + var integer v_containerIndex := -1; + + var template RequestPrimitive v_createServiceSubscriptionProfile := m_createM2mServiceSubscriptionProfileMaxValue1; + var template RequestPrimitive v_createContentInstanceRequest := m_createContentInstanceBase; + var template RequestPrimitive v_createContainerRequest := m_createContainerBase; + var template RequestPrimitive v_request; + + // directly on CSEBase from superAE, Create serviceSubscriptionProfile with maxNumInstancesPerContainer = 1 + v_subscriptionProfileIndex := f_cse_createResource(int11, v_createServiceSubscriptionProfile, -1); + + // register one AE + // TODO: Link this AE to Subscription Profile created above + // NOTE: Its assumed that the CSE has the mapping of this AE with ServiceSubscriptionProfile + vc_ae2.start(f_cse_createResource(int2, m_createAe(vc_aeSimuDesc.appId, omit, PX_ALLOWED_C_AE_IDS[0]), -1)); + f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2); + + // Create one container + v_aeIndex := f_getLatestResourceIndex(vc_ae2); + v_createContainerRequest.from_ := PX_ALLOWED_C_AE_IDS[0]; + vc_ae2.start(f_cse_createResource(int3, v_createContainerRequest, v_aeIndex)); + f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2); + + + // Create 1 content instance from same AE. maxNumInstancesPerContainer allowed 1 + v_request := f_getCreateRequestPrimitive(int4, m_createContentInstanceBase, v_containerIndex); + f_send(e_mcaPort, m_request(v_request)); + + tc_ac.start; + alt { + + // SUCCESSFULL CREATION + [] mcaPort.receive(mw_response(mw_responsePrimitive(int2001))) -> value vc_response { + + tc_ac.stop; + setverdict(pass, __SCOPE__ & ": Resource successfully created"); + + } + + [] mcaPort.receive(mw_response(mw_responsePrimitiveInverse(int2001))) -> value vc_response{ + tc_ac.stop; + setverdict(fail, __SCOPE__ & ": Request should successfully create instead of " & int2str(enum2int(vc_response.primitive.responsePrimitive.responseStatusCode))); + } + [] tc_ac.timeout { + setverdict(fail, __SCOPE__ & ": No answer while retrieving resource"); + } + } + + + f_checkAeSimuStatus(); + + // Postamble + f_cse_postamble_deleteResources(); + + // Tear down + f_cf01Down(); + } + + /** + * @desc Check that the IUT processes the request when the authorized AE + * having not exceeded the limit for ATTRIBUTE_NAME in its m2mServiceSubscriptionProfile resource + * tries to perform OPERATION on the resource TARGET_RESOURCE_ADDRESS + * + */ + testcase TC_CSE_SSM_SSP_008_MNT() runs on Tester system CseSystem { + var AeSimu v_ae1 := AeSimu.create("AE1") alive; + + v_ae1.start(f_CSE_SSM_SSP_008_MNT()); + v_ae1.done; + } + + function f_CSE_SSM_SSP_008_MNT() runs on AeSimu system CseSystem { + + var integer v_subscriptionProfileIndex := -1; + var integer v_aeIndex := -1; + + var RequestPrimitive v_request; + + var template RequestPrimitive v_createServiceSubscriptionProfile := m_createM2mServiceSubscriptionProfileMaxValue1; + var template RequestPrimitive v_createTimeSeriesRequest := m_createTimeSeriesBase; + + // directly on CSEBase from superAE, Create serviceSubscriptionProfile with maxNumTimeSeries = 1 + v_subscriptionProfileIndex := f_cse_createResource(int11, v_createServiceSubscriptionProfile, -1); + + // register one AE + // TODO: Link this AE to Subscription Profile created above + // NOTE: Its assumed that the CSE has the mapping of this AE with ServiceSubscriptionProfile + vc_ae2.start(f_cse_createResource(int2, m_createAe(vc_aeSimuDesc.appId, omit, PX_ALLOWED_C_AE_IDS[0]), -1)); + f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2); + + // Create another TimeSeries container. maxNumTimeSeries allowed 1 + v_request := f_getCreateRequestPrimitive(int29, m_createTimeSeriesBase, v_aeIndex); + v_request.from_ := PX_ALLOWED_C_AE_IDS[0]; + f_send(e_mcaPort, m_request(v_request)); + + tc_ac.start; + alt { + + // SUCCESSFULL CREATION + [] mcaPort.receive(mw_response(mw_responsePrimitive(int2001))) -> value vc_response { + + tc_ac.stop; + setverdict(pass, __SCOPE__ & ": Resource successfully created"); + + } + + [] mcaPort.receive(mw_response(mw_responsePrimitiveInverse(int2001))) -> value vc_response{ + tc_ac.stop; + setverdict(fail, __SCOPE__ & ": Request should successfully create instead of " & int2str(enum2int(vc_response.primitive.responsePrimitive.responseStatusCode))); + } + [] tc_ac.timeout { + setverdict(fail, __SCOPE__ & ": No answer while retrieving resource"); + } + } + + f_checkAeSimuStatus(); + + // Postamble + f_cse_postamble_deleteResources(); + + // Tear down + f_cf01Down(); + } + + + /** + * @desc Check that the IUT processes the request when the authorized AE + * having not exceeded the limit for ATTRIBUTE_NAME in its m2mServiceSubscriptionProfile resource + * tries to perform OPERATION on the resource TARGET_RESOURCE_ADDRESS + * + */ + testcase TC_CSE_SSM_SSP_008_MMG_CRE() runs on Tester system CseSystem { + var AeSimu v_ae1 := AeSimu.create("AE1") alive; + + v_ae1.start(f_CSE_SSM_SSP_008_MMG_CRE()); + v_ae1.done; + } + + function f_CSE_SSM_SSP_008_MMG_CRE() runs on AeSimu system CseSystem { + + var integer v_subscriptionProfileIndex := -1; + var integer v_aeIndex := -1; + var integer v_containerOneIndex := -1; + + var RequestPrimitive v_request; + var ListOfURIs v_memberIDs; + + var template RequestPrimitive v_createServiceSubscriptionProfile := m_createM2mServiceSubscriptionProfileMaxValue1; + var template RequestPrimitive v_createContainerRequest := m_createContainerBase; + // directly on CSEBase from superAE, Create serviceSubscriptionProfile with maxMembersPerGroup = 1 + v_subscriptionProfileIndex := f_cse_createResource(int11, v_createServiceSubscriptionProfile, -1); + + // register one AE + // TODO: Link this AE to Subscription Profile created above + // NOTE: Its assumed that the CSE has the mapping of this AE with ServiceSubscriptionProfile + vc_ae2.start(f_cse_createResource(int2, m_createAe(vc_aeSimuDesc.appId, omit, PX_ALLOWED_C_AE_IDS[0]), -1)); + f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2); + + // Create one container + v_aeIndex := f_getLatestResourceIndex(vc_ae2); + v_createContainerRequest.from_ := PX_ALLOWED_C_AE_IDS[0]; + vc_ae2.start(f_cse_createResource(int3, v_createContainerRequest, v_aeIndex)); + + f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2); + v_containerOneIndex := f_getLatestResourceIndex(vc_ae2); + + + // Create one Group resource with 1 container above as members + v_memberIDs := { + f_getResourceId(vc_resourcesList[v_containerOneIndex].resource) + }; + + v_request := f_getCreateRequestPrimitive(int9, m_createGroup(1, v_memberIDs, omit, int2, -, omit,-), -1); + v_request.from_ := PX_ALLOWED_C_AE_IDS[0]; + f_send(e_mcaPort, m_request(v_request)); + + + tc_ac.start; + alt { + + // SUCCESSFULL CREATION + [] mcaPort.receive(mw_response(mw_responsePrimitive(int2001))) -> value vc_response { + + tc_ac.stop; + setverdict(pass, __SCOPE__ & ": Resource successfully created"); + + } + + [] mcaPort.receive(mw_response(mw_responsePrimitiveInverse(int2001))) -> value vc_response{ + tc_ac.stop; + setverdict(fail, __SCOPE__ & ": Request should successfully create instead of " & int2str(enum2int(vc_response.primitive.responsePrimitive.responseStatusCode))); + } + [] tc_ac.timeout { + setverdict(fail, __SCOPE__ & ": No answer while retrieving resource"); + } + } + + f_checkAeSimuStatus(); + + // Postamble + f_cse_postamble_deleteResources(); + + // Tear down + f_cf01Down(); + } + + /** + * @desc Check that the IUT processes the request when the authorized AE + * having not exceeded the limit for ATTRIBUTE_NAME in its m2mServiceSubscriptionProfile resource + * tries to perform OPERATION on the resource TARGET_RESOURCE_ADDRESS + * + */ + testcase TC_CSE_SSM_SSP_008_MNB() runs on Tester system CseSystem { + var AeSimu v_ae1 := AeSimu.create("AE1") alive; + + v_ae1.start(f_CSE_SSM_SSP_008_MNB()); + v_ae1.done; + } + + function f_CSE_SSM_SSP_008_MNB() runs on AeSimu system CseSystem { + + var integer v_subscriptionProfileIndex := -1; + var integer v_aeIndex := -1; + var integer v_containerIndex := -1; + var RequestPrimitive v_request; + + var template RequestPrimitive v_createServiceSubscriptionProfile := m_createM2mServiceSubscriptionProfileMaxNumBytes100; + var template RequestPrimitive v_createContainerRequest := m_createContainerBase; + var template RequestPrimitive v_createRequestContentInstance; + + var XSD.String v_instanceData := any2unistr(int2oct(1, 50)); //50Bytes + + // directly on CSEBase from superAE, Create serviceSubscriptionProfile with maxNumTimeSeries = 2 + v_subscriptionProfileIndex := f_cse_createResource(int11, v_createServiceSubscriptionProfile, -1); + + // register one AE + // TODO: Link this AE to Subscription Profile created above + // NOTE: Its assumed that the CSE has the mapping of this AE with ServiceSubscriptionProfile + vc_ae2.start(f_cse_createResource(int2, m_createAe(vc_aeSimuDesc.appId, omit, PX_ALLOWED_C_AE_IDS[0]), -1)); + f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2); + + // Create one container + v_aeIndex := f_getLatestResourceIndex(vc_ae2); + v_createContainerRequest.from_ := PX_ALLOWED_C_AE_IDS[0]; + vc_ae2.start(f_cse_createResource(int3, v_createContainerRequest, v_aeIndex)); + f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2); + + // Create another content instance with 50 bytes size. Max allowed 100 bytes + v_containerIndex := f_getLatestResourceIndex(vc_ae2); + v_createRequestContentInstance := m_createContentInstance(c_defaultContentInstanceResourceName, v_instanceData); + v_request := f_getCreateRequestPrimitive(int4, v_createRequestContentInstance, v_containerIndex); + f_send(e_mcaPort, m_request(v_request)); + + tc_ac.start; + alt { + + // SUCCESSFULL CREATION + [] mcaPort.receive(mw_response(mw_responsePrimitive(int2001))) -> value vc_response { + + tc_ac.stop; + setverdict(pass, __SCOPE__ & ": Resource successfully created"); + + } + + [] mcaPort.receive(mw_response(mw_responsePrimitiveInverse(int2001))) -> value vc_response{ + tc_ac.stop; + setverdict(fail, __SCOPE__ & ": Request should successfully create instead of " & int2str(enum2int(vc_response.primitive.responsePrimitive.responseStatusCode))); + } + [] tc_ac.timeout { + setverdict(fail, __SCOPE__ & ": No answer while retrieving resource"); + } + } + + f_checkAeSimuStatus(); + + // Postamble + f_cse_postamble_deleteResources(); + + // Tear down + f_cf01Down(); + } + + + + /** + * @desc Check that the IUT processes the request when the authorized AE + * having not exceeded the limit for ATTRIBUTE_NAME in its m2mServiceSubscriptionProfile resource + * tries to perform OPERATION on the resource TARGET_RESOURCE_ADDRESS + * + */ + testcase TC_CSE_SSM_SSP_008_MND() runs on Tester system CseSystem { + var AeSimu v_ae1 := AeSimu.create("AE1") alive; + + v_ae1.start(f_CSE_SSM_SSP_008_MND()); + v_ae1.done; + } + + function f_CSE_SSM_SSP_008_MND() runs on AeSimu system CseSystem { + + var integer v_subscriptionProfileIndex := -1; + var RequestPrimitive v_request; + var integer v_aeIndex := -1; + + var template RequestPrimitive v_createServiceSubscriptionProfile := m_createM2mServiceSubscriptionProfileMaxValue1; + var template RequestPrimitive v_createNodeRequest := m_createNodeBase; + + // directly on CSEBase from superAE, Create serviceSubscriptionProfile with maxNumNodes = 1 + v_subscriptionProfileIndex := f_cse_createResource(int11, v_createServiceSubscriptionProfile, -1); + + // register one AE + // TODO: Link this AE to Subscription Profile created above + // NOTE: Its assumed that the CSE has the mapping of this AE with ServiceSubscriptionProfile + vc_ae2.start(f_cse_createResource(int2, m_createAe(vc_aeSimuDesc.appId, omit, PX_ALLOWED_C_AE_IDS[0]), -1)); + f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2); + + + // Create 1 Node resource under CSEBase and maxNumNodes set to 1 + v_request := f_getCreateRequestPrimitive(int14, m_createNodeBase, -1); + v_request.from_ := PX_ALLOWED_C_AE_IDS[0]; + f_send(e_mcaPort, m_request(v_request)); + + + tc_ac.start; + alt { + + // SUCCESSFULL CREATION + [] mcaPort.receive(mw_response(mw_responsePrimitive(int2001))) -> value vc_response { + + tc_ac.stop; + setverdict(pass, __SCOPE__ & ": Resource successfully created"); + + } + + [] mcaPort.receive(mw_response(mw_responsePrimitiveInverse(int2001))) -> value vc_response{ + tc_ac.stop; + setverdict(fail, __SCOPE__ & ": Request should successfully create instead of " & int2str(enum2int(vc_response.primitive.responsePrimitive.responseStatusCode))); + } + [] tc_ac.timeout { + setverdict(fail, __SCOPE__ & ": No answer while retrieving resource"); + } + } + + + f_checkAeSimuStatus(); + + // Postamble + f_cse_postamble_deleteResources(); + + // Tear down + f_cf01Down(); + } + + /** + * @desc Check that the IUT processes the request when the authorized AE + * having not exceeded the limit for ATTRIBUTE_NAME in its m2mServiceSubscriptionProfile resource + * tries to perform OPERATION on the resource TARGET_RESOURCE_ADDRESS + * + */ + testcase TC_CSE_SSM_SSP_008_MNU() runs on Tester system CseSystem { + var AeSimu v_ae1 := AeSimu.create("AE1") alive; + + v_ae1.start(f_CSE_SSM_SSP_008_MNU()); + v_ae1.done; + } + + function f_CSE_SSM_SSP_008_MNU() runs on AeSimu system CseSystem { + + var integer v_subscriptionProfileIndex := -1; + var RequestPrimitive v_request; + var integer v_aeIndex := -1; + + var template RequestPrimitive v_createServiceSubscriptionProfile := m_createM2mServiceSubscriptionProfileMaxValue1; + var template RequestPrimitive v_createServiceSubscribedUserProfile := m_createServiceSubscribedUserProfileMaxValue1; + + // directly on CSEBase from superAE, Create serviceSubscriptionProfile with maxNumUsers = 1 + v_subscriptionProfileIndex := f_cse_createResource(int11, v_createServiceSubscriptionProfile, -1); + + // register one AE + // TODO: Link this AE to Subscription Profile created above + // NOTE: Its assumed that the CSE has the mapping of this AE with ServiceSubscriptionProfile + vc_ae2.start(f_cse_createResource(int2, m_createAe(vc_aeSimuDesc.appId, omit, PX_ALLOWED_C_AE_IDS[0]), -1)); + f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2); + + //// Create ServiceSubscriptionUserProfile, max allowed users associated with this Service Subscription Profile is 1 + v_request := f_getCreateRequestPrimitive(int52, v_createServiceSubscribedUserProfile, v_subscriptionProfileIndex); + v_request.from_ := PX_ALLOWED_C_AE_IDS[0]; + f_send(e_mcaPort, m_request(v_request)); + + tc_ac.start; + alt { + + // SUCCESSFULL CREATION + [] mcaPort.receive(mw_response(mw_responsePrimitive(int2001))) -> value vc_response { + + tc_ac.stop; + setverdict(pass, __SCOPE__ & ": Resource successfully created"); + + } + + [] mcaPort.receive(mw_response(mw_responsePrimitiveInverse(int2001))) -> value vc_response{ + tc_ac.stop; + setverdict(fail, __SCOPE__ & ": Request should successfully create instead of " & int2str(enum2int(vc_response.primitive.responsePrimitive.responseStatusCode))); + } + [] tc_ac.timeout { + setverdict(fail, __SCOPE__ & ": No answer while retrieving resource"); + } + } + + f_checkAeSimuStatus(); + + // Postamble + f_cse_postamble_deleteResources(); + + // Tear down + f_cf01Down(); + } + + + }// Basic_Operation + + + group Update { + + /** + * @desc Check that the IUT updates the value of the attributes activationTime, status, deactivationTime + * in <m2mserviceSubscriptionProfile> resource when activate attribute is set to TRUE in resource representation + * of UPDATE request + * + */ + testcase TC_CSE_SSM_SSP_UPD_001() runs on Tester system CseSystem { + var AeSimu v_ae1 := AeSimu.create("AE1") alive; + + v_ae1.start(f_CSE_SSM_SSP_UPD_001()); + v_ae1.done; + } + + function f_CSE_SSM_SSP_UPD_001() runs on AeSimu system CseSystem { + + var integer v_subscriptionProfileIndex := -1; + var RequestPrimitive v_updateRequest; + + var template RequestPrimitive v_createServiceSubscriptionProfile := m_createM2mServiceSubscriptionProfileDeactivated; + var template RequestPrimitive v_updateRequestPrimitive := m_updateServiceSubscriptionProfileActivated; + + // directly on CSEBase from superAE + v_subscriptionProfileIndex := f_cse_createResource(int11, v_createServiceSubscriptionProfile, -1); + + // Update ServiceSubscriptionProfile + v_updateRequest := f_getUpdateRequestPrimitive(int11, v_subscriptionProfileIndex, v_updateRequestPrimitive); + f_send(e_mcaPort, m_request(v_updateRequest)); + + tc_ac.start; + alt { + [] mcaPort.receive(mw_response(mw_responsePrimitive(int2004))) -> value vc_response { + + tc_ac.stop; + setverdict(pass, __SCOPE__ & ": m2mServiceSubscriptionProfile successfully Updated."); + + } + + [] mcaPort.receive(mw_response(mw_responsePrimitiveInverse(int2004))) -> value vc_response{ + tc_ac.stop; + setverdict(fail, __SCOPE__ & ": Error while updating m2mServiceSubscriptionProfile with status code " & int2str(enum2int(vc_response.primitive.responsePrimitive.responseStatusCode))); + } + [] tc_ac.timeout { + setverdict(fail, __SCOPE__ & ": No answer while retrieving resource"); + } + } + + // Verifiy that the ServiceSubscriptionProfile resource has been updated correctly: + // activate attribute set to TRUE + // activationTime attribute set to Current Time + // deactivationTime attribute set to Null + // status attribute set to ACTIVE + + vc_primitiveContentRetrievedResource := f_cse_retrieveResource(v_subscriptionProfileIndex); + + if(not(match(vc_primitiveContentRetrievedResource.m2mServiceSubscriptionProfile.Activate, true))) { + + setverdict(fail, __SCOPE__&":INFO: Retrieved ServiceSubscriptionProfile Activate is not TRUE"); + + } + + if(not(match(vc_primitiveContentRetrievedResource.m2mServiceSubscriptionProfile.activationTime, fx_generateTimestamp()))) { //getcurrentTime() + + setverdict(fail, __SCOPE__&":INFO: Retrieved ServiceSubscriptionProfile activationTime does not match with current time"); + + } + + if(not(match(vc_primitiveContentRetrievedResource.m2mServiceSubscriptionProfile.deactivationTime, null ))){ + + setverdict(fail, __SCOPE__&":INFO: Retrieved ServiceSubscriptionProfile deactivationTime does not match with null."); + + } + + if(not(match(vc_primitiveContentRetrievedResource.m2mServiceSubscriptionProfile.Status, active ))){ + + setverdict(fail, __SCOPE__&":INFO: Retrieved ServiceSubscriptionProfile does not has Status as ACTIVE in updated content."); + } + + f_checkAeSimuStatus(); + + // Postamble + f_cse_postamble_deleteResources(); + + // Tear down + f_cf01Down(); + } + + /** + * @desc Check that the IUT updates the value of the attributes deactivationTime, status when + * activate attribute is set to FALSE in resource representation of UPDATE request + * + */ + testcase TC_CSE_SSM_SSP_UPD_002() runs on Tester system CseSystem { + var AeSimu v_ae1 := AeSimu.create("AE1") alive; + + v_ae1.start(f_CSE_SSM_SSP_UPD_002()); + v_ae1.done; + } + + function f_CSE_SSM_SSP_UPD_002() runs on AeSimu system CseSystem { + + var integer v_subscriptionProfileIndex := -1; + var RequestPrimitive v_updateRequest; + + var template RequestPrimitive v_createServiceSubscriptionProfile := m_createM2mServiceSubscriptionProfileDeactivated; //activate default value false + var template RequestPrimitive v_updateRequestPrimitive := m_updateServiceSubscriptionProfileDeactivated; + + // directly on CSEBase from superAE + v_subscriptionProfileIndex := f_cse_createResource(int11, v_createServiceSubscriptionProfile, -1); + + // Update ServiceSubscriptionProfile + v_updateRequest := f_getUpdateRequestPrimitive(int11, v_subscriptionProfileIndex, v_updateRequestPrimitive); + f_send(e_mcaPort, m_request(v_updateRequest)); + + tc_ac.start; + alt { + [] mcaPort.receive(mw_response(mw_responsePrimitive(int2004))) -> value vc_response { + + tc_ac.stop; + setverdict(pass, __SCOPE__ & ": m2mServiceSubscriptionProfile successfully Updated."); + + } + + [] mcaPort.receive(mw_response(mw_responsePrimitiveInverse(int2004))) -> value vc_response{ + tc_ac.stop; + setverdict(fail, __SCOPE__ & ": Error while updating m2mServiceSubscriptionProfile with status code " & int2str(enum2int(vc_response.primitive.responsePrimitive.responseStatusCode))); + } + [] tc_ac.timeout { + setverdict(fail, __SCOPE__ & ": No answer while retrieving resource"); + } + } + + // Verifiy that the ServiceSubscriptionProfile resource has been updated correctly: + // activate attribute set to FALSE + // deactivationTime attribute set to Current Time + // status attribute set to INACTIVE + + vc_primitiveContentRetrievedResource := f_cse_retrieveResource(v_subscriptionProfileIndex); + + if(not(match(vc_primitiveContentRetrievedResource.m2mServiceSubscriptionProfile.Activate, false))) { + + setverdict(fail, __SCOPE__&":INFO: Retrieved ServiceSubscriptionProfile Activate is not FALSE"); + + } + + + if(not(match(vc_primitiveContentRetrievedResource.m2mServiceSubscriptionProfile.deactivationTime, fx_generateTimestamp() ))){ //getCurrentTime() + + setverdict(fail, __SCOPE__&":INFO: Retrieved ServiceSubscriptionProfile deactivationTime does not match current time"); + + } + + if(not(match(vc_primitiveContentRetrievedResource.m2mServiceSubscriptionProfile.Status, inactive ))){ + + setverdict(fail, __SCOPE__&":INFO: Retrieved ServiceSubscriptionProfile does not has Status as INACTIVE in updated content."); + } + + f_checkAeSimuStatus(); + + // Postamble + f_cse_postamble_deleteResources(); + + // Tear down + f_cf01Down(); + } + + /** + * @desc Check that the IUT overrides the value of the attribute ATTRIBUTE_NAME with the current limit + * when the value provided in the resource representation of the UPDATE request is less than the current limit. + * + */ + testcase TC_CSE_SSM_SSP_UPD_003_MAE() runs on Tester system CseSystem { + var AeSimu v_ae1 := AeSimu.create("AE1") alive; + + v_ae1.start(f_CSE_SSM_SSP_UPD_003_MAE()); + v_ae1.done; + } + + function f_CSE_SSM_SSP_UPD_003_MAE() runs on AeSimu system CseSystem { + + var integer v_subscriptionProfileIndex := -1; + var RequestPrimitive v_updateRequest; + var M2mServiceSubscriptionProfile_optional m2mServiceSubscriptionProfile; + + var template RequestPrimitive v_createServiceSubscriptionProfile := m_createM2mServiceSubscriptionProfileMaxValue2; // maxNumAEs 2 + var template RequestPrimitive v_updateRequestPrimitive := m_updateServiceSubscriptionProfileMaxNumAEsZero; + + // directly on CSEBase from superAE + v_subscriptionProfileIndex := f_cse_createResource(int11, v_createServiceSubscriptionProfile, -1); + + // register one AE + // TODO: Link this AE to Subscription Profile created above + // NOTE: Its assumed that the CSE has the mapping of this AE with ServiceSubscriptionProfile + vc_ae2.start(f_cse_createResource(int2, m_createAe(vc_aeSimuDesc.appId, omit, PX_ALLOWED_C_AE_IDS[0]), -1)); + f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2); + + // Update ServiceSubscriptionProfile and make maxNumAEs to 0 + v_updateRequest := f_getUpdateRequestPrimitive(int11, v_subscriptionProfileIndex, v_updateRequestPrimitive); +// v_updateRequest.from_ := PX_ALLOWED_C_AE_IDS[0]; + + f_send(e_mcaPort, m_request(v_updateRequest)); + + tc_ac.start; + alt { + [] mcaPort.receive(mw_response(mw_responsePrimitive(int2004))) -> value vc_response { + + tc_ac.stop; + setverdict(pass, __SCOPE__ & ": m2mServiceSubscriptionProfile successfully Updated."); + + } + + [] mcaPort.receive(mw_response(mw_responsePrimitiveInverse(int2004))) -> value vc_response{ + tc_ac.stop; + setverdict(fail, __SCOPE__ & ": Error while updating m2mServiceSubscriptionProfile with status code " & int2str(enum2int(vc_response.primitive.responsePrimitive.responseStatusCode))); + } + [] tc_ac.timeout { + setverdict(fail, __SCOPE__ & ": No answer while retrieving resource"); + } + } + + // Verifiy that the ServiceSubscriptionProfile resource has been updated correctly: + // maxNumAEs = currentNumberOfAE (1 in this case) + + vc_primitiveContentRetrievedResource := f_cse_retrieveResource(v_subscriptionProfileIndex); + m2mServiceSubscriptionProfile := vc_primitiveContentRetrievedResource.m2mServiceSubscriptionProfile; + + if(not(match(m2mServiceSubscriptionProfile.maxNumAEs, m2mServiceSubscriptionProfile.currentNumAEs))) { + + setverdict(fail, __SCOPE__&":INFO: Retrieved ServiceSubscriptionProfile maxNumAEs should be equal to currentNumberOfAEs"); + + } + + f_checkAeSimuStatus(); + + // Postamble + f_cse_postamble_deleteResources(); + + // Tear down + f_cf01Down(); + } + + /** + * @desc Check that the IUT overrides the value of the attribute ATTRIBUTE_NAME with the current limit + * when the value provided in the resource representation of the UPDATE request is less than the current limit. + * + */ + testcase TC_CSE_SSM_SSP_UPD_003_MNC() runs on Tester system CseSystem { + var AeSimu v_ae1 := AeSimu.create("AE1") alive; + + v_ae1.start(f_CSE_SSM_SSP_UPD_003_MNC()); + v_ae1.done; + } + + function f_CSE_SSM_SSP_UPD_003_MNC() runs on AeSimu system CseSystem { + + var integer v_subscriptionProfileIndex := -1; + var integer v_aeIndex := -1; + var RequestPrimitive v_updateRequest; + + var template RequestPrimitive v_createServiceSubscriptionProfile := m_createM2mServiceSubscriptionProfileMaxValue2; + var template RequestPrimitive v_updateRequestPrimitive := m_updateServiceSubscriptionProfileMaxNumContainersZero; + var template RequestPrimitive v_createRequestContainer := m_createContainerBase; + + // directly on CSEBase from superAE, Create serviceSubscriptionProfile with maxNumContainers = 2 + v_subscriptionProfileIndex := f_cse_createResource(int11, v_createServiceSubscriptionProfile, -1); + + // register one AE + // TODO: Link this AE to Subscription Profile created above + // NOTE: Its assumed that the CSE has the mapping of this AE with ServiceSubscriptionProfile + vc_ae2.start(f_cse_createResource(int2, m_createAe(vc_aeSimuDesc.appId, omit, PX_ALLOWED_C_AE_IDS[0]), -1)); + f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2); + + // Create one container + v_aeIndex := f_getLatestResourceIndex(vc_ae2); + v_createRequestContainer.from_ := PX_ALLOWED_C_AE_IDS[0]; + vc_ae2.start(f_cse_createResource(int3, v_createRequestContainer, v_aeIndex)); + f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2); + + // Update ServiceSubscriptionProfile and make maxNumContainers to 0 + v_updateRequest := f_getUpdateRequestPrimitive(int11, v_subscriptionProfileIndex, v_updateRequestPrimitive); + f_send(e_mcaPort, m_request(v_updateRequest)); + + tc_ac.start; + alt { + [] mcaPort.receive(mw_response(mw_responsePrimitive(int2004))) -> value vc_response { + + tc_ac.stop; + setverdict(pass, __SCOPE__ & ": m2mServiceSubscriptionProfile successfully Updated."); + + } + + [] mcaPort.receive(mw_response(mw_responsePrimitiveInverse(int2004))) -> value vc_response{ + tc_ac.stop; + setverdict(fail, __SCOPE__ & ": Error while updating m2mServiceSubscriptionProfile with status code " & int2str(enum2int(vc_response.primitive.responsePrimitive.responseStatusCode))); + } + [] tc_ac.timeout { + setverdict(fail, __SCOPE__ & ": No answer while retrieving resource"); + } + } + + // Verifiy that the ServiceSubscriptionProfile resource has been updated correctly: + // maxNumContainers = currentNumContainers (1 in this case) + + vc_primitiveContentRetrievedResource := f_cse_retrieveResource(v_subscriptionProfileIndex); + + if(not(match(vc_primitiveContentRetrievedResource.m2mServiceSubscriptionProfile.maxNumContainers, 1))) { + + setverdict(fail, __SCOPE__&":INFO: Retrieved ServiceSubscriptionProfile maxNumContainers should be equal to currentNumContainers (1 in this case)"); + + } + + f_checkAeSimuStatus(); + + // Postamble + f_cse_postamble_deleteResources(); + + // Tear down + f_cf01Down(); + } + + /** + * @desc Check that the IUT overrides the value of the attribute ATTRIBUTE_NAME with the current limit + * when the value provided in the resource representation of the UPDATE request is less than the current limit. + * + */ + testcase TC_CSE_SSM_SSP_UPD_003_MNI() runs on Tester system CseSystem { + var AeSimu v_ae1 := AeSimu.create("AE1") alive; + + v_ae1.start(f_CSE_SSM_SSP_UPD_003_MNI()); + v_ae1.done; + } + + function f_CSE_SSM_SSP_UPD_003_MNI() runs on AeSimu system CseSystem { + + var integer v_subscriptionProfileIndex := -1; + var integer v_aeIndex := -1; + var RequestPrimitive v_updateRequest; + + var template RequestPrimitive v_createServiceSubscriptionProfile := m_createM2mServiceSubscriptionProfileMaxValue2; + var template RequestPrimitive v_updateRequestPrimitive := m_updateServiceSubscriptionProfileMaxNumInstancesPerContainerOne; + + // directly on CSEBase from superAE, Create serviceSubscriptionProfile with maxNumInstancesPerContainer = 2 + v_subscriptionProfileIndex := f_cse_createResource(int11, v_createServiceSubscriptionProfile, -1); + + // register one AE + // TODO: Link this AE to Subscription Profile created above + // NOTE: Its assumed that the CSE has the mapping of this AE with ServiceSubscriptionProfile + vc_ae2.start(f_cse_createResource(int2, m_createAe(vc_aeSimuDesc.appId, omit, PX_ALLOWED_C_AE_IDS[0]), -1)); + f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2); + + // Create container and 2 content instances under + v_aeIndex := f_getLatestResourceIndex(vc_ae2); + //// Create 2 container instances + //trigger 1k bytes data storage 200 bytes of data at 100 bytes at time + // Operations to generate charging info - AE2 stores total 200 bytes of data at 100 bytes at time + vc_ae2.start(f_cse_createContentAndInstances(200, 100, v_aeIndex)); + f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2); + + // Update ServiceSubscriptionProfile and make maxNumInstancesPerContainer to 1 + v_updateRequest := f_getUpdateRequestPrimitive(int11, v_subscriptionProfileIndex, v_updateRequestPrimitive); + f_send(e_mcaPort, m_request(v_updateRequest)); + + + tc_ac.start; + alt { + [] mcaPort.receive(mw_response(mw_responsePrimitive(int2004))) -> value vc_response { + + tc_ac.stop; + setverdict(pass, __SCOPE__ & ": m2mServiceSubscriptionProfile successfully Updated."); + + } + + [] mcaPort.receive(mw_response(mw_responsePrimitiveInverse(int2004))) -> value vc_response{ + tc_ac.stop; + setverdict(fail, __SCOPE__ & ": Error while updating m2mServiceSubscriptionProfile with status code " & int2str(enum2int(vc_response.primitive.responsePrimitive.responseStatusCode))); + } + [] tc_ac.timeout { + setverdict(fail, __SCOPE__ & ": No answer while retrieving resource"); + } + } + + // Verifiy that the ServiceSubscriptionProfile resource has been updated correctly: + // maxNumInstancesPerContainer = currentNumInstancesPerContainer (1 in this case) + + vc_primitiveContentRetrievedResource := f_cse_retrieveResource(v_subscriptionProfileIndex); + + if(not(match(vc_primitiveContentRetrievedResource.m2mServiceSubscriptionProfile.maxNumInstancesPerContainer, 2))) { + + setverdict(fail, __SCOPE__&":INFO: Retrieved ServiceSubscriptionProfile maxNumInstancesPerContainer should be equal to currentNumInstancesPerContainer (2 in this case)"); + + } + + f_checkAeSimuStatus(); + + // Postamble + f_cse_postamble_deleteResources(); + + // Tear down + f_cf01Down(); + } + + /** + * @desc Check that the IUT overrides the value of the attribute ATTRIBUTE_NAME with the current limit + * when the value provided in the resource representation of the UPDATE request is less than the current limit. + * + */ + testcase TC_CSE_SSM_SSP_UPD_003_MNT() runs on Tester system CseSystem { + var AeSimu v_ae1 := AeSimu.create("AE1") alive; + + v_ae1.start(f_CSE_SSM_SSP_UPD_003_MNT()); + v_ae1.done; + } + + function f_CSE_SSM_SSP_UPD_003_MNT() runs on AeSimu system CseSystem { + + var integer v_subscriptionProfileIndex := -1; + var integer v_aeIndex := -1; + + var RequestPrimitive v_updateRequest; + + var template RequestPrimitive v_createServiceSubscriptionProfile := m_createM2mServiceSubscriptionProfileMaxValue2; + var template RequestPrimitive v_updateRequestPrimitive := m_updateServiceSubscriptionProfileMaxNumTimeSeriesZero; + var template RequestPrimitive v_createTimeSeriesRequest := m_createTimeSeriesBase; + var template RequestPrimitive v_createRequestContainer := m_createContainerBase; + + // directly on CSEBase from superAE, Create serviceSubscriptionProfile with maxNumTimeSeries = 2 + v_subscriptionProfileIndex := f_cse_createResource(int11, v_createServiceSubscriptionProfile, -1); + + // register one AE + // TODO: Link this AE to Subscription Profile created above + // NOTE: Its assumed that the CSE has the mapping of this AE with ServiceSubscriptionProfile + vc_ae2.start(f_cse_createResource(int2, m_createAe(vc_aeSimuDesc.appId, omit, PX_ALLOWED_C_AE_IDS[0]), -1)); + f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2); + + // Create one TimeSeries container + v_aeIndex := f_getLatestResourceIndex(vc_ae2); + v_createTimeSeriesRequest.from_ := PX_ALLOWED_C_AE_IDS[0]; + vc_ae2.start(f_cse_createResource(int29, v_createTimeSeriesRequest, v_aeIndex)); + f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2); + + // Update ServiceSubscriptionProfile and make maxNumTimeSeries to 0 + v_updateRequest := f_getUpdateRequestPrimitive(int11, v_subscriptionProfileIndex, v_updateRequestPrimitive); + f_send(e_mcaPort, m_request(v_updateRequest)); + + tc_ac.start; + alt { + [] mcaPort.receive(mw_response(mw_responsePrimitive(int2004))) -> value vc_response { + + tc_ac.stop; + setverdict(pass, __SCOPE__ & ": m2mServiceSubscriptionProfile successfully Updated."); + + } + + [] mcaPort.receive(mw_response(mw_responsePrimitiveInverse(int2004))) -> value vc_response{ + tc_ac.stop; + setverdict(fail, __SCOPE__ & ": Error while updating m2mServiceSubscriptionProfile with status code " & int2str(enum2int(vc_response.primitive.responsePrimitive.responseStatusCode))); + } + [] tc_ac.timeout { + setverdict(fail, __SCOPE__ & ": No answer while retrieving resource"); + } + } + + // Verifiy that the ServiceSubscriptionProfile resource has been updated correctly: + // maxNumTimeSeries = currentNumTimeSeries (1 in this case) + + vc_primitiveContentRetrievedResource := f_cse_retrieveResource(v_subscriptionProfileIndex); + + if(not(match(vc_primitiveContentRetrievedResource.m2mServiceSubscriptionProfile.maxNumTimeSeries, 1))) { + + setverdict(fail, __SCOPE__&":INFO: Retrieved ServiceSubscriptionProfile maxNumTimeSeries should be equal to currentNumTimeSeries (1 in this case)"); + + } + + f_checkAeSimuStatus(); + + // Postamble + f_cse_postamble_deleteResources(); + + // Tear down + f_cf01Down(); + } + + /** + * @desc Check that the IUT overrides the value of the attribute ATTRIBUTE_NAME with the current limit + * when the value provided in the resource representation of the UPDATE request is less than the current limit. + * + */ + testcase TC_CSE_SSM_SSP_UPD_003_MIT() runs on Tester system CseSystem { + var AeSimu v_ae1 := AeSimu.create("AE1") alive; + + v_ae1.start(f_CSE_SSM_SSP_UPD_003_MIT()); + v_ae1.done; + } + + function f_CSE_SSM_SSP_UPD_003_MIT() runs on AeSimu system CseSystem { + + var integer v_subscriptionProfileIndex := -1; + var integer v_aeIndex := -1; + + var RequestPrimitive v_updateRequest; + + var template RequestPrimitive v_createServiceSubscriptionProfile := m_createM2mServiceSubscriptionProfileMaxValue2; + var template RequestPrimitive v_updateRequestPrimitive := m_updateServiceSubscriptionProfileMaxNumInstancesPerTimeSeriesZero; + var template RequestPrimitive v_createTimeSeriesRequest := m_createTimeSeriesBase; + // directly on CSEBase from superAE, Create serviceSubscriptionProfile with maxNumInstancesPerContainer = 2 + v_subscriptionProfileIndex := f_cse_createResource(int11, v_createServiceSubscriptionProfile, -1); + + // register one AE + // TODO: Link this AE to Subscription Profile created above + // NOTE: Its assumed that the CSE has the mapping of this AE with ServiceSubscriptionProfile + vc_ae2.start(f_cse_createResource(int2, m_createAe(vc_aeSimuDesc.appId, omit, PX_ALLOWED_C_AE_IDS[0]), -1)); + f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2); + + // Create TimeSeries and 1 TimeSeriesInstance under + v_aeIndex := f_getLatestResourceIndex(vc_ae2); + v_createTimeSeriesRequest.from_ := PX_ALLOWED_C_AE_IDS[0]; + vc_ae2.start(f_CSE_DMR_CRE_001(int30, m_createTimeSeriesInstanceBase, v_createTimeSeriesRequest));//TimeSeriesInstance + f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2); + + + // Update ServiceSubscriptionProfile and make maxNumInstancesPerTimeSeries to 0 + v_updateRequest := f_getUpdateRequestPrimitive(int11, v_subscriptionProfileIndex, v_updateRequestPrimitive); + f_send(e_mcaPort, m_request(v_updateRequest)); + + + tc_ac.start; + alt { + [] mcaPort.receive(mw_response(mw_responsePrimitive(int2004))) -> value vc_response { + + tc_ac.stop; + setverdict(pass, __SCOPE__ & ": m2mServiceSubscriptionProfile successfully Updated."); + + } + + [] mcaPort.receive(mw_response(mw_responsePrimitiveInverse(int2004))) -> value vc_response{ + tc_ac.stop; + setverdict(fail, __SCOPE__ & ": Error while updating m2mServiceSubscriptionProfile with status code " & int2str(enum2int(vc_response.primitive.responsePrimitive.responseStatusCode))); + } + [] tc_ac.timeout { + setverdict(fail, __SCOPE__ & ": No answer while retrieving resource"); + } + } + + // Verifiy that the ServiceSubscriptionProfile resource has been updated correctly: + // maxNumInstancesPerTimeSeries = currentNumInstancesPerTimeSeries (1 in this case) + + vc_primitiveContentRetrievedResource := f_cse_retrieveResource(v_subscriptionProfileIndex); + + if(not(match(vc_primitiveContentRetrievedResource.m2mServiceSubscriptionProfile.maxNumInstancesPerTimeSeries, 1))) { + + setverdict(fail, __SCOPE__&":INFO: Retrieved ServiceSubscriptionProfile maxNumInstancesPerTimeSeries should be equal to currentNumInstancesPerTimeSeries (1 in this case)"); + + } + + f_checkAeSimuStatus(); + + // Postamble + f_cse_postamble_deleteResources(); + + // Tear down + f_cf01Down(); + } + + /** + * @desc Check that the IUT overrides the value of the attribute ATTRIBUTE_NAME with the current limit + * when the value provided in the resource representation of the UPDATE request is less than the current limit. + * + */ + testcase TC_CSE_SSM_SSP_UPD_003_MMG() runs on Tester system CseSystem { + var AeSimu v_ae1 := AeSimu.create("AE1") alive; + + v_ae1.start(f_CSE_SSM_SSP_UPD_003_MMG()); + v_ae1.done; + } + + function f_CSE_SSM_SSP_UPD_003_MMG() runs on AeSimu system CseSystem { + + var integer v_subscriptionProfileIndex := -1; + var RequestPrimitive v_updateRequest; + var ListOfURIs v_memberIDs; + + var template RequestPrimitive v_createServiceSubscriptionProfile := m_createM2mServiceSubscriptionProfileMaxValue2; + var template RequestPrimitive v_updateRequestPrimitive := m_updateServiceSubscriptionProfileMaxMembersPerGroupZero; + + var template RequestPrimitive v_createGroupRequest; + + // directly on CSEBase from superAE, Create serviceSubscriptionProfile with maxNumTimeSeries = 2 + v_subscriptionProfileIndex := f_cse_createResource(int11, v_createServiceSubscriptionProfile, -1); + + // register one AE + // TODO: Link this AE to Subscription Profile created above + // NOTE: Its assumed that the CSE has the mapping of this AE with ServiceSubscriptionProfile + vc_ae2.start(f_cse_createResource(int2, m_createAe(vc_aeSimuDesc.appId, omit, PX_ALLOWED_C_AE_IDS[0]), -1)); + f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2); + + // Create one Group resource having one AE as member + v_memberIDs := {f_getLatestResourceAddress(vc_ae2)}; + v_createGroupRequest := m_createGroup(2, v_memberIDs, omit, int2, -, omit,-); + v_createGroupRequest.from_ := PX_ALLOWED_C_AE_IDS[0]; + + vc_ae2.start(f_cse_createResource(int9, v_createGroupRequest, -1)); + f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2); + + + // Update ServiceSubscriptionProfile and make maxMembersPerGroup to 0 + v_updateRequest := f_getUpdateRequestPrimitive(int11, v_subscriptionProfileIndex, v_updateRequestPrimitive); + f_send(e_mcaPort, m_request(v_updateRequest)); + + tc_ac.start; + alt { + [] mcaPort.receive(mw_response(mw_responsePrimitive(int2004))) -> value vc_response { + + tc_ac.stop; + setverdict(pass, __SCOPE__ & ": m2mServiceSubscriptionProfile successfully Updated."); + + } + + [] mcaPort.receive(mw_response(mw_responsePrimitiveInverse(int2004))) -> value vc_response{ + tc_ac.stop; + setverdict(fail, __SCOPE__ & ": Error while updating m2mServiceSubscriptionProfile with status code " & int2str(enum2int(vc_response.primitive.responsePrimitive.responseStatusCode))); + } + [] tc_ac.timeout { + setverdict(fail, __SCOPE__ & ": No answer while retrieving resource"); + } + } + + // Verifiy that the ServiceSubscriptionProfile resource has been updated correctly: + // maxNumTimeSeries = currentNumTimeSeries (1 in this case) + + vc_primitiveContentRetrievedResource := f_cse_retrieveResource(v_subscriptionProfileIndex); + + if(not(match(vc_primitiveContentRetrievedResource.m2mServiceSubscriptionProfile.maxMembersPerGroup, 1))) { + + setverdict(fail, __SCOPE__&":INFO: Retrieved ServiceSubscriptionProfile maxMembersPerGroup should be equal to current Members in group already created (1 in this case)"); + + } + + f_checkAeSimuStatus(); + + // Postamble + f_cse_postamble_deleteResources(); + + // Tear down + f_cf01Down(); + } + + /** + * @desc Check that the IUT overrides the value of the attribute ATTRIBUTE_NAME with the current limit + * when the value provided in the resource representation of the UPDATE request is less than the current limit. + * + */ + testcase TC_CSE_SSM_SSP_UPD_003_MNB() runs on Tester system CseSystem { + var AeSimu v_ae1 := AeSimu.create("AE1") alive; + + v_ae1.start(f_CSE_SSM_SSP_UPD_003_MNB()); + v_ae1.done; + } + + function f_CSE_SSM_SSP_UPD_003_MNB() runs on AeSimu system CseSystem { + + var integer v_subscriptionProfileIndex := -1; + var RequestPrimitive v_updateRequest; + var integer v_aeIndex := -1; + + var template RequestPrimitive v_createServiceSubscriptionProfile := m_createM2mServiceSubscriptionProfileMaxNumBytes200; + var template RequestPrimitive v_updateRequestPrimitive := m_updateServiceSubscriptionProfileMaxNumBytes100; + + // directly on CSEBase from superAE, Create serviceSubscriptionProfile with maxNumTimeSeries = 2 + v_subscriptionProfileIndex := f_cse_createResource(int11, v_createServiceSubscriptionProfile, -1); + + // register one AE + // TODO: Link this AE to Subscription Profile created above + // NOTE: Its assumed that the CSE has the mapping of this AE with ServiceSubscriptionProfile + vc_ae2.start(f_cse_createResource(int2, m_createAe(vc_aeSimuDesc.appId, omit, PX_ALLOWED_C_AE_IDS[0]), -1)); + f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2); + + + //// Create 2 container instances saving 200 bytes of data + + //trigger 1k bytes data storage 200 bytes of data at 100 bytes at time + // Operations to generate charging info - AE2 stores total 200 bytes of data at 100 bytes at time + v_aeIndex := f_getLatestResourceIndex(vc_ae2); + vc_ae2.start(f_cse_createContentAndInstances(200, 100, v_aeIndex)); + f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2); + + + // Update ServiceSubscriptionProfile and make maxNumBytes to 100 + v_updateRequest := f_getUpdateRequestPrimitive(int11, v_subscriptionProfileIndex, v_updateRequestPrimitive); + f_send(e_mcaPort, m_request(v_updateRequest)); + + tc_ac.start; + alt { + [] mcaPort.receive(mw_response(mw_responsePrimitive(int2004))) -> value vc_response { + + tc_ac.stop; + setverdict(pass, __SCOPE__ & ": m2mServiceSubscriptionProfile successfully Updated."); + + } + + [] mcaPort.receive(mw_response(mw_responsePrimitiveInverse(int2004))) -> value vc_response{ + tc_ac.stop; + setverdict(fail, __SCOPE__ & ": Error while updating m2mServiceSubscriptionProfile with status code " & int2str(enum2int(vc_response.primitive.responsePrimitive.responseStatusCode))); + } + [] tc_ac.timeout { + setverdict(fail, __SCOPE__ & ": No answer while retrieving resource"); + } + } + + // Verifiy that the ServiceSubscriptionProfile resource has been updated correctly: + // maxNumBytes = currentNumBytes (200 in this case) + + vc_primitiveContentRetrievedResource := f_cse_retrieveResource(v_subscriptionProfileIndex); + + if(not(match(vc_primitiveContentRetrievedResource.m2mServiceSubscriptionProfile.maxNumBytes, 200))) { + + setverdict(fail, __SCOPE__&":INFO: Retrieved ServiceSubscriptionProfile maxNumBytes should be equal to currentNumBytes already created (200 in this case)"); + + } + + f_checkAeSimuStatus(); + + // Postamble + f_cse_postamble_deleteResources(); + + // Tear down + f_cf01Down(); + } + + + + /** + * @desc Check that the IUT overrides the value of the attribute ATTRIBUTE_NAME with the current limit + * when the value provided in the resource representation of the UPDATE request is less than the current limit. + * + */ + testcase TC_CSE_SSM_SSP_UPD_003_MND() runs on Tester system CseSystem { + var AeSimu v_ae1 := AeSimu.create("AE1") alive; + + v_ae1.start(f_CSE_SSM_SSP_UPD_003_MND()); + v_ae1.done; + } + + function f_CSE_SSM_SSP_UPD_003_MND() runs on AeSimu system CseSystem { + + var integer v_subscriptionProfileIndex := -1; + var RequestPrimitive v_updateRequest; + var integer v_aeIndex := -1; + + var template RequestPrimitive v_createServiceSubscriptionProfile := m_createM2mServiceSubscriptionProfileMaxValue2; + var template RequestPrimitive v_updateRequestPrimitive := m_updateServiceSubscriptionProfileMaxNumNodesZero; + var template RequestPrimitive v_createNodeRequest := m_createNodeBase; + + // directly on CSEBase from superAE, Create serviceSubscriptionProfile with maxNumNodes = 2 + v_subscriptionProfileIndex := f_cse_createResource(int11, v_createServiceSubscriptionProfile, -1); + + // register one AE + // TODO: Link this AE to Subscription Profile created above + // NOTE: Its assumed that the CSE has the mapping of this AE with ServiceSubscriptionProfile + vc_ae2.start(f_cse_createResource(int2, m_createAe(vc_aeSimuDesc.appId, omit, PX_ALLOWED_C_AE_IDS[0]), -1)); + f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2); + + + //// Create 1 Node resource under CSEBase + v_createNodeRequest.primitiveContent.node.resourceName := omit; + v_createNodeRequest.from_ := PX_ALLOWED_C_AE_IDS[0]; + + vc_ae2.start(f_CSE_DMR_CRE_001(int14, v_createNodeRequest, -));//Node + f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2); + + // Update ServiceSubscriptionProfile and make maxNumNodes to 0 + v_updateRequest := f_getUpdateRequestPrimitive(int11, v_subscriptionProfileIndex, v_updateRequestPrimitive); + f_send(e_mcaPort, m_request(v_updateRequest)); + + tc_ac.start; + alt { + [] mcaPort.receive(mw_response(mw_responsePrimitive(int2004))) -> value vc_response { + + tc_ac.stop; + setverdict(pass, __SCOPE__ & ": m2mServiceSubscriptionProfile successfully Updated."); + + } + + [] mcaPort.receive(mw_response(mw_responsePrimitiveInverse(int2004))) -> value vc_response{ + tc_ac.stop; + setverdict(fail, __SCOPE__ & ": Error while updating m2mServiceSubscriptionProfile with status code " & int2str(enum2int(vc_response.primitive.responsePrimitive.responseStatusCode))); + } + [] tc_ac.timeout { + setverdict(fail, __SCOPE__ & ": No answer while retrieving resource"); + } + } + + // Verifiy that the ServiceSubscriptionProfile resource has been updated correctly: + // maxNumNodes = currentNumBytes (1 in this case) + + vc_primitiveContentRetrievedResource := f_cse_retrieveResource(v_subscriptionProfileIndex); + + if(not(match(vc_primitiveContentRetrievedResource.m2mServiceSubscriptionProfile.maxNumNodes, 1))) { + + setverdict(fail, __SCOPE__&":INFO: Retrieved ServiceSubscriptionProfile maxNumNodes should be equal to currentNumBytes already created (1 in this case)"); + + } + + f_checkAeSimuStatus(); + + // Postamble + f_cse_postamble_deleteResources(); + + // Tear down + f_cf01Down(); + } + + /** + * @desc Check that the IUT overrides the value of the attribute ATTRIBUTE_NAME with the current limit + * when the value provided in the resource representation of the UPDATE request is less than the current limit. + * + */ + testcase TC_CSE_SSM_SSP_UPD_003_MNU() runs on Tester system CseSystem { + var AeSimu v_ae1 := AeSimu.create("AE1") alive; + + v_ae1.start(f_CSE_SSM_SSP_UPD_003_MNU()); + v_ae1.done; + } + + function f_CSE_SSM_SSP_UPD_003_MNU() runs on AeSimu system CseSystem { + + var integer v_subscriptionProfileIndex := -1; + var RequestPrimitive v_updateRequest; + var integer v_aeIndex := -1; + + var template RequestPrimitive v_createServiceSubscriptionProfile := m_createM2mServiceSubscriptionProfileMaxValue1; + var template RequestPrimitive v_updateRequestPrimitive := m_updateServiceSubscriptionProfileMaxNumUsersZero; + var template RequestPrimitive v_createServiceSubscribedUserProfile := m_createServiceSubscribedUserProfileMaxValue1; + + // directly on CSEBase from superAE, Create serviceSubscriptionProfile with maxNumUsers = 1 + v_subscriptionProfileIndex := f_cse_createResource(int11, v_createServiceSubscriptionProfile, -1); + + // register one AE + // TODO: Link this AE to Subscription Profile created above + // NOTE: Its assumed that the CSE has the mapping of this AE with ServiceSubscriptionProfile + vc_ae2.start(f_cse_createResource(int2, m_createAe(vc_aeSimuDesc.appId, omit, PX_ALLOWED_C_AE_IDS[0]), -1)); + f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2); + + + //// Create 1 ServiceSubscriptionUserProfile i.e 1 user associated with this Service Subscription Profile + v_createServiceSubscribedUserProfile.from_ := PX_ALLOWED_C_AE_IDS[0]; + vc_ae2.start(f_cse_createResource(int52, v_createServiceSubscribedUserProfile, v_subscriptionProfileIndex)); + f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2); + + // Update ServiceSubscriptionProfile and make maxNumUsers to 0 + v_updateRequest := f_getUpdateRequestPrimitive(int11, v_subscriptionProfileIndex, v_updateRequestPrimitive); + f_send(e_mcaPort, m_request(v_updateRequest)); + + tc_ac.start; + alt { + [] mcaPort.receive(mw_response(mw_responsePrimitive(int2004))) -> value vc_response { + + tc_ac.stop; + setverdict(pass, __SCOPE__ & ": m2mServiceSubscriptionProfile successfully Updated."); + + } + + [] mcaPort.receive(mw_response(mw_responsePrimitiveInverse(int2004))) -> value vc_response{ + tc_ac.stop; + setverdict(fail, __SCOPE__ & ": Error while updating m2mServiceSubscriptionProfile with status code " & int2str(enum2int(vc_response.primitive.responsePrimitive.responseStatusCode))); + } + [] tc_ac.timeout { + setverdict(fail, __SCOPE__ & ": No answer while retrieving resource"); + } + } + + // Verifiy that the ServiceSubscriptionProfile resource has been updated correctly: + // maxNumUsers = current M2M Service Users associated with this M2M Service Subscription. (1 in this case) + + vc_primitiveContentRetrievedResource := f_cse_retrieveResource(v_subscriptionProfileIndex); + + if(not(match(vc_primitiveContentRetrievedResource.m2mServiceSubscriptionProfile.maxNumUsers, 1))) { + + setverdict(fail, __SCOPE__&":INFO: Retrieved ServiceSubscriptionProfile maxNumUsers should be equal to current M2M Service Users associated with this M2M Service Subscription (1 in this case)"); + + } + + f_checkAeSimuStatus(); + + // Postamble + f_cse_postamble_deleteResources(); + + // Tear down + f_cf01Down(); + } + + + /** + * @desc Check that the IUT updates successfully the value of the attribute ATTRIBUTE_NAME of the TARGET_RESOURCE_ADDRESS + * resource, when the value provided in the resource representation of the UPDATE request is more than the current limit. + * + */ + testcase TC_CSE_SSM_SSP_UPD_004_MAE() runs on Tester system CseSystem { + var AeSimu v_ae1 := AeSimu.create("AE1") alive; + + v_ae1.start(f_CSE_SSM_SSP_UPD_004_MAE()); + v_ae1.done; + } + + function f_CSE_SSM_SSP_UPD_004_MAE() runs on AeSimu system CseSystem { + + var integer v_subscriptionProfileIndex := -1; + var RequestPrimitive v_updateRequest; + var M2mServiceSubscriptionProfile_optional m2mServiceSubscriptionProfile; + + var template RequestPrimitive v_createServiceSubscriptionProfile := m_createM2mServiceSubscriptionProfileMaxValue1; // maxNumAEs 1 + var template RequestPrimitive v_updateRequestPrimitive := m_updateServiceSubscriptionProfileMaxNumAEs2; + + // directly on CSEBase from superAE + v_subscriptionProfileIndex := f_cse_createResource(int11, v_createServiceSubscriptionProfile, -1); + + // register one AE + // TODO: Link this AE to Subscription Profile created above + // NOTE: Its assumed that the CSE has the mapping of this AE with ServiceSubscriptionProfile + vc_ae2.start(f_cse_createResource(int2, m_createAe(vc_aeSimuDesc.appId, omit, PX_ALLOWED_C_AE_IDS[0]), -1)); + f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2); + + + // Update ServiceSubscriptionProfile and make maxNumAEs to 2 + v_updateRequest := f_getUpdateRequestPrimitive(int11, v_subscriptionProfileIndex, v_updateRequestPrimitive); + f_send(e_mcaPort, m_request(v_updateRequest)); + + tc_ac.start; + alt { + [] mcaPort.receive(mw_response(mw_responsePrimitive(int2004))) -> value vc_response { + + tc_ac.stop; + setverdict(pass, __SCOPE__ & ": m2mServiceSubscriptionProfile successfully Updated."); + + } + + [] mcaPort.receive(mw_response(mw_responsePrimitiveInverse(int2004))) -> value vc_response{ + tc_ac.stop; + setverdict(fail, __SCOPE__ & ": Error while updating m2mServiceSubscriptionProfile with status code " & int2str(enum2int(vc_response.primitive.responsePrimitive.responseStatusCode))); + } + [] tc_ac.timeout { + setverdict(fail, __SCOPE__ & ": No answer while retrieving resource"); + } + } + + // Verifiy that the ServiceSubscriptionProfile resource has been updated correctly: + // maxNumAEs = 2 (1 in this case) + + vc_primitiveContentRetrievedResource := f_cse_retrieveResource(v_subscriptionProfileIndex); + m2mServiceSubscriptionProfile := vc_primitiveContentRetrievedResource.m2mServiceSubscriptionProfile; + + if(not(match(m2mServiceSubscriptionProfile.maxNumAEs, 2))) { + + setverdict(fail, __SCOPE__&":INFO: Retrieved ServiceSubscriptionProfile maxNumAEs should be equal to 2"); + + } + + f_checkAeSimuStatus(); + + // Postamble + f_cse_postamble_deleteResources(); + + // Tear down + f_cf01Down(); + } + + /** + * @desc Check that the IUT updates successfully the value of the attribute ATTRIBUTE_NAME of the TARGET_RESOURCE_ADDRESS + * resource, when the value provided in the resource representation of the UPDATE request is more than the current limit. + * + */ + testcase TC_CSE_SSM_SSP_UPD_004_MNC() runs on Tester system CseSystem { + var AeSimu v_ae1 := AeSimu.create("AE1") alive; + + v_ae1.start(f_CSE_SSM_SSP_UPD_004_MNC()); + v_ae1.done; + } + + function f_CSE_SSM_SSP_UPD_004_MNC() runs on AeSimu system CseSystem { + + var integer v_subscriptionProfileIndex := -1; + var integer v_aeIndex := -1; + var RequestPrimitive v_updateRequest; + + var template RequestPrimitive v_createServiceSubscriptionProfile := m_createM2mServiceSubscriptionProfileMaxValue1; + var template RequestPrimitive v_updateRequestPrimitive := m_updateServiceSubscriptionProfileMaxNumContainers2; + var template RequestPrimitive v_createRequestContainer := m_createContainerBase; + + // directly on CSEBase from superAE, Create serviceSubscriptionProfile with maxNumContainers = 1 + v_subscriptionProfileIndex := f_cse_createResource(int11, v_createServiceSubscriptionProfile, -1); + + // register one AE + // TODO: Link this AE to Subscription Profile created above + // NOTE: Its assumed that the CSE has the mapping of this AE with ServiceSubscriptionProfile + vc_ae2.start(f_cse_createResource(int2, m_createAe(vc_aeSimuDesc.appId, omit, PX_ALLOWED_C_AE_IDS[0]), -1)); + f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2); + + // Create one container + v_aeIndex := f_getLatestResourceIndex(vc_ae2); + v_createRequestContainer.from_ := PX_ALLOWED_C_AE_IDS[0]; + vc_ae2.start(f_cse_createResource(int3, v_createRequestContainer, v_aeIndex)); + f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2); + + // Update ServiceSubscriptionProfile and make maxNumContainers to 2 + v_updateRequest := f_getUpdateRequestPrimitive(int11, v_subscriptionProfileIndex, v_updateRequestPrimitive); + f_send(e_mcaPort, m_request(v_updateRequest)); + + tc_ac.start; + alt { + [] mcaPort.receive(mw_response(mw_responsePrimitive(int2004))) -> value vc_response { + + tc_ac.stop; + setverdict(pass, __SCOPE__ & ": m2mServiceSubscriptionProfile successfully Updated."); + + } + + [] mcaPort.receive(mw_response(mw_responsePrimitiveInverse(int2004))) -> value vc_response{ + tc_ac.stop; + setverdict(fail, __SCOPE__ & ": Error while updating m2mServiceSubscriptionProfile with status code " & int2str(enum2int(vc_response.primitive.responsePrimitive.responseStatusCode))); + } + [] tc_ac.timeout { + setverdict(fail, __SCOPE__ & ": No answer while retrieving resource"); + } + } + + // Verifiy that the ServiceSubscriptionProfile resource has been updated correctly: + // maxNumContainers = 2 + + vc_primitiveContentRetrievedResource := f_cse_retrieveResource(v_subscriptionProfileIndex); + + if(not(match(vc_primitiveContentRetrievedResource.m2mServiceSubscriptionProfile.maxNumContainers, 2))) { + + setverdict(fail, __SCOPE__&":INFO: Retrieved ServiceSubscriptionProfile maxNumContainers should be equal to 2"); + + } + + f_checkAeSimuStatus(); + + // Postamble + f_cse_postamble_deleteResources(); + + // Tear down + f_cf01Down(); + } + + /** + * @desc Check that the IUT updates successfully the value of the attribute ATTRIBUTE_NAME of the TARGET_RESOURCE_ADDRESS + * resource, when the value provided in the resource representation of the UPDATE request is more than the current limit. + * + */ + testcase TC_CSE_SSM_SSP_UPD_004_MNI() runs on Tester system CseSystem { + var AeSimu v_ae1 := AeSimu.create("AE1") alive; + + v_ae1.start(f_CSE_SSM_SSP_UPD_004_MNI()); + v_ae1.done; + } + + function f_CSE_SSM_SSP_UPD_004_MNI() runs on AeSimu system CseSystem { + + var integer v_subscriptionProfileIndex := -1; + var integer v_aeIndex := -1; + var RequestPrimitive v_updateRequest; + + var template RequestPrimitive v_createServiceSubscriptionProfile := m_createM2mServiceSubscriptionProfileMaxValue2; + var template RequestPrimitive v_updateRequestPrimitive := m_updateServiceSubscriptionProfileMaxNumInstancesPerContainer3; + + // directly on CSEBase from superAE, Create serviceSubscriptionProfile with maxNumInstancesPerContainer = 2 + v_subscriptionProfileIndex := f_cse_createResource(int11, v_createServiceSubscriptionProfile, -1); + + // register one AE + // TODO: Link this AE to Subscription Profile created above + // NOTE: Its assumed that the CSE has the mapping of this AE with ServiceSubscriptionProfile + vc_ae2.start(f_cse_createResource(int2, m_createAe(vc_aeSimuDesc.appId, omit, PX_ALLOWED_C_AE_IDS[0]), -1)); + f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2); + + // Create container and 2 content instances under + v_aeIndex := f_getLatestResourceIndex(vc_ae2); + //// Create 2 container instances + //trigger 1k bytes data storage 200 bytes of data at 100 bytes at time + // Operations to generate charging info - AE2 stores total 200 bytes of data at 100 bytes at time + vc_ae2.start(f_cse_createContentAndInstances(200, 100, v_aeIndex)); + f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2); + + // Update ServiceSubscriptionProfile and make maxNumInstancesPerContainer to 3 + v_updateRequest := f_getUpdateRequestPrimitive(int11, v_subscriptionProfileIndex, v_updateRequestPrimitive); + f_send(e_mcaPort, m_request(v_updateRequest)); + + + tc_ac.start; + alt { + [] mcaPort.receive(mw_response(mw_responsePrimitive(int2004))) -> value vc_response { + + tc_ac.stop; + setverdict(pass, __SCOPE__ & ": m2mServiceSubscriptionProfile successfully Updated."); + + } + + [] mcaPort.receive(mw_response(mw_responsePrimitiveInverse(int2004))) -> value vc_response{ + tc_ac.stop; + setverdict(fail, __SCOPE__ & ": Error while updating m2mServiceSubscriptionProfile with status code " & int2str(enum2int(vc_response.primitive.responsePrimitive.responseStatusCode))); + } + [] tc_ac.timeout { + setverdict(fail, __SCOPE__ & ": No answer while retrieving resource"); + } + } + + // Verifiy that the ServiceSubscriptionProfile resource has been updated correctly: + // maxNumInstancesPerContainer = 3 + + vc_primitiveContentRetrievedResource := f_cse_retrieveResource(v_subscriptionProfileIndex); + + if(not(match(vc_primitiveContentRetrievedResource.m2mServiceSubscriptionProfile.maxNumInstancesPerContainer, 3))) { + + setverdict(fail, __SCOPE__&":INFO: Retrieved ServiceSubscriptionProfile maxNumInstancesPerContainer should be equal to 3"); + + } + + f_checkAeSimuStatus(); + + // Postamble + f_cse_postamble_deleteResources(); + + // Tear down + f_cf01Down(); + } + + /** + * @desc Check that the IUT updates successfully the value of the attribute ATTRIBUTE_NAME of the TARGET_RESOURCE_ADDRESS + * resource, when the value provided in the resource representation of the UPDATE request is more than the current limit. + * + */ + testcase TC_CSE_SSM_SSP_UPD_004_MNT() runs on Tester system CseSystem { + var AeSimu v_ae1 := AeSimu.create("AE1") alive; + + v_ae1.start(f_CSE_SSM_SSP_UPD_004_MNT()); + v_ae1.done; + } + + function f_CSE_SSM_SSP_UPD_004_MNT() runs on AeSimu system CseSystem { + + var integer v_subscriptionProfileIndex := -1; + var integer v_aeIndex := -1; + + var RequestPrimitive v_updateRequest; + + var template RequestPrimitive v_createServiceSubscriptionProfile := m_createM2mServiceSubscriptionProfileMaxValue2; + var template RequestPrimitive v_updateRequestPrimitive := m_updateServiceSubscriptionProfileMaxNumTimeSeries3; + + var template RequestPrimitive v_createTimeSeriesRequest := m_createTimeSeriesBase; + + // directly on CSEBase from superAE, Create serviceSubscriptionProfile with maxNumTimeSeries = 2 + v_subscriptionProfileIndex := f_cse_createResource(int11, v_createServiceSubscriptionProfile, -1); + + // register one AE + // TODO: Link this AE to Subscription Profile created above + // NOTE: Its assumed that the CSE has the mapping of this AE with ServiceSubscriptionProfile + vc_ae2.start(f_cse_createResource(int2, m_createAe(vc_aeSimuDesc.appId, omit, PX_ALLOWED_C_AE_IDS[0]), -1)); + f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2); + + // Create one TimeSeries container + v_aeIndex := f_getLatestResourceIndex(vc_ae2); + v_createTimeSeriesRequest.from_ := PX_ALLOWED_C_AE_IDS[0]; + vc_ae2.start(f_cse_createResource(int29, v_createTimeSeriesRequest, v_aeIndex)); + f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2); + + // Update ServiceSubscriptionProfile and make maxNumTimeSeries to 3 + v_updateRequest := f_getUpdateRequestPrimitive(int11, v_subscriptionProfileIndex, v_updateRequestPrimitive); + f_send(e_mcaPort, m_request(v_updateRequest)); + + tc_ac.start; + alt { + [] mcaPort.receive(mw_response(mw_responsePrimitive(int2004))) -> value vc_response { + + tc_ac.stop; + setverdict(pass, __SCOPE__ & ": m2mServiceSubscriptionProfile successfully Updated."); + + } + + [] mcaPort.receive(mw_response(mw_responsePrimitiveInverse(int2004))) -> value vc_response{ + tc_ac.stop; + setverdict(fail, __SCOPE__ & ": Error while updating m2mServiceSubscriptionProfile with status code " & int2str(enum2int(vc_response.primitive.responsePrimitive.responseStatusCode))); + } + [] tc_ac.timeout { + setverdict(fail, __SCOPE__ & ": No answer while retrieving resource"); + } + } + + // Verifiy that the ServiceSubscriptionProfile resource has been updated correctly: + // maxNumTimeSeries = 3 + + vc_primitiveContentRetrievedResource := f_cse_retrieveResource(v_subscriptionProfileIndex); + + if(not(match(vc_primitiveContentRetrievedResource.m2mServiceSubscriptionProfile.maxNumTimeSeries, 3))) { + + setverdict(fail, __SCOPE__&":INFO: Retrieved ServiceSubscriptionProfile maxNumTimeSeries should be equal to updated value (3)"); + + } + + f_checkAeSimuStatus(); + + // Postamble + f_cse_postamble_deleteResources(); + + // Tear down + f_cf01Down(); + } + + /** + * @desc Check that the IUT updates successfully the value of the attribute ATTRIBUTE_NAME of the TARGET_RESOURCE_ADDRESS + * resource, when the value provided in the resource representation of the UPDATE request is more than the current limit. + * + */ + testcase TC_CSE_SSM_SSP_UPD_004_MIT() runs on Tester system CseSystem { + var AeSimu v_ae1 := AeSimu.create("AE1") alive; + + v_ae1.start(f_CSE_SSM_SSP_UPD_004_MIT()); + v_ae1.done; + } + + function f_CSE_SSM_SSP_UPD_004_MIT() runs on AeSimu system CseSystem { + + var integer v_subscriptionProfileIndex := -1; + var integer v_aeIndex := -1; + + var RequestPrimitive v_updateRequest; + + var template RequestPrimitive v_createServiceSubscriptionProfile := m_createM2mServiceSubscriptionProfileMaxValue2; + var template RequestPrimitive v_updateRequestPrimitive := m_updateServiceSubscriptionProfileMaxNumInstancesPerTimeSeries3; + var template RequestPrimitive v_createTimeSeriesRequest := m_createTimeSeriesBase; + // directly on CSEBase from superAE, Create serviceSubscriptionProfile with maxNumInstancesPerContainer = 2 + v_subscriptionProfileIndex := f_cse_createResource(int11, v_createServiceSubscriptionProfile, -1); + + // register one AE + // TODO: Link this AE to Subscription Profile created above + // NOTE: Its assumed that the CSE has the mapping of this AE with ServiceSubscriptionProfile + vc_ae2.start(f_cse_createResource(int2, m_createAe(vc_aeSimuDesc.appId, omit, PX_ALLOWED_C_AE_IDS[0]), -1)); + f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2); + + // Create TimeSeries and 1 TimeSeriesInstance under + v_aeIndex := f_getLatestResourceIndex(vc_ae2); + v_createTimeSeriesRequest.from_ := PX_ALLOWED_C_AE_IDS[0]; + + vc_ae2.start(f_CSE_DMR_CRE_001(int30, m_createTimeSeriesInstanceBase, v_createTimeSeriesRequest));//TimeSeriesInstance + f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2); + + + // Update ServiceSubscriptionProfile and make maxNumInstancesPerTimeSeries to 3 + v_updateRequest := f_getUpdateRequestPrimitive(int11, v_subscriptionProfileIndex, v_updateRequestPrimitive); + f_send(e_mcaPort, m_request(v_updateRequest)); + + + tc_ac.start; + alt { + [] mcaPort.receive(mw_response(mw_responsePrimitive(int2004))) -> value vc_response { + + tc_ac.stop; + setverdict(pass, __SCOPE__ & ": m2mServiceSubscriptionProfile successfully Updated."); + + } + + [] mcaPort.receive(mw_response(mw_responsePrimitiveInverse(int2004))) -> value vc_response{ + tc_ac.stop; + setverdict(fail, __SCOPE__ & ": Error while updating m2mServiceSubscriptionProfile with status code " & int2str(enum2int(vc_response.primitive.responsePrimitive.responseStatusCode))); + } + [] tc_ac.timeout { + setverdict(fail, __SCOPE__ & ": No answer while retrieving resource"); + } + } + + // Verifiy that the ServiceSubscriptionProfile resource has been updated correctly: + // maxNumInstancesPerTimeSeries = 3 + + vc_primitiveContentRetrievedResource := f_cse_retrieveResource(v_subscriptionProfileIndex); + + if(not(match(vc_primitiveContentRetrievedResource.m2mServiceSubscriptionProfile.maxNumInstancesPerTimeSeries, 3))) { + + setverdict(fail, __SCOPE__&":INFO: Retrieved ServiceSubscriptionProfile maxNumInstancesPerTimeSeries should be equal to updated value (3)"); + + } + + f_checkAeSimuStatus(); + + // Postamble + f_cse_postamble_deleteResources(); + + // Tear down + f_cf01Down(); + } + + /** + * @desc Check that the IUT updates successfully the value of the attribute ATTRIBUTE_NAME of the TARGET_RESOURCE_ADDRESS + * resource, when the value provided in the resource representation of the UPDATE request is more than the current limit. + * + */ + testcase TC_CSE_SSM_SSP_UPD_004_MMG() runs on Tester system CseSystem { + var AeSimu v_ae1 := AeSimu.create("AE1") alive; + + v_ae1.start(f_CSE_SSM_SSP_UPD_004_MMG()); + v_ae1.done; + } + + function f_CSE_SSM_SSP_UPD_004_MMG() runs on AeSimu system CseSystem { + + var integer v_subscriptionProfileIndex := -1; + var RequestPrimitive v_updateRequest; + var ListOfURIs v_memberIDs; + + var template RequestPrimitive v_createServiceSubscriptionProfile := m_createM2mServiceSubscriptionProfileMaxValue2; + var template RequestPrimitive v_updateRequestPrimitive := m_updateServiceSubscriptionProfileMaxMembersPerGroup3; + var template RequestPrimitive v_createGroupRequest; + + var template RequestPrimitive v_createRequestContainer := m_createContainerBase; + + // directly on CSEBase from superAE, Create serviceSubscriptionProfile with maxNumTimeSeries = 2 + v_subscriptionProfileIndex := f_cse_createResource(int11, v_createServiceSubscriptionProfile, -1); + + // register one AE + // TODO: Link this AE to Subscription Profile created above + // NOTE: Its assumed that the CSE has the mapping of this AE with ServiceSubscriptionProfile + vc_ae2.start(f_cse_createResource(int2, m_createAe(vc_aeSimuDesc.appId, omit, PX_ALLOWED_C_AE_IDS[0]), -1)); + f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2); + + // Create one Group resource container + v_memberIDs := {f_getLatestResourceAddress(vc_ae2)}; + v_createGroupRequest := m_createGroup(2, v_memberIDs, omit, int2, -, omit,-); + v_createGroupRequest.from_ := PX_ALLOWED_C_AE_IDS[0]; + vc_ae2.start(f_cse_createResource(int9, v_createGroupRequest, -1)); + f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2); + + + // Update ServiceSubscriptionProfile and make maxMembersPerGroup to 3 + v_updateRequest := f_getUpdateRequestPrimitive(int11, v_subscriptionProfileIndex, v_updateRequestPrimitive); + f_send(e_mcaPort, m_request(v_updateRequest)); + + tc_ac.start; + alt { + [] mcaPort.receive(mw_response(mw_responsePrimitive(int2004))) -> value vc_response { + + tc_ac.stop; + setverdict(pass, __SCOPE__ & ": m2mServiceSubscriptionProfile successfully Updated."); + + } + + [] mcaPort.receive(mw_response(mw_responsePrimitiveInverse(int2004))) -> value vc_response{ + tc_ac.stop; + setverdict(fail, __SCOPE__ & ": Error while updating m2mServiceSubscriptionProfile with status code " & int2str(enum2int(vc_response.primitive.responsePrimitive.responseStatusCode))); + } + [] tc_ac.timeout { + setverdict(fail, __SCOPE__ & ": No answer while retrieving resource"); + } + } + + // Verifiy that the ServiceSubscriptionProfile resource has been updated correctly: + // maxNumTimeSeries = 3 + + vc_primitiveContentRetrievedResource := f_cse_retrieveResource(v_subscriptionProfileIndex); + + if(not(match(vc_primitiveContentRetrievedResource.m2mServiceSubscriptionProfile.maxMembersPerGroup, 3))) { + + setverdict(fail, __SCOPE__&":INFO: Retrieved ServiceSubscriptionProfile maxMembersPerGroup should be equal to 3 (updated value)"); + + } + + f_checkAeSimuStatus(); + + // Postamble + f_cse_postamble_deleteResources(); + + // Tear down + f_cf01Down(); + } + + /** + * @desc Check that the IUT updates successfully the value of the attribute ATTRIBUTE_NAME of the TARGET_RESOURCE_ADDRESS + * resource, when the value provided in the resource representation of the UPDATE request is more than the current limit. + * + */ + testcase TC_CSE_SSM_SSP_UPD_004_MNB() runs on Tester system CseSystem { + var AeSimu v_ae1 := AeSimu.create("AE1") alive; + + v_ae1.start(f_CSE_SSM_SSP_UPD_004_MNB()); + v_ae1.done; + } + + function f_CSE_SSM_SSP_UPD_004_MNB() runs on AeSimu system CseSystem { + + var integer v_subscriptionProfileIndex := -1; + var RequestPrimitive v_updateRequest; + var integer v_aeIndex := -1; + + var template RequestPrimitive v_createServiceSubscriptionProfile := m_createM2mServiceSubscriptionProfileMaxNumBytes200; + var template RequestPrimitive v_updateRequestPrimitive := m_updateServiceSubscriptionProfileMaxNumBytes300; + + // directly on CSEBase from superAE, Create serviceSubscriptionProfile with maxNumBytes = 200 + v_subscriptionProfileIndex := f_cse_createResource(int11, v_createServiceSubscriptionProfile, -1); + + // register one AE + // TODO: Link this AE to Subscription Profile created above + // NOTE: Its assumed that the CSE has the mapping of this AE with ServiceSubscriptionProfile + vc_ae2.start(f_cse_createResource(int2, m_createAe(vc_aeSimuDesc.appId, omit, PX_ALLOWED_C_AE_IDS[0]), -1)); + f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2); + + + //// Create 2 container instances saving 200 bytes of data + + //trigger 1k bytes data storage 200 bytes of data at 100 bytes at time + // Operations to generate charging info - AE2 stores total 200 bytes of data at 100 bytes at time + v_aeIndex := f_getLatestResourceIndex(vc_ae2); + vc_ae2.start(f_cse_createContentAndInstances(200, 100, v_aeIndex)); + f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2); + + + // Update ServiceSubscriptionProfile and make maxNumBytes to 300 + v_updateRequest := f_getUpdateRequestPrimitive(int11, v_subscriptionProfileIndex, v_updateRequestPrimitive); + f_send(e_mcaPort, m_request(v_updateRequest)); + + tc_ac.start; + alt { + [] mcaPort.receive(mw_response(mw_responsePrimitive(int2004))) -> value vc_response { + + tc_ac.stop; + setverdict(pass, __SCOPE__ & ": m2mServiceSubscriptionProfile successfully Updated."); + + } + + [] mcaPort.receive(mw_response(mw_responsePrimitiveInverse(int2004))) -> value vc_response{ + tc_ac.stop; + setverdict(fail, __SCOPE__ & ": Error while updating m2mServiceSubscriptionProfile with status code " & int2str(enum2int(vc_response.primitive.responsePrimitive.responseStatusCode))); + } + [] tc_ac.timeout { + setverdict(fail, __SCOPE__ & ": No answer while retrieving resource"); + } + } + + // Verifiy that the ServiceSubscriptionProfile resource has been updated correctly: + // maxNumBytes = updatedValue (300 in this case) + + vc_primitiveContentRetrievedResource := f_cse_retrieveResource(v_subscriptionProfileIndex); + + if(not(match(vc_primitiveContentRetrievedResource.m2mServiceSubscriptionProfile.maxNumBytes, 300))) { + + setverdict(fail, __SCOPE__&":INFO: Retrieved ServiceSubscriptionProfile maxNumBytes should be equal to 300"); + + } + + f_checkAeSimuStatus(); + + // Postamble + f_cse_postamble_deleteResources(); + + // Tear down + f_cf01Down(); + } + + + + /** + * @desc Check that the IUT updates successfully the value of the attribute ATTRIBUTE_NAME of the TARGET_RESOURCE_ADDRESS + * resource, when the value provided in the resource representation of the UPDATE request is more than the current limit. + * + */ + testcase TC_CSE_SSM_SSP_UPD_004_MND() runs on Tester system CseSystem { + var AeSimu v_ae1 := AeSimu.create("AE1") alive; + + v_ae1.start(f_CSE_SSM_SSP_UPD_004_MND()); + v_ae1.done; + } + + function f_CSE_SSM_SSP_UPD_004_MND() runs on AeSimu system CseSystem { + + var integer v_subscriptionProfileIndex := -1; + var RequestPrimitive v_updateRequest; + var integer v_aeIndex := -1; + + var template RequestPrimitive v_createServiceSubscriptionProfile := m_createM2mServiceSubscriptionProfileMaxValue2; + var template RequestPrimitive v_updateRequestPrimitive := m_updateServiceSubscriptionProfileMaxNumNodes3; + var template RequestPrimitive v_createNodeRequest := m_createNodeBase; + + // directly on CSEBase from superAE, Create serviceSubscriptionProfile with maxNumNodes = 2 + v_subscriptionProfileIndex := f_cse_createResource(int11, v_createServiceSubscriptionProfile, -1); + + // register one AE + // TODO: Link this AE to Subscription Profile created above + // NOTE: Its assumed that the CSE has the mapping of this AE with ServiceSubscriptionProfile + vc_ae2.start(f_cse_createResource(int2, m_createAe(vc_aeSimuDesc.appId, omit, PX_ALLOWED_C_AE_IDS[0]), -1)); + f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2); + + + //// Create 1 Node resource under CSEBase + v_createNodeRequest.primitiveContent.node.resourceName := omit; + v_createNodeRequest.from_ := PX_ALLOWED_C_AE_IDS[0]; + vc_ae2.start(f_CSE_DMR_CRE_001(int14, v_createNodeRequest, -));//Node + f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2); + + // Update ServiceSubscriptionProfile and make maxNumNodes to 3 + v_updateRequest := f_getUpdateRequestPrimitive(int11, v_subscriptionProfileIndex, v_updateRequestPrimitive); + f_send(e_mcaPort, m_request(v_updateRequest)); + + tc_ac.start; + alt { + [] mcaPort.receive(mw_response(mw_responsePrimitive(int2004))) -> value vc_response { + + tc_ac.stop; + setverdict(pass, __SCOPE__ & ": m2mServiceSubscriptionProfile successfully Updated."); + + } + + [] mcaPort.receive(mw_response(mw_responsePrimitiveInverse(int2004))) -> value vc_response{ + tc_ac.stop; + setverdict(fail, __SCOPE__ & ": Error while updating m2mServiceSubscriptionProfile with status code " & int2str(enum2int(vc_response.primitive.responsePrimitive.responseStatusCode))); + } + [] tc_ac.timeout { + setverdict(fail, __SCOPE__ & ": No answer while retrieving resource"); + } + } + + // Verifiy that the ServiceSubscriptionProfile resource has been updated correctly: + // maxNumNodes = currentNumBytes (1 in this case) + + vc_primitiveContentRetrievedResource := f_cse_retrieveResource(v_subscriptionProfileIndex); + + if(not(match(vc_primitiveContentRetrievedResource.m2mServiceSubscriptionProfile.maxNumNodes, 3))) { + + setverdict(fail, __SCOPE__&":INFO: Retrieved ServiceSubscriptionProfile maxNumNodes should be equal to updated value (3)"); + + } + + f_checkAeSimuStatus(); + + // Postamble + f_cse_postamble_deleteResources(); + + // Tear down + f_cf01Down(); + } + + /** + * @desc Check that the IUT updates successfully the value of the attribute ATTRIBUTE_NAME of the TARGET_RESOURCE_ADDRESS + * resource, when the value provided in the resource representation of the UPDATE request is more than the current limit. + * + */ + testcase TC_CSE_SSM_SSP_UPD_004_MNU() runs on Tester system CseSystem { + var AeSimu v_ae1 := AeSimu.create("AE1") alive; + + v_ae1.start(f_CSE_SSM_SSP_UPD_004_MNU()); + v_ae1.done; + } + + function f_CSE_SSM_SSP_UPD_004_MNU() runs on AeSimu system CseSystem { + + var integer v_subscriptionProfileIndex := -1; + var RequestPrimitive v_updateRequest; + var integer v_aeIndex := -1; + + var template RequestPrimitive v_createServiceSubscriptionProfile := m_createM2mServiceSubscriptionProfileMaxValue1; + var template RequestPrimitive v_updateRequestPrimitive := m_updateServiceSubscriptionProfileMaxNumUsers2; + var template RequestPrimitive v_createServiceSubscribedUserProfile := m_createServiceSubscribedUserProfileMaxValue1; + + // directly on CSEBase from superAE, Create serviceSubscriptionProfile with maxNumUsers = 1 + v_subscriptionProfileIndex := f_cse_createResource(int11, v_createServiceSubscriptionProfile, -1); + + // register one AE + // TODO: Link this AE to Subscription Profile created above + // NOTE: Its assumed that the CSE has the mapping of this AE with ServiceSubscriptionProfile + vc_ae2.start(f_cse_createResource(int2, m_createAe(vc_aeSimuDesc.appId, omit, PX_ALLOWED_C_AE_IDS[0]), -1)); + f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2); + + + //// Create 1 ServiceSubscriptionUserProfile i.e 1 user associated with this Service Subscription Profile + v_createServiceSubscribedUserProfile.from_ := PX_ALLOWED_C_AE_IDS[0]; + vc_ae2.start(f_cse_createResource(int52, v_createServiceSubscribedUserProfile, v_subscriptionProfileIndex)); + f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2); + + // Update ServiceSubscriptionProfile and make maxNumUsers to 2 + v_updateRequest := f_getUpdateRequestPrimitive(int11, v_subscriptionProfileIndex, v_updateRequestPrimitive); + f_send(e_mcaPort, m_request(v_updateRequest)); + + tc_ac.start; + alt { + [] mcaPort.receive(mw_response(mw_responsePrimitive(int2004))) -> value vc_response { + + tc_ac.stop; + setverdict(pass, __SCOPE__ & ": m2mServiceSubscriptionProfile successfully Updated."); + + } + + [] mcaPort.receive(mw_response(mw_responsePrimitiveInverse(int2004))) -> value vc_response{ + tc_ac.stop; + setverdict(fail, __SCOPE__ & ": Error while updating m2mServiceSubscriptionProfile with status code " & int2str(enum2int(vc_response.primitive.responsePrimitive.responseStatusCode))); + } + [] tc_ac.timeout { + setverdict(fail, __SCOPE__ & ": No answer while retrieving resource"); + } + } + + // Verifiy that the ServiceSubscriptionProfile resource has been updated correctly: + // maxNumUsers = 2 + + vc_primitiveContentRetrievedResource := f_cse_retrieveResource(v_subscriptionProfileIndex); + + if(not(match(vc_primitiveContentRetrievedResource.m2mServiceSubscriptionProfile.maxNumUsers, 2))) { + + setverdict(fail, __SCOPE__&":INFO: Retrieved ServiceSubscriptionProfile maxNumUsers should be equal to updated value (2)"); + + } + + f_checkAeSimuStatus(); + + // Postamble + f_cse_postamble_deleteResources(); + + // Tear down + f_cf01Down(); + } + + + + + + + }// Update + + }// Service_Subscription_Profile + + group Service_Subscribed_App_Rule { + + group g_CSE_SSAR_001 { + + /** + * @desc Check that the IUT successfully performs operations on + * resource seriviceSubscribedAppRule for authorized AE. + * + */ + testcase TC_CSE_SSM_SSAR_001_CRE() runs on Tester system CseSystem { + var AeSimu v_ae1 := AeSimu.create("AE1") alive; + + v_ae1.start(f_CSE_SSM_SSAR_001_CRE()); + v_ae1.done; + } + + function f_CSE_SSM_SSAR_001_CRE() runs on AeSimu system CseSystem { + + var RequestPrimitive v_request; + var integer v_resourceIndex := -1; + var template RequestPrimitive v_createRequest := m_createServiceSubscribedAppRuleBase; + + // Create seriviceSubscribedAppRule under CSEBase + v_request := f_getCreateRequestPrimitive(int19, v_createRequest, -1); + f_send(e_mcaPort, m_request(v_request)); + + tc_ac.start; + alt { + [] mcaPort.receive(mw_response(mw_responsePrimitive(int2001))) -> value vc_response { + tc_ac.stop; + setverdict(pass, __SCOPE__ & ": Resource type seriviceSubscribedAppRule created successfully"); + f_checkAttributesToBeSaved(int19, v_request, vc_response.primitive.responsePrimitive); + v_resourceIndex := f_setResource(vc_response.primitive.responsePrimitive.primitiveContent, int19, -1); + } + [] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value vc_response { + tc_ac.stop; + setverdict(fail, __SCOPE__ & ": Wrong response status code"); + } + [] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value vc_response { + tc_ac.stop; + setverdict(fail, __SCOPE__ & ": Error while creating resource type seriviceSubscribedAppRule "); + } + [] tc_ac.timeout { + setverdict(fail, __SCOPE__ & ": No answer while creating resource type seriviceSubscribedAppRule" ); + } + } + + //Check to see if the resource is present or not + if (f_cse_isResourcePresent(v_resourceIndex)){ + setverdict(pass, __SCOPE__ & ":INFO: Resource created"); + } else { + setverdict(fail, __SCOPE__ & ":ERROR: Resource not created"); + } + + + f_checkAeSimuStatus(); + + // Postamble + f_cse_postamble_deleteResources(); + + // Tear down + f_cf01Down(); + } + + /** + * @desc Check that the IUT successfully performs operations on + * resource seriviceSubscribedAppRule for authorized AE. + * + */ + testcase TC_CSE_SSM_SSAR_001_RET() runs on Tester system CseSystem { + var AeSimu v_ae1 := AeSimu.create("AE1") alive; + + v_ae1.start(f_CSE_SSM_SSAR_001_RET()); + v_ae1.done; + } + + function f_CSE_SSM_SSAR_001_RET() runs on AeSimu system CseSystem { + + var RequestPrimitive v_request; + var integer v_serviceSubscribedAppRuleIndex := -1; + var template RequestPrimitive v_createRequest := m_createServiceSubscribedAppRuleBase; + var template PrimitiveContent v_contentResponse; + var MsgIn v_response; + + // Create seriviceSubscribedAppRule under CSEBase + v_serviceSubscribedAppRuleIndex := f_cse_createResource(int19, m_createServiceSubscribedAppRuleBase, -1); + + v_contentResponse.serviceSubscribedAppRule := mw_contentServiceSubscribedAppRuleBase; + + // Retrieve v_serviceSubscribedAppRule + f_send(e_mcaPort, m_request(m_retrieve(f_getResourceAddress(v_serviceSubscribedAppRuleIndex), f_getOriginator(-1)))); + + tc_ac.start; + alt { + [] mcaPort.receive(mw_response(mw_responsePrimitive(int2000, v_contentResponse))) -> value v_response { + tc_ac.stop; + setverdict(pass, __SCOPE__ & ": serviceSubscribedAppRule successfully retrived."); + + } + [] mcaPort.receive(mw_response(mw_responsePrimitiveInverse(int2000))) -> value vc_response{ + tc_ac.stop; + setverdict(fail, __SCOPE__ & ": Error while retrieving serviceSubscribedAppRule with status code " & int2str(enum2int(vc_response.primitive.responsePrimitive.responseStatusCode))); + } + [] tc_ac.timeout { + setverdict(fail, __SCOPE__ & ": No answer from IUT for the last Request!"); + } + } + + f_checkAeSimuStatus(); + + // Postamble + f_cse_postamble_deleteResources(); + + // Tear down + f_cf01Down(); + } + + /** + * @desc Check that the IUT successfully performs operations on + * resource seriviceSubscribedAppRule for authorized AE. + * + */ + testcase TC_CSE_SSM_SSAR_001_UPD() runs on Tester system CseSystem { + var AeSimu v_ae1 := AeSimu.create("AE1") alive; + + v_ae1.start(f_CSE_SSM_SSAR_001_UPD()); + v_ae1.done; + } + + function f_CSE_SSM_SSAR_001_UPD() runs on AeSimu system CseSystem { + + var integer v_serviceSubscribedAppRuleIndex := -1; + var template RequestPrimitive v_createRequest := m_createServiceSubscribedAppRuleBase; + + var RequestPrimitive v_updateRequest; + var template RequestPrimitive v_updateRequestPrimitive := m_updateServiceSubscribedAppRule; + + // Create serviceSubscribedAppRule under CSEBase + v_serviceSubscribedAppRuleIndex := f_cse_createResource(int19, m_createServiceSubscribedAppRuleBase, -1); + + // Update serviceSubscribedAppRule + v_updateRequest := f_getUpdateRequestPrimitive(int19, v_serviceSubscribedAppRuleIndex, v_updateRequestPrimitive); + f_send(e_mcaPort, m_request(v_updateRequest)); + + tc_ac.start; + alt { + [] mcaPort.receive(mw_response(mw_responsePrimitive(int2004))) { + tc_ac.stop; + setverdict(pass, __SCOPE__ & ": serviceSubscribedAppRule successfully updated."); + } + [] mcaPort.receive(mw_response(mw_responsePrimitiveInverse(int2004))) -> value vc_response{ + tc_ac.stop; + setverdict(fail, __SCOPE__ & ": Error while retrieving m2mServiceSubscriptionProfile with status code " & int2str(enum2int(vc_response.primitive.responsePrimitive.responseStatusCode))); + } + [] tc_ac.timeout { + setverdict(fail, __SCOPE__ & ": No answer while retrieving resource"); + } + } + + f_checkAeSimuStatus(); + + // Verifiy that the seriviceSubscribedAppRule resource has been updated + vc_primitiveContentRetrievedResource := f_cse_retrieveResource(v_serviceSubscribedAppRuleIndex); + + if(not(match(v_updateRequestPrimitive.primitiveContent.serviceSubscribedAppRule.allowedApp_IDs, vc_primitiveContentRetrievedResource.serviceSubscribedAppRule.allowedApp_IDs))) { + setverdict(fail, __SCOPE__&":INFO: Retrived ServiceSubscriptionProfile does not match with updated content."); + } else { + setverdict(pass, __SCOPE__ & ": Retrived ServiceSubscriptionProfile matched with updated content."); + } + + // Postamble + f_cse_postamble_deleteResources(); + + // Tear down + f_cf01Down(); + } + + /** + * @desc Check that the IUT successfully performs operations on resource m2mServiceSubscriptionProfile for authorized AE + * + */ + testcase TC_CSE_SSM_SSAR_001_DEL() runs on Tester system CseSystem { + var AeSimu v_ae1 := AeSimu.create("AE1") alive; + + v_ae1.start(f_CSE_SSM_SSAR_001_DEL()); + v_ae1.done; + } + + function f_CSE_SSM_SSAR_001_DEL() runs on AeSimu system CseSystem { + + var integer v_serviceSubscribedAppRuleIndex := -1; + var template RequestPrimitive v_createRequest := m_createServiceSubscribedAppRuleBase; + + // Create serviceSubscribedAppRule under CSEBase + v_serviceSubscribedAppRuleIndex := f_cse_createResource(int19, m_createServiceSubscribedAppRuleBase, -1); + + // Delete serviceSubscribedAppRule + f_send(e_mcaPort, m_request(m_delete(f_getResourceAddress(v_serviceSubscribedAppRuleIndex), f_getOriginator(v_serviceSubscribedAppRuleIndex)))); + + tc_ac.start; + alt { + [] mcaPort.receive(mw_response(mw_responsePrimitive(int2002))) { + tc_ac.stop; + setverdict(pass, __SCOPE__ & ": v_serviceSubscribedAppRuleIndex successfully deleted."); + } + [] mcaPort.receive(mw_response(mw_responsePrimitiveInverse(int2002))) -> value vc_response{ + tc_ac.stop; + setverdict(fail, __SCOPE__ & ": Error while deleting v_serviceSubscribedAppRuleIndex with status code " & int2str(enum2int(vc_response.primitive.responsePrimitive.responseStatusCode))); + } + [] tc_ac.timeout { + setverdict(fail, __SCOPE__ & ": No answer while deleting resource"); + } + } + + f_checkAeSimuStatus(); + + // Verify that m2mServiceSubscriptionProfile is not present + if (f_cse_isResourceNotPresent(-1, f_getResourceName(vc_resourcesList[v_serviceSubscribedAppRuleIndex].resource))){ + setverdict(pass, __SCOPE__ & ":INFO: Resource deleted"); + } else { + setverdict(fail, __SCOPE__ & ":ERROR: Resource not deleted"); + } + + // Postamble + f_cse_postamble_deleteResources(); + + // Tear down + f_cf01Down(); + } + + + + }// g_CSE_SSAR_001 + + }//Service_Subscribed_App_Rule + + group Service_Subscribed_Node { + + group Basic_Operation { + + group g_CSE_SSN_001 { + + + /** + * @desc Check that the IUT successfully performs operations on resource seriviceSubscribedNode for authorized AE + * + */ + testcase TC_CSE_SSM_SSN_001_CRE() runs on Tester system CseSystem { + var AeSimu v_ae1 := AeSimu.create("AE1") alive; + + v_ae1.start(f_CSE_SSM_SSN_001_CRE()); + v_ae1.done; + } + + function f_CSE_SSM_SSN_001_CRE() runs on AeSimu system CseSystem { + + var integer v_resourceIndex := -1; + var integer v_serviceSubscribedAppRuleIndex := -1; + var XSD.ID v_cseId := PX_TS_CSE1.cseId; + + var template ListOfM2MID v_allowedUsers := {""}; + ListOfM2MID v_allowedAEs := {""} + NodeID v_nodeID := "urn:gsma:imei:90420156-025763-0"; //Dummy ID + + var template RequestPrimitive v_createServiceSubscribedNode; + var template RequestPrimitive v_createServiceSubscribedAppRule; + var template RequestPrimitive v_createServiceSubscriptionProfile := m_createM2mServiceSubscriptionProfileMaxValue1; // maxNumAEs 1 + + // directly on CSEBase from superAE + v_subscriptionProfileIndex := f_cse_createResource(int11, v_createServiceSubscriptionProfile, -1); + + v_createServiceSubscribedAppRule := m_createServiceSubscribedAppRule({"None"}, {vc_aeSimuDesc.appId}, v_allowedAEs, valueof(v_allowedUsers)); + // Create AppRule under CSEBase + v_serviceSubscribedAppRuleIndex := f_cse_createResource(int19, v_createServiceSubscribedAppRule); + + // ServiceSubscribedNode as a child of SubscriptionProfile with ruleLinks pointing to SubscribedAppRule + v_createServiceSubscribedNode := m_createServiceSubscribedNodeBase({f_getResourceAddress(v_serviceSubscribedAppRuleIndex)}, v_nodeID, v_cseId); + v_request := f_getCreateRequestPrimitive(int20, v_createServiceSubscribedNode, v_subscriptionProfileIndex); + + f_send(e_mcaPort, m_request(v_request)); + + tc_ac.start; + alt { + [] mcaPort.receive(mw_response(mw_responsePrimitive(int2001))) -> value vc_response { + tc_ac.stop; + setverdict(pass, __SCOPE__ & ": Resource type ServiceSubscribedNode created successfully"); + f_checkAttributesToBeSaved(int11, v_request, vc_response.primitive.responsePrimitive); + v_resourceIndex := f_setResource(vc_response.primitive.responsePrimitive.primitiveContent, int11, -1); + } + [] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value vc_response { + tc_ac.stop; + setverdict(fail, __SCOPE__ & ": Wrong response status code"); + } + [] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value vc_response { + tc_ac.stop; + setverdict(fail, __SCOPE__ & ": Error while creating resource type ServiceSubscribedNode"); + } + [] tc_ac.timeout { + setverdict(fail, __SCOPE__ & ": No answer while creating resource type ServiceSubscribedNode"); + } + } + + //Check to see if the resource is present or not + if (f_cse_isResourcePresent(v_resourceIndex)){ + setverdict(pass, __SCOPE__ & ":INFO: Resource created"); + } else { + setverdict(fail, __SCOPE__ & ":ERROR: Resource not created"); + } + + f_checkAeSimuStatus(); + + // Postamble + f_cse_postamble_deleteResources(); + + // Tear down + f_cf01Down(); + } + + /** + * @desc Check that the IUT successfully performs operations on resource seriviceSubscribedNode for authorized AE + * + */ + testcase TC_CSE_SSM_SSN_001_RET() runs on Tester system CseSystem { + var AeSimu v_ae1 := AeSimu.create("AE1") alive; + + v_ae1.start(f_CSE_SSM_SSN_001_RET()); + v_ae1.done; + } + + function f_CSE_SSM_SSN_001_RET() runs on AeSimu system CseSystem { + + var integer v_subscriptionProfileIndex := -1; + var integer v_serviceSubscribedAppRuleIndex := -1; + var integer v_serviceSubscribedNodeIndex := -1; + var template ListOfM2MID v_allowedUsers := {""}; + var XSD.ID v_cseId := PX_TS_CSE1.cseId; + + ListOfM2MID v_allowedAEs := {""} + NodeID v_nodeID := "urn:gsma:imei:90420156-025763-0"; //Dummy ID + + var template PrimitiveContent v_contentResponse; + + var template RequestPrimitive v_createServiceSubscribedNode; + var template RequestPrimitive v_createServiceSubscribedAppRule; + var template RequestPrimitive v_createServiceSubscriptionProfile := m_createM2mServiceSubscriptionProfileMaxValue1; // maxNumAEs 1 + + var MsgIn v_response; + + // directly on CSEBase from superAE + v_subscriptionProfileIndex := f_cse_createResource(int11, v_createServiceSubscriptionProfile, -1); + + v_createServiceSubscribedAppRule := m_createServiceSubscribedAppRule({"None"}, {vc_aeSimuDesc.appId}, v_allowedAEs, valueof(v_allowedUsers)); + // Create AppRule under CSEBase + v_serviceSubscribedAppRuleIndex := f_cse_createResource(int19, v_createServiceSubscribedAppRule); + + // ServiceSubscribedNode as a child of SubscriptionProfile with ruleLinks pointing to SubscribedAppRule + v_createServiceSubscribedNode := m_createServiceSubscribedNodeBase({f_getResourceAddress(v_serviceSubscribedAppRuleIndex)}, v_nodeID, v_cseId); + v_serviceSubscribedNodeIndex := f_cse_createResource(int20, v_createServiceSubscribedNode, v_subscriptionProfileIndex); + + v_contentResponse.serviceSubscribedNode := mw_contentServiceSubscribedNodeBase; + + // Retrieve ServiceSubscribedNode + f_send(e_mcaPort, m_request(m_retrieve(f_getResourceAddress(v_serviceSubscribedNodeIndex), f_getOriginator(-1)))); + + tc_ac.start; + alt { + [] mcaPort.receive(mw_response(mw_responsePrimitive(int2000, v_contentResponse))) -> value v_response { + tc_ac.stop; + setverdict(pass, __SCOPE__ & ": ServiceSubscribedNode successfully retrived."); + + } + [] mcaPort.receive(mw_response(mw_responsePrimitiveInverse(int2000))) -> value vc_response{ + tc_ac.stop; + setverdict(fail, __SCOPE__ & ": Error while retrieving ServiceSubscribedNode with status code " & int2str(enum2int(vc_response.primitive.responsePrimitive.responseStatusCode))); + } + [] tc_ac.timeout { + setverdict(fail, __SCOPE__ & ": No answer from IUT for the last Request!"); + } + } + + f_checkAeSimuStatus(); + + // Postamble + f_cse_postamble_deleteResources(); + + // Tear down + f_cf01Down(); + } + + /** + * @desc Check that the IUT successfully performs operations on resource seriviceSubscribedNode for authorized AE + * + */ + testcase TC_CSE_SSM_SSN_001_UPD() runs on Tester system CseSystem { + var AeSimu v_ae1 := AeSimu.create("AE1") alive; + + v_ae1.start(f_CSE_SSM_SSN_001_UPD()); + v_ae1.done; + } + + function f_CSE_SSM_SSN_001_UPD() runs on AeSimu system CseSystem { + + var RequestPrimitive v_updateRequest; + var template RequestPrimitive v_updateRequestPrimitive := m_updateServiceSubscribedNode; + + var integer v_subscriptionProfileIndex := -1; + var integer v_serviceSubscribedAppRuleIndex := -1; + var integer v_serviceSubscribedNodeIndex := -1; + var template ListOfM2MID v_allowedUsers := {""}; + var XSD.ID v_cseId := PX_TS_CSE1.cseId; + + ListOfM2MID v_allowedAEs := {""} + NodeID v_nodeID := "urn:gsma:imei:90420156-025763-0"; //Dummy ID + + var template PrimitiveContent v_contentResponse; + + var template RequestPrimitive v_createServiceSubscribedNode; + var template RequestPrimitive v_createServiceSubscribedAppRule; + var template RequestPrimitive v_createServiceSubscriptionProfile := m_createM2mServiceSubscriptionProfileMaxValue1; // maxNumAEs 1 + + // directly on CSEBase from superAE + v_subscriptionProfileIndex := f_cse_createResource(int11, v_createServiceSubscriptionProfile, -1); + + v_createServiceSubscribedAppRule := m_createServiceSubscribedAppRule({"None"}, {vc_aeSimuDesc.appId}, v_allowedAEs, valueof(v_allowedUsers)); + // Create AppRule under CSEBase + v_serviceSubscribedAppRuleIndex := f_cse_createResource(int19, v_createServiceSubscribedAppRule); + + // ServiceSubscribedNode as a child of SubscriptionProfile with ruleLinks pointing to SubscribedAppRule + v_createServiceSubscribedNode := m_createServiceSubscribedNodeBase({f_getResourceAddress(v_serviceSubscribedAppRuleIndex)}, v_nodeID, v_cseId); + v_serviceSubscribedNodeIndex := f_cse_createResource(int20, v_createServiceSubscribedNode, v_subscriptionProfileIndex); + + // Update ServiceSubscribedNode + v_updateRequest := f_getUpdateRequestPrimitive(int20, v_serviceSubscribedNodeIndex, v_updateRequestPrimitive); + f_send(e_mcaPort, m_request(v_updateRequest)); + + tc_ac.start; + alt { + [] mcaPort.receive(mw_response(mw_responsePrimitive(int2004))) { + tc_ac.stop; + setverdict(pass, __SCOPE__ & ": serviceSubscribedAppRule successfully updated."); + } + [] mcaPort.receive(mw_response(mw_responsePrimitiveInverse(int2004))) -> value vc_response{ + tc_ac.stop; + setverdict(fail, __SCOPE__ & ": Error while retrieving m2mServiceSubscriptionProfile with status code " & int2str(enum2int(vc_response.primitive.responsePrimitive.responseStatusCode))); + } + [] tc_ac.timeout { + setverdict(fail, __SCOPE__ & ": No answer while retrieving resource"); + } + } + + f_checkAeSimuStatus(); + + // Verifiy that the ServiceSubscribedNode resource has been updated + vc_primitiveContentRetrievedResource := f_cse_retrieveResource(v_serviceSubscribedNodeIndex); + + if(not(match(v_updateRequestPrimitive.primitiveContent.serviceSubscribedNode.niddRequired, vc_primitiveContentRetrievedResource.serviceSubscribedNode.niddRequired))) { + setverdict(fail, __SCOPE__&":INFO: Retrived serviceSubscribedNode does not match with updated content."); + } else { + setverdict(pass, __SCOPE__ & ": Retrived serviceSubscribedNode matched with updated content."); + } + + // Postamble + f_cse_postamble_deleteResources(); + + // Tear down + f_cf01Down(); + } + + /** + * @desc Check that the IUT successfully performs operations on resource seriviceSubscribedNode for authorized AE + * + */ + testcase TC_CSE_SSM_SSN_001_DEL() runs on Tester system CseSystem { + var AeSimu v_ae1 := AeSimu.create("AE1") alive; + + v_ae1.start(f_CSE_SSM_SSN_001_DEL()); + v_ae1.done; + } + + function f_CSE_SSM_SSN_001_DEL() runs on AeSimu system CseSystem { + + var integer v_subscriptionProfileIndex := -1; + var integer v_serviceSubscribedAppRuleIndex := -1; + var integer v_serviceSubscribedNodeIndex := -1; + var template ListOfM2MID v_allowedUsers := {""}; + var XSD.ID v_cseId := PX_TS_CSE1.cseId; + + ListOfM2MID v_allowedAEs := {""} + NodeID v_nodeID := "urn:gsma:imei:90420156-025763-0"; //Dummy ID + + var template PrimitiveContent v_contentResponse; + + var template RequestPrimitive v_createServiceSubscribedNode; + var template RequestPrimitive v_createServiceSubscribedAppRule; + var template RequestPrimitive v_createServiceSubscriptionProfile := m_createM2mServiceSubscriptionProfileMaxValue1; // maxNumAEs 1 + + // directly on CSEBase from superAE + v_subscriptionProfileIndex := f_cse_createResource(int11, v_createServiceSubscriptionProfile, -1); + + v_createServiceSubscribedAppRule := m_createServiceSubscribedAppRule({"None"}, {vc_aeSimuDesc.appId}, v_allowedAEs, valueof(v_allowedUsers)); + // Create AppRule under CSEBase + v_serviceSubscribedAppRuleIndex := f_cse_createResource(int19, v_createServiceSubscribedAppRule); + + // ServiceSubscribedNode as a child of SubscriptionProfile with ruleLinks pointing to SubscribedAppRule + v_createServiceSubscribedNode := m_createServiceSubscribedNodeBase({f_getResourceAddress(v_serviceSubscribedAppRuleIndex)}, v_nodeID, v_cseId); + v_serviceSubscribedNodeIndex := f_cse_createResource(int20, v_createServiceSubscribedNode, v_subscriptionProfileIndex); + + // Delete ServiceSubscribedNode + f_send(e_mcaPort, m_request(m_delete(f_getResourceAddress(v_serviceSubscribedNodeIndex), f_getOriginator(v_serviceSubscribedNodeIndex)))); + + tc_ac.start; + alt { + [] mcaPort.receive(mw_response(mw_responsePrimitive(int2002))) { + tc_ac.stop; + setverdict(pass, __SCOPE__ & ": ServiceSubscribedNode successfully deleted."); + } + [] mcaPort.receive(mw_response(mw_responsePrimitiveInverse(int2002))) -> value vc_response{ + tc_ac.stop; + setverdict(fail, __SCOPE__ & ": Error while deleting ServiceSubscribedNode with status code " & int2str(enum2int(vc_response.primitive.responsePrimitive.responseStatusCode))); + } + [] tc_ac.timeout { + setverdict(fail, __SCOPE__ & ": No answer while deleting resource"); + } + } + + f_checkAeSimuStatus(); + + // Verify that ServiceSubscribedNode is not present + if (f_cse_isResourceNotPresent(-1, f_getResourceName(vc_resourcesList[v_serviceSubscribedNodeIndex].resource))){ + setverdict(pass, __SCOPE__ & ":INFO: Resource deleted"); + } else { + setverdict(fail, __SCOPE__ & ":ERROR: Resource not deleted"); + } + + // Postamble + f_cse_postamble_deleteResources(); + + // Tear down + f_cf01Down(); + } + + + + + + + } + + + group Create { + + /** + * @desc Check that the IUT rejects CREATE request If the ruleLinks attribute + * is present in the resource representation, but the CSE-ID attribute + * is not present in the resource representation of <serviceSubscribedNode> resource + * + */ + testcase TC_CSE_SSM_SSN_CRE_001() runs on Tester system CseSystem { + var AeSimu v_ae1 := AeSimu.create("AE1") alive; + + v_ae1.start(f_CSE_SSM_SSN_CRE_001()); + v_ae1.done; + } + + function f_CSE_SSM_SSN_CRE_001() runs on AeSimu system CseSystem { + + var integer v_subscriptionProfileIndex := -1; + var integer v_serviceSubscribedAppRuleIndex := -1; + var integer v_serviceSubscribedNodeIndex := -1; + var template ListOfM2MID v_allowedUsers := {""}; + + ListOfM2MID v_allowedAEs := {""} + NodeID v_nodeID := "urn:gsma:imei:90420156-025763-0"; //Dummy ID + + var template PrimitiveContent v_contentResponse; + + var template RequestPrimitive v_createServiceSubscribedNode; + var template RequestPrimitive v_createServiceSubscribedAppRule; + var template RequestPrimitive v_createServiceSubscriptionProfile := m_createM2mServiceSubscriptionProfileMaxValue1; // maxNumAEs 1 + + // directly on CSEBase from superAE + v_subscriptionProfileIndex := f_cse_createResource(int11, v_createServiceSubscriptionProfile, -1); + + v_createServiceSubscribedAppRule := m_createServiceSubscribedAppRule({"None"}, {vc_aeSimuDesc.appId}, v_allowedAEs, valueof(v_allowedUsers)); + // Create AppRule under CSEBase + v_serviceSubscribedAppRuleIndex := f_cse_createResource(int19, v_createServiceSubscribedAppRule); + + // ServiceSubscribedNode as a child of SubscriptionProfile with ruleLinks pointing to SubscribedAppRule + // and no CSE-ID + v_createServiceSubscribedNode := m_createServiceSubscribedNodeBase({f_getResourceAddress(v_serviceSubscribedAppRuleIndex)}, v_nodeID, omit); + + v_request := f_getCreateRequestPrimitive(int20, v_createServiceSubscribedNode, v_subscriptionProfileIndex); + + f_send(e_mcaPort, m_request(v_request)); + + tc_ac.start; + alt { + // BAD_REQUEST + [] mcaPort.receive(mw_response(mw_responsePrimitive(int4000))) { + tc_ac.stop; + setverdict(pass, __SCOPE__ & ": ServiceSubscribedNode creation successfully rejected with 4000 (BAD_REQUEST)."); + } + [] mcaPort.receive(mw_response(mw_responsePrimitiveInverse(int4000))) -> value vc_response{ + tc_ac.stop; + setverdict(fail, __SCOPE__ & ": Request should be rejected with BAD_REQUEST instead of" & int2str(enum2int(vc_response.primitive.responsePrimitive.responseStatusCode))); + } + [] tc_ac.timeout { + setverdict(fail, __SCOPE__ & ": No answer while Creating resource"); + } + } + + f_checkAeSimuStatus(); + + // Postamble + f_cse_postamble_deleteResources(); + + // Tear down + f_cf01Down(); + } + + } + + } + + }//Service_Subscribed_Node + }//end group CSE }