diff --git a/LibOneM2M/OneM2M_Templates.ttcn b/LibOneM2M/OneM2M_Templates.ttcn index 6bb748f1373013bfd91a80271ef6eff477d98679..d2cf29806ce53410ad67b571c812fc11d81c53d5 100644 --- a/LibOneM2M/OneM2M_Templates.ttcn +++ b/LibOneM2M/OneM2M_Templates.ttcn @@ -694,6 +694,14 @@ module OneM2M_Templates { primitiveContent:= {container := m_contentUpdateContainerMaxByte(p_maxByte)} }; + /** + * @desc UPDATE request primitive for Container resource + */ + template (value) RequestPrimitive m_updateContainerMaxNrInstances(XSD.NonNegativeInteger p_MaxNrInstances) modifies m_updateContainerBase:= { + requestIdentifier := "m_updateContainer", + primitiveContent:= {container := m_contentUpdateContainerMaxNrInstances(p_MaxNrInstances)} + }; + /** * @desc Base Reception template for update Container */ @@ -755,6 +763,14 @@ module OneM2M_Templates { primitiveContent:= {group_ := m_contentUpdateGroup} }; + /** + * @desc UPDATE request primitive for Group resource + */ + template (value) RequestPrimitive m_updateGroupMaxNrMembers(XSD.NonNegativeInteger p_MembersPerGroup) modifies m_updateGroupBase:= { + requestIdentifier := "m_updateGroupMaxMembersPerGroup", + primitiveContent:= {group_ := m_contentUpdateGroupMaxNrMembers(p_MembersPerGroup)} + }; + /** * @desc Base UPDATE request primitive for CSEBase resource */ @@ -7644,6 +7660,20 @@ module OneM2M_Templates { }; + /** + * @desc primitiveContent for UPDATE operation for Container resource + */ + template (value) Container_optional m_contentUpdateContainerMaxNrInstances (XSD.NonNegativeInteger p_MaxNrInstances) modifies m_contentUpdateContainer := { + maxNrOfInstances := p_MaxNrInstances//O + }; + + /** + * @desc primitiveContent for UPDATE operation for Group resource + */ + template (value) Group_optional m_contentUpdateGroupMaxNrMembers (XSD.NonNegativeInteger p_MembersPerGroup) modifies m_contentUpdateGroup := { + maxNrOfMembers := p_MembersPerGroup//O + }; + /** * @desc Base primitiveContent for UPDATE operation for ContentInstance resource */ diff --git a/OneM2M_Testcases_CSE_Release_4.ttcn b/OneM2M_Testcases_CSE_Release_4.ttcn index e80e2fdad514998b8a23f57d5254a97a9d58b468..ea5beec4e9f740271eeb7b521c78fca0ee003c4c 100644 --- a/OneM2M_Testcases_CSE_Release_4.ttcn +++ b/OneM2M_Testcases_CSE_Release_4.ttcn @@ -12927,6 +12927,84 @@ module OneM2M_Testcases_CSE_Release_4 { 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_UPD() runs on Tester system CseSystem { + var AeSimu v_ae1 := AeSimu.create("AE1") alive; + + v_ae1.start(f_CSE_SSM_SSP_007_MIC_UPD()); + v_ae1.done; + } + + function f_CSE_SSM_SSP_007_MIC_UPD() 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_updateContainerMaxNrInstancesRequest := m_updateContainerMaxNrInstances(2); + var RequestPrimitive v_request; + + // Test component configuration + f_cf01Up(true); + + // 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); + + // UPDATE container's attribute maxNumInstancesPerContainer = 2 from same AE. maxNumInstancesPerContainer in SSP allowed 1 + v_request := f_getUpdateRequestPrimitive(int3, v_containerIndex, v_updateContainerMaxNrInstancesRequest); + 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 @@ -13091,6 +13169,102 @@ module OneM2M_Testcases_CSE_Release_4 { 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_UPD() runs on Tester system CseSystem { + var AeSimu v_ae1 := AeSimu.create("AE1") alive; + + v_ae1.start(f_CSE_SSM_SSP_007_MMG_UPD()); + v_ae1.done; + } + + function f_CSE_SSM_SSP_007_MMG_UPD() 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 integer v_groupIndex := -1; + + + var RequestPrimitive v_request; + var ListOfURIs v_memberIDs; + + var template RequestPrimitive v_createServiceSubscriptionProfile := m_createM2mServiceSubscriptionProfileMaxValue1; + var template RequestPrimitive v_updateGroupMaxNrMembers := m_updateGroupMaxNrMembers(2); + + // Test component configuration + f_cf01Up(true); + + // 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) + }; + + + // Create Group with 2 members from same AE + vc_ae2.start(f_cse_createResource(int3, m_createGroup(2, v_memberIDs, omit, int2, -, omit,-), -1)); + f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2); + v_groupIndex := f_getLatestResourceIndex(vc_ae2); + + // UPDATE Group's attribute maxMembersPerGroup = 2 from same AE. maxNumMembersPerGroup in SSP allowed 1 + v_request := f_getUpdateRequestPrimitive(int9, v_groupIndex, v_updateGroupMaxNrMembers); + 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 @@ -13532,6 +13706,86 @@ module OneM2M_Testcases_CSE_Release_4 { 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_UPD() runs on Tester system CseSystem { + var AeSimu v_ae1 := AeSimu.create("AE1") alive; + + v_ae1.start(f_CSE_SSM_SSP_008_MIC_UPD()); + v_ae1.done; + } + + function f_CSE_SSM_SSP_008_MIC_UPD() 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_updateContainerMaxNrInstancesRequest := m_updateContainerMaxNrInstances(1); + + var RequestPrimitive v_request; + + // Test component configuration + f_cf01Up(true); + + // 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); + + // UPDATE container's attribute maxNumInstancesPerContainer = 1 from same AE. maxNumInstancesPerContainer in SSP allowed 1 + v_containerIndex := f_getLatestResourceIndex(vc_ae2); + v_request := f_getUpdateRequestPrimitive(int3, v_containerIndex, v_updateContainerMaxNrInstancesRequest); + 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 @@ -13687,6 +13941,93 @@ module OneM2M_Testcases_CSE_Release_4 { 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_UPD() runs on Tester system CseSystem { + var AeSimu v_ae1 := AeSimu.create("AE1") alive; + + v_ae1.start(f_CSE_SSM_SSP_008_MMG_UPD()); + v_ae1.done; + } + + function f_CSE_SSM_SSP_008_MMG_UPD() runs on AeSimu system CseSystem { + + var integer v_subscriptionProfileIndex := -1; + var integer v_aeIndex := -1; + var integer v_containerOneIndex := -1; + var integer v_groupIndex := -1; + + var RequestPrimitive v_request; + var ListOfURIs v_memberIDs; + + var template RequestPrimitive v_createServiceSubscriptionProfile := m_createM2mServiceSubscriptionProfileMaxValue1; + var template RequestPrimitive v_createContainerRequest := m_createContainerBase; + var template RequestPrimitive v_updateGroupMaxNrMembers := m_updateGroupMaxNrMembers(1); + + // Test component configuration + f_cf01Up(true); + + // 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 Empty Group from same AE + vc_ae2.start(f_cse_createResource(int3, m_createGroup(1, -, omit, int2, -, -, -), -1)); + f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2); + v_groupIndex := f_getLatestResourceIndex(vc_ae2); + + // UPDATE Group's attribute maxMembersPerGroup = 1 from same AE. maxNumMembersPerGroup in SSP allowed 1 + v_request := f_getUpdateRequestPrimitive(int9, v_groupIndex, v_updateGroupMaxNrMembers); + 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