diff --git a/LibOneM2M/OneM2M_Functions.ttcn b/LibOneM2M/OneM2M_Functions.ttcn index 6f24b1f2327c56271af9370df064ae91832a838e..f9e20081292a17d7dde032f8b8ca96918504485d 100644 --- a/LibOneM2M/OneM2M_Functions.ttcn +++ b/LibOneM2M/OneM2M_Functions.ttcn @@ -1325,6 +1325,59 @@ module OneM2M_Functions { f_checkAeSimuStatus(); return vc_aeIndex; } + + /** + * @desc Creation of auxiliar resource AE for correct execution of the test case containing POINT_OF_ACCESS attribute and REQUEST_REACHABILITY set to true + * @param p_accessControlPolicyIDs AccessControlPolicyIDs for the auxiliar AE resource + * @param p_poaList Point of contact of the auxiliar AE resource + * @return Internal AE resource index + * @verdict + */ + function f_cse_preamble_registerAeWithRequestReachability(template (omit) AcpType p_accessControlPolicyIDs := omit, in template (omit) PoaList p_poaList := omit) runs on AeSimu return integer {//c_CRUDNDi + + var RequestPrimitive v_request; + var MsgIn v_response; + + //Activate defaults when running on a PTC + f_cse_activateDefaults_ae(); + + v_request := valueof(m_createAe(vc_aeSimuDesc.appId, p_accessControlPolicyIDs, vc_aeSimuDesc.aeIdStem, c_defaultAe1ResourceName, p_poaList)); + v_request.primitiveContent.aE.requestReachability := true; + + v_request := f_getCreateRequestPrimitive(int2, v_request, -1); + + f_send(e_mcaPort, m_request(v_request)); + + tc_ac.start; + alt { + [] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response { + tc_ac.stop; + setverdict(pass,__SCOPE__&":INFO: Application registered successfuly"); + if(ischosen(v_response.primitive.responsePrimitive.primitiveContent.aE)) { + + f_checkAttributesToBeSaved(int2, v_request, v_response.primitive.responsePrimitive); + + vc_aeIndex := f_setResource(v_response.primitive.responsePrimitive.primitiveContent, int2); + + if(ispresent(v_response.primitive.responsePrimitive.primitiveContent.aE.aE_ID)){ + f_sendAcPrimitive("AE-ID_changed", vc_aeIndex); + } + } + } + [] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) { + tc_ac.stop; + setverdict(inconc, __SCOPE__&":INFO: Error while registering application"); + stop; + } + [] tc_ac.timeout { + setverdict(inconc, __SCOPE__&":INFO: No answer while registering resource"); + stop; + } + } + + f_checkAeSimuStatus(); + return vc_aeIndex; + } /** * @desc Creation of auxiliar resources ACP and AE for correct execution of the test case @@ -2586,7 +2639,7 @@ module OneM2M_Functions { f_checkCseSimuStatus(); - } //end f_cse_notifyProcedure_notify + } //end f_cse_notifyProcedure_notify /** * @desc Handling message exchange for the dynamic authorization procedure diff --git a/OneM2M_PermutationFunctions.ttcn b/OneM2M_PermutationFunctions.ttcn index 062b638e4759d1dba5f906fe2a67454a36932f82..ed4d85753066849822a7842513cb608d3740bcc0 100644 --- a/OneM2M_PermutationFunctions.ttcn +++ b/OneM2M_PermutationFunctions.ttcn @@ -8776,6 +8776,65 @@ module OneM2M_PermutationFunctions { //Tear down f_cf01Down(); }// end f_CSE_SUB_CRE_001 + + function f_CSE_SUB_CRE_006(template RequestPrimitive p_createRequest) runs on AeSimu system CseSystem { + // Local variables + var integer v_aeIndex := -1; + var integer v_resourceIndex := -1; + var RequestPrimitive v_request; + var MsgIn v_response; + + // Test control + + // Test component configuration + f_cf01Up(); + + // Test adapter configuration + + // Preamble + v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi; + + v_request := f_getCreateRequestPrimitive(int23, p_createRequest, v_aeIndex);//Subscription + + // Test Body + f_send(e_mcaPort, m_request(v_request)); + tc_ac.start; + alt { + [] mcaPort.receive(mw_response(mw_responsePrimitive(int2001))) -> value v_response { //CREATED - TS-004 - Table 6.6.3.3-1: RSCs for successful response class + 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); + } + [] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value v_response { + tc_ac.stop; + setverdict(inconc, __SCOPE__&":INFO: Error while creating resource"); + } + [] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response { + tc_ac.stop; + setverdict(fail, __SCOPE__ & ": Wrong response status code in the response"); + } + [] tc_ac.timeout { + setverdict(fail, __SCOPE__ & ": No answer while creating resource"); + } + } + + f_checkAeSimuStatus(); + + //Check to see if the resource is present or not + if (f_cse_isResourcePresent(v_resourceIndex)){ + setverdict(pass, __SCOPE__ & ":INFO: Resource created"); + } else { + setverdict(fail, __SCOPE__ & ":ERROR: Resource not created"); + } + + //Postamble + f_cse_postamble_deleteResources(); + + //Tear down + f_cf01Down(); + + } // end f_CSE_SUB_CRE_006 function f_CSE_SUB_CRE_009(in NotificationEventType p_notificationEventType) runs on AeSimu system CseSystem { // Local variables diff --git a/OneM2M_Testcases_CSE_Release_3.ttcn b/OneM2M_Testcases_CSE_Release_3.ttcn index a2e44ae8f121b32eb1714c0822cb0acbf35aafe9..5493becd741db11cad96b1ff317b820df254276e 100644 --- a/OneM2M_Testcases_CSE_Release_3.ttcn +++ b/OneM2M_Testcases_CSE_Release_3.ttcn @@ -18,6 +18,7 @@ module OneM2M_Testcases_CSE_Release_3 { import from OneM2M_Types all;//{type XSD.ID}; import from OneM2M_TypesAndValues all; import from OneM2M_Pixits all; + import from LibCommon_Time all; import from OneM2M_Pics all; import from OneM2M_Functions all; import from OneM2M_PermutationFunctions all; @@ -7615,7 +7616,376 @@ module OneM2M_Testcases_CSE_Release_3 { } }// end group g_CSE_SUB_CRE_001 + + group g_CSE_SUB_CRE_006 { + /** + * @desc Check that the IUT accepts the creation of a subscription resource with the eventNotificationCriteria attribute which includes a CONDITION_TAG condition provided + * + */ + testcase TC_CSE_SUB_CRE_006_CRB() runs on Tester system CseSystem { + + var AeSimu v_ae1 := AeSimu.create("AE1") alive; + var Timestamp v_timeStamp := fx_generateTimestamp(); + var template RequestPrimitive v_createRequest := m_createSubscriptionBase; + + v_createRequest.primitiveContent.subscription.eventNotificationCriteria.createdBefore := v_timeStamp; + + v_ae1.start(f_CSE_SUB_CRE_006(v_createRequest));//createdBefore + v_ae1.done; + + } + testcase TC_CSE_SUB_CRE_006_CRA() runs on Tester system CseSystem { + + var AeSimu v_ae1 := AeSimu.create("AE1") alive; + var Timestamp v_timeStamp := fx_generateTimestamp(); + var template RequestPrimitive v_createRequest := m_createSubscriptionBase; + + v_createRequest.primitiveContent.subscription.eventNotificationCriteria.createdAfter := v_timeStamp; + + v_ae1.start(f_CSE_SUB_CRE_006(v_createRequest));//createdAfter + v_ae1.done; + + } + testcase TC_CSE_SUB_CRE_006_MS() runs on Tester system CseSystem { + + var AeSimu v_ae1 := AeSimu.create("AE1") alive; + var Timestamp v_timeStamp := fx_generateTimestamp(); + var template RequestPrimitive v_createRequest := m_createSubscriptionBase; + + v_createRequest.primitiveContent.subscription.eventNotificationCriteria.modifiedSince := v_timeStamp; + + v_ae1.start(f_CSE_SUB_CRE_006(v_createRequest));//modifiedSince + v_ae1.done; + + } + testcase TC_CSE_SUB_CRE_006_US() runs on Tester system CseSystem { + + var AeSimu v_ae1 := AeSimu.create("AE1") alive; + var Timestamp v_timeStamp := fx_generateTimestamp(); + var template RequestPrimitive v_createRequest := m_createSubscriptionBase; + + v_createRequest.primitiveContent.subscription.eventNotificationCriteria.unmodifiedSince := v_timeStamp; + + v_ae1.start(f_CSE_SUB_CRE_006(v_createRequest)); //unmodifiedSince + v_ae1.done; + + } + testcase TC_CSE_SUB_CRE_006_STS() runs on Tester system CseSystem { + + var AeSimu v_ae1 := AeSimu.create("AE1") alive; + var XSD.PositiveInteger v_stateTagSmaller := 5; + var template RequestPrimitive v_createRequest := m_createSubscriptionBase; + + v_createRequest.primitiveContent.subscription.eventNotificationCriteria.stateTagSmaller := v_stateTagSmaller; + + v_ae1.start(f_CSE_SUB_CRE_006(v_createRequest)); //stateTagSmaller + v_ae1.done; + + } + testcase TC_CSE_SUB_CRE_006_STB() runs on Tester system CseSystem { + + var AeSimu v_ae1 := AeSimu.create("AE1") alive; + var XSD.PositiveInteger v_stateTagBigger := 5; + var template RequestPrimitive v_createRequest := m_createSubscriptionBase; + + v_createRequest.primitiveContent.subscription.eventNotificationCriteria.stateTagBigger := v_stateTagBigger; + + v_ae1.start(f_CSE_SUB_CRE_006(v_createRequest)); // stateTagBigger + v_ae1.done; + + } + testcase TC_CSE_SUB_CRE_006_EXB() runs on Tester system CseSystem { + + var AeSimu v_ae1 := AeSimu.create("AE1") alive; + var Timestamp v_timeStamp := fx_generateTimestamp(); + var template RequestPrimitive v_createRequest := m_createSubscriptionBase; + + v_createRequest.primitiveContent.subscription.eventNotificationCriteria.expireBefore := v_timeStamp; + + v_ae1.start(f_CSE_SUB_CRE_006(v_createRequest)); //expireBefore + v_ae1.done; + + } + testcase TC_CSE_SUB_CRE_006_EXA() runs on Tester system CseSystem { + + var AeSimu v_ae1 := AeSimu.create("AE1") alive; + var Timestamp v_timeStamp := fx_generateTimestamp(); + var template RequestPrimitive v_createRequest := m_createSubscriptionBase; + + v_createRequest.primitiveContent.subscription.eventNotificationCriteria.expireAfter := v_timeStamp; + + v_ae1.start(f_CSE_SUB_CRE_006(v_createRequest)); //expireAfter + v_ae1.done; + + } + testcase TC_CSE_SUB_CRE_006_SZA() runs on Tester system CseSystem { + + var AeSimu v_ae1 := AeSimu.create("AE1") alive; + var XSD.PositiveInteger v_sizeAbove := 5; + var template RequestPrimitive v_createRequest := m_createSubscriptionBase; + + v_createRequest.primitiveContent.subscription.eventNotificationCriteria.sizeAbove := v_sizeAbove; + + v_ae1.start(f_CSE_SUB_CRE_006(v_createRequest)); //sizeAbove + v_ae1.done; + + } + testcase TC_CSE_SUB_CRE_006_SZB() runs on Tester system CseSystem { + + var AeSimu v_ae1 := AeSimu.create("AE1") alive; + var XSD.PositiveInteger v_sizeBelow := 5; + var template RequestPrimitive v_createRequest := m_createSubscriptionBase; + + v_createRequest.primitiveContent.subscription.eventNotificationCriteria.sizeBelow := v_sizeBelow; + + v_ae1.start(f_CSE_SUB_CRE_006(v_createRequest)); //sizeBelow + v_ae1.done; + + } + testcase TC_CSE_SUB_CRE_006_ET() runs on Tester system CseSystem { + + var AeSimu v_ae1 := AeSimu.create("AE1") alive; + 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.notificationEventType_list := v_notificationEventType; + + v_ae1.start(f_CSE_SUB_CRE_006(v_createRequest)); //eventType + v_ae1.done; + + } + testcase TC_CSE_SUB_CRE_006_OM() runs on Tester system CseSystem { + + var AeSimu v_ae1 := AeSimu.create("AE1") alive; + var template RequestPrimitive v_createRequest := m_createSubscriptionBase; + var template OperationMonitor v_OperationMonitor; + + v_OperationMonitor.operations := int1; + v_OperationMonitor.originator := PX_SUPER_CSE_ID; + + v_createRequest.primitiveContent.subscription.eventNotificationCriteria.operationMonitor_list := {v_OperationMonitor}; + + v_ae1.start(f_CSE_SUB_CRE_006(v_createRequest)); //operationMonitor + v_ae1.done; + + } + testcase TC_CSE_SUB_CRE_006_ATR() runs on Tester system CseSystem { + + var AeSimu v_ae1 := AeSimu.create("AE1") alive; + var EventNotificationCriteria.attribute v_attributeList := {"apn"}; + var template RequestPrimitive v_createRequest := m_createSubscriptionBase; + + v_createRequest.primitiveContent.subscription.eventNotificationCriteria := m_eventNotificationCriteria({int1}); //notificationEventType = "Update to attributes of the subscribed-to resource" + v_createRequest.primitiveContent.subscription.eventNotificationCriteria.attribute := v_attributeList; // value taken as example + // TS-001, cl 9.6.8, Table 9.6.8-3 -> the attributes list is only applicable when notificationEventType has a value of "Update to attributes of the subscribed-to resource" or "Update to attributes of the subscribed-to resource with blocking of the triggering UPDATE operation" + v_ae1.start(f_CSE_SUB_CRE_006(v_createRequest)); //eventType + v_ae1.done; + + } + testcase TC_CSE_SUB_CRE_006_CRT() runs on Tester system CseSystem { + + var AeSimu v_ae1 := AeSimu.create("AE1") alive; + var template RequestPrimitive v_createRequest := m_createSubscriptionBase; + + v_createRequest.primitiveContent.subscription.eventNotificationCriteria := m_eventNotificationCriteria({int3}); //notificationEventType = "Creation of a direct child of the subscribed-to resource" + // TS-001, cl 9.6.8, Table 9.6.8-3 -> childResource list is only applicable when notificationEventType has a value of "Creation of a direct child of the subscribed-to resource" or "Deletion of a direct child of the subscribed-to resource".4 + v_createRequest.primitiveContent.subscription.eventNotificationCriteria.childResourceType := {int23}; + + v_ae1.start(f_CSE_SUB_CRE_006(v_createRequest)); //childResourceType + v_ae1.done; + + } // acc. to TS-0001, clause 9.6.8, conditions "missingData" and "filterOperation" could be added. Also "attribute" is duplicated in TS-00018 TP/oneM2M/CSE/SUB/CRE/006 + + + }// end group g_CSE_SUB_CRE_006 + + group g_CSE_SUB_CRE_007 { + + /** + * @desc Check that the IUT accepts the creation of a subscription resource with the eventNotificationCriteria attribute which includes a missingData condition provided + * + */ + testcase TC_CSE_SUB_CRE_007() runs on Tester system CseSystem { + + var AeSimu v_ae1 := AeSimu.create("AE1") alive; + + v_ae1.start(f_CSE_SUB_CRE_007()); + + v_ae1.done; + + } // end TC_CSE_SUB_CRE_007 + + 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_resourceIndex := -1; + var integer v_timeSeriesIndex := -1; + var template (value) EventNotificationCriteria v_eventNotificationCriteria := m_eventNotificationCriteria; // parameter notificationEventType_list + var template RequestPrimitive v_createRequest := omit; + var RequestPrimitive v_request; + var XSD.PositiveInteger v_missingDataPointNumber := 1; + + // Test control + + // Test component configuration + f_cf01Up(true); + + // Test adapter configuration + + // Preamble + 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_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_request := f_getCreateRequestPrimitive(int23, v_createRequest, v_aeIndex);//Subscription + v_request.to_ := f_getResourceAddress(v_timeSeriesIndex); + // Test Body + f_send(e_mcaPort, m_request(v_request)); + tc_ac.start; + alt { + [] mcaPort.receive(mw_response(mw_responsePrimitive(int2001))) -> value v_response { + 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); + } + [] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) { + tc_ac.stop; + setverdict(inconc, __SCOPE__&":INFO: Error while creating resource"); + } + [] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) { + tc_ac.stop; + setverdict(fail, __SCOPE__ & ": Wrong response status code in the response"); + } + [] tc_ac.timeout { + setverdict(fail, __SCOPE__ & ": No answer while creating resource"); + } + } + + f_checkAeSimuStatus(); + + //Check to see if the resource is present or not + if (f_cse_isResourcePresent(v_resourceIndex)){ + setverdict(pass, __SCOPE__ & ":INFO: Resource created"); + } else { + setverdict(fail, __SCOPE__ & ":ERROR: Resource not created"); + } + + //Postamble + f_cse_postamble_deleteResources(); + + //Tear down + f_cf01Down(); + + } // end f_CSE_SUB_CRE_007 + + }// end group g_CSE_SUB_CRE_007 + + group g_CSE_SUB_CRE_008 { + + /** + * @desc Check that the IUT accepts the creation of a subscription resource with the optional attributes notificationForwardingURI and groupID provided + * + */ + testcase TC_CSE_SUB_CRE_008() runs on Tester system CseSystem { + + var AeSimu v_ae1 := AeSimu.create("AE1") alive; + + v_ae1.start(f_CSE_SUB_CRE_008()); + + v_ae1.done; + + } // end TC_CSE_SUB_CRE_008 + + function f_CSE_SUB_CRE_008() runs on AeSimu system CseSystem { + + // Local variables + var MsgIn v_response; + var integer v_containerIndex := -1; + var integer v_aeIndex := -1; + var integer v_resourceIndex := -1; + var XSD.ID v_memberID; + var template RequestPrimitive v_request := m_createSubscriptionBase; + var template RequestPrimitive v_groupRequest; + var integer v_groupIndex := -1; + + // Test control + + // Test component configuration + f_cf01Up(); + + // Test adapter configuration + + // Preamble + v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi + v_containerIndex := f_cse_createResource(int3, m_createContainerBase, v_aeIndex); // child resource + + v_memberID := f_getResourceId(vc_resourcesList[v_containerIndex].resource); + + v_groupRequest := valueof(m_createGroup(1, {v_memberID}, omit, int3)); + 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; + //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.requestIdentifier := valueof(v_groupRequest.requestIdentifier) & f_rnd(1, 1000000); + + v_request := f_getCreateRequestPrimitive(int23, v_request, v_aeIndex);//Subscription + v_request.to_ := f_getResourceAddress(v_groupIndex) & "/fopt"; + v_request.from_ := f_getResourceAddress(v_aeIndex); + + // Test Body + f_send(e_mcaPort, m_request(valueof(v_request))); + tc_ac.start; + alt { + [] mcaPort.receive(mw_response(mw_responsePrimitive(int2001))) -> value v_response { //CREATED - TS-004 - Table 6.6.3.3 1: RSCs for successful response class + tc_ac.stop; + setverdict(pass, __SCOPE__ & ": Resource created successfully"); + f_checkAttributesToBeSaved(int23, valueof(v_request), v_response.primitive.responsePrimitive); + v_resourceIndex := f_setResource(v_response.primitive.responsePrimitive.primitiveContent, int23, vc_aeIndex); + } + [] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) { + tc_ac.stop; + setverdict(inconc, __SCOPE__&":INFO: Error while creating resource"); + } + [] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) { + tc_ac.stop; + setverdict(fail, __SCOPE__ & ": Wrong response status code in the response"); + } + [] tc_ac.timeout { + setverdict(fail, __SCOPE__ & ": No answer while creating resource"); + } + } + + f_checkAeSimuStatus(); + + //Check to see if the resource is present or not + if (f_cse_isResourcePresent(v_resourceIndex)){ + setverdict(pass, __SCOPE__ & ":INFO: Resource created"); + } else { + setverdict(fail, __SCOPE__ & ":ERROR: Resource not created"); + } + + //Postamble + f_cse_postamble_deleteResources(); + + //Tear down + f_cf01Down(); + + } // end f_CSE_SUB_CRE_008 + + } // end g_CSE_SUB_CRE_008 + + group g_CSE_SUB_CRE_009 { /** * @desc Check that the IUT rejects a CREATE request when the notificationEventType is set to 6(Trigger_Received_For_AE_Resource) in combination of NOTIFICATION_EVENT_TYPE. @@ -7904,7 +8274,546 @@ module OneM2M_Testcases_CSE_Release_3 { }//end group Create group Notify{ - + + /** + * @desc Check that the IUT sends the latest notification to the subscriber resource when latestNotify is set to TRUE, the duration value of the batchNotify attribute is set to TIME_LIMIT and when this timer expires + * + */ + testcase TC_CSE_SUB_NTF_004() runs on Tester system CseSystem { + + var AeSimu v_ae1 := AeSimu.create("AE1") alive; + + v_ae1.start(f_CSE_SUB_NTF_004()); + + v_ae1.done; + + } + + function f_CSE_SUB_NTF_004() runs on AeSimu system CseSystem { + // Local variables + timer t_batchNotificationTimer := PX_TAC * 2.0; + var float v_elapsedTime; + var Labels v_labels_1:= {"VALUE_1"}; + var integer v_ae1Index := -1; + var template RequestPrimitive v_createRequest := omit; + var template PrimitiveContent v_contentResponse; + var template RequestPrimitive v_updateRequest := m_updateAeBase; + 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); + + // Test adapter configuration + + // Preamble + f_cse_createAccessControlPolicyAux("SubscriptionVerificationAcp",{"all"}, int63); + + v_ae1Index := f_cse_createResource_withAcpAux(int2, m_createAe(vc_aeSimuDesc.appId, -, vc_aeSimuDesc.aeIdStem, c_defaultAe1ResourceName, {f_getLocalPoA(vc_aeSimuDesc.mcaPortIn, "")}), -1); // now AE1 is registered + + vc_ae2.start(f_cse_createResource(int2, m_createAe(PX_TS_AE2.appId, -, PX_TS_AE2.aeIdStem, c_defaultAe2ResourceName, omit), -1)); // AE2 is registered + + f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2); + + v_ae2LocalIndex := f_getResourceFromAeSimu(vc_ae2); + + v_ae2Index := f_getLatestResourceIndex(vc_ae2); + + // 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 + + 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_mcaPortIn, 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_mcaPortIn, 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); + + // 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 + + 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_mcaPortIn, m_response(v_responsePrimitive)); + + } + [] mcaPortIn.receive(mw_request(mw_notifyAggregatedNotification({{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_mcaPortIn, m_response(v_responsePrimitive)); + + } + [] tc_ac.timeout { + setverdict(fail, __SCOPE__ & ": No notification received"); + } + } + + f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2); + + //Postamble + f_cse_postamble_deleteResources(); + + //Tear down + f_cf01Down(); + + } // end TC_CSE_SUB_NTF_004 + + + /** + * @desc Check that the IUT sends the latest cached notification after IUT escapes from connectionless state when the pendingNotification is set to 1 (sendLatest) + * + */ + testcase TC_CSE_SUB_NTF_005() runs on Tester system CseSystem { + + var AeSimu v_ae1 := AeSimu.create("AE1") alive; + + v_ae1.start(f_CSE_SUB_NTF_005()); + + v_ae1.done; + + } + + function f_CSE_SUB_NTF_005() runs on AeSimu system CseSystem { + // Local variables + const integer receivedUpdateCounter := 3; + var Labels v_labels[receivedUpdateCounter]; + var integer i; + 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 integer v_ae2Index := -1; + var integer v_ae2LocalIndex := -1; + + v_contentResponse.aE := mw_contentAeBase; // all attributes expected + v_labels[0] := {"VALUE_1"}; + v_labels[1] := {"VALUE_2"}; + v_labels[2] := {"VALUE_3"}; + + // Test control + + // Test component configuration + f_cf01Up(true); + + // Test adapter configuration + + // Preamble + v_ae1Index := f_cse_preamble_registerAe();//c_CRUDNDi); + + 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_resourceIndex := f_cse_createResource(int23, v_createRequest, v_ae1Index);//Subscription + + //IUT being in the "connectionless state" with AE2 + /*if(vc_ae2.running) { + vc_ae2.stop; + };*/ + vc_auxiliaryAe2Up := false; + 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 + 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 + } + + // Test Body + vc_ae2.start(f_cf01UpAe2()); + 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 + + f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2); + + //Postamble + f_cse_postamble_deleteResources(); + + //Tear down + f_cf01Down(); + + } // end TC_CSE_SUB_NTF_005 + + /** + * @desc Check that the IUT sends the notifications of cached notification messages after IUT escapes from connectionless state when the pendingNotification is set to 2 (sendAllPending) + * + */ + testcase TC_CSE_SUB_NTF_006() runs on Tester system CseSystem { + + var AeSimu v_ae1 := AeSimu.create("AE1") alive; + + v_ae1.start(f_CSE_SUB_NTF_006()); + + v_ae1.done; + } + + function f_CSE_SUB_NTF_006() runs on AeSimu system CseSystem { + // Local variables + const integer receivedUpdateCounter := 3; + var Labels v_labels[receivedUpdateCounter]; + var integer i; + var integer v_ae1Index := -1; + var integer v_resourceIndex := -1; + var template RequestPrimitive v_createRequest := m_createSubscriptionBase; + var template PrimitiveContent v_contentResponse; + var template RequestPrimitive v_updateRequest := m_updateAeBase; + var integer v_ae2Index := -1; + var integer v_ae2LocalIndex := -1; + + v_contentResponse.aE := mw_contentAeBase; // all attributes expected + v_labels[0] := {"VALUE_1"}; + v_labels[1] := {"VALUE_2"}; + v_labels[2] := {"VALUE_3"}; + + // Test control + + // Test component configuration + f_cf01Up(true); + + // Test adapter configuration + + // Preamble + v_ae1Index := f_cse_preamble_registerAe();//c_CRUDNDi); + + 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_resourceIndex := f_cse_createResource(int23, v_createRequest, v_ae1Index);//Subscription + + //IUT being in the "connectionless state" with AE2 + /*if(vc_ae2.running) { + vc_ae2.stop; + };*/ + vc_auxiliaryAe2Up := false; + 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 + 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 + } + + // Test Body + vc_ae2.start(f_cf01UpAe2()); + 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 + + f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2); + + //Postamble + f_cse_postamble_deleteResources(); + + //Tear down + f_cf01Down(); + + } // end TC_CSE_SUB_NTF_006 + + + /** + * @desc Check that the IUT retargets the notification to the AE according to pointOfAccess in the <AE> resource + */ + testcase TC_CSE_SUB_NTF_007() runs on Tester system CseSystem { + + var AeSimu v_ae1 := AeSimu.create("AE1") alive; + + v_ae1.start(f_CSE_SUB_NTF_007()); + + v_ae1.done; + } + + function f_CSE_SUB_NTF_007() runs on AeSimu system CseSystem { + // Local variables + var integer v_aeIndex := -1; + var RequestPrimitive v_request; + var ResponsePrimitive v_responsePrimitive; + var RequestPrimitive v_reqNotify; + + // Test control + + // Test component configuration + f_cf02Up(); + vc_cse1.start(f_cse_registerRemoteCse(m_createRemoteCSE_poa(-, -, -, -, -, {f_getLocalPoA()}))); + // Test adapter configuration + + // Preamble + v_aeIndex := f_cse_preamble_registerAe(-, {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))); + + vc_cse1.start(f_cse_notifyProcedure_notify(v_reqNotify)); //Message exchange for notification + + tc_ac.start; + alt { + [] mcaPortIn.receive(mw_request(mw_notifyNotification(mw_contentNotification(?)))) -> value vc_request { + tc_ac.stop; + + setverdict(pass, __SCOPE__ & ":INFO: Notification received"); + + //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; + } + [] mcaPortIn.receive(mw_request(mw_notifyResponsePrimitive(?))) -> value vc_request { + tc_ac.stop; + setverdict(fail, __SCOPE__ & ": Error, Non expected notification received"); + //Send response in any case + v_responsePrimitive := valueof(m_responseNotification(int2000, omit)); + v_responsePrimitive.requestIdentifier := vc_request.primitive.requestPrimitive.requestIdentifier; + f_send(e_mcaPortIn, m_response(v_responsePrimitive)); + } + [] tc_ac.timeout { + setverdict(fail, __SCOPE__ & ": No answer while retargeting request"); + } + } + + f_aeSimu_checkComponentDoneAndGetVerdict(vc_cse1); + + // Postamble + f_cse_postamble_deleteResources(); + + // Tear down + f_cf02Down(); + + } // end TC_CSE_SUB_NTF_007 + + /** + * @desc Check that the IUT retargets the notification to the AE according to pointOfAccess in the <AE> resource and forward the response back to the CSE + */ + testcase TC_CSE_SUB_NTF_008() runs on Tester system CseSystem { + + var CseSimu v_cse1 := CseSimu.create("CSE1") alive; + + v_cse1.start(f_CSE_SUB_NTF_008()); + + v_cse1.done; + } + + function f_CSE_SUB_NTF_008() runs on CseSimu system CseSystem { + var integer v_aeIndex, v_remoteCseIndex := -1; + var ResponsePrimitive v_responsePrimitive; + //var template RequestPrimitive v_requestCreateAE := m_createAe(vc_aeSimuDesc.appId, omit, vc_aeSimuDesc.aeIdStem, c_defaultAe1ResourceName, {f_getLocalPoA(vc_aeSimuDesc.mcaPortIn)}); + var RequestPrimitive v_reqNotify; + + // Test control + + // Test component configuration + f_cf02UpCseSimuMaster(); + + // Test adapter configuration + + // Preamble + v_remoteCseIndex := f_cse_registerRemoteCse(m_createRemoteCSE_poa(-, -, -, -, -, {f_getLocalPoA()})); + + vc_ae1.start(f_cse_createAccessControlPolicyAux("SubscriptionVerificationAcp",{"all"}, int63)); + f_cseSimu_checkComponentDoneAndGetVerdict(vc_ae1); + + vc_ae1.start(f_cse_createResource_withAcpAux(int2, m_createAe(PX_TS_AE1.appId, -, PX_TS_AE1.aeIdStem, c_defaultAe2ResourceName, {f_getLocalPoA(PX_TS_AE1.mcaPortIn, "")}), -1)); // AE2 is registred + f_cseSimu_checkComponentDoneAndGetVerdict(vc_ae1); + + // Test Body + v_aeIndex := f_getLatestResource(vc_ae1); + v_reqNotify := valueof(m_notifyNotification(f_getResourceAddress(v_aeIndex), m_contentNotification_subscriptionVerification(PX_TS_CSE1.cseId))); + + vc_ae1.start(f_cse_notifyProcedure_subscriptionVerificationHandler());//Message exchange for notification + + f_send(e_mccPort, m_request(v_reqNotify)); + tc_ac.start; + alt { + [] mccPort.receive(mw_request(mw_notifyNotification(mw_contentNotification(?)))) -> value vc_request { + tc_ac.stop; + + setverdict(pass, __SCOPE__ & ":INFO: Notification received"); + + //Send response in any case + v_responsePrimitive := valueof(m_responseNotification(int2000, omit)); + } + [] mccPort.receive(mw_request(mw_notifyResponsePrimitive(?))) -> value vc_request { + tc_ac.stop; + setverdict(fail, __SCOPE__ & ": Error, Non expected notification received"); + } + [] tc_ac.timeout { + setverdict(fail, __SCOPE__ & ": No answer while retargeting request"); + } + } + + f_cseSimu_checkComponentDoneAndGetVerdict(vc_ae1); + + // Postamble + f_cse_postamble_deleteResourcesCSE(); + + // Tear down + f_cf02DownCseSimuMaster(); + + } // end f_CSE_SUB_NTF_008 + + /** + * @desc Check that the IUT sends an aggregatedNotification to the AE according to URI provided in notificationForwardingURI attribute when an event occurs on <group> resource with its members having group related subscriptions + */ + testcase TC_CSE_SUB_NTF_009() runs on Tester system CseSystem { + + var AeSimu v_ae1 := AeSimu.create("AE1") alive; + + v_ae1.start(f_CSE_SUB_NTF_009()); + + v_ae1.done; + } + + function f_CSE_SUB_NTF_009() runs on AeSimu system CseSystem { + // Local variables + var MsgIn v_response; + var integer v_aeIndex := -1; + var integer v_ae2Index := -1; + var integer v_groupIndex := -1; + var integer v_containerIndex := -1; + var XSD.AnyURI v_memberID_1, v_memberID_2; + var integer v_resourceIndex; + var template RequestPrimitive v_groupRequest; + var XSD.AnyURI v_fanoutPointAddress; + var RequestPrimitive v_request; + var template RequestPrimitive v_createRequest := m_createSubscriptionBase; + var template PrimitiveContent v_contentResponse; + + // Test control + + // Test component configuration + f_cf02Up(); + + // Test adapter configuration + + // Preamble + v_aeIndex := f_cse_preamble_registerAe(); + + f_cse_preamble_subscriptionVerification(v_ae2Index, v_createRequest, int23); + + v_containerIndex := f_cse_createResource(int3, m_createContainerBase, v_aeIndex); + v_memberID_1 := f_getResourceId(vc_resourcesList[v_containerIndex].resource); + v_containerIndex := f_cse_createResource(int3, m_createContainerBase, v_aeIndex); + v_memberID_2 := f_getResourceId(vc_resourcesList[v_containerIndex].resource); + + v_groupRequest := valueof(m_createGroup(2, {v_memberID_1, v_memberID_2}, omit, int3)); + v_groupIndex := f_cse_createResource(int9, v_groupRequest, v_aeIndex); + + v_fanoutPointAddress := f_getResourceAddress(v_groupIndex) & "/" & c_resourceShortNameFanOutPoint; + v_request.primitiveContent.subscription.groupID := f_getResourceId(vc_resourcesList[v_groupIndex].resource); + v_request.primitiveContent.subscription.notificationURI := {v_fanoutPointAddress}; + v_request.primitiveContent.subscription.notificationForwardingURI := v_fanoutPointAddress; + //subscription created on these members with notificationForwardingURI attribute set identical to notificationURI + + v_request.primitiveContent.group_.memberIDs := {v_memberID_1, v_memberID_2}; + + v_request := f_getCreateRequestPrimitive(int23, v_request, v_aeIndex);//Subscription + f_send(e_mcaPort, m_request(v_request)); + tc_ac.start; + alt { + [] mcaPort.receive(mw_response(mw_responsePrimitive(int2001))) -> value v_response { + tc_ac.stop; + setverdict(pass, __SCOPE__ & ": Resource created successfully"); + f_checkAttributesToBeSaved(int23, valueof(v_request), v_response.primitive.responsePrimitive); + v_resourceIndex := f_setResource(v_response.primitive.responsePrimitive.primitiveContent, int23, vc_aeIndex); + } + [] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) { + tc_ac.stop; + setverdict(inconc, __SCOPE__&":INFO: Error while creating resource"); + } + [] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) { + tc_ac.stop; + setverdict(fail, __SCOPE__ & ": Wrong response status code in the response"); + } + [] tc_ac.timeout { + setverdict(fail, __SCOPE__ & ": No answer while creating resource"); + } + } + + // Test Body + v_contentResponse.notification.notificationForwardingURI := v_fanoutPointAddress; + vc_ae2.start(f_cse_notifyProcedure_aggregatedNoficationHandler(v_contentResponse, 1)); // check if the Rx. of notification and match contents + + f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2); + + //Postamble + f_cse_postamble_deleteResources(); + + // Tear down + f_cf02Down(); + + } // end f_CSE_SUB_NTF_009 + + /** * @desc Check that the IUT doesn’t send a Notify request to the subscriber resource when “childResourceType†condition tag of eventNotificationCriteria attribute is set to LIST_OF_RESOURCE_TYPE and this list doesn’t contain the RESOURCE_TYPE created in the request. * @@ -14922,7 +15831,7 @@ module OneM2M_Testcases_CSE_Release_3 { var XSD.ID v_remoteOntologyAddress; var integer v_remoteOntologyRepoIndex := -1; var integer v_remoteOntologyIndex := -1; - var RequestPrimitive v_updateSdRequestPrimitive := m_updateSemanticDescriptorBase; + var template RequestPrimitive v_updateSdRequestPrimitive := m_updateSemanticDescriptorBase; // Test control @@ -14958,7 +15867,7 @@ module OneM2M_Testcases_CSE_Release_3 { v_updateSdRequestPrimitive.primitiveContent.semanticDescriptor.ontologyRef := v_remoteOntologyAddress; v_updateSdRequestPrimitive.primitiveContent.semanticDescriptor.validationEnable := true; v_updateSdRequestPrimitive := f_getUpdateRequestPrimitive(int24, v_resourceIndexSd, v_updateSdRequestPrimitive); - f_send(e_mcaPort, m_request(v_updateSdRequestPrimitive)); + f_send(e_mcaPort, m_request(valueof(v_updateSdRequestPrimitive))); tc_ac.start; alt {