From 785fd0c0e88e735d7ceec2b27d68357ec245f07f Mon Sep 17 00:00:00 2001 From: acverdugo <acverdugo@at4wireless.com> Date: Fri, 8 Jun 2018 15:39:29 +0200 Subject: [PATCH] Updated f_check_notificationContent function for timeSeries New templates: m_missingData, mw_contentTimeSeriesBase Updated Resource_2 type for timeSeries Updated identifier of timeSeries testcases New testcases: TC_CSE_TS_003, TC_CSE_TS_004 Signed-off-by: acverdugo <acverdugo@at4wireless.com> --- LibOneM2M/OneM2M_Functions.ttcn | 9 ++ LibOneM2M/OneM2M_Templates.ttcn | 44 +++++++ LibOneM2M/OneM2M_Types.ttcn | 3 +- OneM2M_Testcases_CSE_Release_2.ttcn | 190 ++++++++++++++++++++++++++-- 4 files changed, 237 insertions(+), 9 deletions(-) diff --git a/LibOneM2M/OneM2M_Functions.ttcn b/LibOneM2M/OneM2M_Functions.ttcn index b9ab12b..d438580 100644 --- a/LibOneM2M/OneM2M_Functions.ttcn +++ b/LibOneM2M/OneM2M_Functions.ttcn @@ -1670,6 +1670,15 @@ module OneM2M_Functions { v_matchResult := match(p_requestPrimitive.primitiveContent.notification.notificationEvent.representation.responsePrimitive.primitiveContent.container, p_primitiveContent.container) } } + + if (ischosen(p_primitiveContent.timeSeries)){ + if(isvalue(p_requestPrimitive.primitiveContent.notification.notificationEvent.representation.resource.timeSeries)) { + v_matchResult := match(p_requestPrimitive.primitiveContent.notification.notificationEvent.representation.resource.timeSeries, p_primitiveContent.timeSeries) + } + else if(isvalue(p_requestPrimitive.primitiveContent.notification.notificationEvent.representation.responsePrimitive.primitiveContent.timeSeries)) { + v_matchResult := match(p_requestPrimitive.primitiveContent.notification.notificationEvent.representation.responsePrimitive.primitiveContent.timeSeries, p_primitiveContent.timeSeries) + } + } return v_matchResult; diff --git a/LibOneM2M/OneM2M_Templates.ttcn b/LibOneM2M/OneM2M_Templates.ttcn index 53bc07e..70456dc 100644 --- a/LibOneM2M/OneM2M_Templates.ttcn +++ b/LibOneM2M/OneM2M_Templates.ttcn @@ -2505,6 +2505,11 @@ module OneM2M_Templates { sequenceNr := omit,//O contentSize := omit//NP }; + + template (value) MissingData m_missingData( in XSD.NonNegativeInteger p_number, in XSD.Duration p_duration) := { + number := p_number, + duration := p_duration + }; }//end group ContentCreate @@ -3904,6 +3909,45 @@ module OneM2M_Templates { template CSEBase_optional mw_contentCSEBase_rc1 modifies mw_contentCSEBaseBase := { choice := omit //O } + + template TimeSeries_optional mw_contentTimeSeriesBase := { + resourceName := ?,//M + resourceType := ?,//M + resourceID := ?,//M + parentID := ?,//M + creationTime := ?,//M + lastModifiedTime := ?,//M + labels := *,//O + accessControlPolicyIDs := *,//O + expirationTime := ?,//M + dynamicAuthorizationConsultationIDs := *,//O + announceTo := *,//O + announcedAttribute := *,//O + stateTag := ?,//M + creator := ?,//M + maxNrOfInstances := *,//O + maxByteSize := *,//O + maxInstanceAge := *,//O + currentNrOfInstances := ?,//M + currentByteSize := ?,//M + periodicInterval := *,//O + missingDataDetect := *,//O + missingDataMaxNr := *,//O + missingDataList := *,//O + missingDataCurrentNr := *,//O + missingDataDetectTimer := *,//O + ontologyRef := *,//O + choice := *//O + }; + + template TimeSeries_optional mw_contentTimeSeries(in template MissingDataList p_missingDataList := *, in template XSD.NonNegativeInteger p_missingDataCurrentNr := *) modifies mw_contentTimeSeriesBase := { + missingDataList := p_missingDataList, + missingDataCurrentNr := p_missingDataCurrentNr + } + + template TimeSeries_optional mw_contentTimeSeries_rc1 modifies mw_contentTimeSeriesBase := { + choice := omit //O + } }//end group responseContent diff --git a/LibOneM2M/OneM2M_Types.ttcn b/LibOneM2M/OneM2M_Types.ttcn index 33d3f4b..f69c6f6 100644 --- a/LibOneM2M/OneM2M_Types.ttcn +++ b/LibOneM2M/OneM2M_Types.ttcn @@ -8646,7 +8646,8 @@ group OtherTypes { StatsCollect_optional statsCollect, M2mServiceSubscriptionProfile_optional m2mServiceSubscriptionProfile, ServiceSubscribedAppRule_optional serviceSubscribedAppRule, - Subscription_optional subscription + Subscription_optional subscription, + TimeSeries_optional timeSeries } with { variant "untagged"; diff --git a/OneM2M_Testcases_CSE_Release_2.ttcn b/OneM2M_Testcases_CSE_Release_2.ttcn index 8b20012..22e2eae 100644 --- a/OneM2M_Testcases_CSE_Release_2.ttcn +++ b/OneM2M_Testcases_CSE_Release_2.ttcn @@ -7205,17 +7205,17 @@ module OneM2M_Testcases_CSE_Release_2 { * @desc Check that the IUT inserts the dataGenerationTime informantion of a missing data point and increases the missingDataCurrentNr attribute when a missing data point is detected * */ - testcase TC_CSE_DMR_TS_001() runs on Tester system CseSystem { + testcase TC_CSE_TS_001() runs on Tester system CseSystem { var AeSimu v_ae1 := AeSimu.create("AE1") alive; - v_ae1.start(f_CSE_DMR_TS_001()); + v_ae1.start(f_CSE_TS_001()); v_ae1.done; } - function f_CSE_DMR_TS_001() runs on AeSimu return ResponsePrimitive { + function f_CSE_TS_001() runs on AeSimu return ResponsePrimitive { // Local variables var MsgIn v_response; @@ -7284,17 +7284,17 @@ module OneM2M_Testcases_CSE_Release_2 { * @desc Check that the IUT removes the oldest element in MissingDataList when MissingDataCurrentNr reaches MissingDataMaxNr to enable insertion of a new missing data point * */ - testcase TC_CSE_DMR_TS_002() runs on Tester system CseSystem { + testcase TC_CSE_TS_002() runs on Tester system CseSystem { var AeSimu v_ae1 := AeSimu.create("AE1") alive; - v_ae1.start(f_CSE_DMR_TS_002()); + v_ae1.start(f_CSE_TS_002()); v_ae1.done; } - function f_CSE_DMR_TS_002() runs on AeSimu return ResponsePrimitive { + function f_CSE_TS_002() runs on AeSimu return ResponsePrimitive { // Local variables var MsgIn v_response; @@ -7418,11 +7418,185 @@ module OneM2M_Testcases_CSE_Release_2 { return vc_response.primitive.responsePrimitive; }//end f_CSE_DMR_TS_002 + + /** + * @desc Check that the IUT sends a notification with missing data points information when the number of missing data points detected becomes equal to the minimum specified missing number of the Time Series Data specified in missingData condition of the subscription resource + * + */ + testcase TC_CSE_TS_003() runs on Tester system CseSystem { + + var AeSimu v_ae1 := AeSimu.create("AE1") alive; + + v_ae1.start(f_CSE_TS_003()); + + v_ae1.done; + + } + + function f_CSE_TS_003() runs on AeSimu { + // Local variables + var integer v_aeIndex := -1; + var integer v_timeSeriesIndex := -1; + var integer v_subscriptionIndex := -1; + var EventNotificationCriteria v_eventNotificationCriteria := valueof(m_eventNotificationCriteria({int1}, -)); + var template RequestPrimitive v_createRequest := omit; + var RequestPrimitive v_request; + var integer v_ae2Index := -1; + var XSD.NonNegativeInteger v_missingDataPointNumber := 1; + var template PrimitiveContent v_contentNotification := {timeSeries := mw_contentTimeSeries(?,v_missingDataPointNumber)}; + + v_eventNotificationCriteria.missingData := valueof(m_missingData(v_missingDataPointNumber, "1000")); + + // Test control + + // Test component configuration + f_cf01Up(true); + + // Test adapter configuration + + // Preamble + v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi); + + v_timeSeriesIndex := f_cse_createResource(int29, m_createTimeSeries(-, true, 5, -, 2000), v_aeIndex);//TimeSeries + + f_cse_preamble_subscriptionVerification(v_ae2Index, v_createRequest, int23);//AE2 registered + + v_createRequest := m_createSubscriptionAdvanced(f_getResourceAddress(v_timeSeriesIndex), -, {f_getResourceAddress(v_aeIndex)}, v_eventNotificationCriteria, omit, omit, omit, omit, omit, omit); + + v_subscriptionIndex := f_cse_createResource(int23, v_createRequest, v_timeSeriesIndex);//Subscription under TimeSeries + + if(vc_ae2.running) { + vc_ae2.stop; + }; + + // Test Body + + //Create data points and force a missingDataPoint + vc_ae2.start(f_cse_generateMissingDataPoint(v_timeSeriesIndex)); + vc_ae2.done; + + f_cse_notifyProcedure_representationHandler(v_contentNotification); + + //Postamble + f_cse_postamble_deleteResources(); + + //Tear down + f_cf01Down(); + + } // end f_CSE_TS_003 + + /** + * @desc Check that the IUT does not send notification when the total number of missing data points does not exceed the minimum specified missing number of the Time Series Data specified in missingData condition of the subscription resource during the window duration specified in the same missingData condition + * + */ + testcase TC_CSE_TS_004() runs on Tester system CseSystem { + + var AeSimu v_ae1 := AeSimu.create("AE1") alive; + + v_ae1.start(f_CSE_TS_004()); + + v_ae1.done; + + } + + function f_CSE_TS_004() runs on AeSimu { + // Local variables + var integer v_aeIndex := -1; + var integer v_timeSeriesIndex := -1; + var integer v_subscriptionIndex := -1; + var EventNotificationCriteria v_eventNotificationCriteria := valueof(m_eventNotificationCriteria({int1}, -)); + var template RequestPrimitive v_createRequest := omit; + var ResponsePrimitive v_responsePrimitive; + var integer v_ae2Index := -1; + var XSD.NonNegativeInteger v_missingDataPointNumber := 100; + var template PrimitiveContent v_contentResponse; + + v_eventNotificationCriteria.missingData := valueof(m_missingData(v_missingDataPointNumber, "1000")); + + // Test control + + // Test component configuration + f_cf01Up(true); + + // Test adapter configuration + + // Preamble + v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi); + + v_timeSeriesIndex := f_cse_createResource(int29, m_createTimeSeries(-, true, 5, -, 2000), v_aeIndex);//TimeSeries + + f_cse_preamble_subscriptionVerification(v_ae2Index, v_createRequest, int23);//AE2 registered + + v_createRequest := m_createSubscriptionAdvanced(f_getResourceAddress(v_timeSeriesIndex), -, {f_getResourceAddress(v_aeIndex)}, v_eventNotificationCriteria, omit, omit, omit, omit, omit, omit); + + v_subscriptionIndex := f_cse_createResource(int23, v_createRequest, v_timeSeriesIndex);//Subscription under TimeSeries + + if(vc_ae2.running) { + vc_ae2.stop; + }; + + // Test Body + + //Create data points and force a missingDataPoint + vc_ae2.start(f_cse_generateMissingDataPoint(v_timeSeriesIndex)); + vc_ae2.done; + + tc_ac.start; + alt { + [] mcaPortIn.receive(mw_request(mw_notifyNotification(?))){ + tc_ac.stop; + setverdict(fail, __SCOPE__ & ":ERROR: Notification received"); + //Send response in any case + v_responsePrimitive := valueof(m_responseNotification(int2001, omit)); + v_responsePrimitive.requestIdentifier := vc_request.primitive.requestPrimitive.requestIdentifier; + mcaPortIn.send(m_response(v_responsePrimitive)); + } + [] tc_ac.timeout { + setverdict(pass, __SCOPE__ & ": Notification not received"); + } + } + + //Check if the IUT restarts missing data point counter and timer + mcaPort.send(m_request(m_retrieve(f_getResourceAddress(v_timeSeriesIndex), f_getOriginator(v_timeSeriesIndex)))); + + v_contentResponse.timeSeries := mw_contentTimeSeries_rc1; + v_contentResponse.timeSeries.missingDataCurrentNr := 0; + + tc_ac.start; + alt { + [] mcaPort.receive(mw_response(mw_responsePrimitive(int2000, v_contentResponse))){ + tc_ac.stop; + setverdict(pass, __SCOPE__ & ": Response OK for retrieving. MissingDataCurrentNr has been restarted"); + } + [] mcaPort.receive(mw_response(mw_responsePrimitiveOK(v_contentResponse))){ + tc_ac.stop; + setverdict(fail, __SCOPE__ & ": Wrong response status code"); + } + [] mcaPort.receive(mw_response(mw_responsePrimitiveOK)){ + tc_ac.stop; + setverdict(fail, __SCOPE__ & ": Error, resource elements provided not matching expected resource elements"); + } + [] mcaPort.receive(mw_response(mw_responsePrimitiveKO)){ + tc_ac.stop; + setverdict(fail, __SCOPE__ & ": Error while retrieving resource"); + } + [] tc_ac.timeout { + setverdict(fail, __SCOPE__ & ": No answer while retrieving resource"); + } + } + + //Postamble + f_cse_postamble_deleteResources(); + + //Tear down + f_cf01Down(); + + } // end f_CSE_TS_004 + }//end group timeSeries }//end group dataManagement }//end group CSE - - + } -- GitLab