diff --git a/OneM2M_Testcases_CSE_Release_2.ttcn b/OneM2M_Testcases_CSE_Release_2.ttcn index 99833afd2c89f995ed3f7d07628ee45cedef2067..d18fc70e32e4552cd6a199caf64b258eeb2dae26 100644 --- a/OneM2M_Testcases_CSE_Release_2.ttcn +++ b/OneM2M_Testcases_CSE_Release_2.ttcn @@ -2917,7 +2917,7 @@ module OneM2M_Testcases_CSE_Release_2 { } // end TC_CSE_SUB_NTF_002 /** - * @desc Check that the IUT sends aggregated notification to the subscriber resource when the duration value of the batchNotify attribute is set to TIME_LIMIT and when this timer expires + * @desc Check that the IUT sends batched notifications to the subscriber resource when the duration value of the batchNotify attribute is set to TIME_LIMIT and when this timer expires * */ testcase TC_CSE_SUB_NTF_003() runs on Tester system CseSystem { @@ -2934,20 +2934,24 @@ module OneM2M_Testcases_CSE_Release_2 { // Local variables timer t_batchNotificationTimer := PX_TAC * 2.0; var float v_elapsedTime; - const integer c_numberOfAggregatedNotification := 2; var Labels v_labels_1:= {"VALUE_1"}; - var Labels v_labels_2:= {"VALUE_2"}; - var integer v_aeIndex := -1; + var integer v_ae1Index := -1; var integer v_resourceIndex := -1; var template RequestPrimitive v_createRequest := omit; var template PrimitiveContent v_contentResponse; - var template RequestPrimitive v_updateRequest := m_updateAeBase; + var template RequestPrimitive v_updateRequest := m_updateAeBase; var RequestPrimitive v_request; + var ResponsePrimitive v_responsePrimitive; var integer v_ae2Index := -1; + var integer v_ae2LocalIndex := -1; v_contentResponse.aE := mw_contentAeBase; // all attributes expected // Test control + if(PX_TAC < 10.0) { + setverdict(inconc, __SCOPE__ & ": PX_TAC is required to be bigger than 10 seconds to run this test case"); + stop; + } // Test component configuration f_cf01Up(true); @@ -2955,39 +2959,83 @@ module OneM2M_Testcases_CSE_Release_2 { // Test adapter configuration // Preamble - v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi); + f_cse_createAccessControlPolicyAux("SubscriptionVerificationAcp",{"all"}, int63); - f_cse_preamble_subscriptionVerification(v_ae2Index, v_createRequest, int23); + v_ae1Index := f_cse_createResource_withAcpAux(int2, m_createAe(PX_TS_AE1.appId, -, PX_TS_AE1.aeIdStem, c_aeAuxName, {f_getCompletePoA(PX_TS_AE1.mcaPortIn, "")}), -1); // AE1 is registred - v_createRequest := m_createSubscriptionAdvanced(f_getResourceAddress(v_aeIndex), -, {f_getResourceAddress(v_ae2Index)},omit,omit,m_batchNotify(c_numberOfAggregatedNotification + 1, "PT10S" ), omit, omit, -, int2);//batchNotify/number greater than number of notifications to be sent so that batchNotify/duration expires before - - v_resourceIndex := f_cse_createResource(int23, v_createRequest, v_aeIndex);//Subscription + vc_ae2.start(f_cse_createResource(int2, m_createAe(PX_TS_AE2.appId, -, PX_TS_AE2.aeIdStem, c_defaultAE2Name, omit), -1)); // AE2 is registred - if(vc_ae2.running) { - vc_ae2.stop; - }; + f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2); + + v_ae2LocalIndex := f_getResourceFromAeSimu(vc_ae2); + + v_ae2Index := f_getLatestResourceIndex(vc_ae2); + + v_createRequest := m_createSubscriptionAdvanced(f_getResourceAddress(v_ae2LocalIndex), -, {f_getResourceAddress(v_ae1Index)},omit,omit,m_batchNotify(2, "PT10S" ), omit, omit, -, int2);//batchNotify/number greater than number of notifications to be sent so that batchNotify/duration expires before + vc_ae2.start(f_cse_createResource(int23, v_createRequest, v_ae2Index));//Subscription + + tc_ac.start; + alt { + [] mcaPortIn.receive(mw_request(mw_notifyNotification(mw_contentNotificationVerification))) -> value vc_request { + tc_ac.stop; + setverdict(pass, __SCOPE__ & ":INFO: Notification received"); + v_responsePrimitive := valueof(m_responseNotification(int2000, omit)); + v_responsePrimitive.requestIdentifier := vc_request.primitive.requestPrimitive.requestIdentifier; + f_send(e_mca_in_port, m_httpResponse(v_responsePrimitive)); + } + [] mcaPortIn.receive(mw_request(mw_notifyNotification(mw_contentNotification(?)))) -> value vc_request { + tc_ac.stop; + setverdict(inconc, __SCOPE__ & ":ERROR: Notification received but verificationRequest isn't set to TRUE"); + v_responsePrimitive := valueof(m_responseNotification(int4000, omit)); + v_responsePrimitive.requestIdentifier := vc_request.primitive.requestPrimitive.requestIdentifier; + f_send(e_mca_in_port, m_httpResponse(v_responsePrimitive)); + } + [] tc_ac.timeout { + if (not(vc_ae2.running)){ + setverdict(pass, __SCOPE__ & ":INFO: No subscription verification received but subscription resource was created"); + } + } + } + + f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2); + + f_checkAeSimuStatus(); + // Test Body - vc_ae2.start(f_cse_notifyProcedure_aggregatedNoficationHandler(v_contentResponse, c_numberOfAggregatedNotification)); - - v_updateRequest.primitiveContent.aE.labels := v_labels_1; - f_cse_updateResource(int2, v_aeIndex, v_updateRequest); // Update request 1 - t_batchNotificationTimer.start; + t_batchNotificationTimer.start; - v_updateRequest := m_updateAeBase; - v_updateRequest.primitiveContent.aE.appName := "MyAppName2"; - f_cse_updateResource(int2, v_aeIndex, v_updateRequest); // Update request 2 - - vc_ae2.done; - v_elapsedTime := t_batchNotificationTimer.read; - t_batchNotificationTimer.stop; + v_updateRequest.primitiveContent.aE.labels := v_labels_1; + vc_ae2.start(f_cse_updateResource(int2, v_ae2Index, v_updateRequest)); // Update request 1 - if(v_elapsedTime < 10.0) { - setverdict(fail, __SCOPE__ & ": Notifications sent before bathNotify/duration expired"); + tc_ac.start; + alt { + [] mcaPortIn.receive(mw_request(mw_notifyNotification(mw_contentNotification(?)))) -> value vc_request { + tc_ac.stop; + if(f_check_notificationContent(vc_request.primitive.requestPrimitive, v_contentResponse)){ + setverdict(pass, __SCOPE__ & ":INFO: Notification received"); + v_elapsedTime := t_batchNotificationTimer.read; + t_batchNotificationTimer.stop; + if(v_elapsedTime < 10.0) { + setverdict(fail, __SCOPE__ & ": Notifications sent before bathNotify/duration expired"); + } + } + else{ + setverdict(fail, __SCOPE__ & ":ERROR: Notification received but the content doesn't match"); + } + //Send response in any case + v_responsePrimitive := valueof(m_responseNotification(int2000, omit)); + v_responsePrimitive.requestIdentifier := vc_request.primitive.requestPrimitive.requestIdentifier; + f_send(e_mca_in_port, m_response(v_responsePrimitive)); + + } + [] tc_ac.timeout { + setverdict(fail, __SCOPE__ & ": No notification received"); + } } f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2); - + //Postamble f_cse_postamble_deleteResources();