From 61297e7326504be5c55e6673fbc043f3d976aae2 Mon Sep 17 00:00:00 2001 From: reinaortega <miguelangel.reinaortega@etsi.org> Date: Thu, 17 Nov 2022 15:25:59 +0100 Subject: [PATCH] Initialize eventNotificationCriteria for SUB test cases Signed-off-by: reinaortega <miguelangel.reinaortega@etsi.org> --- OneM2M_Testcases_CSE_Release_3.ttcn | 87 ++++++++++++++++------------- 1 file changed, 49 insertions(+), 38 deletions(-) diff --git a/OneM2M_Testcases_CSE_Release_3.ttcn b/OneM2M_Testcases_CSE_Release_3.ttcn index c72ab26..9072855 100644 --- a/OneM2M_Testcases_CSE_Release_3.ttcn +++ b/OneM2M_Testcases_CSE_Release_3.ttcn @@ -7705,6 +7705,7 @@ module OneM2M_Testcases_CSE_Release_3 { var Timestamp v_timeStamp := fx_generateTimestamp(); var template RequestPrimitive v_createRequest := m_createSubscriptionBase; + v_createRequest.primitiveContent.subscription.eventNotificationCriteria := m_eventNotificationCriteria(); v_createRequest.primitiveContent.subscription.eventNotificationCriteria.createdBefore := v_timeStamp; v_ae1.start(f_CSE_SUB_CRE_006(v_createRequest));//createdBefore @@ -7717,6 +7718,7 @@ module OneM2M_Testcases_CSE_Release_3 { var Timestamp v_timeStamp := fx_generateTimestamp(); var template RequestPrimitive v_createRequest := m_createSubscriptionBase; + v_createRequest.primitiveContent.subscription.eventNotificationCriteria := m_eventNotificationCriteria(); v_createRequest.primitiveContent.subscription.eventNotificationCriteria.createdAfter := v_timeStamp; v_ae1.start(f_CSE_SUB_CRE_006(v_createRequest));//createdAfter @@ -7729,6 +7731,7 @@ module OneM2M_Testcases_CSE_Release_3 { var Timestamp v_timeStamp := fx_generateTimestamp(); var template RequestPrimitive v_createRequest := m_createSubscriptionBase; + v_createRequest.primitiveContent.subscription.eventNotificationCriteria := m_eventNotificationCriteria(); v_createRequest.primitiveContent.subscription.eventNotificationCriteria.modifiedSince := v_timeStamp; v_ae1.start(f_CSE_SUB_CRE_006(v_createRequest));//modifiedSince @@ -7741,6 +7744,7 @@ module OneM2M_Testcases_CSE_Release_3 { var Timestamp v_timeStamp := fx_generateTimestamp(); var template RequestPrimitive v_createRequest := m_createSubscriptionBase; + v_createRequest.primitiveContent.subscription.eventNotificationCriteria := m_eventNotificationCriteria(); v_createRequest.primitiveContent.subscription.eventNotificationCriteria.unmodifiedSince := v_timeStamp; v_ae1.start(f_CSE_SUB_CRE_006(v_createRequest)); //unmodifiedSince @@ -7753,6 +7757,7 @@ module OneM2M_Testcases_CSE_Release_3 { var XSD.PositiveInteger v_stateTagSmaller := 5; var template RequestPrimitive v_createRequest := m_createSubscriptionBase; + v_createRequest.primitiveContent.subscription.eventNotificationCriteria := m_eventNotificationCriteria(); v_createRequest.primitiveContent.subscription.eventNotificationCriteria.stateTagSmaller := v_stateTagSmaller; v_ae1.start(f_CSE_SUB_CRE_006(v_createRequest)); //stateTagSmaller @@ -7765,6 +7770,7 @@ module OneM2M_Testcases_CSE_Release_3 { var XSD.PositiveInteger v_stateTagBigger := 5; var template RequestPrimitive v_createRequest := m_createSubscriptionBase; + v_createRequest.primitiveContent.subscription.eventNotificationCriteria := m_eventNotificationCriteria(); v_createRequest.primitiveContent.subscription.eventNotificationCriteria.stateTagBigger := v_stateTagBigger; v_ae1.start(f_CSE_SUB_CRE_006(v_createRequest)); // stateTagBigger @@ -7777,6 +7783,7 @@ module OneM2M_Testcases_CSE_Release_3 { var Timestamp v_timeStamp := fx_generateTimestamp(); var template RequestPrimitive v_createRequest := m_createSubscriptionBase; + v_createRequest.primitiveContent.subscription.eventNotificationCriteria := m_eventNotificationCriteria(); v_createRequest.primitiveContent.subscription.eventNotificationCriteria.expireBefore := v_timeStamp; v_ae1.start(f_CSE_SUB_CRE_006(v_createRequest)); //expireBefore @@ -7789,6 +7796,7 @@ module OneM2M_Testcases_CSE_Release_3 { var Timestamp v_timeStamp := fx_generateTimestamp(); var template RequestPrimitive v_createRequest := m_createSubscriptionBase; + v_createRequest.primitiveContent.subscription.eventNotificationCriteria := m_eventNotificationCriteria(); v_createRequest.primitiveContent.subscription.eventNotificationCriteria.expireAfter := v_timeStamp; v_ae1.start(f_CSE_SUB_CRE_006(v_createRequest)); //expireAfter @@ -7801,6 +7809,7 @@ module OneM2M_Testcases_CSE_Release_3 { var XSD.PositiveInteger v_sizeAbove := 5; var template RequestPrimitive v_createRequest := m_createSubscriptionBase; + v_createRequest.primitiveContent.subscription.eventNotificationCriteria := m_eventNotificationCriteria(); v_createRequest.primitiveContent.subscription.eventNotificationCriteria.sizeAbove := v_sizeAbove; v_ae1.start(f_CSE_SUB_CRE_006(v_createRequest)); //sizeAbove @@ -7813,6 +7822,7 @@ module OneM2M_Testcases_CSE_Release_3 { var XSD.PositiveInteger v_sizeBelow := 5; var template RequestPrimitive v_createRequest := m_createSubscriptionBase; + v_createRequest.primitiveContent.subscription.eventNotificationCriteria := m_eventNotificationCriteria(); v_createRequest.primitiveContent.subscription.eventNotificationCriteria.sizeBelow := v_sizeBelow; v_ae1.start(f_CSE_SUB_CRE_006(v_createRequest)); //sizeBelow @@ -7825,6 +7835,7 @@ module OneM2M_Testcases_CSE_Release_3 { var EventNotificationCriteria.notificationEventType_list v_notificationEventType := {int1}; // Example value taken from TS-001, cl 9.6.8, Table 9.6.8-3 -> A. Update to attributes of the subscribed-to resource var template RequestPrimitive v_createRequest := m_createSubscriptionBase; + v_createRequest.primitiveContent.subscription.eventNotificationCriteria := m_eventNotificationCriteria(); v_createRequest.primitiveContent.subscription.eventNotificationCriteria.notificationEventType_list := v_notificationEventType; v_ae1.start(f_CSE_SUB_CRE_006(v_createRequest)); //eventType @@ -7840,6 +7851,7 @@ module OneM2M_Testcases_CSE_Release_3 { v_OperationMonitor.operations := int1; v_OperationMonitor.originator := PX_SUPER_CSE_ID; + v_createRequest.primitiveContent.subscription.eventNotificationCriteria := m_eventNotificationCriteria(); v_createRequest.primitiveContent.subscription.eventNotificationCriteria.operationMonitor_list := {v_OperationMonitor}; v_ae1.start(f_CSE_SUB_CRE_006(v_createRequest)); //operationMonitor @@ -7895,7 +7907,7 @@ module OneM2M_Testcases_CSE_Release_3 { function f_CSE_SUB_CRE_007() runs on AeSimu system CseSystem { // Local variables var MsgIn v_response; - var integer v_aeIndex := -1; + var integer v_aeIndex, v_ae2Index := -1; var integer v_resourceIndex := -1; var integer v_timeSeriesIndex := -1; var template (value) EventNotificationCriteria v_eventNotificationCriteria := m_eventNotificationCriteria; // parameter notificationEventType_list @@ -7914,12 +7926,12 @@ module OneM2M_Testcases_CSE_Release_3 { v_aeIndex := f_cse_preamble_registerAe(); v_eventNotificationCriteria.missingData := valueof(m_missingData(v_missingDataPointNumber, "PT1M"));//1 missing data, duration 1 Minute - v_timeSeriesIndex := f_cse_createResource(int23, m_createTimeSeries(-, true, 5, -, 2000), v_aeIndex); + v_timeSeriesIndex := f_cse_createResource(int29, m_createTimeSeries(-, true, 5, -, 2000), v_aeIndex); - v_createRequest := m_createSubscriptionAdvanced(f_getResourceAddress(v_aeIndex), -, {f_getResourceAddress(v_timeSeriesIndex)}, v_eventNotificationCriteria, omit, omit, omit, omit, omit, omit); - f_cse_preamble_subscriptionVerification(v_timeSeriesIndex, v_createRequest, int23); + v_createRequest := m_createSubscriptionAdvanced(f_getResourceAddress(v_timeSeriesIndex), -, -, v_eventNotificationCriteria, omit, omit, omit, omit, omit, omit); + f_cse_preamble_subscriptionVerification(v_ae2Index, v_createRequest, int23); - v_request := f_getCreateRequestPrimitive(int23, v_createRequest, v_aeIndex);//Subscription + v_request := f_getCreateRequestPrimitive(int23, v_createRequest, v_timeSeriesIndex);//Subscription v_request.to_ := f_getResourceAddress(v_timeSeriesIndex); // Test Body f_send(e_mcaPort, m_request(v_request)); @@ -7929,7 +7941,7 @@ module OneM2M_Testcases_CSE_Release_3 { tc_ac.stop; setverdict(pass, __SCOPE__ & ": Resource created successfully"); f_checkAttributesToBeSaved(int23, v_request, v_response.primitive.responsePrimitive); - v_resourceIndex := f_setResource(v_response.primitive.responsePrimitive.primitiveContent, int23, vc_aeIndex); + v_resourceIndex := f_setResource(v_response.primitive.responsePrimitive.primitiveContent, int23, v_timeSeriesIndex); } [] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) { tc_ac.stop; @@ -8009,11 +8021,10 @@ module OneM2M_Testcases_CSE_Release_3 { v_groupIndex := f_cse_createResource(int9, v_groupRequest, v_aeIndex); // initial conditions v_request.primitiveContent.subscription.groupID := f_getResourceId(vc_resourcesList[v_groupIndex].resource); - v_request.primitiveContent.subscription.notificationURI := {v_memberID}; - v_request.primitiveContent.subscription.notificationForwardingURI := v_memberID; + v_request.primitiveContent.subscription.notificationForwardingURI := "NotInitialized"; //notificationForwardingURI shall be present only for group related subscriptions. If the subscriber intends the Group Hosting CSE to aggregate the notifications, the attribute shall be set identical to the notificationURI attribute - v_request.primitiveContent.group_.memberIDs := {f_getResourceId(vc_resourcesList[v_groupIndex].resource)}; + //v_request.primitiveContent.group_.memberIDs := {f_getResourceId(vc_resourcesList[v_groupIndex].resource)}; v_request.requestIdentifier := valueof(v_groupRequest.requestIdentifier) & f_rnd(1, 1000000); v_request := f_getCreateRequestPrimitive(int23, v_request, v_aeIndex);//Subscription @@ -8408,6 +8419,7 @@ module OneM2M_Testcases_CSE_Release_3 { // subscription child resource having notificationURI attribute set to AE2_RESOURCE_ADDRESS and latestNotify attribute set to TRUE and batchNotify attribute containing duration attribute set to TIME_LIMIT v_createRequest := m_createSubscriptionAdvanced(f_getResourceAddress(v_ae2LocalIndex), -, {f_getResourceAddress(v_ae1Index)},omit,omit,m_batchNotify(2, "PT10S" ), true, omit, -, int2); //batchNotify/number greater than number of notifications to be sent so that batchNotify/duration expires before along with latestNotify + t_batchNotificationTimer.start; // Timer to control requisite on duration attribute vc_ae2.start(f_cse_createResource(int23, v_createRequest, v_ae2Index));//Subscription tc_ac.start; @@ -8436,8 +8448,6 @@ module OneM2M_Testcases_CSE_Release_3 { f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2); // Test Body - t_batchNotificationTimer.start; // Timer to control requisite on duration attribute - v_updateRequest.primitiveContent.aE.labels := v_labels_1; vc_ae2.start(f_cse_updateResource(int2, v_ae2Index, v_updateRequest)); // Update request 1 @@ -8513,8 +8523,8 @@ module OneM2M_Testcases_CSE_Release_3 { function f_CSE_SUB_NTF_005() runs on AeSimu system CseSystem { // Local variables - const integer receivedUpdateCounter := 3; - var Labels v_labels[receivedUpdateCounter]; + const integer c_receivedUpdateCounter := 3; + var Labels v_labels[c_receivedUpdateCounter]; var integer i; var integer v_ae1Index := -1; var integer v_resourceIndex := -1; @@ -8542,7 +8552,7 @@ module OneM2M_Testcases_CSE_Release_3 { f_cse_preamble_subscriptionVerification(v_ae2Index, v_createRequest, int23); // subscription child resource containing notificationURI attribute set to AE2_RESOURCE_ADDRESS and pendingNotification attribute set to 1 (sendLatest) - v_createRequest := m_createSubscriptionAdvanced(f_getResourceAddress(v_ae2LocalIndex), -, {f_getResourceAddress(v_ae2Index)},omit,omit,omit,omit,omit, -, int1); + v_createRequest := m_createSubscriptionAdvanced(-, -, {f_getResourceAddress(v_ae2Index)},omit,omit,omit,omit,omit, -, int2); v_resourceIndex := f_cse_createResource(int23, v_createRequest, v_ae1Index);//Subscription @@ -8554,7 +8564,7 @@ module OneM2M_Testcases_CSE_Release_3 { vc_ae2.start(f_cf01DownAe2()); vc_ae2.done; - for (i := 0; i < receivedUpdateCounter; i := i+1 ) {// Update request, see TS-001 - cl. 10.2.10.7 + for (i := 0; i < c_receivedUpdateCounter-1; i := i+1 ) {// Update request, see TS-001 - cl. 10.2.10.7 v_updateRequest.primitiveContent.aE.labels := v_labels[i]; f_cse_updateResource(int2, v_ae1Index, v_updateRequest); //IUT having frequently received from AE1 a valid UPDATE Request to subscribed-to resource } @@ -8564,9 +8574,12 @@ module OneM2M_Testcases_CSE_Release_3 { vc_ae2.done; vc_auxiliaryAe2Up := true; //the IUT escapes from the “connectionless state†- v_contentResponse.aE.labels := v_labels[2]; - vc_ae2.start(f_cse_notifyProcedure_aggregatedNoficationHandler(v_contentResponse, 1)); // check if the Rx. of notification and match contents + v_contentResponse.aE.labels := v_labels[2]; + vc_ae2.start(f_cse_notifyProcedure_aggregatedNoficationHandler(v_contentResponse, 1)); // check if the Rx. of notification and match contents + v_updateRequest.primitiveContent.aE.labels := v_labels[i]; + f_cse_updateResource(int2, v_ae1Index, v_updateRequest); //IUT having frequently received from AE1 a valid UPDATE Request to subscribed-to resource + f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2); //Postamble @@ -8592,8 +8605,8 @@ module OneM2M_Testcases_CSE_Release_3 { function f_CSE_SUB_NTF_006() runs on AeSimu system CseSystem { // Local variables - const integer receivedUpdateCounter := 3; - var Labels v_labels[receivedUpdateCounter]; + const integer c_receivedUpdateCounter := 3; + var Labels v_labels[c_receivedUpdateCounter]; var integer i; var integer v_ae1Index := -1; var integer v_resourceIndex := -1; @@ -8621,7 +8634,7 @@ module OneM2M_Testcases_CSE_Release_3 { f_cse_preamble_subscriptionVerification(v_ae2Index, v_createRequest, int23); // subscription child resource having notificationURI attribute set to AE2_RESOURCE_ADDRESS and pendingNotification attribute set to 2 (sendAllPending) - v_createRequest := m_createSubscriptionAdvanced(f_getResourceAddress(v_ae2LocalIndex), -, {f_getResourceAddress(v_ae1Index)},omit,omit,omit,omit,omit, -, int2); + v_createRequest := m_createSubscriptionAdvanced(-, -, {f_getResourceAddress(v_ae2Index)},omit,omit,omit,omit,omit, -, int2); v_resourceIndex := f_cse_createResource(int23, v_createRequest, v_ae1Index);//Subscription @@ -8633,7 +8646,7 @@ module OneM2M_Testcases_CSE_Release_3 { vc_ae2.start(f_cf01DownAe2()); vc_ae2.done; - for (i := 0; i < receivedUpdateCounter; i := i+1 ) {// Update request, see TS-001 - cl. 10.2.10.7 + for (i := 0; i < c_receivedUpdateCounter-1; i := i+1 ) {// Update request, see TS-001 - cl. 10.2.10.7 v_updateRequest.primitiveContent.aE.labels := v_labels[i]; f_cse_updateResource(int2, v_ae1Index, v_updateRequest); //IUT having received from AE1 a NUMBER of valid UPDATE Requests to subscribed-to resource } @@ -8643,8 +8656,10 @@ module OneM2M_Testcases_CSE_Release_3 { vc_ae2.done; vc_auxiliaryAe2Up := true; //the IUT escapes from the “connectionless state†- vc_ae2.start(f_cse_notifyProcedure_aggregatedNoficationHandler(v_contentResponse, receivedUpdateCounter)); // check if the Rz. of notification and match contents - + vc_ae2.start(f_cse_notifyProcedure_aggregatedNoficationHandler(v_contentResponse, c_receivedUpdateCounter)); // check if the Rz. of notification and match contents + v_updateRequest.primitiveContent.aE.labels := v_labels[i]; + f_cse_updateResource(int2, v_ae1Index, v_updateRequest); //IUT having received from AE1 a NUMBER of valid UPDATE Requests to subscribed-to resource + f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2); //Postamble @@ -8680,10 +8695,13 @@ module OneM2M_Testcases_CSE_Release_3 { // Test component configuration f_cf02Up(); vc_cse1.start(f_cse_registerRemoteCse(m_createRemoteCSE_poa(-, -, -, -, -, {f_getLocalPoA()}))); + f_aeSimu_checkComponentDoneAndGetVerdict(vc_cse1); // Test adapter configuration // Preamble - v_aeIndex := f_cse_preamble_registerAe(-, {f_getLocalPoA(vc_aeSimuDesc.mcaPortIn, "")});//c_CRUDNDi); + f_cse_createAccessControlPolicyAux(); + + v_aeIndex := f_cse_preamble_registerAe({f_getResourceId(vc_resourcesList[vc_acpIndex].resource)}, {f_getLocalPoA(vc_aeSimuDesc.mcaPortIn, "")});//c_CRUDNDi); // Test Body v_reqNotify := valueof(m_notifyNotification(f_getResourceAddress(v_aeIndex), m_contentNotification_subscriptionVerification(PX_TS_CSE1.cseId))); @@ -8692,7 +8710,7 @@ module OneM2M_Testcases_CSE_Release_3 { tc_ac.start; alt { - [] mcaPortIn.receive(mw_request(mw_notifyNotification(mw_contentNotification(?)))) -> value vc_request { + [] mcaPortIn.receive(mw_request(mw_notifyNotification(mw_contentNotificationVerification))) -> value vc_request { tc_ac.stop; setverdict(pass, __SCOPE__ & ":INFO: Notification received"); @@ -8700,10 +8718,7 @@ module OneM2M_Testcases_CSE_Release_3 { //Send response in any case v_responsePrimitive := valueof(m_responseNotification(int2000, omit)); v_responsePrimitive.requestIdentifier := vc_request.primitive.requestPrimitive.requestIdentifier; - v_responsePrimitive.to_ := f_getLocalPoA(vc_aeSimuDesc.mcaPortIn); - f_send(e_mcaPortIn, m_response(v_responsePrimitive)); - tc_ac.start; - repeat; + f_send(e_mcaPortIn, m_response(v_responsePrimitive)); } [] mcaPortIn.receive(mw_request(mw_notifyResponsePrimitive(?))) -> value vc_request { tc_ac.stop; @@ -8771,20 +8786,16 @@ module OneM2M_Testcases_CSE_Release_3 { f_send(e_mccPort, m_request(v_reqNotify)); tc_ac.start; alt { - [] mccPort.receive(mw_request(mw_notifyNotification(mw_contentNotification(?)))) -> value vc_request { + [] mccPort.receive(mw_response(mw_responsePrimitiveOK)) { tc_ac.stop; - - setverdict(pass, __SCOPE__ & ":INFO: Notification received"); - - //Send response in any case - v_responsePrimitive := valueof(m_responseNotification(int2000, omit)); + setverdict(pass, __SCOPE__ & ":INFO: Response Notification received"); } - [] mccPort.receive(mw_request(mw_notifyResponsePrimitive(?))) -> value vc_request { + [] mccPort.receive(mw_response(mw_responsePrimitiveKO)) { tc_ac.stop; - setverdict(fail, __SCOPE__ & ": Error, Non expected notification received"); + setverdict(fail, __SCOPE__ & ": Error, Wrong response status code in response notification received"); } [] tc_ac.timeout { - setverdict(fail, __SCOPE__ & ": No answer while retargeting request"); + setverdict(fail, __SCOPE__ & ": No response notification received"); } } -- GitLab