From fc2095783aa180364f62349565d9096314132934 Mon Sep 17 00:00:00 2001 From: reinaortega <miguelangel.reinaortega@etsi.org> Date: Wed, 14 Dec 2022 08:49:10 +0100 Subject: [PATCH] Use of f_aeSimu_checkComponentDoneAndGetVerdict for subscription verification Signed-off-by: reinaortega <miguelangel.reinaortega@etsi.org> --- LibOneM2M/OneM2M_Functions.ttcn | 15 ++++--- OneM2M_PermutationFunctions.ttcn | 68 +++++++++++++++++------------ OneM2M_Testcases_CSE_Release_1.ttcn | 49 +++++++++------------ OneM2M_Testcases_CSE_Release_2.ttcn | 50 +++++++-------------- 4 files changed, 87 insertions(+), 95 deletions(-) diff --git a/LibOneM2M/OneM2M_Functions.ttcn b/LibOneM2M/OneM2M_Functions.ttcn index f874df8..690e880 100644 --- a/LibOneM2M/OneM2M_Functions.ttcn +++ b/LibOneM2M/OneM2M_Functions.ttcn @@ -1192,7 +1192,9 @@ module OneM2M_Functions { if(ischosen(p_createRequestPrimitive.primitiveContent.subscription)){ //this condition is necessary for Subscription TCs where notification URI is set in m_createSubscriptionAdvanced p_createRequestPrimitive.primitiveContent.subscription.notificationURI := {f_getResourceAddress(p_ae2Index)}; } - vc_ae2.start(f_cse_notifyProcedure_subscriptionVerificationHandler(p_responseStatusCode)); + if(PICS_SUBSCRIPTION_VERIFICATION) { + vc_ae2.start(f_cse_notifyProcedure_subscriptionVerificationHandler(p_responseStatusCode)); + } } } @@ -5277,13 +5279,16 @@ module OneM2M_Functions { } [] tc_done.timeout { setverdict(inconc, __SCOPE__ & "INFO: Component did not finish"); + f_checkAeSimuStatus(); } } - if(v_verdict == pass) { // Component was successfully completed and got stopped state - setverdict(pass); - } else { - setverdict(inconc); // Component was not completed successfully + if(v_verdict != none) {//Component started at least once (except config) + if(v_verdict == pass) { // Component was successfully completed and got stopped state + setverdict(pass); + } else { + setverdict(inconc); // Component was not completed successfully + } } f_checkAeSimuStatus(); diff --git a/OneM2M_PermutationFunctions.ttcn b/OneM2M_PermutationFunctions.ttcn index 525bba5..6b9c48b 100644 --- a/OneM2M_PermutationFunctions.ttcn +++ b/OneM2M_PermutationFunctions.ttcn @@ -2533,9 +2533,7 @@ module OneM2M_PermutationFunctions { } v_parentIndex := f_cse_createResource(valueof(v_parentRequestPrimitive.resourceType), v_parentRequestPrimitive, v_parentIndex); - if(vc_ae2.running) { - vc_ae2.stop; - } + f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2); } else {//Resource under CSEBase @@ -2583,7 +2581,7 @@ module OneM2M_PermutationFunctions { } } - f_checkAeSimuStatus(); + f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2); //Check to see if the resource is present or not if (f_cse_isResourcePresent(v_resourceIndex)){ @@ -2727,7 +2725,7 @@ module OneM2M_PermutationFunctions { } } - f_checkAeSimuStatus(); + f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2); //Check to see if the resource is present or not if(f_cse_isResourcePresent(v_resourceIndex)){ @@ -2779,10 +2777,9 @@ module OneM2M_PermutationFunctions { v_request.requestIdentifier := "Existing resource"; if(p_resourceType == int23){ - if(vc_ae2.running) { - f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2); + if(PICS_SUBSCRIPTION_VERIFICATION) { + vc_ae2.start(f_cse_notifyProcedure_subscriptionVerificationHandler()); } - vc_ae2.start(f_cse_notifyProcedure_subscriptionVerificationHandler()); } f_send(e_mca_port, m_request(v_request)); @@ -3197,9 +3194,9 @@ module OneM2M_PermutationFunctions { } } - f_checkAeSimuStatus(); - - //Check to see if the resource is present or not + f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2); + + //Check to see if the resource is present or not if(f_cse_isResourcePresent(v_resourceIndex)) { setverdict(pass, __SCOPE__ & ":INFO: Resource created"); } else { @@ -3895,7 +3892,9 @@ module OneM2M_PermutationFunctions { setverdict(fail, __SCOPE__ & ": No answer while retrieving resource"); } } - + + f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2); + // Postamble f_cse_postamble_deleteResources(); @@ -5323,6 +5322,8 @@ module OneM2M_PermutationFunctions { } } + f_checkAeSimuStatus(); + //Used to check that the resource has been updated vc_primitiveContentRetrievedResource := f_cse_retrieveResource(v_resourceIndex); @@ -5383,6 +5384,8 @@ module OneM2M_PermutationFunctions { } } + f_checkAeSimuStatus(); + vc_primitiveContentRetrievedResource := f_cse_retrieveResource(v_resourceIndex); // Postamble @@ -5439,8 +5442,10 @@ module OneM2M_PermutationFunctions { [] tc_ac.timeout { setverdict(fail, __SCOPE__ & ": No answer while updating resource type " & int2str(enum2int(p_resourceType))); } - } - + } + + f_checkAeSimuStatus(); + vc_primitiveContentRetrievedResource := f_cse_retrieveResource(v_resourceIndex); // Postamble @@ -5509,6 +5514,8 @@ module OneM2M_PermutationFunctions { } } + f_checkAeSimuStatus(); + vc_primitiveContentRetrievedResource := f_cse_retrieveResource(v_resourceIndex); // Postamble @@ -5565,6 +5572,8 @@ module OneM2M_PermutationFunctions { } } + f_checkAeSimuStatus(); + vc_primitiveContentRetrievedResource := f_cse_retrieveResource(v_resourceIndex); // Postamble @@ -5621,6 +5630,8 @@ module OneM2M_PermutationFunctions { } } + f_checkAeSimuStatus(); + vc_primitiveContentRetrievedResource := f_cse_retrieveResource(v_resourceIndex); // Postamble @@ -5932,6 +5943,8 @@ module OneM2M_PermutationFunctions { } } + f_checkAeSimuStatus(); + vc_primitiveContentRetrievedResource := f_cse_retrieveResource(v_resourceIndex); //Postamble @@ -6042,6 +6055,8 @@ module OneM2M_PermutationFunctions { } } + f_checkAeSimuStatus(); + vc_primitiveContentRetrievedResource := f_cse_retrieveResource(v_resourceIndex); //Postamble @@ -6272,13 +6287,13 @@ module OneM2M_PermutationFunctions { v_childResourceIndex := f_cse_createResource(valueof(p_childResourceType), p_childRequestPrimitive, v_resourceIndex); } + f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2); + // Test Body v_request := f_getUpdateRequestPrimitive(p_resourceType, v_resourceIndex, p_updateRequestPrimitive); v_request.resultContent := int0;//Nothing if(valueof(p_childResourceType) == int23) { - if (vc_ae2.running) { - vc_ae2.stop; - } + vc_ae2.start(f_cse_notifyProcedure_defaultHandler()); } f_send(e_mca_port, m_request(v_request)); @@ -6347,13 +6362,13 @@ module OneM2M_PermutationFunctions { v_childResourceIndex := f_cse_createResource(valueof(p_childResourceType), p_childRequestPrimitive, v_resourceIndex); } + f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2); + // Test Body v_request := f_getUpdateRequestPrimitive(p_resourceType, v_resourceIndex, p_updateRequestPrimitive); v_request.resultContent := int1;//Attributes if(valueof(p_childResourceType) == int23) { - if (vc_ae2.running) { - vc_ae2.stop; - } + vc_ae2.start(f_cse_notifyProcedure_defaultHandler()); } f_send(e_mca_port, m_request(v_request)); @@ -6422,13 +6437,13 @@ module OneM2M_PermutationFunctions { v_childResourceIndex := f_cse_createResource(valueof(p_childResourceType), p_childRequestPrimitive, v_resourceIndex); } + f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2); + // Test Body v_request := f_getUpdateRequestPrimitive(p_resourceType, v_resourceIndex, p_updateRequestPrimitive); v_request.resultContent := int9;//Modified Attributes if(valueof(p_childResourceType) == int23) { - if (vc_ae2.running) { - vc_ae2.stop; - } + vc_ae2.start(f_cse_notifyProcedure_defaultHandler()); } f_send(e_mca_port, m_request(v_request)); @@ -6498,12 +6513,11 @@ module OneM2M_PermutationFunctions { v_resourceIndex := f_cse_createResource(p_resourceType, p_createRequestPrimitive, v_parentIndex); + f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2); + // Test Body if(p_resourceType == int23) { - if (vc_ae2.running) { - vc_ae2.stop; - } - vc_ae2.start(f_cse_notifyProcedure_noNotificationHandler()); + vc_ae2.start(f_cse_notifyProcedure_defaultHandler()); } v_request := valueof(m_delete(f_getResourceAddress(v_resourceIndex), f_getOriginator(v_resourceIndex))); diff --git a/OneM2M_Testcases_CSE_Release_1.ttcn b/OneM2M_Testcases_CSE_Release_1.ttcn index 79d8dec..46aed99 100644 --- a/OneM2M_Testcases_CSE_Release_1.ttcn +++ b/OneM2M_Testcases_CSE_Release_1.ttcn @@ -8506,20 +8506,24 @@ module OneM2M_Testcases_CSE_Release_1 { function f_CSE_SUB_CRE_004() runs on AeSimu system CseSystem { //Local variables - var template RequestPrimitive v_request := m_createSubscriptionBase; - var RequestPrimitive v_notificationRequest; - var integer v_aeIndex := -1; - var integer v_ae2Index := -1; - var integer v_resourceIndex := -1; + var template RequestPrimitive v_request := m_createSubscriptionBase; + var RequestPrimitive v_notificationRequest; + var integer v_aeIndex := -1; + var integer v_ae2Index := -1; + var integer v_resourceIndex := -1; - // Test control - - // Test component configuration - f_cf01Up(true); + // Test control + if(not(PICS_SUBSCRIPTION_VERIFICATION)) { + setverdict(inconc, __SCOPE__ & ": Subscription verification support is required to run this test case"); + stop; + } + + // Test component configuration + f_cf01Up(true); - // Test adapter configuration + // Test adapter configuration - // Preamble + // Preamble v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi); f_cse_preamble_subscriptionVerification(v_ae2Index, v_request, int23); @@ -8529,11 +8533,6 @@ module OneM2M_Testcases_CSE_Release_1 { v_resourceIndex := f_cse_createResource(int23, v_request, v_aeIndex);//Subscription - if(vc_ae2.running) { - setverdict(inconc, __SCOPE__ & ": Notification not received"); - vc_ae2.stop; - }; - f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2); // Test Body @@ -8594,10 +8593,8 @@ module OneM2M_Testcases_CSE_Release_1 { v_resourceIndex := f_cse_createResource(int23, v_createRequest, v_aeIndex);//Subscription - if(vc_ae2.running) { - vc_ae2.stop; - }; - + f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2); + // Test Body v_request:= f_getCreateRequestPrimitive(int3, m_createContainerBase, v_aeIndex); @@ -8623,8 +8620,6 @@ module OneM2M_Testcases_CSE_Release_1 { } } - f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2); - //Postamble f_cse_postamble_deleteResources(); @@ -8676,9 +8671,7 @@ module OneM2M_Testcases_CSE_Release_1 { v_resourceIndex := f_cse_createResource(int23, v_createRequest, v_aeIndex);//Subscription - if(vc_ae2.running) { - vc_ae2.stop; - }; + f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2); // Test Body v_contentResponse.aE := mw_contentAeBase; // all attributes expected @@ -8763,10 +8756,8 @@ module OneM2M_Testcases_CSE_Release_1 { v_request := valueof(m_delete(f_getResourceAddress(v_resourceIndex), f_getOriginator(v_resourceIndex))); // Subscription resource deletion request - if(vc_ae2.running) { - vc_ae2.stop; - }; - + f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2); + // Test Body v_notificationContent.subscriptionReference := ?; v_notificationContent.notificationEvent := omit; diff --git a/OneM2M_Testcases_CSE_Release_2.ttcn b/OneM2M_Testcases_CSE_Release_2.ttcn index a766c71..98a6350 100644 --- a/OneM2M_Testcases_CSE_Release_2.ttcn +++ b/OneM2M_Testcases_CSE_Release_2.ttcn @@ -2524,10 +2524,8 @@ module OneM2M_Testcases_CSE_Release_2 { v_resourceIndex := f_cse_createResource(int23, v_createRequest, v_aeIndex); //Subscription - if(vc_ae2.running) { - vc_ae2.stop; - }; - + f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2); + // Test Body //TODO Use f_getTemplateFromPrimitiveContent() which needs to be modified to receive the template in which the output template will be built upon v_contentResponse.aE.labels := ?;// only modified attribute expected @@ -2698,9 +2696,7 @@ module OneM2M_Testcases_CSE_Release_2 { v_resourceIndex := f_cse_createResource(int23, v_createRequest, v_aeIndex); // Subscription - if(vc_ae2.running) { - vc_ae2.stop; - }; + f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2); // Test Body vc_ae2.start(f_cse_notifyProcedure_representationHandler(v_contentResponse)); // check if the notification is well received and if its content matchs @@ -2790,10 +2786,8 @@ module OneM2M_Testcases_CSE_Release_2 { v_resourceIndex := f_cse_createResource(int23, v_createRequest, v_aeIndex);// Subscription - if(vc_ae2.running) { - vc_ae2.stop; - }; - + f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2); + // Test Body vc_ae2.start(f_cse_notifyProcedure_representationHandler(v_contentResponse)); // check if the notification is well received and if its content matchs f_cse_updateResource(int2, v_aeIndex, v_updateRequest); // AE update request @@ -2877,10 +2871,8 @@ module OneM2M_Testcases_CSE_Release_2 { v_request:= f_getUpdateRequestPrimitive(int2, v_aeIndex, v_updateRequest); // Update request - if(vc_ae2.running) { - vc_ae2.stop; - }; - + f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2); + // Test Body vc_ae2.start(f_cse_notifyProcedure_noNotificationHandler()); // check that no notification is received @@ -2960,10 +2952,8 @@ module OneM2M_Testcases_CSE_Release_2 { v_resourceIndex := f_cse_createResource(int23, v_createRequest, v_aeIndex);//Subscription - if(vc_ae2.running) { - vc_ae2.stop; - }; - + f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2); + // Test Body vc_ae2.start(f_cse_notifyProcedure_aggregatedNoficationHandler(v_contentResponse, numberOfAggregatedNotification)); // check that no notification is received @@ -3032,9 +3022,7 @@ module OneM2M_Testcases_CSE_Release_2 { v_resourceIndex := f_cse_createResource(int23, v_createRequest, v_aeIndex);//Subscription - if(vc_ae2.running) { - vc_ae2.stop; - }; + f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2); // Test Body v_contentResponse.aE.labels := v_labels_3; @@ -3107,10 +3095,8 @@ module OneM2M_Testcases_CSE_Release_2 { v_request:= f_getUpdateRequestPrimitive(int2, v_aeIndex, v_updateRequest); // Update request - if(vc_ae2.running) { - vc_ae2.stop; - }; - + f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2); + // Test Body vc_ae2.start(f_cse_notifyProcedure_representationHandler(v_contentResponse)); // check if the notification is well received and if its content matchs @@ -3190,10 +3176,8 @@ module OneM2M_Testcases_CSE_Release_2 { v_subscriptionResourceIndex := f_cse_createResource(int23, v_createRequest, v_aeIndex );//Subscription - if(vc_ae2.running) { - vc_ae2.stop; - }; - + f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2); + //Test Body v_notificationContent := {aE:= mw_contentAeBase}; // all attributes expected; @@ -3274,10 +3258,8 @@ module OneM2M_Testcases_CSE_Release_2 { v_subscriptionResourceIndex := f_cse_createResource(int23, v_createRequest, v_aeIndex);//Subscription (with name attribute omitted) - if(vc_ae2.running) { - vc_ae2.stop; - }; - + f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2); + //Test Body v_notificationContent := {container := mw_contentContainer_rc1}; // all attributes expected; -- GitLab