diff --git a/OneM2M_Testcases_CSE_Release_4.ttcn b/OneM2M_Testcases_CSE_Release_4.ttcn index 1916b8203341a03245fe150efbea6c851100b09d..3289e608ea0eb5dbea59eadc448bb5973b0ca897 100644 --- a/OneM2M_Testcases_CSE_Release_4.ttcn +++ b/OneM2M_Testcases_CSE_Release_4.ttcn @@ -3785,6 +3785,302 @@ module OneM2M_Testcases_CSE_Release_4 { } // end f_CSE_SUB_NTF_x13 + /** @desc Check that the IUT records notification statistics in the notificationStatsInfo attribute of the subscription resource if the notificationStatsEnable attribute of the subscription CREATE request is set to TRUE + * + */ + testcase TC_CSE_SUB_NTF_x14() runs on Tester system CseSystem { + + var AeSimu v_ae1 := AeSimu.create("AE1") alive; + + v_ae1.start(f_CSE_SUB_NTF_x14()); + + v_ae1.done; + + } + + function f_CSE_SUB_NTF_x14() runs on AeSimu system CseSystem { + + // Local variables + var integer v_aeIndex, v_ae2Index := -1; + var integer v_acpIndex := -1; + var integer v_subscriptionIndex := -1; + var template RequestPrimitive v_createRequest, v_retrieveRequest; + var template PrimitiveContent v_retrieveContentResponse; + var template RequestPrimitive v_updateRequest := m_updateAeBase; + var template RequestPrimitive v_createSubscriptionRequest := m_createSubscriptionBase; + + v_retrieveContentResponse.subscription := mw_contentSubscriptionBase; + v_createSubscriptionRequest.primitiveContent.subscription.notificationStatsEnable:= true; + + // Test control + + // Test component configuration + f_cf01Up(true); + + // Test adapter configuration + + // Preamble + v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi); + + f_cse_preamble_subscriptionVerification(v_ae2Index, v_createSubscriptionRequest, int23); + + v_subscriptionIndex := f_cse_createResource(int23, v_createSubscriptionRequest, v_aeIndex);//Parent + + //Update of the target resource + vc_ae2.start(f_cse_notifyProcedure_defaultHandler()); + + v_updateRequest.primitiveContent.aE.labels := {"VALUE_1"}; + f_cse_updateResource(int2, v_aeIndex, v_updateRequest); + + f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2); + + // Test Body + f_sleep(5.0); + v_retrieveRequest := valueof(m_retrieve(f_getResourceAddress(v_subscriptionIndex), f_getOriginator(v_aeIndex))); + f_send(e_mcaPort, m_request(valueof(v_retrieveRequest))); + + tc_ac.start; + alt { + [] mcaPort.receive(mw_response(mw_responsePrimitiveOK(v_retrieveContentResponse))) -> value vc_response { + tc_ac.stop; + if(ispresent(vc_response.primitive.responsePrimitive.primitiveContent.subscription.notificationStatsInfo)) { + if(sizeof(vc_response.primitive.responsePrimitive.primitiveContent.subscription.notificationStatsInfo) == 1 ){ + setverdict(pass, __SCOPE__ & ": INFO: notifications recorded correctly"); + } + else{ + setverdict(fail, __SCOPE__ & ": ERROR: Notifications not recorded properly"); + } + } else { + setverdict(fail, __SCOPE__ & ": ERROR: Notifications not recorded"); + } + } + [] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value vc_response { + tc_ac.stop; + setverdict(fail, __SCOPE__ & ": Error, resource elements provided not matching expected resource elements"); + } + [] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value vc_response { + tc_ac.stop; + setverdict(fail, __SCOPE__ & ": Error while retrieving resource"); + } + [] tc_ac.timeout { + setverdict(fail, __SCOPE__ & ": No answer while retrieving resource"); + } + } + + //Postamble + f_cse_postamble_deleteResources(); + + //Tear down + f_cf01Down(); + + } // end f_CSE_SUB_NTF_x14 + + /** @desc Check that the IUT restarts recording notification statistics in the notificationStatsInfo attribute of the crossResourceSubscription resource if the notificationStatsEnable attribute of the crossResourceSubscription UPDATE request is set to TRUE + * + */ + testcase TC_CSE_SUB_NTF_x15() runs on Tester system CseSystem { + + var AeSimu v_ae1 := AeSimu.create("AE1") alive; + + v_ae1.start(f_CSE_SUB_NTF_x15()); + + v_ae1.done; + + } + + function f_CSE_SUB_NTF_x15() runs on AeSimu system CseSystem { + + // Local variables + var integer v_aeIndex, v_ae2Index := -1; + var integer v_acpIndex := -1; + var integer v_subscriptionIndex := -1; + var template RequestPrimitive v_createRequest, v_retrieveRequest; + var template PrimitiveContent v_retrieveContentResponse; + var template RequestPrimitive v_updateRequestAe := m_updateAeBase; + var template RequestPrimitive v_updateRequest := m_updateCrossResourceSubscriptionBase; + var template RequestPrimitive v_createSubscriptionRequest := m_createSubscriptionBase; + + v_retrieveContentResponse.subscription := mw_contentSubscriptionBase; + v_createSubscriptionRequest.primitiveContent.subscription.notificationStatsEnable:= true; + + // Test control + + // Test component configuration + f_cf01Up(true); + + // Test adapter configuration + + // Preamble + v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi); + + f_cse_preamble_subscriptionVerification(v_ae2Index, v_createSubscriptionRequest, int23); + + v_subscriptionIndex := f_cse_createResource(int23, v_createSubscriptionRequest, v_aeIndex);//Parent + + //Update of the target resource + vc_ae2.start(f_cse_notifyProcedure_defaultHandler()); + + v_updateRequest.primitiveContent.aE.labels := {"VALUE_1"}; + f_cse_updateResource(int2, v_aeIndex, v_updateRequest); + + f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2); + + //Update subscription notificationStatsEnable to True + v_updateRequest.primitiveContent.subscription.notificationStatsEnable := true; + f_cse_updateResource(int23, v_subscriptionIndex, v_updateRequest); + + //Second update of the target resource + vc_ae2.start(f_cse_notifyProcedure_defaultHandler()); + + v_updateRequest.primitiveContent.aE.labels := {"VALUE_1"}; + f_cse_updateResource(int2, v_aeIndex, v_updateRequest); + + f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2); + + // Test Body + f_sleep(5.0); + v_retrieveRequest := valueof(m_retrieve(f_getResourceAddress(v_subscriptionIndex), f_getOriginator(v_aeIndex))); + f_send(e_mcaPort, m_request(valueof(v_retrieveRequest))); + + tc_ac.start; + alt { + [] mcaPort.receive(mw_response(mw_responsePrimitiveOK(v_retrieveContentResponse))) -> value vc_response { + tc_ac.stop; + if(ispresent(vc_response.primitive.responsePrimitive.primitiveContent.subscription.notificationStatsInfo)) { + if(sizeof(vc_response.primitive.responsePrimitive.primitiveContent.subscription.notificationStatsInfo) == 1 ){ + setverdict(pass, __SCOPE__ & ": INFO: notifications recorded correctly"); + } + else{ + setverdict(fail, __SCOPE__ & ": ERROR: Notifications not recorded properly"); + } + } else { + setverdict(fail, __SCOPE__ & ": ERROR: Notifications not recorded"); + } + } + [] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value vc_response { + tc_ac.stop; + setverdict(fail, __SCOPE__ & ": Error, resource elements provided not matching expected resource elements"); + } + [] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value vc_response { + tc_ac.stop; + setverdict(fail, __SCOPE__ & ": Error while retrieving resource"); + } + [] tc_ac.timeout { + setverdict(fail, __SCOPE__ & ": No answer while retrieving resource"); + } + } + + //Postamble + f_cse_postamble_deleteResources(); + + //Tear down + f_cf01Down(); + + } // end f_CSE_SUB_NTF_x15 + + /** @desc Check that the IUT stops recording notification statistics in the notificationStatsInfo attribute of the crossResourceSubscription resource if the notificationStatsEnable attribute of the crossResourceSubscription UPDATE request is set to FALSE and keeps the current value of the notificationStatsInfo + * + */ + testcase TC_CSE_SUB_NTF_x16() runs on Tester system CseSystem { + + var AeSimu v_ae1 := AeSimu.create("AE1") alive; + + v_ae1.start(f_CSE_SUB_NTF_x16()); + + v_ae1.done; + + } + + function f_CSE_SUB_NTF_x16() runs on AeSimu system CseSystem { + + // Local variables + var integer v_aeIndex, v_ae2Index := -1; + var integer v_acpIndex := -1; + var integer v_subscriptionIndex := -1; + var template RequestPrimitive v_createRequest, v_retrieveRequest; + var template PrimitiveContent v_retrieveContentResponse; + var template RequestPrimitive v_updateRequestAe := m_updateAeBase; + var template RequestPrimitive v_updateRequest := m_updateCrossResourceSubscriptionBase; + var template RequestPrimitive v_createSubscriptionRequest := m_createSubscriptionBase; + + v_retrieveContentResponse.subscription := mw_contentSubscriptionBase; + v_createSubscriptionRequest.primitiveContent.subscription.notificationStatsEnable:= true; + + // Test control + + // Test component configuration + f_cf01Up(true); + + // Test adapter configuration + + // Preamble + v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi); + + f_cse_preamble_subscriptionVerification(v_ae2Index, v_createSubscriptionRequest, int23); + + v_subscriptionIndex := f_cse_createResource(int23, v_createSubscriptionRequest, v_aeIndex);//Parent + + //Update of the target resource + vc_ae2.start(f_cse_notifyProcedure_defaultHandler()); + + v_updateRequest.primitiveContent.aE.labels := {"VALUE_1"}; + f_cse_updateResource(int2, v_aeIndex, v_updateRequest); + + f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2); + + //Update subscription notificationStatsEnable to False + v_updateRequest.primitiveContent.subscription.notificationStatsEnable := false; + f_cse_updateResource(int23, v_subscriptionIndex, v_updateRequest); + + //Second update of the target resource + vc_ae2.start(f_cse_notifyProcedure_defaultHandler()); + + v_updateRequest.primitiveContent.aE.labels := {"VALUE_1"}; + f_cse_updateResource(int2, v_aeIndex, v_updateRequest); + + f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2); + + // Test Body + f_sleep(5.0); + v_retrieveRequest := valueof(m_retrieve(f_getResourceAddress(v_subscriptionIndex), f_getOriginator(v_aeIndex))); + f_send(e_mcaPort, m_request(valueof(v_retrieveRequest))); + + tc_ac.start; + alt { + [] mcaPort.receive(mw_response(mw_responsePrimitiveOK(v_retrieveContentResponse))) -> value vc_response { + tc_ac.stop; + if(ispresent(vc_response.primitive.responsePrimitive.primitiveContent.subscription.notificationStatsInfo)) { + if(sizeof(vc_response.primitive.responsePrimitive.primitiveContent.subscription.notificationStatsInfo) == 1 ){ + setverdict(pass, __SCOPE__ & ": INFO: notifications recorded correctly"); + } + else{ + setverdict(fail, __SCOPE__ & ": ERROR: Notifications not recorded properly"); + } + } else { + setverdict(fail, __SCOPE__ & ": ERROR: Notifications not recorded"); + } + } + [] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value vc_response { + tc_ac.stop; + setverdict(fail, __SCOPE__ & ": Error, resource elements provided not matching expected resource elements"); + } + [] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value vc_response { + tc_ac.stop; + setverdict(fail, __SCOPE__ & ": Error while retrieving resource"); + } + [] tc_ac.timeout { + setverdict(fail, __SCOPE__ & ": No answer while retrieving resource"); + } + } + + //Postamble + f_cse_postamble_deleteResources(); + + //Tear down + f_cf01Down(); + + } // end f_CSE_SUB_NTF_x16 + }//end group Notify group Update {