diff --git a/LibOneM2M/OneM2M_Functions.ttcn b/LibOneM2M/OneM2M_Functions.ttcn index e4c593a0be86aff473047a2d9d3281a24bb8e201..dfe81eb5e508d8ca8f473d61f054bbf0b3c03351 100644 --- a/LibOneM2M/OneM2M_Functions.ttcn +++ b/LibOneM2M/OneM2M_Functions.ttcn @@ -1467,6 +1467,41 @@ module OneM2M_Functions { } } //end f_cse_notifyProcedure_representationHandler + + /** + * @desc Handling message exchange for the notification procedure + * @param p_responsePrimitive Expected responsePrimitive in the notification + * @verdict + */ + function f_cse_notifyProcedure_responsePrimitiveHandler(template ResponsePrimitive p_responsePrimitive) runs on AeSimu { + // Local variables + var ResponsePrimitive v_responsePrimitive; + + //Activate defaults when running on a PTC + f_cse_activateDefaults_ae(); + + tc_ac.start; + alt { + [] mcaPortIn.receive(mw_request(mw_notifyResponsePrimitive(p_responsePrimitive))) -> value vc_request { + tc_ac.stop; + setverdict(pass, __SCOPE__ & ":INFO: Notification received with the expected content"); + v_responsePrimitive := valueof(m_responseNotification(int2001, omit)); + v_responsePrimitive.requestIdentifier := vc_request.primitive.requestPrimitive.requestIdentifier; + mcaPortIn.send(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(int2001, omit)); + v_responsePrimitive.requestIdentifier := vc_request.primitive.requestPrimitive.requestIdentifier; + mcaPortIn.send(m_response(v_responsePrimitive)); + } + [] tc_ac.timeout { + setverdict(fail, __SCOPE__ & ":ERROR: No notification received"); + } + } + + } //end f_cse_notifyProcedure_representationHandler /** * @desc Handling message exchange for the notification procedure (aggregatedNotification) diff --git a/LibOneM2M/OneM2M_Templates.ttcn b/LibOneM2M/OneM2M_Templates.ttcn index b4b87dc1cfeef2512f669eb068d37f823ee08dd4..786e38df481dd56c09d87b08f44dd8d52578eaec 100644 --- a/LibOneM2M/OneM2M_Templates.ttcn +++ b/LibOneM2M/OneM2M_Templates.ttcn @@ -1345,6 +1345,13 @@ module OneM2M_Templates { primitiveContent := {notification := p_notification} }; + /** + * @desc Base NOTIFY request primitive for ResponsePrimitive + */ + + template RequestPrimitive mw_notifyResponsePrimitive(in template (present) ResponsePrimitive p_responsePrimitive) modifies mw_notify := { + primitiveContent := {responsePrimitive := p_responsePrimitive} + }; diff --git a/OneM2M_PermutationFunctions.ttcn b/OneM2M_PermutationFunctions.ttcn index cfddf802af46ecb737ae9e8649e6f8db6dfd1e0e..e456a2a31384dbd78400c55c170990e2a4561515 100644 --- a/OneM2M_PermutationFunctions.ttcn +++ b/OneM2M_PermutationFunctions.ttcn @@ -6473,7 +6473,7 @@ module OneM2M_PermutationFunctions { } // Test component configuration - f_cf01Up(true); + f_cf01Up(); // Test adapter configuration @@ -6539,7 +6539,7 @@ module OneM2M_PermutationFunctions { } // Test component configuration - f_cf01Up(true); + f_cf01Up(); // Test adapter configuration @@ -6639,7 +6639,7 @@ module OneM2M_PermutationFunctions { } // Test component configuration - f_cf01Up(true); + f_cf01Up(); // Test adapter configuration @@ -6766,7 +6766,7 @@ module OneM2M_PermutationFunctions { } // Test component configuration - f_cf01Up(true); + f_cf01Up(); // Test adapter configuration @@ -6843,7 +6843,7 @@ module OneM2M_PermutationFunctions { } // Test component configuration - f_cf01Up(true); + f_cf01Up(); // Test adapter configuration @@ -6920,6 +6920,159 @@ module OneM2M_PermutationFunctions { f_cf01Down(); }//end f_CSE_NBR_ASY_002 + + function f_CSE_NBR_ASY_003(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 := -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(); + + // Test adapter configuration + + // Preamble + + v_contentResponse.uRI := ?; + + v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi); + + 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 := omit; //"...no notification target list is provided" + + mcaPort.send(m_request(valueof(p_requestPrimitive))); + tc_ac.start; + alt { + [] mcaPort.receive(mw_response(mw_responsePrimitive(int1001, 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(int1001))) -> 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(); + + //Test Body + + //Check to see if the notification is received + f_cse_notifyProcedure_responsePrimitiveHandler(mw_responsePrimitive(p_responseStatusCode)); + + // Postamble + f_cse_postamble_deleteResources(); + + // Tear down + f_cf01Down(); + + }//end f_CSE_NBR_ASY_003 + + function f_CSE_NBR_ASY_004(template RequestPrimitive p_requestPrimitive, in template (omit) RequestPrimitive p_parentRequestPrimitive := omit) runs on AeSimu{ + + // Local variables + var MsgIn v_response; + var RequestPrimitive v_request; + var integer v_aeIndex := -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(); + + // Test adapter configuration + + // Preamble + + v_contentResponse.uRI := ?; + + v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi); + + 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 := {}; //"...an empty notification target list is provided" + + // Test Body + + mcaPort.send(m_request(valueof(p_requestPrimitive))); + tc_ac.start; + alt { + [] mcaPort.receive(mw_response(mw_responsePrimitive(int1001, 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(int1001))) -> 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 + + f_cse_notifyProcedure_noNotificationHandler(); + + // Postamble + f_cse_postamble_deleteResources(); + + // Tear down + f_cf01Down(); + + }//end f_CSE_NBR_ASY_004 }//end Group Asynchronous diff --git a/OneM2M_Testcases_CSE_Release_2.ttcn b/OneM2M_Testcases_CSE_Release_2.ttcn index 02b9ff9c5b0347c6e2b6aee6d3907076acb50ea5..4ed95d7d698bc0a08df7d425d78f9a8a47b3076d 100644 --- a/OneM2M_Testcases_CSE_Release_2.ttcn +++ b/OneM2M_Testcases_CSE_Release_2.ttcn @@ -7281,7 +7281,7 @@ module OneM2M_Testcases_CSE_Release_2 { v_ae1.start(f_CSE_NBR_SYN_002(m_updateContainerBase, m_createContainerBase)); //Update Container v_ae1.done; - } + } testcase TC_CSE_NBR_SYN_002_RET() runs on Tester system CseSystem { // Local variables @@ -7333,7 +7333,7 @@ module OneM2M_Testcases_CSE_Release_2 { v_ae1.start(f_CSE_NBR_SYN_003(m_updateContainerBase, m_createContainerBase, int3)); //Update Container v_ae1.done; - } + } testcase TC_CSE_NBR_SYN_003_RET() runs on Tester system CseSystem { // Local variables @@ -7388,7 +7388,7 @@ module OneM2M_Testcases_CSE_Release_2 { v_ae1.start(f_CSE_NBR_ASY_001(m_updateContainerBase, m_createContainerBase)); //Update Container v_ae1.done; - } + } testcase TC_CSE_NBR_ASY_001_RET() runs on Tester system CseSystem { // Local variables @@ -7440,7 +7440,7 @@ module OneM2M_Testcases_CSE_Release_2 { v_ae1.start(f_CSE_NBR_ASY_002(m_updateContainerBase, m_createContainerBase)); //Update Container v_ae1.done; - } + } testcase TC_CSE_NBR_ASY_002_RET() runs on Tester system CseSystem { // Local variables @@ -7464,6 +7464,110 @@ module OneM2M_Testcases_CSE_Release_2 { }// end group g_CSE_NBR_ASY_002 + group g_CSE_NBR_ASY_003{ + + /** + * @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_003_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_CSE_NBR_ASY_003(m_createContainerBase, -, int2001)); //Create Container + v_ae1.done; + + } + + testcase TC_CSE_NBR_ASY_003_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_updateRequest.primitiveContent.container.labels := v_labels_1; + + v_ae1.start(f_CSE_NBR_ASY_003(m_updateContainerBase, m_createContainerBase, int2004)); //Update Container + v_ae1.done; + + } + + testcase TC_CSE_NBR_ASY_003_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_CSE_NBR_ASY_003(m_retrieve("NotInitialized", "NotInitialized"), m_createContainerBase, int2000)); //Retrieve Container + v_ae1.done; + + } + + testcase TC_CSE_NBR_ASY_003_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_CSE_NBR_ASY_003(m_delete("NotInitialized", "NotInitialized"), m_createContainerBase, int2002)); //Delete Container + v_ae1.done; + + } + + }// end group g_CSE_NBR_ASY_003 + + group g_CSE_NBR_ASY_004{ + + /** + * @desc Check that the IUT does not send the result of the requested Non-Blocking Asynchronous OPERATION as notification to the Originator when an empty notification target list is provided + * + */ + testcase TC_CSE_NBR_ASY_004_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_CSE_NBR_ASY_004(m_createContainerBase, -)); //Create Container + v_ae1.done; + + } + + testcase TC_CSE_NBR_ASY_004_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_updateRequest.primitiveContent.container.labels := v_labels_1; + + v_ae1.start(f_CSE_NBR_ASY_004(m_updateContainerBase, m_createContainerBase)); //Update Container + v_ae1.done; + + } + + testcase TC_CSE_NBR_ASY_004_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_CSE_NBR_ASY_004(m_retrieve("NotInitialized", "NotInitialized"), m_createContainerBase)); //Retrieve Container + v_ae1.done; + + } + + testcase TC_CSE_NBR_ASY_004_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_CSE_NBR_ASY_004(m_delete("NotInitialized", "NotInitialized"), m_createContainerBase)); //Delete Container + v_ae1.done; + + } + + }// end group g_CSE_NBR_ASY_004 + }// end group Asynchronous }// end group Non_Blocking_Requests