diff --git a/LibOneM2M/OneM2M_Functions.ttcn b/LibOneM2M/OneM2M_Functions.ttcn index 805c07e28caa0c0ba4d64349b447c4ca31d5002a..2bfb9b0fbc12830e5b99bff6925987576208d0b5 100644 --- a/LibOneM2M/OneM2M_Functions.ttcn +++ b/LibOneM2M/OneM2M_Functions.ttcn @@ -2592,9 +2592,10 @@ module OneM2M_Functions { * @param p_primitiveContent Expected primitiveContent in the notification * @verdict */ - function f_cse_notifyProcedure_representationHandler(template PrimitiveContent p_primitiveContent, in ResponseStatusCode p_responseStatusCode := int2000) runs on AeSimu { + function f_cse_notifyProcedure_representationHandler(template PrimitiveContent p_primitiveContent, in ResponseStatusCode p_responseStatusCode := int2000, boolean p_holdResponse := false) runs on AeSimu { // Local variables var ResponsePrimitive v_responsePrimitive; + timer t_holdResponse; //Activate defaults when running on a PTC f_cse_activateDefaults_ae(); @@ -2612,6 +2613,10 @@ module OneM2M_Functions { //Send response in any case v_responsePrimitive := valueof(m_responseNotification(p_responseStatusCode, omit)); v_responsePrimitive.requestIdentifier := vc_request.primitive.requestPrimitive.requestIdentifier; + if (p_holdResponse) { + t_holdResponse.start(PX_TAC/2.0); + t_holdResponse.timeout; + } f_send(e_mcaPortIn, m_response(v_responsePrimitive)); } [] mcaPortIn.receive(mw_request(mw_notifyNotification(?))) -> value vc_request { diff --git a/OneM2M_Testcases_CSE_Release_4.ttcn b/OneM2M_Testcases_CSE_Release_4.ttcn index b88878948a4832201f50201722ccf05192a54ff8..15ff25a2f6817b88f3ee6855f5716a41e0d30f52 100644 --- a/OneM2M_Testcases_CSE_Release_4.ttcn +++ b/OneM2M_Testcases_CSE_Release_4.ttcn @@ -2157,8 +2157,8 @@ module OneM2M_Testcases_CSE_Release_4 { var template RequestPrimitive v_updateRequest := m_updateContainerBase; var Labels v_labels_1:= {"VALUE_1"}; var Labels v_labels_2:= {"VALUE_2"}; - var template PrimitiveContent v_contentNotification := {container := mw_contentContainerBase};// all attributes expected - + var template PrimitiveContent v_contentNotification := {container := mw_contentContainer_allOmit};//only modified attributes expected + v_contentNotification.container.labels := v_labels_2; // Test control @@ -2172,7 +2172,7 @@ module OneM2M_Testcases_CSE_Release_4 { v_createRequest.primitiveContent.container.labels := v_labels_1; v_resourceIndex := f_cse_createResource(c_containerResourceType, v_createRequest, v_aeIndex_1);//Container - v_createRequest := m_createSubscriptionAdvanced(f_getResourceAddress(v_resourceIndex), -, {f_getResourceAddress(v_aeIndex_2)}, m_eventNotificationCriteria({int7}), -, omit, omit, omit, -, omit); //Blocking_update(7) + v_createRequest := m_createSubscriptionAdvanced(f_getResourceAddress(v_resourceIndex), -, {f_getResourceAddress(v_aeIndex_2)}, m_eventNotificationCriteria({int7}), -, omit, omit, omit, int2, omit); //Blocking_update(7) f_cse_preamble_subscriptionVerification(v_aeIndex_2, v_createRequest, int23);//AE2 registration @@ -2180,17 +2180,27 @@ module OneM2M_Testcases_CSE_Release_4 { f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2); - if(vc_ae2.running) { - vc_ae2.stop; - }; - // Test Body vc_ae2.start(f_cse_notifyProcedure_representationHandler(v_contentNotification));//Check notification - v_updateRequest.filterCriteria.labels := v_labels_1; v_updateRequest.primitiveContent.container.labels := v_labels_2; f_cse_sendUpdateRequestPrimitive(int3, v_updateRequest, v_resourceIndex); // Update request + tc_ac.start; + alt { + [] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value vc_response { + tc_ac.stop; + setverdict(pass, __SCOPE__&":INFO: Attribute of resource updated successfuly"); + } + [] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value vc_response { + tc_ac.stop; + setverdict(fail, __SCOPE__&":INFO: Error while updating resource"); + } + [] tc_ac.timeout { + setverdict(fail, __SCOPE__&":INFO: No answer while updating resource"); + } + } + f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2); //Postamble @@ -2225,9 +2235,9 @@ module OneM2M_Testcases_CSE_Release_4 { var template RequestPrimitive v_updateRequest := m_updateContainerBase; var Labels v_labels_1:= {"VALUE_1"}; var Labels v_labels_2:= {"VALUE_2"}; - const AttributeList c_optionalAttribute := {"labels"}; - var template PrimitiveContent v_contentNotification := {container := mw_contentContainerBase};// all attributes expected - + const AttributeList c_optionalAttribute := {"lbl"}; + var template PrimitiveContent v_contentNotification := {container := mw_contentContainer_allOmit};//only modified attributes expected + v_contentNotification.container.labels := v_labels_2; // Test control @@ -2241,7 +2251,7 @@ module OneM2M_Testcases_CSE_Release_4 { v_createRequest.primitiveContent.container.labels := v_labels_1; v_resourceIndex := f_cse_createResource(c_containerResourceType, v_createRequest, v_aeIndex_1);//Container - v_createRequest := m_createSubscriptionAdvanced(f_getResourceAddress(v_resourceIndex), -, {f_getResourceAddress(v_aeIndex_2)}, m_eventNotificationCriteria({int7}, c_optionalAttribute), -, omit, omit, omit, -, omit); //Blocking_update(7) + v_createRequest := m_createSubscriptionAdvanced(f_getResourceAddress(v_resourceIndex), -, {f_getResourceAddress(v_aeIndex_2)}, m_eventNotificationCriteria({int7}, c_optionalAttribute), -, omit, omit, omit, int2, omit); //Blocking_update(7) f_cse_preamble_subscriptionVerification(v_aeIndex_2, v_createRequest, int23);//AE2 registration @@ -2249,17 +2259,29 @@ module OneM2M_Testcases_CSE_Release_4 { f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2); - if(vc_ae2.running) { - vc_ae2.stop; - }; - // Test Body vc_ae2.start(f_cse_notifyProcedure_representationHandler(v_contentNotification));//Check notification + v_updateRequest.filterCriteria := m_filterCriteria; v_updateRequest.filterCriteria.labels := v_labels_1; v_updateRequest.primitiveContent.container.labels := v_labels_2; f_cse_sendUpdateRequestPrimitive(int3, v_updateRequest, v_resourceIndex); // Update request + tc_ac.start; + alt { + [] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value vc_response { + tc_ac.stop; + setverdict(pass, __SCOPE__&":INFO: Attribute of resource updated successfuly"); + } + [] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value vc_response { + tc_ac.stop; + setverdict(fail, __SCOPE__&":INFO: Error while updating resource"); + } + [] tc_ac.timeout { + setverdict(fail, __SCOPE__&":INFO: No answer while updating resource"); + } + } + f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2); //Postamble @@ -2294,11 +2316,8 @@ module OneM2M_Testcases_CSE_Release_4 { var template RequestPrimitive v_updateRequest := m_updateContainerBase; var Labels v_labels_1:= {"VALUE_1"}; var Labels v_labels_2:= {"VALUE_2"}; - const AttributeList c_optionalAttribute_1 := {"labels"}; - const AttributeList c_optionalAttribute_2 := {"maxByteSize"}; - var template PrimitiveContent v_contentNotification := {container := mw_contentContainerBase};// all attributes expected - - + const AttributeList c_optionalAttribute_1 := {"mbs"}; + // Test control // Test component configuration @@ -2311,7 +2330,7 @@ module OneM2M_Testcases_CSE_Release_4 { v_createRequest.primitiveContent.container.labels := v_labels_1; v_resourceIndex := f_cse_createResource(c_containerResourceType, v_createRequest, v_aeIndex_1);//Container - v_createRequest := m_createSubscriptionAdvanced(f_getResourceAddress(v_resourceIndex), -, {f_getResourceAddress(v_aeIndex_2)}, m_eventNotificationCriteria({int7}, c_optionalAttribute_2), -, omit, omit, omit, -, omit); //Blocking_update(7) + v_createRequest := m_createSubscriptionAdvanced(f_getResourceAddress(v_resourceIndex), -, {f_getResourceAddress(v_aeIndex_2)}, m_eventNotificationCriteria({int7}, c_optionalAttribute_1), -, omit, omit, omit, int2, omit); //Blocking_update(7) f_cse_preamble_subscriptionVerification(v_aeIndex_2, v_createRequest, int23);//AE2 registration @@ -2319,17 +2338,29 @@ module OneM2M_Testcases_CSE_Release_4 { f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2); - if(vc_ae2.running) { - vc_ae2.stop; - }; - // Test Body vc_ae2.start(f_cse_notifyProcedure_noNotificationHandler());//Check no notification + v_updateRequest.filterCriteria := m_filterCriteria; v_updateRequest.filterCriteria.labels := v_labels_1; v_updateRequest.primitiveContent.container.labels := v_labels_2; f_cse_sendUpdateRequestPrimitive(int3, v_updateRequest, v_resourceIndex); // Update request + tc_ac.start; + alt { + [] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value vc_response { + tc_ac.stop; + setverdict(pass, __SCOPE__&":INFO: Attribute of resource updated successfuly"); + } + [] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value vc_response { + tc_ac.stop; + setverdict(fail, __SCOPE__&":INFO: Error while updating resource"); + } + [] tc_ac.timeout { + setverdict(fail, __SCOPE__&":INFO: No answer while updating resource"); + } + } + f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2); //Postamble @@ -2365,8 +2396,9 @@ module OneM2M_Testcases_CSE_Release_4 { var template RequestPrimitive v_updateRequest := m_updateContainerBase; var Labels v_labels_1:= {"VALUE_1"}; var Labels v_labels_2:= {"VALUE_2"}; - var template PrimitiveContent v_contentNotification := {container := mw_contentContainerBase};// all attributes expected - + var Labels v_labels_3:= {"VALUE_3"}; + var template PrimitiveContent v_contentNotification := {container := mw_contentContainer_allOmit};// all attributes expected + v_contentNotification.container.labels := v_labels_2; // Test control @@ -2380,7 +2412,7 @@ module OneM2M_Testcases_CSE_Release_4 { v_createRequest.primitiveContent.container.labels := v_labels_1; v_resourceIndex := f_cse_createResource(c_containerResourceType, v_createRequest, v_aeIndex_1);//Container - v_createRequest := m_createSubscriptionAdvanced(f_getResourceAddress(v_resourceIndex), -, {f_getResourceAddress(v_aeIndex_2)}, m_eventNotificationCriteria({int7}), -, omit, omit, omit, -, omit); //Blocking_update(7) + v_createRequest := m_createSubscriptionAdvanced(f_getResourceAddress(v_resourceIndex), -, {f_getResourceAddress(v_aeIndex_2)}, m_eventNotificationCriteria({int7}), -, omit, omit, omit, int2, omit); //Blocking_update(7) f_cse_preamble_subscriptionVerification(v_aeIndex_2, v_createRequest, int23);//AE2 registration @@ -2388,37 +2420,33 @@ module OneM2M_Testcases_CSE_Release_4 { f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2); - if(vc_ae2.running) { - vc_ae2.stop; - }; - // Test Body - v_updateRequest.filterCriteria.labels := v_labels_1; + vc_ae2.start(f_cse_notifyProcedure_representationHandler(v_contentNotification, -, true));//Check notification + v_updateRequest.primitiveContent.container.labels := v_labels_2; f_cse_sendUpdateRequestPrimitive(int3, v_updateRequest, v_resourceIndex); // Update request 1 must be incomplete v_request:= f_getUpdateRequestPrimitive(int3, v_resourceIndex, v_updateRequest); // Update request 2 - + v_request.primitiveContent.container.labels := v_labels_3; + v_request.requestExpirationTimestamp.alt_1 := 10000; f_send(e_mcaPort, m_request(v_request)); tc_ac.start; alt { - [] mcaPort.receive(mw_response(mw_responsePrimitive(int2004))) -> value vc_response { + [] mcaPort.receive(mw_response(mw_responsePrimitive(int4008))) -> value vc_response { tc_ac.stop; - setverdict(fail, __SCOPE__ & ": Update operation not blocked"); + setverdict(pass, __SCOPE__ & ": Update operation blocked"); } [] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value vc_response { tc_ac.stop; - setverdict(fail, __SCOPE__ & ": Wrong response status code"); - } - [] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value vc_response { - tc_ac.stop; - setverdict(fail, __SCOPE__ & ": Error while updating resource type int3 (Container)"); + setverdict(fail, __SCOPE__ & ": Update operation not blocked"); } [] tc_ac.timeout { setverdict(pass, __SCOPE__ & ": No answer while updating resource type int3 (Container)"); // No answer while previous update request is incomplete } } + + f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2); //Postamble f_cse_postamble_deleteResources(); @@ -2452,8 +2480,8 @@ module OneM2M_Testcases_CSE_Release_4 { var template RequestPrimitive v_updateRequest := m_updateContainerBase; var Labels v_labels_1:= {"VALUE_1"}; var Labels v_labels_2:= {"VALUE_2"}; - var template PrimitiveContent v_contentNotification := {container := mw_contentContainerBase};// all attributes expected - + var template PrimitiveContent v_contentNotification := {container := mw_contentContainer_allOmit};// all attributes expected + v_contentNotification.container.labels := v_labels_2; // Test control @@ -2467,7 +2495,7 @@ module OneM2M_Testcases_CSE_Release_4 { v_createRequest.primitiveContent.container.labels := v_labels_1; v_resourceIndex := f_cse_createResource(c_containerResourceType, v_createRequest, v_aeIndex_1);//Container - v_createRequest := m_createSubscriptionAdvanced(f_getResourceAddress(v_resourceIndex), -, {f_getResourceAddress(v_aeIndex_2)}, m_eventNotificationCriteria({int7}), -, omit, omit, omit, -, omit); //Blocking_update(7) + v_createRequest := m_createSubscriptionAdvanced(f_getResourceAddress(v_resourceIndex), -, {f_getResourceAddress(v_aeIndex_2)}, m_eventNotificationCriteria({int7}), -, omit, omit, omit, int2, omit); //Blocking_update(7) f_cse_preamble_subscriptionVerification(v_aeIndex_2, v_createRequest, int23);//AE2 registration @@ -2475,14 +2503,9 @@ module OneM2M_Testcases_CSE_Release_4 { f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2); - if(vc_ae2.running) { - vc_ae2.stop; - }; - // Test Body vc_ae2.start(f_cse_notifyProcedure_representationHandler(v_contentNotification));//Check notification - v_updateRequest.filterCriteria.labels := v_labels_1; v_updateRequest.primitiveContent.container.labels := v_labels_2; f_cse_updateResource(int3, v_resourceIndex, v_updateRequest); // Update request @@ -2521,8 +2544,8 @@ module OneM2M_Testcases_CSE_Release_4 { var template RequestPrimitive v_updateRequest := m_updateContainerBase; var Labels v_labels_1:= {"VALUE_1"}; var Labels v_labels_2:= {"VALUE_2"}; - var template PrimitiveContent v_contentNotification := {container := mw_contentContainerBase};// all attributes expected - + var template PrimitiveContent v_contentNotification := {container := mw_contentContainer_allOmit};// all attributes expected + v_contentNotification.container.labels := v_labels_2; // Test control @@ -2536,7 +2559,7 @@ module OneM2M_Testcases_CSE_Release_4 { v_createRequest.primitiveContent.container.labels := v_labels_1; v_resourceIndex := f_cse_createResource(c_containerResourceType, v_createRequest, v_aeIndex_1);//Container - v_createRequest := m_createSubscriptionAdvanced(f_getResourceAddress(v_resourceIndex), -, {f_getResourceAddress(v_aeIndex_2)}, m_eventNotificationCriteria({int7}), -, omit, omit, omit, -, omit); //Blocking_update(7) + v_createRequest := m_createSubscriptionAdvanced(f_getResourceAddress(v_resourceIndex), -, {f_getResourceAddress(v_aeIndex_2)}, m_eventNotificationCriteria({int7}), -, omit, omit, omit, int2, omit); //Blocking_update(7) f_cse_preamble_subscriptionVerification(v_aeIndex_2, v_createRequest, int23);//AE2 registration @@ -2544,14 +2567,9 @@ module OneM2M_Testcases_CSE_Release_4 { f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2); - if(vc_ae2.running) { - vc_ae2.stop; - }; - // Test Body - vc_ae2.start(f_cse_notifyProcedure_subscriptionVerificationHandler(int5103));//Check notification TARGET_NOT_REACHABLE(5103) + vc_ae2.start(f_cse_notifyProcedure_representationHandler(v_contentNotification, int5103));//Check notification TARGET_NOT_REACHABLE(5103) - v_updateRequest.filterCriteria.labels := v_labels_1; v_updateRequest.primitiveContent.container.labels := v_labels_2; v_request:= f_getUpdateRequestPrimitive(int3, v_resourceIndex, v_updateRequest); @@ -2610,8 +2628,8 @@ module OneM2M_Testcases_CSE_Release_4 { var template RequestPrimitive v_updateRequest := m_updateContainerBase; var Labels v_labels_1:= {"VALUE_1"}; var Labels v_labels_2:= {"VALUE_2"}; - var template PrimitiveContent v_contentNotification := {container := mw_contentContainerBase};// all attributes expected - + var template PrimitiveContent v_contentNotification := {container := mw_contentContainer_allOmit};// all attributes expected + v_contentNotification.container.labels := v_labels_2; // Test control @@ -2625,7 +2643,7 @@ module OneM2M_Testcases_CSE_Release_4 { v_createRequest.primitiveContent.container.labels := v_labels_1; v_resourceIndex := f_cse_createResource(c_containerResourceType, v_createRequest, v_aeIndex_1);//Container - v_createRequest := m_createSubscriptionAdvanced(f_getResourceAddress(v_resourceIndex), -, {f_getResourceAddress(v_aeIndex_2)}, m_eventNotificationCriteria({int7}), -, omit, omit, omit, -, omit); //Blocking_update(7) + v_createRequest := m_createSubscriptionAdvanced(f_getResourceAddress(v_resourceIndex), -, {f_getResourceAddress(v_aeIndex_2)}, m_eventNotificationCriteria({int7}), -, omit, omit, omit, int2, omit); //Blocking_update(7) f_cse_preamble_subscriptionVerification(v_aeIndex_2, v_createRequest, int23);//AE2 registration @@ -2633,14 +2651,9 @@ module OneM2M_Testcases_CSE_Release_4 { f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2); - if(vc_ae2.running) { - vc_ae2.stop; - }; - // Test Body - vc_ae2.start(f_cse_notifyProcedure_subscriptionVerificationHandler(int4005));//Check notification OPERATION_NOT_ALLOWED(4005) + vc_ae2.start(f_cse_notifyProcedure_representationHandler(v_contentNotification, int4005));//Check notification OPERATION_NOT_ALLOWED(4005) - v_updateRequest.filterCriteria.labels := v_labels_1; v_updateRequest.primitiveContent.container.labels := v_labels_2; v_request:= f_getUpdateRequestPrimitive(int3, v_resourceIndex, v_updateRequest);