diff --git a/LibOneM2M/OneM2M_Functions.ttcn b/LibOneM2M/OneM2M_Functions.ttcn index 2003ad1a879f6ba5a84f734d69cc51ed8be21a9c..3c7a584bad2f0511abad285884693533d1cf37a0 100644 --- a/LibOneM2M/OneM2M_Functions.ttcn +++ b/LibOneM2M/OneM2M_Functions.ttcn @@ -4229,13 +4229,20 @@ module OneM2M_Functions { } else { return f_getResourceId(vc_resourcesList[p_targetResourceIndex].resource); } - } else { + } else if (p_addressingMethod == e_hierarchical){ if(p_targetResourceIndex == -1) { return PX_CSE_NAME; } else { v_resourceAddress := f_getResourceAddress(vc_resourcesList[p_targetResourceIndex].parentIndex, p_addressingMethod, p_primitiveScope) & "/" & f_getResourceName(vc_resourcesList[p_targetResourceIndex].resource); return v_resourceAddress; } + } else if (p_addressingMethod == e_hybrid){ + if(p_targetResourceIndex == -1) { + return PX_CSE_RESOURCE_ID; + } else { + v_resourceAddress := f_getResourceAddress(vc_resourcesList[p_targetResourceIndex].parentIndex, e_nonHierarchical, p_primitiveScope) & "/" & f_getResourceName(vc_resourcesList[p_targetResourceIndex].resource); + return v_resourceAddress; + } } } else if (p_primitiveScope == e_spRelative) { @@ -4246,13 +4253,20 @@ module OneM2M_Functions { v_resourceAddress := PX_CSE_ID & "/" & f_getResourceId(vc_resourcesList[p_targetResourceIndex].resource); return v_resourceAddress; } - } else { + } else if (p_addressingMethod == e_hierarchical){ if(p_targetResourceIndex == -1) { return PX_CSE_ID & "/" & PX_CSE_NAME; } else { v_resourceAddress := f_getResourceAddress(vc_resourcesList[p_targetResourceIndex].parentIndex, p_addressingMethod, p_primitiveScope) & "/" & f_getResourceName(vc_resourcesList[p_targetResourceIndex].resource); return v_resourceAddress; } + } else if (p_addressingMethod == e_hybrid){ + if(p_targetResourceIndex == -1) { + return PX_CSE_ID & "/" & PX_CSE_RESOURCE_ID; + } else { + v_resourceAddress := f_getResourceAddress(vc_resourcesList[p_targetResourceIndex].parentIndex, e_nonHierarchical, p_primitiveScope) & "/" & f_getResourceName(vc_resourcesList[p_targetResourceIndex].resource); + return v_resourceAddress; + } } } else if (p_primitiveScope == e_absolute) { if(p_addressingMethod == e_nonHierarchical) { @@ -4262,14 +4276,21 @@ module OneM2M_Functions { v_resourceAddress := PX_SP_ID & PX_CSE_ID & "/" & f_getResourceId(vc_resourcesList[p_targetResourceIndex].resource); return v_resourceAddress; } - } else { + } else if (p_addressingMethod == e_hierarchical){ if(p_targetResourceIndex == -1) { return PX_SP_ID & PX_CSE_ID & "/" & PX_CSE_NAME; } else { v_resourceAddress := f_getResourceAddress(vc_resourcesList[p_targetResourceIndex].parentIndex, p_addressingMethod, p_primitiveScope) & "/" & f_getResourceName(vc_resourcesList[p_targetResourceIndex].resource); return v_resourceAddress; } - } + } else if (p_addressingMethod == e_hybrid){ + if(p_targetResourceIndex == -1) { + return PX_SP_ID & PX_CSE_ID & "/" & PX_CSE_RESOURCE_ID; + } else { + v_resourceAddress := f_getResourceAddress(vc_resourcesList[p_targetResourceIndex].parentIndex, e_nonHierarchical, p_primitiveScope) & "/" & f_getResourceName(vc_resourcesList[p_targetResourceIndex].resource); + return v_resourceAddress; + } + } } else { return ""; } diff --git a/LibOneM2M/OneM2M_Types.ttcn b/LibOneM2M/OneM2M_Types.ttcn index f804670f51d58f88a465aedf691c77c571517d03..1c34ae4e649ad85ad4000f35af4689fe9a88c5fe 100644 --- a/LibOneM2M/OneM2M_Types.ttcn +++ b/LibOneM2M/OneM2M_Types.ttcn @@ -8690,7 +8690,8 @@ group OtherTypes { type enumerated AddressingMethod { e_nonHierarchical, - e_hierarchical + e_hierarchical, + e_hybrid } type union Resource_2 { diff --git a/OneM2M_PermutationFunctions.ttcn b/OneM2M_PermutationFunctions.ttcn index 6b9a54e05ed7bb1661d1060c6b54e978cb2e5be9..9639c22482d107c6c590794d54ff750676023cc9 100644 --- a/OneM2M_PermutationFunctions.ttcn +++ b/OneM2M_PermutationFunctions.ttcn @@ -826,7 +826,7 @@ module OneM2M_PermutationFunctions { v_resourceIndex := f_cse_createResource(int3, m_createContainerBase, v_aeIndex); // Test Body - //Force usage of Non-Hierarchical addressing method + //Force usage of Hierarchical addressing method v_addressingMethod := e_hierarchical; v_primitiveScope := p_primitiveScope; v_request := f_getCreateRequestPrimitive(int3, m_createContainerBase, v_resourceIndex); @@ -921,6 +921,68 @@ module OneM2M_PermutationFunctions { }//end f_CSE_GEN_CRE_003 + + function f_CSE_GEN_CRE_004(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 Hybrid Hierarchical addressing method + v_addressingMethod := e_hybrid; + v_primitiveScope := p_primitiveScope; + v_request := f_getCreateRequestPrimitive(int3, m_createContainerBase, v_resourceIndex); + v_request.to_ := 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 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 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_004 + + } // end of group Create group Retrieve { @@ -1007,7 +1069,7 @@ module OneM2M_PermutationFunctions { v_resourceIndex := f_cse_createResource(int3, m_createContainerBase, v_aeIndex); // Test Body - //Force usage of Non-Hierarchical addressing method + //Force usage of Hierarchical addressing method v_addressingMethod := e_hierarchical; v_primitiveScope := p_primitiveScope; @@ -1094,6 +1156,62 @@ module OneM2M_PermutationFunctions { }//end f_CSE_GEN_RET_003 + function f_CSE_GEN_RET_004(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 Hybrid Hierarchical addressing method + v_addressingMethod := e_hybrid; + v_primitiveScope := p_primitiveScope; + + mcaPort.send(f_getMsgOutPrimitive(m_request(m_retrieve(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 hybrid 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 hybrid 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_004 + } // end of group Retrieve group Update { @@ -1187,7 +1305,7 @@ module OneM2M_PermutationFunctions { v_resourceIndex := f_cse_createResource(int3, m_createContainerBase, v_aeIndex); // Test Body - //Force usage of Non-Hierarchical addressing method + //Force usage of Hierarchical addressing method v_addressingMethod := e_hierarchical; v_primitiveScope := p_primitiveScope; @@ -1287,6 +1405,69 @@ module OneM2M_PermutationFunctions { }//end f_CSE_GEN_UPD_003 + function f_CSE_GEN_UPD_004(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 Hybrid Hierarchical addressing method + v_addressingMethod := e_hybrid; + v_primitiveScope := p_primitiveScope; + + v_updateRequest.primitiveContent.container.labels := {"MyLabel"}; + + v_updateRequest := f_getUpdateRequestPrimitive(int3, v_resourceIndex, v_updateRequest); + v_updateRequest.to_ := 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 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 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_004 + } // end of group Update group Delete { @@ -1377,7 +1558,7 @@ module OneM2M_PermutationFunctions { v_resourceIndex := f_cse_createResource(int3, m_createContainerBase, v_aeIndex); // Test Body - //Force usage of Non-Hierarchical addressing method + //Force usage of Hierarchical addressing method v_addressingMethod := e_hierarchical; v_primitiveScope := p_primitiveScope; @@ -1471,6 +1652,66 @@ module OneM2M_PermutationFunctions { }//end f_CSE_GEN_DEL_003 + function f_CSE_GEN_DEL_004(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 Hybrid Hierarchical addressing method + v_addressingMethod := e_hybrid; + v_primitiveScope := p_primitiveScope; + + v_request := valueof(m_delete(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 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 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_004 + } // 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 4d39979e03b175a6a9835d712fc923030d45fbc3..3227eeb646e3f5a0ec657635f283f6c69a906c3b 100644 --- a/OneM2M_Testcases_CSE_Release_2.ttcn +++ b/OneM2M_Testcases_CSE_Release_2.ttcn @@ -123,8 +123,48 @@ module OneM2M_Testcases_CSE_Release_2 { } }// end of group g_CSE_GEN_CRE_003 - + group g_CSE_GEN_CRE_004 { + + /** + * @desc Check that the IUT accepts the creation of a <container> resource using structured resource identifier with hybrid addressing. + * + */ + testcase TC_CSE_GEN_CRE_004_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_004(e_cseRelative)); + v_ae1.done; + } + + testcase TC_CSE_GEN_CRE_004_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_004(e_spRelative)); + v_ae1.done; + } + + testcase TC_CSE_GEN_CRE_004_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_004(e_absolute)); + v_ae1.done; + } + + } // end of group g_CSE_GEN_CRE_004 + } // end of group Create group Retrieve { @@ -169,6 +209,48 @@ module OneM2M_Testcases_CSE_Release_2 { } // end of group g_CSE_GEN_RET_003 + + group g_CSE_GEN_RET_004 { + + /** + * @desc Check that the IUT accepts the retrieval of a <container> resource using structured resource identifier with hybrid addressing. + * + */ + testcase TC_CSE_GEN_RET_004_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_004(e_cseRelative)); + v_ae1.done; + } + + testcase TC_CSE_GEN_RET_004_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_004(e_spRelative)); + v_ae1.done; + } + + testcase TC_CSE_GEN_RET_004_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_004(e_absolute)); + v_ae1.done; + } + + } // end of group g_CSE_GEN_RET_004 + } // end of group Retrieve group Update { @@ -214,6 +296,48 @@ module OneM2M_Testcases_CSE_Release_2 { } // end of group g_CSE_GEN_UPD_003 + + group g_CSE_GEN_UPD_004 { + + /** + * @desc Check that the IUT accepts the update of a <container> resource using structured resource identifier with hybrid addressing.. + * + */ + testcase TC_CSE_GEN_UPD_004_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_004(e_cseRelative)); + v_ae1.done; + } + + testcase TC_CSE_GEN_UPD_004_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_004(e_spRelative)); + v_ae1.done; + } + + testcase TC_CSE_GEN_UPD_004_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_004(e_absolute)); + v_ae1.done; + } + + } // end of group g_CSE_GEN_UPD_004 + } // end of group Update group Delete { @@ -259,6 +383,48 @@ module OneM2M_Testcases_CSE_Release_2 { } // end of group g_CSE_GEN_DEL_003 + + group g_CSE_GEN_DEL_004 { + + /** + * @desc Check that the IUT accepts the deletion of a <container> resource using structured resource identifier with hybrid addressing. + * + */ + testcase TC_CSE_GEN_DEL_004_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_004(e_cseRelative)); + v_ae1.done; + } + + testcase TC_CSE_GEN_DEL_004_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_004(e_spRelative)); + v_ae1.done; + } + + testcase TC_CSE_GEN_DEL_004_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_004(e_absolute)); + v_ae1.done; + } + + } // end of group g_CSE_GEN_DEL_004 + } // end of group Delete } // end of group Generic