diff --git a/LibOneM2M/OneM2M_Functions.ttcn b/LibOneM2M/OneM2M_Functions.ttcn index 763e59ce5d93fac52ddf1a2c8816d9382dcaa8d0..4b128c10fce911ac4276bc544eee77918d708a82 100644 --- a/LibOneM2M/OneM2M_Functions.ttcn +++ b/LibOneM2M/OneM2M_Functions.ttcn @@ -5230,6 +5230,45 @@ module OneM2M_Functions { //log("result: " & result); return result; } + + /** + * @desc Replace the CSE-Name by the shortcut ("-") in a structured resource id format + * @return Cleaned-up resourceID + */ + function f_useShortcutInResourceId(in XSD.ID p_resourceID) return XSD.ID { + var integer v_length := lengthof(p_resourceID); + var integer i; + var integer v_numberOfSlashes := 0; + var XSD.ID v_modifiedResourceId:= ""; + var XSD.ID v_cseName := ""; + + if(p_resourceID[0] == "/") { + if(p_resourceID[1] == "/") { + v_numberOfSlashes := 4; + } else { + v_numberOfSlashes := 2; + } + } + //log("p_resourceID: " & p_resourceID); + for (i := 0; i < v_length ; i := i+1){ + if(v_numberOfSlashes != 0) { + if(p_resourceID[i]=="/"){ + v_numberOfSlashes := v_numberOfSlashes - 1; + } + v_modifiedResourceId := v_modifiedResourceId & p_resourceID[i]; + } else if (v_numberOfSlashes == 0){ + if(p_resourceID[i]=="/"){ + v_numberOfSlashes := v_numberOfSlashes - 1; + v_modifiedResourceId := v_modifiedResourceId & "-/"; + log(__SCOPE__, "INFO: CSE Name to be removed from resource ID: " & v_cseName); + } + v_cseName := v_cseName & p_resourceID[i]; + } else if (v_numberOfSlashes == -1){ + v_modifiedResourceId := v_modifiedResourceId & p_resourceID[i]; + } + } + return v_modifiedResourceId; + } /** * @desc It removes the poa from a given url diff --git a/OneM2M_PermutationFunctions.ttcn b/OneM2M_PermutationFunctions.ttcn index 6238466ad890a5f3d493bcef4bc2a0a34b91b5c2..6b9a54e05ed7bb1661d1060c6b54e978cb2e5be9 100644 --- a/OneM2M_PermutationFunctions.ttcn +++ b/OneM2M_PermutationFunctions.ttcn @@ -858,8 +858,69 @@ module OneM2M_PermutationFunctions { // Tear down f_cf01Down(); - }//end f_CSE_GEN_CRE_002 - + }//end f_CSE_GEN_CRE_002 + + function f_CSE_GEN_CRE_003(in PrimitiveScope p_primitiveScope) runs on AeSimu { + + // Local variables + var RequestPrimitive v_request; + var integer v_aeIndex := -1; + var integer v_resourceIndex := -1; + var AddressingMethod v_addressingMethod; + var PrimitiveScope v_primitiveScope; + var XSD.ID v_cseName := PX_CSE_NAME; + + // Test control + if(not(PICS_STRUCTURED_CSE_RELATIVE_RESOURCE_ID_FORMAT)) { + setverdict(inconc, __SCOPE__ & ": Structured-CSE-Relative-Resource-ID format support is required to run this test case"); + stop; + } + + // Test component configuration + f_cf01Up(); + + // Test adapter configuration + + // Preamble + v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi); + + v_resourceIndex := f_cse_createResource(int3, m_createContainerBase, v_aeIndex); + + // Test Body + //Force usage of Non-Hierarchical addressing method + v_addressingMethod := e_hierarchical; + v_primitiveScope := p_primitiveScope; + v_request := f_getCreateRequestPrimitive(int3, m_createContainerBase, v_resourceIndex); + v_request.to_ := f_useShortcutInResourceId(f_getResourceAddress(v_resourceIndex, v_addressingMethod, v_primitiveScope)); + + mcaPort.send(f_getMsgOutPrimitive(m_request(v_request))); + tc_ac.start; + alt { + [] mcaPort.receive(mw_response(mw_responsePrimitive(int2001))) { + tc_ac.stop; + setverdict(pass, __SCOPE__ & ": Container resource created using shortcut in hierarchical addressing method"); + } + [] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) { + tc_ac.stop; + setverdict(fail, __SCOPE__ & ": Wrong response status code in the response"); + } + [] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) { + tc_ac.stop; + setverdict(fail, __SCOPE__ & ": Error while creating container resource using shortcut in hierarchical addressing method"); + } + [] tc_ac.timeout { + setverdict(fail, __SCOPE__ & ": No answer while creating resource"); + } + } + + // Postamble + f_cse_postamble_deleteResources(); + + // Tear down + f_cf01Down(); + + }//end f_CSE_GEN_CRE_003 + } // end of group Create group Retrieve { @@ -977,6 +1038,62 @@ module OneM2M_PermutationFunctions { }//end f_CSE_GEN_RET_002 + function f_CSE_GEN_RET_003(in PrimitiveScope p_primitiveScope) runs on AeSimu { + + // Local variables + var integer v_aeIndex := -1; + var integer v_resourceIndex := -1; + var AddressingMethod v_addressingMethod; + var PrimitiveScope v_primitiveScope; + + // Test control + if(not(PICS_STRUCTURED_CSE_RELATIVE_RESOURCE_ID_FORMAT)) { + setverdict(inconc, __SCOPE__ & ": Structured-CSE-Relative-Resource-ID format support is required to run this test case"); + stop; + } + + // Test component configuration + f_cf01Up(); + + // Test adapter configuration + + // Preamble + v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi); + + v_resourceIndex := f_cse_createResource(int3, m_createContainerBase, v_aeIndex); + + // Test Body + //Force usage of Non-Hierarchical addressing method + v_addressingMethod := e_hierarchical; + v_primitiveScope := p_primitiveScope; + + mcaPort.send(f_getMsgOutPrimitive(m_request(m_retrieve(f_useShortcutInResourceId(f_getResourceAddress(v_resourceIndex, v_addressingMethod, v_primitiveScope)), f_getOriginator(v_resourceIndex)))));tc_ac.start; + alt { + [] mcaPort.receive(mw_response(mw_responsePrimitive(int2000))) { + tc_ac.stop; + setverdict(pass, __SCOPE__ & ": Container resource retrieved using shortcut in hierarchical addressing method"); + } + [] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) { + tc_ac.stop; + setverdict(fail, __SCOPE__ & ": Wrong response status code in the response"); + } + [] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) { + tc_ac.stop; + setverdict(fail, __SCOPE__ & ": Error while retrieving container resource using shortcut in hierarchical addressing method"); + } + [] tc_ac.timeout { + setverdict(fail, __SCOPE__ & ": No answer while retrieving resource"); + } + } + + // Postamble + f_cse_postamble_deleteResources(); + + // Tear down + f_cf01Down(); + + }//end f_CSE_GEN_RET_003 + } // end of group Retrieve group Update { @@ -1107,6 +1224,69 @@ module OneM2M_PermutationFunctions { }//end f_CSE_GEN_UPD_002 + function f_CSE_GEN_UPD_003(in PrimitiveScope p_primitiveScope) runs on AeSimu { + + // Local variables + var RequestPrimitive v_updateRequest := valueof(m_updateContainerBase); + var integer v_aeIndex := -1; + var integer v_resourceIndex := -1; + var AddressingMethod v_addressingMethod; + var PrimitiveScope v_primitiveScope; + + // Test control + if(not(PICS_STRUCTURED_CSE_RELATIVE_RESOURCE_ID_FORMAT)) { + setverdict(inconc, __SCOPE__ & ": Structured-CSE-Relative-Resource-ID format support is required to run this test case"); + stop; + } + + // Test component configuration + f_cf01Up(); + + // Test adapter configuration + + // Preamble + v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi); + + v_resourceIndex := f_cse_createResource(int3, m_createContainerBase, v_aeIndex); + + // Test Body + //Force usage of Non-Hierarchical addressing method + v_addressingMethod := e_hierarchical; + v_primitiveScope := p_primitiveScope; + + v_updateRequest.primitiveContent.container.labels := {"MyLabel"}; + + v_updateRequest := f_getUpdateRequestPrimitive(int3, v_resourceIndex, v_updateRequest); + v_updateRequest.to_ := f_useShortcutInResourceId(f_getResourceAddress(v_resourceIndex, v_addressingMethod, v_primitiveScope)); + + mcaPort.send(f_getMsgOutPrimitive(m_request(v_updateRequest))); + tc_ac.start; + alt { + [] mcaPort.receive(mw_response(mw_responsePrimitive(int2004))) { + tc_ac.stop; + setverdict(pass, __SCOPE__ & ": Container resource updated using shortcut in hierarchical addressing method"); + } + [] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) { + tc_ac.stop; + setverdict(fail, __SCOPE__ & ": Wrong response status code in the response"); + } + [] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) { + tc_ac.stop; + setverdict(fail, __SCOPE__ & ": Error while updating container resource using shortcut in hierarchical addressing method"); + } + [] tc_ac.timeout { + setverdict(fail, __SCOPE__ & ": No answer while updating resource"); + } + } + + // Postamble + f_cse_postamble_deleteResources(); + + // Tear down + f_cf01Down(); + + }//end f_CSE_GEN_UPD_003 + } // end of group Update group Delete { @@ -1231,6 +1411,66 @@ module OneM2M_PermutationFunctions { }//end f_CSE_GEN_DEL_002 + function f_CSE_GEN_DEL_003(in PrimitiveScope p_primitiveScope) runs on AeSimu { + + // Local variables + var RequestPrimitive v_request; + var integer v_aeIndex := -1; + var integer v_resourceIndex := -1; + var AddressingMethod v_addressingMethod; + var PrimitiveScope v_primitiveScope; + + // Test control + if(not(PICS_STRUCTURED_CSE_RELATIVE_RESOURCE_ID_FORMAT)) { + setverdict(inconc, __SCOPE__ & ": Structured-CSE-Relative-Resource-ID format support is required to run this test case"); + stop; + } + + // Test component configuration + f_cf01Up(); + + // Test adapter configuration + + // Preamble + v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi); + + v_resourceIndex := f_cse_createResource(int3, m_createContainerBase, v_aeIndex); + + // Test Body + //Force usage of Non-Hierarchical addressing method + v_addressingMethod := e_hierarchical; + v_primitiveScope := p_primitiveScope; + + v_request := valueof(m_delete(f_useShortcutInResourceId(f_getResourceAddress(v_resourceIndex, v_addressingMethod, v_primitiveScope)), f_getOriginator(v_resourceIndex))); + + mcaPort.send(f_getMsgOutPrimitive(m_request(v_request))); + tc_ac.start; + alt { + [] mcaPort.receive(mw_response(mw_responsePrimitive(int2002))) { + tc_ac.stop; + setverdict(pass, __SCOPE__ & ": Container resource deleted using shortcut in hierarchical addressing method"); + } + [] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) { + tc_ac.stop; + setverdict(fail, __SCOPE__ & ": Wrong response status code in the response"); + } + [] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) { + tc_ac.stop; + setverdict(fail, __SCOPE__ & ": Error while deleting container resource using shortcut in hierarchical addressing method"); + } + [] tc_ac.timeout { + setverdict(fail, __SCOPE__ & ": No answer while deleting resource"); + } + } + + // Postamble + f_cse_postamble_deleteResources(); + + // Tear down + f_cf01Down(); + + }//end f_CSE_GEN_DEL_003 + } // end of group Delete } // end of group Generic diff --git a/OneM2M_Testcases_CSE_Release_2.ttcn b/OneM2M_Testcases_CSE_Release_2.ttcn index 85d05968f0093368f1a0edd29848f8e068924a6b..df28f23b174bdab69574fa8d536378e9263606d3 100644 --- a/OneM2M_Testcases_CSE_Release_2.ttcn +++ b/OneM2M_Testcases_CSE_Release_2.ttcn @@ -82,16 +82,183 @@ module OneM2M_Testcases_CSE_Release_2 { group Generic { group Create { + + group g_CSE_GEN_CRE_003 { + + /** + * @desc Check that the IUT accepts the creation of a <container> resource using shortcut structured resource identifier + * + */ + testcase TC_CSE_GEN_CRE_003_CSR() runs on Tester system CseSystem { + // Local variables + + var AeSimu v_ae1 := AeSimu.create("AE1") alive; + v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1)); + v_ae1.done; + + v_ae1.start(f_CSE_GEN_CRE_003(e_cseRelative)); + v_ae1.done; + } + + testcase TC_CSE_GEN_CRE_003_SPR() runs on Tester system CseSystem { + // Local variables + + var AeSimu v_ae1 := AeSimu.create("AE1") alive; + v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1)); + v_ae1.done; + + v_ae1.start(f_CSE_GEN_CRE_003(e_spRelative)); + v_ae1.done; + } + + testcase TC_CSE_GEN_CRE_003_ABS() runs on Tester system CseSystem { + // Local variables + + var AeSimu v_ae1 := AeSimu.create("AE1") alive; + v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1)); + v_ae1.done; + + v_ae1.start(f_CSE_GEN_CRE_003(e_absolute)); + v_ae1.done; + } + + }// end of group g_CSE_GEN_CRE_003 + } // end of group Create group Retrieve { + + group g_CSE_GEN_RET_003 { + + /** + * @desc Check that the IUT accepts the retrieval of a <container> resource using shortcut structured resource identifier + * + */ + testcase TC_CSE_GEN_RET_003_CSR() runs on Tester system CseSystem { + // Local variables + var AeSimu v_ae1 := AeSimu.create("AE1") alive; + v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1)); + v_ae1.done; + + v_ae1.start(f_CSE_GEN_RET_003(e_cseRelative)); + v_ae1.done; + } + + testcase TC_CSE_GEN_RET_003_SPR() runs on Tester system CseSystem { + // Local variables + + var AeSimu v_ae1 := AeSimu.create("AE1") alive; + v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1)); + v_ae1.done; + + v_ae1.start(f_CSE_GEN_RET_003(e_spRelative)); + v_ae1.done; + } + + testcase TC_CSE_GEN_RET_003_ABS() runs on Tester system CseSystem { + // Local variables + + var AeSimu v_ae1 := AeSimu.create("AE1") alive; + v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1)); + v_ae1.done; + + v_ae1.start(f_CSE_GEN_RET_003(e_absolute)); + v_ae1.done; + } + + } // end of group g_CSE_GEN_RET_003 + } // end of group Retrieve group Update { + + group g_CSE_GEN_UPD_003 { + + /** + * @desc Check that the IUT accepts the update of a <container> resource using shortcut structured resource identifier + * + */ + testcase TC_CSE_GEN_UPD_003_CSR() runs on Tester system CseSystem { + // Local variables + + var AeSimu v_ae1 := AeSimu.create("AE1") alive; + v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1)); + v_ae1.done; + + v_ae1.start(f_CSE_GEN_UPD_003(e_cseRelative)); + v_ae1.done; + } + + testcase TC_CSE_GEN_UPD_003_SPR() runs on Tester system CseSystem { + // Local variables + + var AeSimu v_ae1 := AeSimu.create("AE1") alive; + v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1)); + v_ae1.done; + + v_ae1.start(f_CSE_GEN_UPD_003(e_spRelative)); + v_ae1.done; + } + + testcase TC_CSE_GEN_UPD_003_ABS() runs on Tester system CseSystem { + // Local variables + + var AeSimu v_ae1 := AeSimu.create("AE1") alive; + v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1)); + v_ae1.done; + + v_ae1.start(f_CSE_GEN_UPD_003(e_absolute)); + v_ae1.done; + } + + } // end of group g_CSE_GEN_UPD_003 + } // end of group Update group Delete { + + group g_CSE_GEN_DEL_003 { + + /** + * @desc Check that the IUT accepts the deletion of a <container> resource using shortcut structured resource identifier + * + */ + testcase TC_CSE_GEN_DEL_003_CSR() runs on Tester system CseSystem { + // Local variables + + var AeSimu v_ae1 := AeSimu.create("AE1") alive; + v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1)); + v_ae1.done; + + v_ae1.start(f_CSE_GEN_DEL_003(e_cseRelative)); + v_ae1.done; + } + + testcase TC_CSE_GEN_DEL_003_SPR() runs on Tester system CseSystem { + // Local variables + + var AeSimu v_ae1 := AeSimu.create("AE1") alive; + v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1)); + v_ae1.done; + + v_ae1.start(f_CSE_GEN_DEL_003(e_spRelative)); + v_ae1.done; + } + + testcase TC_CSE_GEN_DEL_003_ABS() runs on Tester system CseSystem { + // Local variables + + var AeSimu v_ae1 := AeSimu.create("AE1") alive; + v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1)); + v_ae1.done; + + v_ae1.start(f_CSE_GEN_DEL_003(e_absolute)); + v_ae1.done; + } + + } // end of group g_CSE_GEN_DEL_003 + } // end of group Delete } // end of group Generic