diff --git a/LibOneM2M/OneM2M_Functions.ttcn b/LibOneM2M/OneM2M_Functions.ttcn index 2e4aca7cd9b7a0e1618b245edd876bb609d7505f..a24fefc58fdc6bc85ac3becebefe084433cb1937 100644 --- a/LibOneM2M/OneM2M_Functions.ttcn +++ b/LibOneM2M/OneM2M_Functions.ttcn @@ -941,20 +941,27 @@ module OneM2M_Functions { * @desc Connection of InfoPort of two components * @param p_tester PTC where InfoPort is to be connected */ - function f_connectInfoPort(in Tester p_tester) runs on Tester { + function f_connectInfoPort(in Tester p_tester) runs on Tester return boolean { + var boolean connectionState := false; // Connect + if (infoPort.checkstate("Connected")) { + connectionState := true; + } connect(self:infoPort, p_tester:infoPort); - log(__SCOPE__&": INFO: infoPort connected"); + log(__SCOPE__&": INFO: infoPort connected"); + return connectionState; } /** * @desc Disconnection of InfoPort of two components * @param p_tester PTC where InfoPort is to be connected */ - function f_disconnectInfoPort(in Tester p_tester) runs on Tester { + function f_disconnectInfoPort(in Tester p_tester, in boolean connectionState := false) runs on Tester { // Disconnect - disconnect(self:infoPort, p_tester:infoPort); - log(__SCOPE__&": INFO: infoPort disconnected"); + if (not connectionState) { + disconnect(self:infoPort, p_tester:infoPort); + log(__SCOPE__&": INFO: infoPort disconnected"); + } } group getFunctions { @@ -987,8 +994,9 @@ module OneM2M_Functions { */ function f_getRequestPrimitive(in Tester p_component) runs on Tester return RequestPrimitive { var RequestPrimitive v_request; - - f_connectInfoPort(p_component); + var boolean previousConnectionState := false; + + previousConnectionState := f_connectInfoPort(p_component); p_component.start(f_sendRequestPrimitive()); alt { @@ -998,7 +1006,7 @@ module OneM2M_Functions { p_component.done; - f_disconnectInfoPort(p_component); + f_disconnectInfoPort(p_component, previousConnectionState); return v_request; diff --git a/LibOneM2M/OneM2M_Pixits.ttcn b/LibOneM2M/OneM2M_Pixits.ttcn index 4c19c4118f1c7b9ff86631b53fc213c8e29560ec..f8750240baff2848d7e85d9f7a954e5aee221a4e 100644 --- a/LibOneM2M/OneM2M_Pixits.ttcn +++ b/LibOneM2M/OneM2M_Pixits.ttcn @@ -38,37 +38,37 @@ module OneM2M_Pixits { /** * @desc IUT Upper Tester interface support */ - modulepar boolean PX_UT_IMPLEMENTED := false; + modulepar boolean PX_UT_IMPLEMENTED := true; /** * @desc IUT CSE Name */ - modulepar XSD.ID PX_CSE_NAME := "CSE-NAME"; + modulepar XSD.ID PX_CSE_NAME := "cse-in"; /** * @desc IUT CSE-ID with SP-relative-CSE-ID format (relative) according to TS-0001-7.2-1 */ - modulepar XSD.ID PX_CSE_ID := "/CSE-ID"; + modulepar XSD.ID PX_CSE_ID := "/id-in"; /** * @desc IUT CSE resource ID with Unstructured-CSE-relative-Resource-ID (relative) format according to TS-0001-7.2-1 */ - modulepar XSD.ID PX_CSE_RESOURCE_ID := "CSE-ID"; + modulepar XSD.ID PX_CSE_RESOURCE_ID := "id-in"; /** * @desc IUT M2M-SP-ID with M2M-SP-ID format (absolute) according to TS-0001-7.2-1 Unstructured-CSE-relative -Resource-ID */ - modulepar XSD.ID PX_SP_ID := "//CSE-SP-ID"; + modulepar XSD.ID PX_SP_ID := "//acme.example.com"; /** * @desc AE-ID with privileges to CREATE at the IUT CSEBase with AE-ID-Stem format (relative) according to TS-0001-7.2-1 */ - modulepar XSD.ID PX_SUPER_AE_ID := "admin:admin"; + modulepar XSD.ID PX_SUPER_AE_ID := "CAdmin"; /** * @desc CSE-ID with privileges to CREATE at the IUT CSEBase with SP-relative-CSE-ID format (relative) according to TS-0001-7.2-1 */ - modulepar XSD.ID PX_SUPER_CSE_ID := "admin:admin"; + modulepar XSD.ID PX_SUPER_CSE_ID := "CAdmin"; /** * @desc Allowed AE-IDs starting with C diff --git a/LibOneM2M/OneM2M_Templates.ttcn b/LibOneM2M/OneM2M_Templates.ttcn index 642ae574a1e3f17dd46c5f0a16b5ae6ba3c45471..79ca7b75b1881562d731c3750d83b19822320020 100644 --- a/LibOneM2M/OneM2M_Templates.ttcn +++ b/LibOneM2M/OneM2M_Templates.ttcn @@ -1966,6 +1966,15 @@ module OneM2M_Templates { primitiveContent := {schedule := m_contentCreateSchedule ({{"* * * * * * *"}})} }; + /** + * @desc Base CREATE request primitive for Schedule resource + */ + template (value) RequestPrimitive m_createScheduleBase_subscription modifies m_create := { + requestIdentifier := testcasename() & "-m_createSchedule", + resourceType := int18, + primitiveContent := {schedule := m_contentCreateSchedule ({{"* * * * * * *"}}, "notificationSchedule")} + }; + /** * @desc Base CREATE request primitive for Dependency resource */ @@ -2078,7 +2087,7 @@ module OneM2M_Templates { primitiveContent := {subscription := m_contentCreateSubscription ({"NotInitialized"})} }; - template (value) RequestPrimitive m_createSubscription(template (omit) XSD.ID p_to := omit, in template (omit) ResourceName p_name, in template (value) ListOfURIs p_notificationURI := {"NotInitialized"}) modifies m_create := { + template (value) RequestPrimitive m_createSubscription(template (omit) XSD.ID p_to := omit, in template (omit) ResourceName p_name := c_defaultSubscriptionResourceName, in template (value) ListOfURIs p_notificationURI := {"NotInitialized"}) modifies m_create := { to_ := p_to, requestIdentifier := testcasename() & "-m_createSubscription", resourceType := int23, diff --git a/LibOneM2M/OneM2M_TypesAndValues.ttcn b/LibOneM2M/OneM2M_TypesAndValues.ttcn index d1ac974ad57d967075d2667e9bc2e42ff243e330..7b549822d111b255437ab265a6eeea9929df4270 100644 --- a/LibOneM2M/OneM2M_TypesAndValues.ttcn +++ b/LibOneM2M/OneM2M_TypesAndValues.ttcn @@ -5599,7 +5599,7 @@ group Values { group PatternValues { - const universal charstring c_point := "(\[[-+]#(0,1)(180(.0#(1,))#(0,1)|((1[0-7]\d)|([1-9]#(0,1)\d))(.\d#(1,))#(0,1))[,][\q{0,0,0,32}\t]#(0,)[-+]#(0,1)([1-8]#(0,1)\d(.\d#(1,))#(0,1)|90(.0#(1,))#(0,1))([,]\d#(1,))#(0,1)\])"; + template universal charstring c_point := pattern "(\[[-+]#(0,1)(180(.0#(1,))#(0,1)|((1[0-7]\d)|([1-9]#(0,1)\d))(.\d#(1,))#(0,1))[,][\q{0,0,0,32}\t]#(0,)[-+]#(0,1)([1-8]#(0,1)\d(.\d#(1,))#(0,1)|90(.0#(1,))#(0,1))([,]\d#(1,))#(0,1)\])"; template universal charstring c_multipoint := pattern "^\[{c_point}([,][\q{0,0,0,32}\t]#(0,){c_point})#(0,)\]$"; template universal charstring c_lineStringOrMultipoint:= pattern "\[{c_point}([,][\q{0,0,0,32}\t]#(0,){c_point})#(1,)\]"; template universal charstring c_multiLineString := pattern "^\[{c_lineStringOrMultipoint}([,][\q{0,0,0,32}\t]#(0,){c_lineStringOrMultipoint})#(0,)\]$"; diff --git a/OneM2M_PermutationFunctions.ttcn b/OneM2M_PermutationFunctions.ttcn index a42e93f4070390a99d387d2746c799ade1dfc296..2f88e59c5a3de2532409d14908a48623b097d408 100644 --- a/OneM2M_PermutationFunctions.ttcn +++ b/OneM2M_PermutationFunctions.ttcn @@ -10897,7 +10897,7 @@ module OneM2M_PermutationFunctions { t_notificationTimer.start; v_elapsedTime := t_notificationTimer.read; //v_myAbsRelTimestamp = 2.0 seconds - while (v_elapsedTime < 2.0){ // Wait until window size expires + while (v_elapsedTime < 4.0){ // Wait until window size expires v_elapsedTime := t_notificationTimer.read; } t_notificationTimer.stop; @@ -11097,7 +11097,7 @@ module OneM2M_PermutationFunctions { t_notificationTimer.start; v_elapsedTime := t_notificationTimer.read; //v_myAbsRelTimestamp = 2.0 seconds - while (v_elapsedTime < 2.0){ // Wait until window size expires + while (v_elapsedTime < 4.0){ // Wait until window size expires v_elapsedTime := t_notificationTimer.read; } t_notificationTimer.stop; diff --git a/OneM2M_Testcases_CSE_Release_2.ttcn b/OneM2M_Testcases_CSE_Release_2.ttcn index 266a46127dd449ec0363bfe1b6d917516a897b86..317ceba4dc0e467cda5e9ff8d14aeddbdb016072 100644 --- a/OneM2M_Testcases_CSE_Release_2.ttcn +++ b/OneM2M_Testcases_CSE_Release_2.ttcn @@ -1133,7 +1133,7 @@ module OneM2M_Testcases_CSE_Release_2 { var template PrimitiveContent v_contentResponse; v_contentResponse.subscription := mw_contentSubscription_rc1; - v_ae1.start(f_CSE_DMR_RET_021(int23, m_createSubscriptionBase, v_contentResponse, int18, m_createScheduleBase));//Subscription + v_ae1.start(f_CSE_DMR_RET_021(int23, m_createSubscriptionBase, v_contentResponse, int18, m_createScheduleBase_subscription));//Subscription v_ae1.done; } diff --git a/OneM2M_Testcases_CSE_Release_3.ttcn b/OneM2M_Testcases_CSE_Release_3.ttcn index d1e870279a18a41267e76b9fb299d3c80273917c..75dc64200ee8d73c7d6211f8baa735c18ce64053 100644 --- a/OneM2M_Testcases_CSE_Release_3.ttcn +++ b/OneM2M_Testcases_CSE_Release_3.ttcn @@ -8743,7 +8743,11 @@ module OneM2M_Testcases_CSE_Release_3 { [] tc_ac.timeout { setverdict(fail, __SCOPE__ & ": No answer while creating resource"); } - } + } + + if(vc_ae2.running) { + vc_ae2.stop; + }; // Test Body v_contentResponse.notification.notificationForwardingURI := v_fanoutPointAddress; diff --git a/OneM2M_Testcases_CSE_Release_4.ttcn b/OneM2M_Testcases_CSE_Release_4.ttcn index ea5beec4e9f740271eeb7b521c78fca0ee003c4c..14e5efd2debec61b36026c90a7fbaad5366a749a 100644 --- a/OneM2M_Testcases_CSE_Release_4.ttcn +++ b/OneM2M_Testcases_CSE_Release_4.ttcn @@ -572,7 +572,7 @@ module OneM2M_Testcases_CSE_Release_4 { function f_CSE_SCH_001() runs on AeSimu system CseSystem { // Local variables var integer v_aeIndex, v_resourceIndex := -1; - var template RequestPrimitive v_createRequestSchedule := m_createScheduleBase; + var template RequestPrimitive v_createRequestSchedule := m_createScheduleBase_subscription; var RequestPrimitive v_request; // Test component configuration @@ -645,11 +645,11 @@ module OneM2M_Testcases_CSE_Release_4 { v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi); v_resourceIndex := f_cse_createResource(int23, m_createSubscriptionBase, v_aeIndex);//Subscription - v_childscheduleResourceIndex := f_cse_createResource(v_scheduleresourceType, m_updateScheduleBase, v_resourceIndex); + v_childscheduleResourceIndex := f_cse_createResource(v_scheduleresourceType, m_createScheduleBase_subscription, v_resourceIndex); v_contentUpdateSchedule.primitiveContent.schedule.networkCoordinated := true; // Test Body - v_request := f_getUpdateRequestPrimitive(v_scheduleresourceType, v_resourceIndex, v_contentUpdateSchedule); + v_request := f_getUpdateRequestPrimitive(v_scheduleresourceType, v_childscheduleResourceIndex, v_contentUpdateSchedule); f_send(e_mcaPort, m_request(valueof(v_request))); tc_ac.start; alt { @@ -696,18 +696,21 @@ module OneM2M_Testcases_CSE_Release_4 { timer t_batchNotificationTimer := PX_TAC * 2.0; //just gives enough time to execute const ResourceType c_containerResourceType := int3; var float v_elapsedTime; - var integer v_ae1Index, v_ae2Index, v_containerResourceIndex, v_childScheduleIndex := -1; - var template RequestPrimitive v_updateRequestPrimitive := m_updateContainerBase; - var template RequestPrimitive v_updateRequest; - var template RequestPrimitive v_createRequestSubscription; - var template RequestPrimitive v_createRequest := m_createScheduleBase; - + var integer v_ae1Index, v_ae2LocalIndex, v_ae2Index, v_containerResourceIndex, v_subscriptionResourceIndex, v_childScheduleIndex := -1; + var template RequestPrimitive v_updateRequest := m_updateContainerBase; + var template RequestPrimitive v_createRequest := m_createScheduleBase_subscription; + var ResponsePrimitive v_responsePrimitive; + var integer v_actualYear; + var XSD.ID v_containerResourceAddress; + var template PrimitiveContent v_contentResponse := {container := mw_contentContainerBase};// all attributes expected + v_contentResponse.container.labels := ?; + // 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); @@ -716,39 +719,123 @@ module OneM2M_Testcases_CSE_Release_4 { // 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); - // AE1 is registered - - vc_ae2.start(f_cse_createResource_withAcpAux(int2, m_createAe(PX_TS_AE2.appId, -, PX_TS_AE2.aeIdStem, c_defaultAe2ResourceName, {f_getLocalPoA(PX_TS_AE2.mcaPortIn, "")}), -1)); - // AE2 is registered + 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); + + vc_ae2.start(f_cse_createResource(c_containerResourceType, m_createContainerBase, v_ae2Index)); f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2); - v_ae2Index := f_getResourceFromAeSimu(vc_ae2); + + v_containerResourceIndex := f_getLatestResourceIndex(vc_ae2); + + v_containerResourceAddress := f_getLatestResourceAddress(vc_ae2); - v_containerResourceIndex := f_cse_createResource(c_containerResourceType, m_createContainerBase, v_ae1Index); + vc_ae2.start(f_cse_createResource(int23, m_createSubscription(v_containerResourceAddress, -, {f_getResourceAddress(v_ae1Index)}), v_containerResourceIndex)); + + 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_response(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_response(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); + + v_subscriptionResourceIndex := f_getLatestResourceIndex(vc_ae2); + + v_actualYear := f_getYear(fx_generateTimestamp()); + v_createRequest.primitiveContent.schedule.scheduleElement := {{"* * * * * * " & int2str(v_actualYear)}};//scheduled for this year + vc_ae2.start(f_cse_createResource(int18, v_createRequest, v_subscriptionResourceIndex)); + f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2); + + // Test Body + v_updateRequest.primitiveContent.container.labels := {"LABEL_1"}; + vc_ae2.start(f_cse_updateResource(int3, v_containerResourceIndex, 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"); + } + 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)); + f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2); + setverdict(pass, __SCOPE__ & ": Notifications sent on scheduled time"); + } + [] tc_ac.timeout { + setverdict(fail, __SCOPE__ & ": No notification received"); + } + } + + f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2); + + //Postamble + f_cse_postamble_deleteResources(); + + //Tear down + f_cf01Down(); + + /* + // Test component configuration + f_cf01Up(); + + // Test adapter configuration - v_createRequestSubscription := m_createSubscription(f_getResourceAddress(v_ae2Index), omit, {f_getResourceAddress(v_ae1Index)}); + // Preamble + v_aeIndex := f_cse_preamble_registerAe(-, {f_getLocalPoA(vc_aeSimuDesc.mcaPortIn, "")}); + + // AE1 is registered - vc_ae2.start(f_cse_createResource(int23, v_createRequestSubscription, v_containerResourceIndex));//Subscription + v_containerResourceIndex := f_cse_createResource(c_containerResourceType, m_createContainerBase, v_ae1Index); - v_createRequest.primitiveContent.schedule.scheduleElement := {{"*/5 0 0 * * * *"}};//scheduled every 5 seconds - v_childScheduleIndex := f_cse_createResource(int18, v_createRequest, v_containerResourceIndex); //schedule resource child + v_subscriptionResourceIndex := f_cse_createResource(int23, m_createSubscriptionBase(), v_containerResourceIndex);//Subscription - v_updateRequest := f_getUpdateRequestPrimitive(c_containerResourceType, v_containerResourceIndex, v_updateRequestPrimitive); + v_createRequest.primitiveContent.schedule.scheduleElement := {{"*//*5 0 0 * * * *"}};//scheduled every 5 seconds + v_childScheduleIndex := f_cse_createResource(int18, v_createRequest, v_subscriptionResourceIndex); //schedule resource child + v_updateRequest := f_getUpdateRequestPrimitive(c_containerResourceType, v_containerResourceIndex, v_updateRequest); + v_updateRequest.primitiveContent.container.labels := {"LABEL_1"}; + // Test Body - t_batchNotificationTimer.start; - f_send(e_mcaPort, m_request(valueof(v_updateRequest))); tc_ac.start; alt { [] mcaPort.receive(mw_response(mw_responsePrimitive(int2004))) -> value vc_response { tc_ac.stop; setverdict(pass, __SCOPE__&":INFO: Attribute of resource updated successfuly"); - v_elapsedTime := t_batchNotificationTimer.read; - t_batchNotificationTimer.stop; - if(float2int(v_elapsedTime) mod 5 != 0) { - setverdict(fail, __SCOPE__ & ": Notifications sent before SCHEDULE_TIME is reached"); - } + if (v_firstNotification) { + + } + } [] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value vc_response { tc_ac.stop; @@ -758,6 +845,38 @@ module OneM2M_Testcases_CSE_Release_4 { tc_ac.stop; setverdict(fail, __SCOPE__ & ": Error while updating scheduling resource "); } + [] mcaPortIn.receive(mw_request(mw_notifyNotification(mw_contentNotification(?)))) -> value vc_request { + tc_ac.stop; + if(f_check_notificationContent(vc_request.primitive.requestPrimitive, v_contentNotification)){ + setverdict(pass, __SCOPE__ & ":INFO: Notification received"); + } + 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)); + if (v_firstNotification){ + t_batchNotificationTimer.start; + v_updateRequest := f_getUpdateRequestPrimitive(c_containerResourceType, v_containerResourceIndex, v_updateRequest); + v_updateRequest.primitiveContent.container.labels := {"LABEL_2"}; + f_send(e_mcaPort, m_request(valueof(v_updateRequest))); + repeat; + } else { + v_elapsedTime := t_batchNotificationTimer.read; + t_batchNotificationTimer.stop; + if(v_elapsedTime < 5.0) { + setverdict(fail, __SCOPE__ & ": Notifications sent before SCHEDULE_TIME is reached"); + } else { + setverdict(pass, __SCOPE__ & ": Notifications sent on scheduled time"); + } + } + } + [] mcaPortIn.receive(mw_request(mw_notifyNotification(?))) -> value vc_request { + tc_ac.stop; + setverdict(fail, __SCOPE__ & ":ERROR: Notification received but the content doesn't match"); + } [] tc_ac.timeout { setverdict(fail, __SCOPE__ & ": No answer while updating scheduling resource "); } @@ -769,7 +888,7 @@ module OneM2M_Testcases_CSE_Release_4 { f_cse_postamble_deleteResources(); // Tear down - f_cf01Down(); + f_cf01Down();*/ } // f_CSE_SCH_003 }//end group Schedule_functionality