From 0c13e0286e3f2c4fc7a207a5fc16820c8c127f84 Mon Sep 17 00:00:00 2001 From: reinaortega <miguelangel.reinaortega@etsi.org> Date: Thu, 2 Aug 2018 17:45:55 +0200 Subject: [PATCH] New test case implemented (proposal for TP) Signed-off-by: reinaortega <miguelangel.reinaortega@etsi.org> --- LibOneM2M/OneM2M_Functions.ttcn | 7 ++- OneM2M_PermutationFunctions.ttcn | 93 ++++++++++++++++++++++++++++- OneM2M_Testcases_CSE_Release_2.ttcn | 60 +++++++++++++++++++ 3 files changed, 157 insertions(+), 3 deletions(-) diff --git a/LibOneM2M/OneM2M_Functions.ttcn b/LibOneM2M/OneM2M_Functions.ttcn index a266b38..b289308 100644 --- a/LibOneM2M/OneM2M_Functions.ttcn +++ b/LibOneM2M/OneM2M_Functions.ttcn @@ -1770,19 +1770,22 @@ module OneM2M_Functions { setverdict(pass, __SCOPE__ & ":INFO: Notification received with the expected content"); v_responsePrimitive := valueof(m_responseNotification(int2000, omit)); v_responsePrimitive.requestIdentifier := vc_request.primitive.requestPrimitive.requestIdentifier; - mcaPortIn.send(f_getMsgOutPrimitive(m_response(v_responsePrimitive))); } [] mcaPortIn.receive(mw_request(mw_notifyResponsePrimitive(?))) -> value vc_request { tc_ac.stop; setverdict(fail, __SCOPE__ & ":ERROR: Notification received but the content doesn't match"); v_responsePrimitive := valueof(m_responseNotification(int2000, omit)); v_responsePrimitive.requestIdentifier := vc_request.primitive.requestPrimitive.requestIdentifier; - mcaPortIn.send(f_getMsgOutPrimitive(m_response(v_responsePrimitive))); } [] tc_ac.timeout { setverdict(fail, __SCOPE__ & ":ERROR: No notification received"); } } + + if(isvalue(v_responsePrimitive)) { + mcaPortIn.send(f_getMsgOutPrimitive(m_response(v_responsePrimitive))); + } + } //end f_cse_notifyProcedure_representationHandler diff --git a/OneM2M_PermutationFunctions.ttcn b/OneM2M_PermutationFunctions.ttcn index 64c16fd..5110f4b 100644 --- a/OneM2M_PermutationFunctions.ttcn +++ b/OneM2M_PermutationFunctions.ttcn @@ -9775,7 +9775,7 @@ module OneM2M_PermutationFunctions { v_contentResponse.uRI := ?; - v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi); + v_aeIndex := f_cse_preamble_registerAe(-, {f_getAnnouncementTargetPoA(PX_PROTOCOL_BINDING_AE1, PX_AE1_ADDRESS, "")});//c_CRUDNDi); if(ispresent(p_parentRequestPrimitive)) { v_resourceIndex := f_cse_createResource(valueof(p_parentRequestPrimitive.resourceType), p_parentRequestPrimitive, v_aeIndex); @@ -9826,6 +9826,97 @@ module OneM2M_PermutationFunctions { f_cf01Down(); }//end f_CSE_NBR_ASY_004 + + function f_CSE_NBR_ASY_005(template RequestPrimitive p_requestPrimitive, in template (omit) RequestPrimitive p_parentRequestPrimitive := omit, in ResponseStatusCode p_responseStatusCode) runs on AeSimu{ + + // Local variables + var MsgIn v_response; + var RequestPrimitive v_request; + var integer v_aeIndex, v_ae2Index := -1; + var integer v_resourceIndex := -1; + var integer v_acpAuxIndex := -1; + var template PrimitiveContent v_contentResponse; + + // Test control + if(not PICS_NON_BLOCKING_REQUEST_SYNCH){ + setverdict(inconc, __SCOPE__ & ": It is required to support Non-blocking access resource in synchronous mode to run this test case"); + stop; + } + + // Test component configuration + f_cf01Up(true); + + // Test adapter configuration + + // Preamble + + v_contentResponse.uRI := ?; + + v_aeIndex := f_cse_preamble_registerAe(-, {f_getAnnouncementTargetPoA(PX_PROTOCOL_BINDING_AE1, PX_AE1_ADDRESS, "")});//c_CRUDNDi); + + f_checkAeSimuStatus(); + + vc_ae2.start(f_cse_createResource(int2, m_createAe(PX_APP_ID, -, PX_AE2_ID_STEM, c_defaultAE2Name, {f_getAnnouncementTargetPoA(PX_PROTOCOL_BINDING_AE2, PX_AE2_ADDRESS, "")}))); // AE2 is registred + + f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2); + + v_ae2Index := f_getResource(vc_ae2); + + if(ispresent(p_parentRequestPrimitive)) { + v_resourceIndex := f_cse_createResource(valueof(p_parentRequestPrimitive.resourceType), p_parentRequestPrimitive, v_aeIndex); + p_requestPrimitive.to_ := f_getResourceAddress(v_resourceIndex); + }else{ + p_requestPrimitive.to_ := f_getResourceAddress(v_aeIndex); + } + p_requestPrimitive.from_ := f_getOriginator(v_aeIndex); + p_requestPrimitive.responseType.responseTypeValue := int2; //nonBlockingRequestAsynch + p_requestPrimitive.responseType.notificationURI := {f_getResourceAddress(v_aeIndex), f_getResourceAddress(v_ae2Index)}; //"...an empty notification target list is provided" + + // Test Body + + mcaPort.send(f_getMsgOutPrimitive(m_request(valueof(p_requestPrimitive)))); + tc_ac.start; + alt { + [] mcaPort.receive(mw_response(mw_responsePrimitive(int1002, v_contentResponse))) -> value v_response { + tc_ac.stop; + setverdict(pass, __SCOPE__ & ": URI attribute is set to <request> resource address"); + } + [] mcaPort.receive(mw_response(mw_responsePrimitive(int1002))) -> value v_response { + tc_ac.stop; + setverdict(fail, __SCOPE__ & ": URI attribute is not set to <request> resource address"); + } + [] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response { + tc_ac.stop; + setverdict(fail, __SCOPE__ & ": Wrong response status code"); + } + [] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value v_response { + tc_ac.stop; + setverdict(fail, __SCOPE__ & ": Wrong response status code"); + } + [] tc_ac.timeout { + setverdict(fail, __SCOPE__ & ": No answer while executing a Non-blocking access resource in synchronous mode operation"); + } + } + + f_checkAeSimuStatus(); + + //Check if Notification is sent or not + + + vc_ae2.start(f_cse_notifyProcedure_responsePrimitiveHandler(mw_responsePrimitive(p_responseStatusCode))); + + f_cse_notifyProcedure_responsePrimitiveHandler(mw_responsePrimitive(p_responseStatusCode)); + + vc_ae2.done; + + // Postamble + f_cse_postamble_deleteResources(); + + // Tear down + f_cf01Down(); + + }//end f_CSE_NBR_ASY_005 + }//end Group Asynchronous diff --git a/OneM2M_Testcases_CSE_Release_2.ttcn b/OneM2M_Testcases_CSE_Release_2.ttcn index 24d3455..46f0849 100644 --- a/OneM2M_Testcases_CSE_Release_2.ttcn +++ b/OneM2M_Testcases_CSE_Release_2.ttcn @@ -13449,6 +13449,66 @@ module OneM2M_Testcases_CSE_Release_2 { }// end group g_CSE_NBR_ASY_004 + group g_CSE_NBR_ASY_005{ + + /** + * @desc Check that the IUT sends the result of the requested Non-Blocking Asynchronous OPERATION as notification to the Originator when no notification target list is provided + * + */ + testcase TC_CSE_NBR_ASY_005_CRE() runs on Tester system CseSystem { + // Local variables + var template RequestPrimitive v_createRequest := m_createContainerBase; + 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_NBR_ASY_005(m_createContainerBase, -, int2001)); //Create Container + v_ae1.done; + + } + + testcase TC_CSE_NBR_ASY_005_UPD() runs on Tester system CseSystem { + // Local variables + var template RequestPrimitive v_createRequest := m_createContainerBase; + var template RequestPrimitive v_updateRequest := m_updateContainerBase; + var AeSimu v_ae1 := AeSimu.create("AE1") alive; + var Labels v_labels_1 := {"VALUE_1"}; + + v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1)); + v_ae1.done; + v_updateRequest.primitiveContent.container.labels := v_labels_1; + + v_ae1.start(f_CSE_NBR_ASY_005(m_updateContainerBase, m_createContainerBase, int2004)); //Update Container + v_ae1.done; + + } + + testcase TC_CSE_NBR_ASY_005_RET() runs on Tester system CseSystem { + // Local variables + var template RequestPrimitive v_createRequest := m_createContainerBase; + 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_NBR_ASY_005(m_retrieve("NotInitialized", "NotInitialized"), m_createContainerBase, int2000)); //Retrieve Container + v_ae1.done; + + } + + testcase TC_CSE_NBR_ASY_005_DEL() runs on Tester system CseSystem { + // Local variables + var template RequestPrimitive v_createRequest := m_createContainerBase; + 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_NBR_ASY_005(m_delete("NotInitialized", "NotInitialized"), m_createContainerBase, int2002)); //Delete Container + v_ae1.done; + + } + + }// end group g_CSE_NBR_ASY_005 + }// end group Asynchronous }// end group Non_Blocking_Requests -- GitLab