diff --git a/LibOneM2M/OneM2M_Functions.ttcn b/LibOneM2M/OneM2M_Functions.ttcn index 703a132a9646bf192b194d867a4386d31583f2cf..43b9f9fd087f420df57cf9f45ab50088191acfb4 100644 --- a/LibOneM2M/OneM2M_Functions.ttcn +++ b/LibOneM2M/OneM2M_Functions.ttcn @@ -7,7 +7,7 @@ * * @author ETSI * @version $URL: https://forge.etsi.org/svn/oneM2M/trunk/ttcn/LibOneM2M/OneM2M_Functions.ttcn $ - * $Id: OneM2M_Functions.ttcn 155 2016-10-28 12:08:48Z reinaortega $ + * $Id: OneM2M_Functions.ttcn 163 2016-11-10 08:50:50Z carres $ * @desc Module containing functions for oneM2M * */ @@ -181,6 +181,18 @@ module OneM2M_Functions { return v_serviceSubscribedAppRuleIndex; } + + function f_cse_preamble_subscriptionVerification(out CseTester p_notifyHandler,in integer p_aeIndex, inout integer p_ae2Index, inout template RequestPrimitive p_createRequestPrimitive,in ResourceType p_resourceType ) runs on CseTester { + if(p_resourceType == int23){ + p_notifyHandler := CseTester.create("NotifyHandler") alive; + p_ae2Index := f_cse_createResource(int2, m_createAe(PX_APP_ID, -, PX_AE_ID_STEM, "MyAe2", {"http://" & PX_TESTER_ADDRESS & "/"}), -1); // AE2 is registred + vc_resourcesIndexToBeDeleted := vc_resourcesIndexToBeDeleted & {p_ae2Index}; + if(ischosen(p_createRequestPrimitive.primitiveContent.any_1[0].Subscription_optional)){ //this condition is necessary for Subscription TCs where notification URI is set in m_createSubscriptionAdvanced + p_createRequestPrimitive.primitiveContent.any_1[0].Subscription_optional.notificationURI := {f_getResourceAddress(p_ae2Index)}; + } + p_notifyHandler.start(f_subscription_Handler(f_getResourceAddress(p_aeIndex))); + } + } }//end group preambleFunctions @@ -205,8 +217,8 @@ module OneM2M_Functions { v_request := valueof(m_deleteRequest(v_resourceAddress)); if(PX_FROM_IS_AE_ID){ - if(not(ischosen(vc_resourcesList[vc_resourcesIndexToBeDeleted[i]].resource.any_1[0].AccessControlPolicy_optional))) { - v_request.from_ := vc_aeAux.aE_ID; + if(ischosen(vc_resourcesList[vc_resourcesIndexToBeDeleted[i]].resource.any_1[0].AE_optional)) { + v_request.from_ := vc_resourcesList[vc_resourcesIndexToBeDeleted[i]].resource.any_1[0].AE_optional.aE_ID; } } mcaPort.send(m_request(v_request)); @@ -457,7 +469,8 @@ module OneM2M_Functions { */ function f_getCreateRequestPrimitive(in ResourceType p_resourceType, template RequestPrimitive p_request := m_create, integer p_parentIndex) runs on CseTester return RequestPrimitive { var integer p_locresourceIndex := p_parentIndex; - + var template ListOfURIs v_notificationURI := {"Not Initialized"}; + p_request.from_ := f_getOriginator(p_parentIndex); p_request.to_ := f_getResourceAddress(p_parentIndex); @@ -476,16 +489,19 @@ module OneM2M_Functions { } if (p_resourceType == int15) {//pollingChannel - p_request.from_ := vc_aeAux.aE_ID; + if(ischosen(vc_resourcesList[p_parentIndex].resource.any_1[0].AE_optional)) { + p_request.from_ := vc_resourcesList[p_parentIndex].resource.any_1[0].AE_optional.aE_ID; + } } if (p_resourceType == int18) {//schedule } if (p_resourceType == int23) {//subscription - p_request.primitiveContent.any_1[0].Subscription_optional.notificationURI := {f_getResourceAddress(p_parentIndex)}; - - /*if(PX_FROM_IS_AE_ID) { + if(match(valueof(p_request.primitiveContent.any_1[0].Subscription_optional.notificationURI), v_notificationURI )){ + p_request.primitiveContent.any_1[0].Subscription_optional.notificationURI := {f_getResourceAddress(p_parentIndex)}; + } + /*if(PX_FROM_IS_AE_ID) { if(PX_UNSTRUCTURED){ p_request.primitiveContent.any_1[0].Subscription_optional.notificationURI := {vc_aeAux.aE_ID}; } else { @@ -798,13 +814,173 @@ module OneM2M_Functions { }//end of commonFunctions + group Sylvain { + function f_subscription_Handler(in XSD.ID p_creator, in ResponseStatusCode v_responseStatusCode := int2001) runs on CseTester { + // Local variables + var MsgIn v_response; + var ResponsePrimitive v_responsePrimitive; + var template Notification v_notificationRequest := mw_contentNotificationBase; + var PrimitiveContent v_notificationResponse; // TODO Need to see if this parameter is required however there is a problem if it s omitted during the verification + + map(self:mcaPort, system:mcaPort); + map(self:acPort, system:acPort); + + v_notificationResponse.any_1 := {{Notification := valueof(mw_contentNotificationAllOmit)}}; + + v_notificationRequest.verificationRequest := true; + v_notificationRequest.creator := p_creator; + //v_notificationRequest.subscriptionReference := "I Don't know which URI is expected"; // TODO mandatory parameter + v_responsePrimitive := valueof(m_responseNotification(v_responseStatusCode,v_notificationResponse));//TODO No PrimitiveContent is expected + + if(v_responseStatusCode != int2001){ + v_responsePrimitive.primitiveContent := omit; + } + + tc_ac.start; + alt { + [] mcaPort.receive(mw_request(mw_notify(v_notificationRequest))) -> value v_response { + tc_ac.stop; + setverdict(pass, testcasename() & ": Notification received"); + //mcaPort.send(m_response(p_responsePrimitive)); + } + [] mcaPort.receive(mw_request(mw_notify(mw_contentNotification(?)))) -> value v_response { + tc_ac.stop; + setverdict(fail, testcasename() & ": Notification received but verificationRequest isn't set to TRUE"); + } + [] mcaPort.receive{ + tc_ac.stop; + setverdict(fail, testcasename() & ": Error, unexpected message received"); + } + [] tc_ac.timeout { + setverdict(inconc, testcasename() & ": No notification received"); + } + } + + mcaPort.send(m_response(v_responsePrimitive)); // TODO have to be deleted + + unmap(self:mcaPort, system:mcaPort); + unmap(self:acPort, system:acPort); + + } //end f_subscription_Handler + + function f_match_contentNotificationRequest(in RequestPrimitive p_requestPrimitive, template PrimitiveContent p_primitiveContent) runs on CseTester return boolean{ + // Local variables + var boolean v_matchResult := false; + var integer i; + var integer v_numberOfAggregatedNotification; + + if (ischosen(p_primitiveContent.any_1[0].AE_optional)){ + if(ischosen(p_requestPrimitive.primitiveContent.any_1[0].Notification.notificationEvent.representation.resource)) { + v_matchResult := match(p_requestPrimitive.primitiveContent.any_1[0].Notification.notificationEvent.representation.resource.AE_optional, p_primitiveContent.any_1[0].AE_optional) + } + else if(ischosen(p_requestPrimitive.primitiveContent.any_1[0].Notification.notificationEvent.representation.responsePrimitive)) { + v_matchResult :=match(p_requestPrimitive.primitiveContent.any_1[0].Notification.notificationEvent.representation.responsePrimitive.primitiveContent.any_1[0].AE_optional, p_primitiveContent.any_1[0].AE_optional) + } + else if (ischosen(p_requestPrimitive.primitiveContent.any_1[0].AggregatedNotification)) { + v_matchResult := true; + v_numberOfAggregatedNotification := lengthof(p_requestPrimitive.primitiveContent.any_1[0].AggregatedNotification.notification_list); + for(i := 0; i< v_numberOfAggregatedNotification; i := i + 1){ + if(ischosen(p_requestPrimitive.primitiveContent.any_1[0].AggregatedNotification.notification_list[i].notificationEvent.representation.resource)) { + if(not (match(p_requestPrimitive.primitiveContent.any_1[0].AggregatedNotification.notification_list[i].notificationEvent.representation.resource.AE_optional, p_primitiveContent.any_1[0].AE_optional))){ + v_matchResult := false; + } + } + else if(ischosen(p_requestPrimitive.primitiveContent.any_1[0].AggregatedNotification.notification_list[i].notificationEvent.representation.responsePrimitive)) { + if(not (match(p_requestPrimitive.primitiveContent.any_1[0].AggregatedNotification.notification_list[i].notificationEvent.representation.responsePrimitive.primitiveContent.any_1[0].AE_optional, p_primitiveContent.any_1[0].AE_optional))){ + v_matchResult := false; + } + } + } + if (i == 0){ + v_matchResult := false; + } + } + } + if (ischosen(p_primitiveContent.any_1[0].Container_optional)){ + if(ischosen(p_requestPrimitive.primitiveContent.any_1[0].Notification.notificationEvent.representation.resource)) { + v_matchResult := match(p_requestPrimitive.primitiveContent.any_1[0].Notification.notificationEvent.representation.resource.Container_optional, p_primitiveContent.any_1[0].Container_optional) + } + else if(ischosen(p_requestPrimitive.primitiveContent.any_1[0].Notification.notificationEvent.representation.responsePrimitive)) { + v_matchResult := match(p_requestPrimitive.primitiveContent.any_1[0].Notification.notificationEvent.representation.responsePrimitive.primitiveContent.any_1[0].Container_optional, p_primitiveContent.any_1[0].Container_optional) + } + } + + return v_matchResult; + } //end f_match_contentNotificationRequest + function f_update_attribute_request(in RequestPrimitive p_requestPrimitive) runs on CseTester { + var MsgIn v_response; + mcaPort.send(m_request(p_requestPrimitive)); + tc_ac.start; + alt { + [] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response { + tc_ac.stop; + setverdict(pass, testcasename() & ": Attribute of resource type int2 (Ae) updated successfuly"); + } + [] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value v_response { + tc_ac.stop; + setverdict(fail, testcasename() & ": Error while updating resource type int2 (Ae)"); + } + [] mcaPort.receive{ + tc_ac.stop; + setverdict(fail, testcasename() & ": Error, unexpected message received"); + } + [] tc_ac.timeout { + setverdict(inconc, testcasename() & ": No answer while updating resource type int2 (Ae) or None notification received"); + } + } + }// end f_update_attribute_request + function f_match_notification_primitive(template PrimitiveContent p_primitiveContent) runs on CseTester { + // Local variables + var MsgIn v_response; + + map(self:mcaPort, system:mcaPort); + map(self:acPort, system:acPort); + + tc_ac.start; + alt { + [] mcaPort.receive(mw_request(mw_notify(mw_contentNotification(?)))) -> value v_response { + tc_ac.stop; + if(f_match_contentNotificationRequest(v_response.primitive.requestPrimitive, p_primitiveContent)){ + setverdict(pass, testcasename() & ": Notification received"); + } + else{ + setverdict(fail, testcasename() & ": Notification received but the content doesn't match"); + } + } + [] mcaPort.receive{ + tc_ac.stop; + setverdict(fail, testcasename() & ": Error, unexpected message received"); + } + [] tc_ac.timeout { + setverdict(inconc, testcasename() & ": No notification received"); + } + } + + mcaPort.send(m_response(valueof(m_responseNotification(int2001)))); + + unmap(self:mcaPort, system:mcaPort); + unmap(self:acPort, system:acPort); + + } //end f_match_notification_primitive + function f_is_component_done(in CseTester p_notifyHandler) runs on CseTester { + tc_ac.start(10.0); + alt { + [] p_notifyHandler.done { + tc_ac.stop; + } + [] tc_ac.timeout { + setverdict(inconc, testcasename() & ": No answer while updating resource type int2 (Ae)"); + } + } + } //end f_is_component_done + } diff --git a/LibOneM2M/OneM2M_Pixits.ttcn b/LibOneM2M/OneM2M_Pixits.ttcn index 2d29c929ac4560fbefea03de5498ac39868a3b8a..3bea34c143fd741f8a0e230619d2930ee6a45f63 100644 --- a/LibOneM2M/OneM2M_Pixits.ttcn +++ b/LibOneM2M/OneM2M_Pixits.ttcn @@ -7,7 +7,7 @@ * * @author ETSI * @version $URL: https://forge.etsi.org/svn/oneM2M/trunk/ttcn/LibOneM2M/OneM2M_Pixits.ttcn $ - * $Id: OneM2M_Pixits.ttcn 155 2016-10-28 12:08:48Z reinaortega $ + * $Id: OneM2M_Pixits.ttcn 156 2016-11-02 13:35:44Z carres $ * @desc Module containing Pixits for oneM2M * */ @@ -26,7 +26,7 @@ module OneM2M_Pixits { modulepar charstring PX_SUT_ADDRESS := "127.0.0.1:8080"; - modulepar charstring PX_TESTER_ADDRESS := "127.0.0.1:1400"; + modulepar charstring PX_TESTER_ADDRESS := "127.0.0.1:3131"; modulepar charstring PX_XML_NAMESPACE := "om2m=""http://www.onem2m.org/xml/protocols"""; diff --git a/LibOneM2M/OneM2M_Templates.ttcn b/LibOneM2M/OneM2M_Templates.ttcn index 477c79ec9945e391f8dc1db0ccf72423a8daa78f..87522339f66574487b9054f388dc34ca9685b34d 100644 --- a/LibOneM2M/OneM2M_Templates.ttcn +++ b/LibOneM2M/OneM2M_Templates.ttcn @@ -7,7 +7,7 @@ * * @author ETSI * @version $URL: https://forge.etsi.org/svn/oneM2M/trunk/ttcn/LibOneM2M/OneM2M_Templates.ttcn $ - * $Id: OneM2M_Templates.ttcn 155 2016-10-28 12:08:48Z reinaortega $ + * $Id: OneM2M_Templates.ttcn 162 2016-11-09 09:09:44Z carres $ * @desc Module containing templates for oneM2M * */ @@ -116,7 +116,7 @@ module OneM2M_Templates { * @param p_targetResourceAddress Target resource address * @param p_originator Originator (from) */ - template (value) RequestPrimitive m_retrieveResource(XSD.ID p_targetResourceAddress, in XSD.ID p_originator := PX_AE_ID_STEM) := { + template (value) RequestPrimitive m_retrieveResource(XSD.ID p_targetResourceAddress, in XSD.ID p_originator) := { operation := int2, to_ := p_targetResourceAddress, from_ := p_originator, @@ -147,7 +147,7 @@ module OneM2M_Templates { * @param p_targetResourceAddress Target resource address (including "#AttributeName") * @param p_originator Originator (from) */ - template (value) RequestPrimitive m_retrieveResourceAttributeToOption(XSD.ID p_targetResourceAddress, in XSD.ID p_originator := PX_AE_ID_STEM) := { + template (value) RequestPrimitive m_retrieveResourceAttributeToOption(XSD.ID p_targetResourceAddress, in XSD.ID p_originator) := { operation := int2, to_ := p_targetResourceAddress, from_ := p_originator, @@ -179,7 +179,7 @@ module OneM2M_Templates { * @param p_attributeList Target attribute list * @param p_originator Originator (from) */ - template (value) RequestPrimitive m_retrieveResourceAttributeContentOption(XSD.ID p_targetResourceAddress, in template (value) AttributeList_1 p_attributeList, in XSD.ID p_originator := PX_AE_ID_STEM ) := { + template (value) RequestPrimitive m_retrieveResourceAttributeContentOption(XSD.ID p_targetResourceAddress, in template (value) AttributeList_1 p_attributeList, in XSD.ID p_originator) := { operation := int2, to_ := p_targetResourceAddress, from_ := p_originator, @@ -736,13 +736,8 @@ module OneM2M_Templates { /** * @desc Base NOTIFY request primitive */ - template RequestPrimitive mw_notify(in template Representation p_representation) modifies mw_notifyBase := { - primitiveContent := { - any_1 := {{ Notification := mw_contentNotification(p_representation) }} - } - }; - template RequestPrimitive mw_notify_2(in template Notification p_notification) modifies mw_notifyBase := { + template RequestPrimitive mw_notify(in template Notification p_notification) modifies mw_notifyBase := { primitiveContent := { any_1 := {{ Notification := p_notification}} } @@ -1909,10 +1904,7 @@ module OneM2M_Templates { template Notification mw_contentNotification (in template Representation p_representation) modifies mw_contentNotificationBase := { notificationEvent := { representation := p_representation, - operationMonitor := { - operation := ?, - originator:= ? - }, + operationMonitor := *, notificationEventType := ? } }; @@ -2085,10 +2077,10 @@ module OneM2M_Templates { group Notify{ - template ResponsePrimitive m_responseNotification(ResponseStatusCode p_statusCode, in template(omit) Notification p_notification := omit) := { + template ResponsePrimitive m_responseNotification(ResponseStatusCode p_statusCode, in template(omit) PrimitiveContent p_notification := omit) := { responseStatusCode := p_statusCode, requestIdentifier := "m_responseNotification" & f_rnd(1, 1000000), - primitiveContent := {any_1 := {{Notification := p_notification}}}, + primitiveContent := p_notification, to_ := omit, from_ := omit, originatingTimestamp := omit, diff --git a/OneM2M_TestControl.ttcn b/OneM2M_TestControl.ttcn index 14a4aa85dac1f059c1a915a1bf36d8f968c2ca41..a24a8752b83f78c1e9aebdec4a3ddd2cd5088242 100644 --- a/OneM2M_TestControl.ttcn +++ b/OneM2M_TestControl.ttcn @@ -7,7 +7,7 @@ * * @author ETSI * @version $URL: https://forge.etsi.org/svn/oneM2M/trunk/ttcn/OneM2M_TestControl.ttcn $ - * $Id: OneM2M_TestControl.ttcn 97 2016-06-01 15:38:10Z reinaortega $ + * $Id: OneM2M_TestControl.ttcn 162 2016-11-09 09:09:44Z carres $ * @desc Test control module for oneM2M * */ @@ -17,7 +17,6 @@ module OneM2M_TestControl { import from OneM2M_Testcases all; control { - } } // end of module diff --git a/OneM2M_Testcases.ttcn b/OneM2M_Testcases.ttcn index c4410a88eb00d41c98790210cf515e0ef92179e7..3a0e6a781742a6117ad9892141fb172f535af9b5 100644 --- a/OneM2M_Testcases.ttcn +++ b/OneM2M_Testcases.ttcn @@ -7,7 +7,7 @@ * * @author ETSI * @version $URL: https://forge.etsi.org/svn/oneM2M/trunk/ttcn/OneM2M_Testcases.ttcn $ - * $Id: OneM2M_Testcases.ttcn 155 2016-10-28 12:08:48Z reinaortega $ + * $Id: OneM2M_Testcases.ttcn 163 2016-11-10 08:50:50Z carres $ * @desc Module containing test cases for oneM2M * */ @@ -384,7 +384,7 @@ module OneM2M_Testcases { v_resourceIndex := f_cse_createResource(p_resourceType, p_requestPrimitive, v_aeIndex); // Test Body - v_request := valueof(m_retrieveResource(f_getResourceAddress(v_resourceIndex))); + v_request := valueof(m_retrieveResource(f_getResourceAddress(v_resourceIndex), f_getOriginator(v_resourceIndex))); v_request.resultContent := int0;//Nothing mcaPort.send(m_request(v_request)); tc_ac.start; @@ -494,7 +494,7 @@ module OneM2M_Testcases { v_resourceIndex := f_cse_createResource(p_resourceType, p_requestPrimitive, v_aeIndex); // Test Body - v_request := valueof(m_retrieveResource(f_getResourceAddress(v_resourceIndex))); + v_request := valueof(m_retrieveResource(f_getResourceAddress(v_resourceIndex), f_getOriginator(v_resourceIndex))); v_request.resultContent := int1;//Attributes mcaPort.send(m_request(v_request)); tc_ac.start; @@ -604,7 +604,7 @@ module OneM2M_Testcases { v_resourceIndex := f_cse_createResource(p_resourceType, p_requestPrimitive, v_aeIndex); // Test Body - v_request := valueof(m_retrieveResource(f_getResourceAddress(v_resourceIndex))); + v_request := valueof(m_retrieveResource(f_getResourceAddress(v_resourceIndex), f_getOriginator(v_resourceIndex))); v_request.resultContent := int2;//Attributes mcaPort.send(m_request(v_request)); tc_ac.start; @@ -714,7 +714,7 @@ module OneM2M_Testcases { v_resourceIndex := f_cse_createResource(p_resourceType, p_requestPrimitive, v_aeIndex); // Test Body - v_request := valueof(m_retrieveResource(f_getResourceAddress(v_resourceIndex))); + v_request := valueof(m_retrieveResource(f_getResourceAddress(v_resourceIndex), f_getOriginator(v_resourceIndex))); v_request.resultContent := int3;//Hierarchical address and attributes mcaPort.send(m_request(v_request)); tc_ac.start; @@ -824,7 +824,7 @@ module OneM2M_Testcases { v_resourceIndex := f_cse_createResource(p_resourceType, p_requestPrimitive, v_aeIndex); // Test Body - v_request := valueof(m_retrieveResource(f_getResourceAddress(v_resourceIndex))); + v_request := valueof(m_retrieveResource(f_getResourceAddress(v_resourceIndex), f_getOriginator(v_resourceIndex))); v_request.resultContent := int1;//Attributes mcaPort.send(m_request(v_request)); tc_ac.start; @@ -934,7 +934,7 @@ module OneM2M_Testcases { v_resourceIndex := f_cse_createResource(p_resourceType, p_requestPrimitive, v_aeIndex); // Test Body - v_request := valueof(m_retrieveResource(f_getResourceAddress(v_resourceIndex))); + v_request := valueof(m_retrieveResource(f_getResourceAddress(v_resourceIndex), f_getOriginator(v_resourceIndex))); v_request.resultContent := int1;//Attributes mcaPort.send(m_request(v_request)); tc_ac.start; @@ -1044,7 +1044,7 @@ module OneM2M_Testcases { v_resourceIndex := f_cse_createResource(p_resourceType, p_requestPrimitive, v_aeIndex); // Test Body - v_request := valueof(m_retrieveResource(f_getResourceAddress(v_resourceIndex))); + v_request := valueof(m_retrieveResource(f_getResourceAddress(v_resourceIndex), f_getOriginator(v_resourceIndex))); v_request.resultContent := int1;//Attributes mcaPort.send(m_request(v_request)); tc_ac.start; @@ -1087,18 +1087,19 @@ module OneM2M_Testcases { var integer v_sizeResourceTypeList; var integer i; var RequestPrimitiveMatrix v_requestPrimitivematrix; + var CseTester v_notifyHandler; v_requestPrimitivematrix := { {}, - {m_createAeAux(omit,omit)}, - {m_createContainerBase} + {valueof(m_createAeAux(omit,omit))}, + {valueof(m_createContainerBase)} } v_sizeResourceTypeList := lengthof(v_requestPrimitivematrix); v_createRequest.primitiveContent.any_1[0].Container_optional.resourceName := omit; for (i := 0; i<v_sizeResourceTypeList; i := i+1){ - v_responsePrimitive := f_CSE_DMR_CRE_BV_001(int3, v_createRequest, v_requestPrimitivematrix[i]); + v_responsePrimitive := f_CSE_DMR_CRE_BV_001(int3, v_createRequest, v_requestPrimitivematrix[i], v_notifyHandler); log(v_responsePrimitive); if(getverdict == pass){ if(not ispresent(v_responsePrimitive.primitiveContent.any_1[0].Container_optional.resourceName)){ @@ -1115,18 +1116,19 @@ module OneM2M_Testcases { var RequestPrimitiveMatrix v_requestPrimitivematrix; var integer v_sizeResourceTypeList; var integer i; + var CseTester v_notifyHandler; //CSEBase int5, remoteCSE int16, AE int2 v_requestPrimitivematrix := { {}, - {m_createAeAux(omit,omit)} + {valueof(m_createAeAux(omit,omit))} } - v_sizeResourceTypeList := sizeof(v_requestPrimitivematrix); + v_sizeResourceTypeList := lengthof(v_requestPrimitivematrix); v_createRequest.primitiveContent.any_1[0].Group_optional.resourceName := omit; for (i := 0; i<v_sizeResourceTypeList; i := i+1){ - v_responsePrimitive := f_CSE_DMR_CRE_BV_001(int3, v_createRequest, v_requestPrimitivematrix[i]); + v_responsePrimitive := f_CSE_DMR_CRE_BV_001(int3, v_createRequest, v_requestPrimitivematrix[i],v_notifyHandler); log(v_responsePrimitive); if(getverdict == pass){ if(not ispresent(v_responsePrimitive.primitiveContent.any_1[0].Group_optional.resourceName)){ @@ -1143,18 +1145,19 @@ module OneM2M_Testcases { var integer v_sizeResourceTypeList; var integer i; var RequestPrimitiveMatrix v_requestPrimitivematrix; + var CseTester v_notifyHandler; //CSEBase int5, remoteCSE int16, AE int2 v_requestPrimitivematrix := { {}, - {m_createAeAux(omit,omit)} + {valueof(m_createAeAux(omit,omit))} } v_sizeResourceTypeList := lengthof(v_requestPrimitivematrix); v_createRequest.primitiveContent.any_1[0].AccessControlPolicy_optional.resourceName := omit; for (i := 0; i<v_sizeResourceTypeList; i := i+1){ - v_responsePrimitive := f_CSE_DMR_CRE_BV_001(int1, v_createRequest, v_requestPrimitivematrix[i]);//AccessControlPolicy + v_responsePrimitive := f_CSE_DMR_CRE_BV_001(int1, v_createRequest, v_requestPrimitivematrix[i], v_notifyHandler);//AccessControlPolicy if(getverdict == pass){ if(not ispresent(v_responsePrimitive.primitiveContent.any_1[0].AccessControlPolicy_optional.resourceName)){ setverdict(fail, testcasename(), ": Error, resourceName attribute not provided"); @@ -1170,19 +1173,20 @@ module OneM2M_Testcases { var integer v_sizeResourceTypeList; var integer i; var RequestPrimitiveMatrix v_requestPrimitivematrix; + var CseTester v_notifyHandler := CseTester.create("NotifyHandler") alive; // CSEBase int5, remoteCSE int16, AE int2, subscription int23 v_requestPrimitivematrix := { {}, - {m_createAeAux(omit,omit)}, - {m_createSubscriptionBase} + {valueof(m_createAeAux(omit,omit))}, + {valueof(m_createSubscriptionBase)} } v_sizeResourceTypeList := lengthof(v_requestPrimitivematrix); v_createRequest.primitiveContent.any_1[0].Schedule_optional.resourceName := omit; for (i := 0; i<v_sizeResourceTypeList; i := i+1){ - v_responsePrimitive := f_CSE_DMR_CRE_BV_001(int18, v_createRequest, v_requestPrimitivematrix[i]);//Schedule + v_responsePrimitive := f_CSE_DMR_CRE_BV_001(int18, v_createRequest, v_requestPrimitivematrix[i], v_notifyHandler);//Schedule if(getverdict == pass){ if(not ispresent(v_responsePrimitive.primitiveContent.any_1[0].Schedule_optional.resourceName)){ @@ -1199,17 +1203,18 @@ module OneM2M_Testcases { var integer v_sizeResourceTypeList; var integer i; var RequestPrimitiveMatrix v_requestPrimitivematrix; + var CseTester v_notifyHandler; //remoteCSE int16, AE int2 v_requestPrimitivematrix := { - {m_createAeAux(omit,omit)} + {valueof(m_createAeAux(omit,omit))} } v_sizeResourceTypeList := lengthof(v_requestPrimitivematrix); v_createRequest.primitiveContent.any_1[0].PollingChannel_optional.resourceName := omit; for (i := 0; i<v_sizeResourceTypeList; i := i+1){ - v_responsePrimitive := f_CSE_DMR_CRE_BV_001(int15, v_createRequest, v_requestPrimitivematrix[i]);//PollingChannel + v_responsePrimitive := f_CSE_DMR_CRE_BV_001(int15, v_createRequest, v_requestPrimitivematrix[i], v_notifyHandler);//PollingChannel if(getverdict == pass){ if(not ispresent(v_responsePrimitive.primitiveContent.any_1[0].PollingChannel_optional.resourceName)){ setverdict(fail, testcasename(), ": Error, resourceName attribute not provided"); @@ -1225,6 +1230,7 @@ module OneM2M_Testcases { var integer v_sizeResourceTypeList; var integer i; var RequestPrimitiveMatrix v_requestPrimitivematrix; + var CseTester v_notifyHandler := CseTester.create("NotifyHandler") alive; //accessControlPolicy int1, CSEBase int5, remoteCSE int16, AE int2, container int, schedule int, locationPolicy int, delivery int, request int, group int, mgmtCmd int, // node int, m2mServiceSubscriptionProfile int, statsConfig int, statsCollect int, serviceSubscribedAppRule int @@ -1232,12 +1238,12 @@ module OneM2M_Testcases { // mgmtObj int, execInstance int, serviceSubscribedNode int, pollingChannelURI int (doesn't exist in Release2), eventConfig int, v_requestPrimitivematrix := { {}, - {m_createAeAux(omit,omit)}, - {m_createContainerBase}, - {m_createAcpBase}, - {m_createScheduleBase}, - {m_createGroupBase}, - {m_createLocationPolicy(int1,omit,omit,omit,omit)} + {valueof(m_createAeAux(omit,omit))}, + {valueof(m_createContainerBase)}, + {valueof(m_createAcpBase)}, + {valueof(m_createScheduleBase)}, + {valueof(m_createGroupBase)} + //{m_createLocationPolicy(int1,omit,omit,omit,omit)} //{m_createServiceSubscribedAppRule()} //TODO set correct parameters } v_sizeResourceTypeList := lengthof(v_requestPrimitivematrix); @@ -1245,7 +1251,7 @@ module OneM2M_Testcases { v_createRequest.primitiveContent.any_1[0].Subscription_optional.resourceName := omit; for (i := 0; i<v_sizeResourceTypeList; i := i+1){ - v_responsePrimitive := f_CSE_DMR_CRE_BV_001(int23, v_createRequest, v_requestPrimitivematrix[i]);//Subscription + v_responsePrimitive := f_CSE_DMR_CRE_BV_001(int23, v_createRequest, v_requestPrimitivematrix[i], v_notifyHandler);//Subscription if(getverdict == pass){ if(not ispresent(v_responsePrimitive.primitiveContent.any_1[0].Subscription_optional.resourceName)){ setverdict(fail, testcasename(), ": Error, resourceName attribute not provided"); @@ -1254,7 +1260,7 @@ module OneM2M_Testcases { } } - function f_CSE_DMR_CRE_BV_001(ResourceType p_resourceType, template RequestPrimitive p_requestPrimitive, in RequestPrimitiveList p_requestPrimitiveList) runs on CseTester return ResponsePrimitive { + function f_CSE_DMR_CRE_BV_001(ResourceType p_resourceType, template RequestPrimitive p_requestPrimitive, in RequestPrimitiveList p_requestPrimitiveList, in CseTester p_notifyHandler) runs on CseTester return ResponsePrimitive { // Local variables var MsgIn v_response; @@ -1262,8 +1268,10 @@ module OneM2M_Testcases { var integer v_sizeResourceTypeList := lengthof(p_requestPrimitiveList); var integer i; var integer v_parentIndex := -1; - var integer v_aeAuxIndex := -1; var integer v_resourceIndex := -1; + var CseTester v_notifyHandler; + var integer v_ae2Index := -1; + var PoaList v_poaList := {"http://" & PX_TESTER_ADDRESS & "/"}; // Test control @@ -1273,22 +1281,29 @@ module OneM2M_Testcases { // Test adapter configuration // Preamble - v_aeAuxIndex := f_cse_preamble_registerAe();//c_CRUDNDi); - + for (i := 0; i<v_sizeResourceTypeList; i := i+1){ - if(match(p_requestPrimitiveList[i].resourceType, int2)){ - v_parentIndex := v_aeAuxIndex; + if(match(p_requestPrimitiveList[i].resourceType, int23)){ + v_ae2Index := f_cse_createResource(int2, m_createAe(PX_APP_ID, -, PX_AE_ID_STEM, "MyAe2", v_poaList), -1); // AE2 is registred + vc_resourcesIndexToBeDeleted := vc_resourcesIndexToBeDeleted & {v_ae2Index}; + p_requestPrimitiveList[i].primitiveContent.any_1[0].Subscription_optional.notificationURI := {f_getResourceAddress(v_ae2Index)}; + p_notifyHandler.start(f_subscription_Handler(f_getResourceAddress(v_parentIndex))); } - else{ - v_parentIndex := f_cse_createResource(p_requestPrimitiveList[i].resourceType, p_requestPrimitiveList[i], v_parentIndex); - if (i == 0){ - vc_resourcesIndexToBeDeleted := vc_resourcesIndexToBeDeleted & {v_parentIndex}; - } + v_parentIndex := f_cse_createResource(p_requestPrimitiveList[i].resourceType, p_requestPrimitiveList[i], v_parentIndex); + if (i == 0){ + vc_resourcesIndexToBeDeleted := vc_resourcesIndexToBeDeleted & {v_parentIndex}; } } // Test Body + if(match(p_requestPrimitive.resourceType, int23)){ + v_ae2Index := f_cse_createResource(int2, m_createAe(PX_APP_ID, -, PX_AE_ID_STEM, "MyAe2", v_poaList), -1); // AE2 is registred + vc_resourcesIndexToBeDeleted := vc_resourcesIndexToBeDeleted & {v_ae2Index}; + p_requestPrimitive.primitiveContent.any_1[0].Subscription_optional.notificationURI := {f_getResourceAddress(v_ae2Index)}; + p_notifyHandler.start(f_subscription_Handler(f_getResourceAddress(v_parentIndex))); + } + v_request := f_getCreateRequestPrimitive(p_resourceType, p_requestPrimitive, v_parentIndex); mcaPort.send(m_request(v_request)); @@ -1316,7 +1331,9 @@ module OneM2M_Testcases { vc_resourcesIndexToBeDeleted := {}; // Tear down + //notifyHandler.stop; f_cf01Down(); + return v_response.primitive.responsePrimitive; @@ -1437,8 +1454,9 @@ module OneM2M_Testcases { // Local variables var MsgIn v_response; var RequestPrimitive v_request; - var integer v_aeIndex := -1; + var CseTester v_notifyHandler; + var integer v_ae2Index := -1; // Test control @@ -1448,7 +1466,9 @@ module OneM2M_Testcases { // Test adapter configuration // Preamble - v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi); + v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi); + + f_cse_preamble_subscriptionVerification(v_notifyHandler, v_aeIndex, v_ae2Index, p_requestPrimitive, p_resourceType); // Test Body v_request := f_getCreateRequestPrimitive(p_resourceType, p_requestPrimitive, v_aeIndex); @@ -1525,9 +1545,10 @@ module OneM2M_Testcases { // Local variables var MsgIn v_response; var RequestPrimitive v_request; - var integer v_aeIndex := -1; var integer v_resourceIndex := -1; + var CseTester v_notifyHandler; + var integer v_ae2Index := -1; // Test control @@ -1537,7 +1558,9 @@ module OneM2M_Testcases { // Test adapter configuration // Preamble - v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi); + v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi) + + f_cse_preamble_subscriptionVerification(v_notifyHandler, v_aeIndex, v_ae2Index, p_requestPrimitive, p_resourceType); v_resourceIndex := f_cse_createResource(p_resourceType, p_requestPrimitive, v_aeIndex); @@ -1757,9 +1780,10 @@ module OneM2M_Testcases { // Local variables var MsgIn v_response; var RequestPrimitive v_request; - var integer v_aeIndex := -1; var integer v_resourceIndex := -1; + var CseTester v_notifyHandler; + var integer v_ae2Index := -1; // Test control @@ -1771,10 +1795,12 @@ module OneM2M_Testcases { // Preamble v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi); + f_cse_preamble_subscriptionVerification(v_notifyHandler, v_aeIndex, v_ae2Index, p_requestPrimitive, p_resourceType); + v_resourceIndex := f_cse_createResource(p_resourceType, p_requestPrimitive, v_aeIndex); // Test Body - mcaPort.send(m_request(m_retrieveResource(f_getResourceAddress(v_resourceIndex)))); + mcaPort.send(m_request(m_retrieveResource(f_getResourceAddress(v_resourceIndex), f_getOriginator(v_resourceIndex)))); tc_ac.start; alt { @@ -1816,7 +1842,7 @@ module OneM2M_Testcases { var RequestPrimitive v_request; var integer v_aeIndex := -1; - var XSD.ID v_resourceId := "NonExisting"; + var XSD.ID v_resourceId := "nonexisting"; // Test control @@ -1829,10 +1855,10 @@ module OneM2M_Testcases { v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi); // Test Body - if(PX_UNSTRUCTURED) { - mcaPort.send(m_request(m_retrieveResource(f_getResourceAddress(-2) & "/" & v_resourceId))); + if(PX_UNSTRUCTURED and (PX_ADDRESSING_FORMAT == e_cseRelative)) { + mcaPort.send(m_request(m_retrieveResource(v_resourceId, f_getOriginator(v_aeIndex)))); } else { - mcaPort.send(m_request(m_retrieveResource(f_getResourceAddress(v_aeIndex) & "/" & v_resourceId))); + mcaPort.send(m_request(m_retrieveResource(f_getResourceAddress(v_aeIndex) & "/" & v_resourceId, f_getOriginator(v_aeIndex)))); } tc_ac.start; @@ -1910,11 +1936,12 @@ module OneM2M_Testcases { // Local variables var MsgIn v_response; var RequestPrimitive v_request; - var XSD.ID v_acpId; var integer v_aeIndex := -1; var integer v_acpAuxIndex := -1; var integer v_resourceIndex := -1; + var CseTester v_notifyHandler; + var integer v_ae2Index := -1; // Test control if(not(PICS_ACP_SUPPORT)) { @@ -1928,16 +1955,18 @@ module OneM2M_Testcases { // Test adapter configuration // Preamble - v_acpAuxIndex := f_cse_preamble_createAcpAux(-, -);//c_RUDNDi) + v_acpAuxIndex := f_cse_preamble_createAcpAux(-, -);//c_CRUDNDi) v_aeIndex := f_cse_preamble_registerAe({f_getResourceId(vc_resourcesList[v_acpAuxIndex].resource)});//c_CRUDNDi; + + f_cse_preamble_subscriptionVerification(v_notifyHandler, v_aeIndex, v_ae2Index, p_requestPrimitive, p_resourceType); v_resourceIndex := f_cse_createResource(p_resourceType, p_requestPrimitive, v_aeIndex); f_cse_updateAcpAuxResource(int61); //c_CUDNDi // Test Body - mcaPort.send(m_request(m_retrieveResource(f_getResourceAddress(v_resourceIndex)))); + mcaPort.send(m_request(m_retrieveResource(f_getResourceAddress(v_resourceIndex), f_getOriginator(v_resourceIndex)))); tc_ac.start; alt { @@ -2036,10 +2065,11 @@ module OneM2M_Testcases { // Local variables var MsgIn v_response; var RequestPrimitive v_request; - var XSD.String v_attribute := "#pi";//Attribute parentId to be retrieved var integer v_aeIndex := -1; var integer v_resourceIndex := -1; + var CseTester v_notifyHandler; + var integer v_ae2Index := -1; // Test control @@ -2051,10 +2081,12 @@ module OneM2M_Testcases { // Preamble v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi); + f_cse_preamble_subscriptionVerification(v_notifyHandler, v_aeIndex, v_ae2Index, p_requestPrimitive, p_resourceType); + v_resourceIndex := f_cse_createResource(p_resourceType, p_requestPrimitive, v_aeIndex); // Test Body - mcaPort.send(m_request(m_retrieveResourceAttributeToOption(f_getResourceAddress(v_resourceIndex) & v_attribute))); + mcaPort.send(m_request(m_retrieveResourceAttributeToOption(f_getResourceAddress(v_resourceIndex) & v_attribute, f_getOriginator(v_resourceIndex)))); tc_ac.start; alt { @@ -2154,10 +2186,10 @@ module OneM2M_Testcases { // Local variables var MsgIn v_response; var RequestPrimitive v_request; - - var XSD.String v_attribute := "#pi";//Attribute parentId to be retrieved var integer v_aeIndex := -1; var integer v_resourceIndex := -1; + var CseTester v_notifyHandler; + var integer v_ae2Index := -1; // Test control @@ -2169,10 +2201,12 @@ module OneM2M_Testcases { // Preamble v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi); + f_cse_preamble_subscriptionVerification(v_notifyHandler, v_aeIndex, v_ae2Index, p_requestPrimitive, p_resourceType); + v_resourceIndex := f_cse_createResource(p_resourceType, p_requestPrimitive, v_aeIndex); // Test Body - mcaPort.send(m_request(m_retrieveResourceAttributeContentOption(f_getResourceAddress(v_resourceIndex) , {"pi"}))); + mcaPort.send(m_request(m_retrieveResourceAttributeContentOption(f_getResourceAddress(v_resourceIndex) , {"pi"}, f_getOriginator(v_resourceIndex)))); tc_ac.start; alt { @@ -2278,9 +2312,10 @@ module OneM2M_Testcases { // Local variables var MsgIn v_response; var RequestPrimitive v_request; - var integer v_aeIndex := -1; var integer v_resourceIndex := -1; + var CseTester v_notifyHandler; + var integer v_ae2Index := -1; // Test control @@ -2292,11 +2327,13 @@ module OneM2M_Testcases { // Preamble v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi); + f_cse_preamble_subscriptionVerification(v_notifyHandler, v_aeIndex, v_ae2Index, p_requestPrimitive, p_resourceType); + v_resourceIndex := f_cse_createResource(p_resourceType, p_requestPrimitive, v_aeIndex); // Test Body mcaPort.send(m_request(m_retrieveResourceAttributeContentOption(f_getResourceAddress(v_resourceIndex) , - {"parentID", "creationTime"}))); + {"parentID", "creationTime"}, f_getOriginator(v_resourceIndex)))); tc_ac.start; alt { @@ -2372,9 +2409,10 @@ module OneM2M_Testcases { // Local variables var MsgIn v_response; var RequestPrimitive v_request; - var integer v_aeIndex := -1; var integer v_resourceIndex := -1; + var CseTester v_notifyHandler; + var integer v_ae2Index := -1; // Test control @@ -2386,11 +2424,13 @@ module OneM2M_Testcases { // Preamble v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi); + f_cse_preamble_subscriptionVerification(v_notifyHandler, v_aeIndex, v_ae2Index, p_requestPrimitive, p_resourceType); + v_resourceIndex := f_cse_createResource(p_resourceType, p_requestPrimitive, v_aeIndex); // Test Body mcaPort.send(m_request(m_retrieveResourceAttributeContentOption(f_getResourceAddress(v_resourceIndex), - {"lbl"}))); + {"lbl"}, f_getOriginator(v_resourceIndex)))); tc_ac.start; alt { @@ -2403,7 +2443,7 @@ module OneM2M_Testcases { } [] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response { tc_ac.stop; - setverdict(fail, testcasename() & ": Error while retrieving non existing resource attribute"); + setverdict(fail, testcasename() & ": Error : attribute was retrieved while it doesn't exist"); } [] tc_ac.timeout { setverdict(inconc, testcasename() & ": No answer while retrieving resource attribute"); @@ -2465,9 +2505,10 @@ module OneM2M_Testcases { // Local variables var MsgIn v_response; var RequestPrimitive v_request; - var integer v_aeIndex := -1; var integer v_resourceIndex := -1; + var CseTester v_notifyHandler; + var integer v_ae2Index := -1; // Test control @@ -2479,11 +2520,13 @@ module OneM2M_Testcases { // Preamble v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi); + f_cse_preamble_subscriptionVerification(v_notifyHandler, v_aeIndex, v_ae2Index, p_requestPrimitive, p_resourceType); + v_resourceIndex := f_cse_createResource(p_resourceType, p_requestPrimitive, v_aeIndex); // Test Body mcaPort.send(m_request(m_retrieveResourceAttributeContentOption(f_getResourceAddress(v_resourceIndex), - {"lbl", "at"}))); + {"lbl", "at"}, f_getOriginator(v_resourceIndex)))); tc_ac.start; alt { @@ -2496,7 +2539,7 @@ module OneM2M_Testcases { } [] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response { tc_ac.stop; - setverdict(fail, testcasename() & ": Error while retrieving non existing resource attributes"); + setverdict(fail, testcasename() & ": Error : attribute was retrieved while it doesn't exist"); } [] tc_ac.timeout { setverdict(inconc, testcasename() & ": No answer while retrieving resource attributes"); @@ -2678,9 +2721,10 @@ module OneM2M_Testcases { // Local variables var MsgIn v_response; var RequestPrimitive v_request; - var integer v_aeIndex := -1; var integer v_resourceIndex := -1; + var CseTester v_notifyHandler; + var integer v_ae2Index := -1; // Test control @@ -2692,6 +2736,8 @@ module OneM2M_Testcases { // Preamble v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi); + f_cse_preamble_subscriptionVerification(v_notifyHandler, v_aeIndex, v_ae2Index, p_createRequestPrimitive, p_resourceType); + v_resourceIndex := f_cse_createResource(p_resourceType, p_createRequestPrimitive, v_aeIndex); // Test Body @@ -2866,6 +2912,8 @@ module OneM2M_Testcases { var RequestPrimitive v_request; var integer v_aeIndex := -1; var integer v_resourceIndex := -1; + var CseTester v_notifyHandler; + var integer v_ae2Index := -1; // Test control @@ -2876,7 +2924,9 @@ module OneM2M_Testcases { // Preamble v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi); - + + f_cse_preamble_subscriptionVerification(v_notifyHandler, v_aeIndex, v_ae2Index, p_createRequestPrimitive, p_resourceType); + v_resourceIndex := f_cse_createResource(p_resourceType, p_createRequestPrimitive, v_aeIndex); // Test Body @@ -3089,6 +3139,8 @@ module OneM2M_Testcases { var RequestPrimitive v_request; var integer v_aeIndex := -1; var integer v_resourceIndex := -1; + var CseTester v_notifyHandler; + var integer v_ae2Index := -1; // Test control @@ -3099,7 +3151,9 @@ module OneM2M_Testcases { // Preamble v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi); - + + f_cse_preamble_subscriptionVerification(v_notifyHandler, v_aeIndex, v_ae2Index, p_createRequestPrimitive, p_resourceType); + v_resourceIndex := f_cse_createResource(p_resourceType, p_createRequestPrimitive, v_aeIndex); // Test Body @@ -3175,21 +3229,18 @@ module OneM2M_Testcases { testcase TC_CSE_DMR_UPD_BV_004_02() runs on CseTester system CseSystem { // Local variables - var XSD.String v_groupName_1 := "VALUE_1";//Attribute 1 - var XSD.String v_groupName_2 := "VALUE_2"; + var XSD.String v_groupName_1 := "VALUE_1"; var Labels v_labels_1 := {"VALUE_1"}; var Labels v_labels_2 := {"To be deleted"}; - var XSD.NonNegativeInteger v_maxNrOfMembers := 3; // 1 is the default value (set in the template m_createGroupBase) var AttributeList_1 v_nullFields; var template RequestPrimitive v_createRequest := m_createGroupBase; var template RequestPrimitive v_updateRequest := m_updateGroupBase; var ResponsePrimitive v_responsePrimitive; - v_createRequest.primitiveContent.any_1[0].Group_optional.groupName:= v_groupName_1;//Attribute 1 v_createRequest.primitiveContent.any_1[0].Group_optional.labels := v_labels_1;//Attribute 3 - v_updateRequest.primitiveContent.any_1[0].Group_optional.groupName:= v_groupName_2;//Attribute 1 - v_updateRequest.primitiveContent.any_1[0].Group_optional.maxNrOfMembers := v_maxNrOfMembers;//Attribute 2 + v_updateRequest.primitiveContent.any_1[0].Group_optional.expirationTime := "20301231T012345";//Attribute 1 + v_updateRequest.primitiveContent.any_1[0].Group_optional.groupName:= v_groupName_1;//Attribute 2 v_updateRequest.primitiveContent.any_1[0].Group_optional.labels := v_labels_2;//Attribute 3 v_nullFields := {"labels"}; @@ -3204,8 +3255,8 @@ module OneM2M_Testcases { setverdict(fail, testcasename() & ": Error: groupName attribute not updated correctly") } //Check attribute 2 - if(not match(v_responsePrimitive.primitiveContent.any_1[0].Group_optional.maxNrOfMembers, valueof(v_updateRequest.primitiveContent.any_1[0].Group_optional.maxNrOfMembers))){ - setverdict(fail, testcasename() & ": Error: maxNrOfMembers attribute not updated correctly") + if(not match(v_responsePrimitive.primitiveContent.any_1[0].Group_optional.expirationTime, valueof(v_updateRequest.primitiveContent.any_1[0].Group_optional.expirationTime))){ + setverdict(fail, testcasename() & ": Error: expirationTime attribute not updated correctly") } //Check attribute 3 if(ispresent(v_responsePrimitive.primitiveContent.any_1[0].Group_optional.labels)){ @@ -3220,17 +3271,7 @@ module OneM2M_Testcases { // Local variables var Labels v_labels_1 := {"VALUE_1"}; var Labels v_labels_2 := {"To be deleted"}; - var SetOfAcrs v_privileges_1 := { - accessControlRule_list := { - { - accessControlOriginators := {"admin:admin"}, - accessControlOperations := int63, - accessControlContexts_list := omit, - accessControlAuthenticationFlag := omit - } - } - } - var SetOfAcrs v_privileges_2 := { + var SetOfAcrs v_privileges_2 := { // accessControlRule_list := { { accessControlOriginators := {"admin:admin"}, @@ -3241,11 +3282,11 @@ module OneM2M_Testcases { } } var AttributeList_1 v_nullFields; - var template RequestPrimitive v_createRequest := m_createAcpBase; + var template RequestPrimitive v_createRequest := m_createAcpBase;// privileges set by default to 63 for * var template RequestPrimitive v_updateRequest := m_updateAcpBase; var ResponsePrimitive v_responsePrimitive; - v_createRequest.primitiveContent.any_1[0].AccessControlPolicy_optional.privileges := v_privileges_1;//Attribute 1 + v_createRequest.primitiveContent.any_1[0].AccessControlPolicy_optional.labels := v_labels_1;//Attribute 3 v_updateRequest.primitiveContent.any_1[0].AccessControlPolicy_optional.privileges := v_privileges_2; //Attribute 1 v_updateRequest.primitiveContent.any_1[0].AccessControlPolicy_optional.announceTo := {PX_URI_CSE};//Attribute 2 v_updateRequest.primitiveContent.any_1[0].AccessControlPolicy_optional.labels := v_labels_2;//Attribute 3 @@ -3263,7 +3304,7 @@ module OneM2M_Testcases { } //Check attribute 2 if(not match(v_responsePrimitive.primitiveContent.any_1[0].AccessControlPolicy_optional.announceTo, valueof(v_updateRequest.primitiveContent.any_1[0].AccessControlPolicy_optional.announceTo))){ - setverdict(fail, testcasename() & ": Error: Expiration Time attribute not updated correctly") + setverdict(fail, testcasename() & ": Error: Announce_to attribute not updated correctly") } //Check attribute 3 if(ispresent(v_responsePrimitive.primitiveContent.any_1[0].AccessControlPolicy_optional.labels)){ @@ -3352,18 +3393,15 @@ module OneM2M_Testcases { testcase TC_CSE_DMR_UPD_BV_004_06() runs on CseTester system CseSystem { // Local variables var Labels v_labels_1 := {"VALUE_1"}; - var Labels v_labels_2 := {"VALUE_2"}; - var AcpType v_acp := {"ACP_ID"}; var AttributeList_1 v_nullFields; var template RequestPrimitive v_createRequest := m_createSubscriptionBase; var template RequestPrimitive v_updateRequest := m_updateSubscriptionBase; var ResponsePrimitive v_responsePrimitive; - v_createRequest.primitiveContent.any_1[0].Subscription_optional.labels := v_labels_1;//Attribute 1 - v_createRequest.primitiveContent.any_1[0].Subscription_optional.expirationCounter := 5;//Attribute 3 - v_updateRequest.primitiveContent.any_1[0].Subscription_optional.labels := v_labels_2;//Attribute 1 - v_updateRequest.primitiveContent.any_1[0].Subscription_optional.accessControlPolicyIDs := v_acp; //Attribute 2 - v_updateRequest.primitiveContent.any_1[0].Subscription_optional.expirationCounter := 1;//Attribute 3 + v_createRequest.primitiveContent.any_1[0].Subscription_optional.expirationCounter := 10;//Attribute 3 + v_updateRequest.primitiveContent.any_1[0].Subscription_optional.expirationTime := "20301231T012345";//Attribute 1 + v_updateRequest.primitiveContent.any_1[0].Subscription_optional.labels := v_labels_1;//Attribute 2 + v_updateRequest.primitiveContent.any_1[0].Subscription_optional.expirationCounter := 5;//Attribute 3 v_nullFields := {"expirationCounter"}; @@ -3374,15 +3412,15 @@ module OneM2M_Testcases { if(ischosen(v_responsePrimitive.primitiveContent.any_1[0].Subscription_optional)) { //Check attribute 1 if(not match(v_responsePrimitive.primitiveContent.any_1[0].Subscription_optional.labels, valueof(v_updateRequest.primitiveContent.any_1[0].Subscription_optional.labels))){ - setverdict(fail, testcasename() & ": Error: Expiration Time attribute not updated correctly") + setverdict(fail, testcasename() & ": Error: Labels attribute not updated correctly") } //Check attribute 2 - if(not match(v_responsePrimitive.primitiveContent.any_1[0].Subscription_optional.accessControlPolicyIDs, valueof(v_updateRequest.primitiveContent.any_1[0].Subscription_optional.accessControlPolicyIDs))){ - setverdict(fail, testcasename() & ": Error: MaxNrOfInstances attribute not updated correctly") + if(not match(v_responsePrimitive.primitiveContent.any_1[0].Subscription_optional.expirationTime, valueof(v_updateRequest.primitiveContent.any_1[0].Subscription_optional.expirationTime))){ + setverdict(fail, testcasename() & ": Error: expirationTime attribute not updated correctly") } //Check attribute 3 if(ispresent(v_responsePrimitive.primitiveContent.any_1[0].Subscription_optional.expirationCounter)){ - setverdict(fail, testcasename() & ": Error: Labels attribute not deleted correctly") + setverdict(fail, testcasename() & ": Error: expirationCounter attribute not deleted correctly") } } } @@ -3396,6 +3434,8 @@ module OneM2M_Testcases { var RequestPrimitive v_request; var integer v_aeIndex := -1; var integer v_resourceIndex := -1; + var CseTester v_notifyHandler; + var integer v_ae2Index := -1; // Test control @@ -3406,9 +3446,11 @@ module OneM2M_Testcases { // Preamble v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi); - + + f_cse_preamble_subscriptionVerification(v_notifyHandler, v_aeIndex, v_ae2Index, p_createRequestPrimitive, p_resourceType); + v_resourceIndex := f_cse_createResource(p_resourceType, p_createRequestPrimitive, v_aeIndex); - + // Test Body v_request := f_getUpdateRequestPrimitive(p_resourceType, v_resourceIndex, p_updateRequestPrimitive); @@ -3539,7 +3581,7 @@ module OneM2M_Testcases { mcaPort.send(m_request(v_request)); tc_ac.start; alt { - [] mcaPort.receive(mw_response(mw_responsePrimitive(int4005))) -> value v_response { + [] mcaPort.receive(mw_response(mw_responsePrimitive(int4004))) -> value v_response { tc_ac.stop; setverdict(pass, testcasename() & ": Resource " & c_defaultResourceName & " of type " & int2str(enum2int(p_resourceType)) & " not found"); } @@ -3639,6 +3681,8 @@ module OneM2M_Testcases { var integer v_aeIndex := -1; var integer v_acpAuxIndex := -1; var integer v_resourceIndex := -1; + var CseTester v_notifyHandler; + var integer v_ae2Index := -1; // Test control if(not(PICS_ACP_SUPPORT)) { @@ -3656,6 +3700,8 @@ module OneM2M_Testcases { v_aeIndex := f_cse_preamble_registerAe({f_getResourceId(vc_resourcesList[v_acpAuxIndex].resource)}, -);//c_CRDNDi); + f_cse_preamble_subscriptionVerification(v_notifyHandler, v_aeIndex, v_ae2Index, p_createRequestPrimitive, p_resourceType); + v_resourceIndex := f_cse_createResource(p_resourceType, p_createRequestPrimitive, v_aeIndex); // Test Body @@ -3767,6 +3813,8 @@ module OneM2M_Testcases { var RequestPrimitive v_request; var integer v_aeIndex := -1; var integer v_resourceIndex := -1; + var CseTester v_notifyHandler; + var integer v_ae2Index := -1; // Test control @@ -3778,6 +3826,8 @@ module OneM2M_Testcases { // Preamble v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi); + f_cse_preamble_subscriptionVerification(v_notifyHandler, v_aeIndex, v_ae2Index, p_createRequestPrimitive, p_resourceType); + v_resourceIndex := f_cse_createResource(p_resourceType, p_createRequestPrimitive, v_aeIndex); // Test Body @@ -3900,6 +3950,8 @@ module OneM2M_Testcases { var RequestPrimitive v_request; var integer v_aeIndex := -1; var integer v_resourceIndex := -1; + var CseTester v_notifyHandler; + var integer v_ae2Index := -1; // Test control @@ -3911,6 +3963,8 @@ module OneM2M_Testcases { // Preamble v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi); + f_cse_preamble_subscriptionVerification(v_notifyHandler, v_aeIndex, v_ae2Index, p_createRequestPrimitive, p_resourceType); + v_resourceIndex := f_cse_createResource(p_resourceType, p_createRequestPrimitive, v_aeIndex); // Test Body @@ -3958,7 +4012,7 @@ module OneM2M_Testcases { f_CSE_DMR_DEL_BV_001(int3, m_createContainerBase);//Container if(getverdict == pass){ - //check whether "MyRessource" container resource isn't present in the IUT (for exemple attempt to update the resource) + //check if "MyRessource" container resource isn't present in the IUT (for exemple attempt to update the resource) }; }; @@ -4000,6 +4054,8 @@ module OneM2M_Testcases { var RequestPrimitive v_request; var integer v_aeIndex := -1; var integer v_resourceIndex := -1; + var CseTester v_notifyHandler; + var integer v_ae2Index := -1; // Test control @@ -4009,7 +4065,9 @@ module OneM2M_Testcases { // Test adapter configuration // Preamble - v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi); + v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi) + + f_cse_preamble_subscriptionVerification(v_notifyHandler, v_aeIndex, v_ae2Index, p_createRequestPrimitive, p_resourceType); v_resourceIndex := f_cse_createResource(p_resourceType, p_createRequestPrimitive, v_aeIndex); @@ -4086,6 +4144,12 @@ module OneM2M_Testcases { var MsgIn v_response; var RequestPrimitive v_request; var RequestPrimitive v_updateRequest := valueof(m_updateAcpBase); + var integer v_acpAuxIndex := -1; + var integer v_aeIndex := -1; + var integer v_resourceIndex := -1; + var CseTester v_notifyHandler; + var integer v_ae2Index := -1; + var AccessControlRule v_accessControlRule_1 := { accessControlOriginators := {PX_SUPER_USER}, accessControlOperations := int63, @@ -4098,12 +4162,12 @@ module OneM2M_Testcases { accessControlContexts_list := omit, accessControlAuthenticationFlag := omit }; - - var integer v_aeIndex := -1; - var integer v_resourceIndex := -1; - v_updateRequest.primitiveContent.any_1[0].AccessControlPolicy_optional.privileges.accessControlRule_list := {v_accessControlRule_1,v_accessControlRule_2}; // Test control + if(not(PICS_ACP_SUPPORT)) { + setverdict(inconc, testcasename() & ": AccessControlPolicy support is required to run this test case"); + stop; + } // Test component configuration f_cf01Up(); @@ -4111,31 +4175,43 @@ module OneM2M_Testcases { // Test adapter configuration // Preamble - v_aeIndex := f_cse_preamble_registerAe();//c_CRUNDi); - - v_updateRequest.primitiveContent.any_1[0].AccessControlPolicy_optional.privileges.accessControlRule_list[1].accessControlOriginators := {f_getResourceAddress(v_aeIndex)}; - v_updateRequest := f_getUpdateRequestPrimitive(int1, vc_acpAuxIndex, v_updateRequest); + v_acpAuxIndex := f_cse_preamble_createAcpAux(-,-);//c_CRDNDi); + v_aeIndex := f_cse_preamble_registerAe({f_getResourceId(vc_resourcesList[v_acpAuxIndex].resource)}, -);//c_CRUNDi); + + f_cse_preamble_subscriptionVerification(v_notifyHandler, v_aeIndex, v_ae2Index, p_createRequestPrimitive, p_resourceType); - mcaPort.send(m_request(v_updateRequest)); - tc_ac.start; - alt { - [] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response { - tc_ac.stop; - setverdict(pass, testcasename() & ": Attribute of resource type " & int2str(enum2int(p_resourceType)) & " updated successfuly"); - } - [] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value v_response { - tc_ac.stop; - setverdict(fail, testcasename() & ": Error while updating resource type " & int2str(enum2int(p_resourceType))); - } - [] tc_ac.timeout { - setverdict(inconc, testcasename() & ": No answer while updating resource type " & int2str(enum2int(p_resourceType))); - } - } + if (p_resourceType == int1){ + p_createRequestPrimitive.primitiveContent.any_1[0].AccessControlPolicy_optional.selfPrivileges.accessControlRule_list := {v_accessControlRule_1,v_accessControlRule_2}; + p_createRequestPrimitive.primitiveContent.any_1[0].AccessControlPolicy_optional.selfPrivileges.accessControlRule_list[1].accessControlOriginators := {f_getResourceAddress(v_aeIndex)}; + } + else{ + f_setAcpId(p_createRequestPrimitive, {f_getResourceId(vc_resourcesList[v_acpAuxIndex].resource)}); + v_updateRequest.primitiveContent.any_1[0].AccessControlPolicy_optional.privileges.accessControlRule_list := {v_accessControlRule_1,v_accessControlRule_2};// Super User can delete the resource but not the AE + v_updateRequest.primitiveContent.any_1[0].AccessControlPolicy_optional.privileges.accessControlRule_list[1].accessControlOriginators := {f_getOriginator(v_aeIndex)}; + v_updateRequest := f_getUpdateRequestPrimitive(int1, vc_acpAuxIndex, v_updateRequest); + + mcaPort.send(m_request(v_updateRequest)); + tc_ac.start; + alt { + [] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response { + tc_ac.stop; + setverdict(pass, testcasename() & ": Attribute of resource type " & int2str(enum2int(p_resourceType)) & " updated successfuly"); + } + [] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value v_response { + tc_ac.stop; + setverdict(fail, testcasename() & ": Error while updating resource type " & int2str(enum2int(p_resourceType))); + } + [] tc_ac.timeout { + setverdict(inconc, testcasename() & ": No answer while updating resource type " & int2str(enum2int(p_resourceType))); + } + } + } v_resourceIndex := f_cse_createResource(p_resourceType, p_createRequestPrimitive, v_aeIndex); // Test Body v_request := valueof(m_deleteRequest(f_getResourceAddress(v_resourceIndex))); + v_request.from_ := f_getResourceAddress(v_aeIndex); mcaPort.send(m_request(v_request)); tc_ac.start; @@ -4158,6 +4234,22 @@ module OneM2M_Testcases { } // Postamble + mcaPort.send(m_request(valueof(m_deleteRequest(f_getResourceAddress(v_aeIndex))))); + // We are forced to delete the Ae because the delete request in the postamble_deleteResources is sent by Ae itself, witch doesn't have privileges + tc_ac.start; + alt { + [] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) { + tc_ac.stop; + log("Postamble: AE Resource deleted"); + } + [] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) { + tc_ac.stop; + log("Postamble: Error while deleting resource"); + } + [] tc_ac.timeout { + log("Postamble: No answer while deleting resource"); + } + } f_cse_postamble_deleteResources(); // Tear down @@ -4248,8 +4340,8 @@ module OneM2M_Testcases { testcase TC_CSE_DMR_DEL_BV_004_05() runs on CseTester system CseSystem { // Local variables - - f_CSE_DMR_DEL_BV_004(int15, m_createPollingChannelBase, int23, m_createSubscriptionBase);//PollingChannel TODO ResourceType needed is PollingChannelURI + // don't exist pollingChannel's child resource + //f_CSE_DMR_DEL_BV_004(int15, m_createPollingChannelBase, int23, m_createSubscriptionBase);//PollingChannel TODO ResourceType needed is PollingChannelURI }; testcase TC_CSE_DMR_DEL_BV_004_06() runs on CseTester system CseSystem { @@ -4266,6 +4358,8 @@ module OneM2M_Testcases { var integer v_aeIndex := -1; var integer v_resourceIndex := -1; var integer v_childResourceIndex := -1; + var CseTester v_notifyHandler; + var integer v_ae2Index := -1; // Test control @@ -4276,7 +4370,9 @@ module OneM2M_Testcases { // Preamble v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi); - + + f_cse_preamble_subscriptionVerification(v_notifyHandler, v_aeIndex, v_ae2Index, p_createRequestPrimitive, p_resourceType); + v_resourceIndex := f_cse_createResource(p_resourceType, p_createRequestPrimitive, v_aeIndex); v_childResourceIndex := f_cse_createResource(p_childResourceType, p_createRequestPrimitiveChildResource, v_resourceIndex); @@ -4300,7 +4396,7 @@ module OneM2M_Testcases { } } - mcaPort.send(m_request(m_retrieveResource(f_getResourceAddress(v_childResourceIndex)))); + mcaPort.send(m_request(m_retrieveResource(f_getResourceAddress(v_childResourceIndex), f_getOriginator(v_childResourceIndex)))); tc_ac.start; alt { @@ -4334,7 +4430,7 @@ module OneM2M_Testcases { testcase TC_CSE_DMR_DEL_BV_005_01() runs on CseTester system CseSystem { // Local variables - f_CSE_DMR_DEL_BV_005(int3, m_createContainerBase, int23, m_createSubscriptionBase);//Container + f_CSE_DMR_DEL_BV_005(int3, m_createContainerBase, int3, m_createContainerBase);//Container } function f_CSE_DMR_DEL_BV_005(ResourceType p_resourceType, template RequestPrimitive p_createRequestPrimitive, ResourceType p_childResourceType, template RequestPrimitive p_createRequestPrimitiveChildResource) runs on CseTester { @@ -4343,7 +4439,7 @@ module OneM2M_Testcases { var RequestPrimitive v_request; var integer v_aeIndex := -1; var integer v_resourceIndex := -1; - var integer v_childResourceIndex := -1; + var integer v_childResourceIndex := -1; // Test control @@ -4354,7 +4450,7 @@ module OneM2M_Testcases { // Preamble v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi); - + v_resourceIndex := f_cse_createResource(p_resourceType, p_createRequestPrimitive, v_aeIndex); if(ispresent(vc_resourcesList[v_resourceIndex].resource.any_1[0].Container_optional.stateTag)) { @@ -4382,13 +4478,13 @@ module OneM2M_Testcases { - mcaPort.send(m_request(m_retrieveResource(f_getResourceAddress(v_resourceIndex)))); + mcaPort.send(m_request(m_retrieveResource(f_getResourceAddress(v_resourceIndex), f_getOriginator(v_resourceIndex)))); tc_ac.start; alt { [] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response { tc_ac.stop; - if(v_response.primitive.responsePrimitive.primitiveContent.any_1[0].Container_optional.stateTag > vc_resourcesList[v_resourceIndex].resource.any_1[0].Container_optional.stateTag) { // Not good comparison (Create before Delete) + if(v_response.primitive.responsePrimitive.primitiveContent.any_1[0].Container_optional.stateTag == 2) { //(Create and Delete) setverdict(pass, testcasename() & ": The stateTag attribute is incremented"); } else{ @@ -4710,7 +4806,7 @@ module OneM2M_Testcases { v_locContainerResourceIndex := f_cse_createResource(int3, v_container_request_preamble, v_locPolicyResourceIndex);//created container index //Test Body - retrieve the created container resource - mcaPort.send(m_request(valueof(m_retrieveResource(f_getResourceAddress(v_locContainerResourceIndex))))); + mcaPort.send(m_request(valueof(m_retrieveResource(f_getResourceAddress(v_locContainerResourceIndex), f_getOriginator(v_locContainerResourceIndex))))); tc_ac.start; alt{ [] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response{ @@ -4876,7 +4972,7 @@ module OneM2M_Testcases { v_subscriptionResourceIndex := f_cse_createResource(int23, v_subscription_request_preamble, v_locContainerResourceIndex); //Test Body - retrieve the <latest> resource of the created container resource linked with the locationPolicy resource - mcaPort.send(m_request(valueof(m_retrieveResource(f_getResourceAddress(v_locContainerResourceIndex) & "/" & "latest")))); + mcaPort.send(m_request(valueof(m_retrieveResource(f_getResourceAddress(v_locContainerResourceIndex) & "/" & "latest", f_getOriginator(v_locContainerResourceIndex))))); tc_ac.start; alt{ [] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response{ @@ -4939,7 +5035,7 @@ module OneM2M_Testcases { v_subscriptionResourceIndex := f_cse_createResource(int23, v_subscription_request_preamble, v_locContainerResourceIndex); //Test Body - retrieve the <latest> resource of the created container resource linked with the locationPolicy resource - mcaPort.send(m_request(valueof(m_retrieveResource(f_getResourceAddress(v_locContainerResourceIndex) & "/" & "latest")))); + mcaPort.send(m_request(valueof(m_retrieveResource(f_getResourceAddress(v_locContainerResourceIndex) & "/" & "latest", f_getOriginator(v_locContainerResourceIndex))))); tc_ac.start; alt{ [] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response{ @@ -5001,7 +5097,7 @@ module OneM2M_Testcases { v_subscriptionResourceIndex := f_cse_createResource(int23, v_subscription_request_preamble, v_locContainerResourceIndex); //Test Body - retrieve the <latest> resource of the created container resource linked with the locationPolicy resource - mcaPort.send(m_request(valueof(m_retrieveResource(f_getResourceAddress(v_locContainerResourceIndex) & "/" & "latest")))); + mcaPort.send(m_request(valueof(m_retrieveResource(f_getResourceAddress(v_locContainerResourceIndex) & "/" & "latest", f_getOriginator(v_locContainerResourceIndex))))); tc_ac.start; alt{ [] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response{ @@ -5128,7 +5224,7 @@ module OneM2M_Testcases { v_locPolicyResourceIndex := f_cse_createResource(int10, v_locpolicy_request_preamble, v_aeAuxIndex);//created locationpolicy index //Test Body - retrieve the created locationpolicy resource - mcaPort.send(m_request(valueof(m_retrieveResource(f_getResourceAddress(v_locPolicyResourceIndex))))); + mcaPort.send(m_request(valueof(m_retrieveResource(f_getResourceAddress(v_locPolicyResourceIndex), f_getOriginator(v_locPolicyResourceIndex))))); tc_ac.start; alt{ [] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response{ @@ -5538,13 +5634,13 @@ module OneM2M_Testcases { // Local variables var XSD.ID v_resourceId := "NonExisting"; - var RequestPrimitive v_request; + var RequestPrimitive v_request := valueof(m_createGroupBase); var MsgIn v_response; var integer v_aeIndex := -1; var integer v_resourceIndex := -1; - v_request := valueof(m_retrieveResource(f_getResourceAddress(-2) & "/" & v_resourceId)); + //v_request.primitiveContent.any_1[0].Group_optional.fanOutPoint := c_fanoutPointAddress; TODO <--------------------------------------- @@ -5560,7 +5656,7 @@ module OneM2M_Testcases { v_resourceIndex := f_cse_createResource(int9, v_request, v_aeIndex); // Test Body - + v_request := valueof(m_retrieveResource(f_getResourceAddress(v_resourceIndex) & "/" & v_resourceId, f_getOriginator(v_resourceIndex))); mcaPort.send(m_request(valueof(v_request))); tc_ac.start; alt { @@ -6986,6 +7082,8 @@ module OneM2M_Testcases { var integer v_resourceIndex := -1; var template RequestPrimitive v_createRequest := m_createSubscriptionBase; var RequestPrimitive v_request; + var CseTester v_notifyHandler; + var integer v_ae2Index := -1; // Test control @@ -6995,9 +7093,11 @@ module OneM2M_Testcases { // Test adapter configuration // Preamble - v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi); - - v_resourceIndex := f_cse_createResource(int23, v_createRequest, v_aeIndex);//Subscription + v_aeIndex := f_cse_preamble_registerAe();//AE1 is registred; + + f_cse_preamble_subscriptionVerification(v_notifyHandler, v_aeIndex, v_ae2Index, v_createRequest, int23); + + v_resourceIndex := f_cse_createResource(int23, v_createRequest, v_aeIndex);//Subscription resource is created v_request := f_getCreateRequestPrimitive(int23, v_createRequest, v_resourceIndex); @@ -7163,8 +7263,8 @@ module OneM2M_Testcases { v_aeIndex := f_cse_preamble_registerAe();//c_CUDNDi); v_request := f_getCreateRequestPrimitive(int23, v_createRequest, v_aeIndex);//Subscription - v_request.primitiveContent.any_1[0].Subscription_optional.notificationURI := {"Not Initialized"}; - //Can the CSE not send the notify request if the URI is false ? + //v_request.primitiveContent.any_1[0].Subscription_optional.notificationURI := {"Not Initialized"}; + mcaPort.send(m_request(v_request)); tc_ac.start; @@ -7200,19 +7300,13 @@ module OneM2M_Testcases { testcase TC_CSE_SUB_BV_004() runs on CseTester system CseSystem { // Local variables - var CseTester notifyHandler := CseTester.create; var MsgIn v_response; var integer v_aeIndex := -1; - var integer v_ae2Index := -1; var template RequestPrimitive v_createRequest := m_createSubscriptionBase; var RequestPrimitive v_request; - var ResponsePrimitive v_responsePrimitive; - var template Notification v_notificationRequest := mw_contentNotificationBase; - var Notification v_notificationResponse := valueof(mw_contentNotificationAllOmit); - - v_responsePrimitive := valueof(m_responseNotification(int4101, v_notificationResponse)); - - + var CseTester notifyHandler := CseTester.create("NotifyHandler"); + var integer v_ae2Index := -1; + // Test control // Test component configuration @@ -7221,19 +7315,14 @@ module OneM2M_Testcases { // Test adapter configuration // Preamble - v_aeIndex := f_cse_preamble_registerAe(omit,omit);//c_CUDNDi); // set poa to MTC adress - v_ae2Index := f_cse_createResource(int2, m_createAe(PX_APP_ID, -, PX_AE_ID_STEM, "MyAe2", omit), -1); // set poa to NotifyComponent address - - v_notificationRequest.verificationRequest := true; - v_notificationResponse.creator := f_getResourceAddress(v_aeIndex); - v_notificationResponse.subscriptionReference := "I Don't know which URI is expected"; // TODO mandatory parameter - - // here appID AE1 == appID AE2 + v_aeIndex := f_cse_preamble_registerAe(omit,omit);//c_CUDNDi); + v_ae2Index := f_cse_createResource(int2, m_createAe(PX_APP_ID, -, PX_AE_ID_STEM, "MyAe2", {"http://" & PX_TESTER_ADDRESS & "/"}), -1); + vc_resourcesIndexToBeDeleted := vc_resourcesIndexToBeDeleted & {v_ae2Index}; v_request := f_getCreateRequestPrimitive(int23, v_createRequest, v_aeIndex);//Subscription v_request.primitiveContent.any_1[0].Subscription_optional.notificationURI := {f_getResourceAddress(v_ae2Index)}; - notifyHandler.start(f_CSE_SUB_BV_004(v_notificationRequest, v_responsePrimitive)); + notifyHandler.start(f_subscription_Handler(f_getResourceAddress(v_aeIndex), int4101)); mcaPort.send(m_request(v_request)); @@ -7263,91 +7352,6 @@ module OneM2M_Testcases { f_cf01Down(); } // end TC_CSE_SUB_BV_004 - - function f_CSE_SUB_BV_004(in template Notification p_notificationRequest, in ResponsePrimitive p_responsePrimitive) runs on CseTester { - // Local variables - var MsgIn v_response; - - map(self:mcaPort, system:mcaPort); - map(self:acPort, system:acPort); - - tc_ac.start; - alt { - [] mcaPort.receive(mw_request(mw_notify_2(p_notificationRequest))) -> value v_response { - tc_ac.stop; - setverdict(pass, testcasename() & ": Notification received"); - } - [] mcaPort.receive(mw_request(mw_notify(?))) -> value v_response { - tc_ac.stop; - setverdict(fail, testcasename() & ": Notification received but verificationRequest isn't set to TRUE"); - } - [] mcaPort.receive{ - tc_ac.stop; - setverdict(fail, testcasename() & ": Error, unexpected message received"); - } - [] tc_ac.timeout { - setverdict(inconc, testcasename() & ": No answer while deleting resource type int3 (Container) or None notification received"); - } - } - - mcaPort.send(m_response(p_responsePrimitive)); // AE2 shall send a response to CSE with responseStatusCode = SUBSCRIPTION_CREATOR_HAS_NO_PRIVILEGE - - unmap(self:mcaPort, system:mcaPort); - unmap(self:acPort, system:acPort); - - }// end f_CSE_SUB_BV_004 - - function f_registerAe(in template (omit) PoaList p_poaList := omit) runs on CseTester return integer {//c_CRUDNDi - var RequestPrimitive v_request; - var MsgIn v_response; - var integer v_aeIndex := -1; - - if(vc_acpAuxIndex != -1) { - v_request := valueof(m_createAe(PX_APP_ID, {f_getResourceId(vc_resourcesList[vc_acpAuxIndex].resource)}, PX_AE_ID_STEM, "MyAe2", p_poaList)); - //mcaPort.send(m_request(m_createAeAux(p_name, {PX_URI_CSE & PX_CSE_NAME & "/" & PX_ACPAUX_NAME}))); - } else { - v_request := valueof(m_createAe(PX_APP_ID, -, PX_AE_ID_STEM, "MyAe2", p_poaList)); - } - - v_request.to_ := f_getResourceAddress(); - mcaPort.send(m_request(v_request)); - - tc_ac.start; - alt { - [] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response { - tc_ac.stop; - log("Preamble: Application registered successfuly"); - if(ischosen(v_response.primitive.responsePrimitive.primitiveContent.any_1[0].AE_optional)) { - - v_aeIndex := f_setResource(v_response.primitive.responsePrimitive.primitiveContent); - vc_resourcesIndexToBeDeleted := vc_resourcesIndexToBeDeleted & {v_aeIndex}; - - if(ispresent(v_response.primitive.responsePrimitive.primitiveContent.any_1[0].AE_optional.aE_ID)){ - f_sendAcPrimitive("AE-ID_changed", oct2char(unichar2oct(v_response.primitive.responsePrimitive.primitiveContent.any_1[0].AE_optional.aE_ID))); - } else { - f_sendAcPrimitive("AE-ID_changed", "0"); - } - }; - } - [] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) { - tc_ac.stop; - setverdict(inconc, "Preamble: Error while registering application"); - stop; - } - [] mcaPort.receive { - tc_ac.stop; - setverdict(inconc, "Preamble: Unexpected message received"); - stop; - } - [] tc_ac.timeout { - setverdict(inconc, "Preamble: No answer while registering resource"); - stop; - } - } - - return v_aeIndex; - - }// end function }//end group g_CSE_SUB_BV_004 @@ -7359,55 +7363,31 @@ module OneM2M_Testcases { var integer v_aeIndex := -1; var template RequestPrimitive v_createRequest := m_createSubscriptionBase; var RequestPrimitive v_request; - var ResponsePrimitive v_responsePrimitive; - var template PrimitiveContent v_contentResponse; - var template Notification v_notificationRequest := mw_contentNotificationBase; - var Notification v_notificationResponse := valueof(mw_contentNotificationAllOmit); - - + var CseTester notifyHandler := CseTester.create("NotifyHandler"); + var integer v_ae2Index := -1; + // Test control // Test component configuration f_cf01Up(); - + // Test adapter configuration // Preamble - v_aeIndex := f_cse_preamble_registerAe();//c_CUDNDi); + v_aeIndex := f_cse_preamble_registerAe(omit,omit);//c_CUDNDi); // set poa to MTC adress + v_ae2Index := f_cse_createResource(int2, m_createAe(PX_APP_ID, -, PX_AE_ID_STEM, "MyAe2", {"http://" & PX_TESTER_ADDRESS & "/"}), -1); + vc_resourcesIndexToBeDeleted := vc_resourcesIndexToBeDeleted & {v_ae2Index}; - v_notificationRequest.verificationRequest := true; - v_notificationResponse.creator := f_getResourceAddress(v_aeIndex); - v_notificationResponse.subscriptionReference := "I Don't know which URI is expected"; // TODO set it attribute to the correct value - v_responsePrimitive := valueof(m_responseNotification(int5205, v_notificationResponse)); - v_request := f_getCreateRequestPrimitive(int23, v_createRequest, v_aeIndex);//Subscription - v_request.primitiveContent.any_1[0].Subscription_optional.notificationURI := {"Not Initialized"};// TODO set notificationURI to AE2 URI - - mcaPort.send(m_request(v_request)); - - alt { - [] mcaPort.receive(mw_request(mw_notify_2(v_notificationRequest))) -> value v_response { - tc_ac.stop; - setverdict(pass, testcasename() & ": Notification received"); - } - [] mcaPort.receive(mw_request(mw_notify(?))) -> value v_response { - tc_ac.stop; - setverdict(fail, testcasename() & ": Notification received but verificationRequest isn't set to TRUE"); - } - [] mcaPort.receive{ - tc_ac.stop; - setverdict(fail, testcasename() & ": Error, unexpected message received"); - } - [] tc_ac.timeout { - setverdict(inconc, testcasename() & ": No answer while deleting resource type int3 (Container) or None notification received"); - } - } - - mcaPort.send(m_response(v_responsePrimitive)); // AE2 shall send a response to CSE with responseStatusCode = SUBSCRIPTION_HOST_HAS_NO_PRIVILEGE + v_request.primitiveContent.any_1[0].Subscription_optional.notificationURI := {f_getResourceAddress(v_ae2Index)}; + + notifyHandler.start(f_subscription_Handler(f_getResourceAddress(v_aeIndex), int5205)); + mcaPort.send(m_request(v_request)); + tc_ac.start; alt { - [] mcaPort.receive(mw_response(mw_responsePrimitive(int5205))) -> value v_response { //SUBSCRIPTION_HOST_HAS_NO_PRIVILEGE + [] mcaPort.receive(mw_response(mw_responsePrimitive(int5205))) -> value v_response { //SUBSCRIPTION_CREATOR_HAS_NO_PRIVILEGE tc_ac.stop; setverdict(pass, testcasename() & ": OK : Subscription creator has no privilege"); } @@ -7438,8 +7418,6 @@ module OneM2M_Testcases { testcase TC_CSE_SUB_BV_006() runs on CseTester system CseSystem { // Local variables - var boolean v_boolNotification := false; - var boolean v_boolResponse := false; var MsgIn v_response; var Labels v_labels_1:= {"VALUE_1"}; var integer v_aeIndex := -1; @@ -7448,7 +7426,8 @@ module OneM2M_Testcases { var template PrimitiveContent v_contentResponse; var template RequestPrimitive v_updateRequest := m_updateAeBase; var RequestPrimitive v_request; - var PoaList v_poaList := {"http://" & PX_TESTER_ADDRESS & "/monitor"};//TODO Set a proper poa + var CseTester v_notifyHandler; + var integer v_ae2Index := -1; v_updateRequest.primitiveContent.any_1[0].AE_optional.labels := v_labels_1; v_contentResponse.any_1[0].AE_optional := mw_contentAeBase; // all attributes expected @@ -7459,47 +7438,27 @@ module OneM2M_Testcases { f_cf01Up(); // Test adapter configuration - //TODO Add a notification recepient in order to be able to create a subscription resource // Preamble - v_aeIndex := f_cse_preamble_registerAe(-, v_poaList);//c_CRUDNDi); - + v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi); + + f_cse_preamble_subscriptionVerification(v_notifyHandler, v_aeIndex, v_ae2Index, v_createRequest, int23); + v_resourceIndex := f_cse_createResource(int23, v_createRequest, v_aeIndex);//Subscription v_request:= f_getUpdateRequestPrimitive(int2, v_aeIndex, v_updateRequest); // Update request - + + f_is_component_done(v_notifyHandler); + + // Test Body + v_notifyHandler.start(f_match_notification_primitive(v_contentResponse)); // check if the notification is well received and if its content matchs + mcaPort.send(m_request(v_request)); tc_ac.start; alt { - [(not v_boolResponse)] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response { - tc_ac.stop; - setverdict(pass, testcasename() & ": Attribute of resource type int2 (Ae) updated successfuly"); - v_boolResponse := true; - if(not v_boolNotification){repeat;} - } - [(not v_boolNotification)] mcaPort.receive(mw_request(mw_notify(?))) -> value v_response { + [] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response { tc_ac.stop; - if(ischosen(v_response.primitive.requestPrimitive.primitiveContent.any_1[0].Notification.notificationEvent.representation.resource)) { - if(match(v_response.primitive.requestPrimitive.primitiveContent.any_1[0].Notification.notificationEvent.representation.resource.AE_optional, v_contentResponse.any_1[0].AE_optional)) { - setverdict(pass, testcasename() & ": Notification received"); - } - else{ - setverdict(fail, testcasename() & ": Notification received but the content doesn't match"); - } - } else if (ischosen(v_response.primitive.requestPrimitive.primitiveContent.any_1[0].Notification.notificationEvent.representation.responsePrimitive)) { - if(match(v_response.primitive.requestPrimitive.primitiveContent.any_1[0].Notification.notificationEvent.representation.responsePrimitive.primitiveContent.any_1[0].AE_optional, v_contentResponse.any_1[0].AE_optional)) { - setverdict(pass, testcasename() & ": Notification received"); - } - else{ - setverdict(fail, testcasename() & ": Notification received but the content doesn't match"); - } - } else { - setverdict(fail, testcasename() & ": Notification not received"); - } - - v_boolNotification := true; - if(not v_boolResponse){repeat;} - + setverdict(pass, testcasename() & ": Attribute of resource type int2 (Ae) updated successfully"); } [] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value v_response { tc_ac.stop; @@ -7510,7 +7469,7 @@ module OneM2M_Testcases { setverdict(fail, testcasename() & ": Error, unexpected message received"); } [] tc_ac.timeout { - setverdict(inconc, testcasename() & ": No answer while updating resource type int2 (Ae) or None notification received"); + setverdict(inconc, testcasename() & ": No answer while updating resource type int2 (Ae)"); } } @@ -7521,7 +7480,7 @@ module OneM2M_Testcases { f_cf01Down(); } // end TC_CSE_SUB_BV_006 - + }//end group g_CSE_SUB_BV_006 group g_CSE_SUB_BV_007{ @@ -7529,16 +7488,14 @@ module OneM2M_Testcases { testcase TC_CSE_SUB_BV_007() runs on CseTester system CseSystem { // Local variables - var boolean v_boolNotification := false; - var boolean v_boolResponse := false; var MsgIn v_response; var integer v_aeIndex := -1; var integer v_resourceIndex := -1; - var ListOfURIs v_notificationURI := {"Not Initialized"}; var template RequestPrimitive v_createRequest; var template PrimitiveContent v_contentResponse; var RequestPrimitive v_request; - + var CseTester v_notifyHandler; + var integer v_ae2Index := -1; v_contentResponse.any_1[0].Container_optional := mw_contentContainer_rc1; // all attributes expected // Test control @@ -7550,86 +7507,63 @@ module OneM2M_Testcases { // Preamble v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi); + + f_cse_preamble_subscriptionVerification(v_notifyHandler, v_aeIndex, v_ae2Index, v_createRequest, int23); - v_createRequest := m_createSubscriptionAdvanced(f_getResourceAddress(v_aeIndex), -, v_notificationURI, m_eventNotificationCriteria(int3)); // TODO to field is initialised 2 time with parent adress resource (here and in f_cse_createResource) + v_createRequest := m_createSubscriptionAdvanced(f_getResourceAddress(v_aeIndex), -, {f_getResourceAddress(v_ae2Index)}, m_eventNotificationCriteria(int3)); // TODO this field is initialised 2 time with parent adress resource (here and in f_cse_createResource) v_resourceIndex := f_cse_createResource(int23, v_createRequest, v_aeIndex);//Subscription v_request:= f_getCreateRequestPrimitive(int3, m_createContainerBase, v_aeIndex); + f_is_component_done(v_notifyHandler); + + // Test Body + v_notifyHandler.start(f_match_notification_primitive(v_contentResponse)); // check if the notification is well received and if its content matchs + mcaPort.send(m_request(v_request)); - tc_ac.start; - alt { - [(not v_boolResponse)] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response { - tc_ac.stop; - setverdict(pass, testcasename() & ": Container resource created successfuly"); - v_boolResponse := true; - if(not v_boolNotification){repeat;} - } - [(not v_boolNotification)] mcaPort.receive(mw_request(mw_notify(?))) -> value v_response { - tc_ac.stop; - if(ischosen(v_response.primitive.requestPrimitive.primitiveContent.any_1[0].Notification.notificationEvent.representation.resource)) { - if(match(v_response.primitive.requestPrimitive.primitiveContent.any_1[0].Notification.notificationEvent.representation.resource.Container_optional, v_contentResponse.any_1[0].Container_optional)) { - setverdict(pass, testcasename() & ": Notification received"); - } - else{ - setverdict(fail, testcasename() & ": Notification received but the content doesn't match"); - } - } else if (ischosen(v_response.primitive.requestPrimitive.primitiveContent.any_1[0].Notification.notificationEvent.representation.responsePrimitive)) { - if(match(v_response.primitive.requestPrimitive.primitiveContent.any_1[0].Notification.notificationEvent.representation.responsePrimitive.primitiveContent.any_1[0].Container_optional, v_contentResponse.any_1[0].Container_optional)) { - setverdict(pass, testcasename() & ": Notification received"); - } - else{ - setverdict(fail, testcasename() & ": Notification received but the content doesn't match"); - } - } else { - setverdict(fail, testcasename() & ": Notification not received"); - } - - v_boolNotification := true; - if(not v_boolResponse){repeat;} - - } - [] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value v_response { - tc_ac.stop; - setverdict(fail, testcasename() & ": Error while creating resource type int3 (Container)"); - } - [] mcaPort.receive{ - tc_ac.stop; - setverdict(fail, testcasename() & ": Error, unexpected message received"); - } - [] tc_ac.timeout { - setverdict(inconc, testcasename() & ": No answer while creating resource type int3 (Container) or None notification received"); - } - } - + tc_ac.start; + alt { + [] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response { + tc_ac.stop; + setverdict(pass, testcasename() & ": Resource type int3 (Container) created successfully"); + } + [] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value v_response { + tc_ac.stop; + setverdict(fail, testcasename() & ": Error while creating resource type int3 (Container)"); + } + [] mcaPort.receive{ + tc_ac.stop; + setverdict(fail, testcasename() & ": Error, unexpected message received"); + } + [] tc_ac.timeout { + setverdict(inconc, testcasename() & ": No answer while creating resource type int3 (Container)"); + } + } + //Postamble f_cse_postamble_deleteResources(); //Tear down f_cf01Down(); - } // end TC_CSE_SUB_BV_007 + }//end group g_CSE_SUB_BV_007 group g_CSE_SUB_BV_008 { testcase TC_CSE_SUB_BV_008() runs on CseTester system CseSystem { // Local variables - var boolean v_boolNotification := false; - var boolean v_boolResponse := false; var MsgIn v_response; var integer v_aeIndex := -1; - var integer v_containerResourceIndex := -1; var integer v_subscriptionResourceIndex := -1; - var ListOfURIs v_notificationURI := {"Not Initialized"}; var template RequestPrimitive v_createRequest; var template PrimitiveContent v_contentResponse; - var template RequestPrimitive v_updateRequest := m_updateAeBase; var RequestPrimitive v_deleteRequest; - var PoaList v_poaList := {"http://" & PX_TESTER_ADDRESS & "/monitor"};//TODO Set a proper poa - - v_contentResponse.any_1[0].Container_optional := mw_contentContainer_rc1; // all attributes expected + var CseTester v_notifyHandler; + var integer v_ae2Index := -1; + + v_contentResponse.any_1[0].AE_optional := mw_contentAeBase; // all attributes expected // Test control @@ -7637,64 +7571,42 @@ module OneM2M_Testcases { f_cf01Up(); // Test adapter configuration - //TODO Add a notification recepient in order to be able to create a subscription resource // Preamble - v_aeIndex := f_cse_preamble_registerAe(-, v_poaList);//c_CRUDNDi); + v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi); - v_containerResourceIndex := f_cse_createResource(int3, m_createContainerBase,v_aeIndex); // Container + f_cse_preamble_subscriptionVerification(v_notifyHandler, v_aeIndex, v_ae2Index, v_createRequest, int23); + + v_createRequest := m_createSubscriptionAdvanced(f_getResourceAddress(v_aeIndex), -, {f_getResourceAddress(v_ae2Index)}, m_eventNotificationCriteria(int2)); - v_createRequest := m_createSubscriptionAdvanced(f_getResourceAddress(v_containerResourceIndex), -, v_notificationURI, m_eventNotificationCriteria(int2)); // + v_subscriptionResourceIndex := f_cse_createResource(int23, v_createRequest, v_aeIndex );//Subscription - v_subscriptionResourceIndex := f_cse_createResource(int23, v_createRequest, v_containerResourceIndex );//Subscription (Container's child resource) - - v_deleteRequest:= valueof(m_deleteRequest(f_getResourceAddress(v_containerResourceIndex))); // Container delete request + v_deleteRequest:= valueof(m_deleteRequest(f_getResourceAddress(v_aeIndex))); // Ae delete request + + f_is_component_done(v_notifyHandler); + //Test Body + v_notifyHandler.start(f_CSE_SUB_BV_008(v_contentResponse)); // check if the notification is well received and if its content matchs + mcaPort.send(m_request(v_deleteRequest)); tc_ac.start; alt { - [(not v_boolResponse)] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response { + [] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response { tc_ac.stop; - setverdict(pass, testcasename() & ": Attribute of resource type int3 (Container) deleted successfuly"); - v_boolResponse := true; - if(not v_boolNotification){repeat;} - } - [(not v_boolNotification)] mcaPort.receive(mw_request(mw_notify(?))) -> value v_response { - tc_ac.stop; - if(ischosen(v_response.primitive.requestPrimitive.primitiveContent.any_1[0].Notification.notificationEvent.representation.resource)) { - if(match(v_response.primitive.requestPrimitive.primitiveContent.any_1[0].Notification.notificationEvent.representation.resource.Container_optional, v_contentResponse.any_1[0].Container_optional)) { - setverdict(pass, testcasename() & ": Notification received"); - } - else{ - setverdict(fail, testcasename() & ": Notification received but the content doesn't match"); - } - } else if (ischosen(v_response.primitive.requestPrimitive.primitiveContent.any_1[0].Notification.notificationEvent.representation.responsePrimitive)) { - if(match(v_response.primitive.requestPrimitive.primitiveContent.any_1[0].Notification.notificationEvent.representation.responsePrimitive.primitiveContent.any_1[0].Container_optional, v_contentResponse.any_1[0].Container_optional)) { - setverdict(pass, testcasename() & ": Notification received"); - } - else{ - setverdict(fail, testcasename() & ": Notification received but the content doesn't match"); - } - } else { - setverdict(fail, testcasename() & ": Notification not received"); - } - - v_boolNotification := true; - if(not v_boolResponse){repeat;} - + setverdict(pass, testcasename() & ": resource type int2 (AE) deleted successfully"); } [] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value v_response { tc_ac.stop; - setverdict(fail, testcasename() & ": Error while deleting resource type int3 (Container)"); + setverdict(fail, testcasename() & ": Error while deleting resource type int2 (AE)"); } [] mcaPort.receive{ tc_ac.stop; setverdict(fail, testcasename() & ": Error, unexpected message received"); } [] tc_ac.timeout { - setverdict(inconc, testcasename() & ": No answer while deleting resource type int3 (Container) or None notification received"); + setverdict(inconc, testcasename() & ": No answer while deleting resource type int2 (AE)"); } - } + } //Postamble f_cse_postamble_deleteResources(); @@ -7703,6 +7615,42 @@ module OneM2M_Testcases { f_cf01Down(); } // end TC_CSE_SUB_BV_008 + + function f_CSE_SUB_BV_008( template PrimitiveContent p_primitiveContent) runs on CseTester { + var MsgIn v_response; + + map(self:mcaPort, system:mcaPort); + map(self:acPort, system:acPort); + + tc_ac.start; + alt { + [] mcaPort.receive(mw_request(mw_notify(mw_contentNotification(?)))) -> value v_response { + tc_ac.stop; + if(not(match(v_response.primitive.requestPrimitive.primitiveContent.any_1[0].Notification.subscriptionDeletion, true))) { + setverdict(fail, testcasename() & ": subscriptionDeletion attribute have to be set to TRUE"); + } + if(f_match_contentNotificationRequest(v_response.primitive.requestPrimitive, p_primitiveContent)){ + setverdict(pass, testcasename() & ": Notification received"); + } + else{ + setverdict(fail, testcasename() & ": Notification received but the content doesn't match"); + } + } + [] mcaPort.receive{ + tc_ac.stop; + setverdict(fail, testcasename() & ": Error, unexpected message received"); + } + [] tc_ac.timeout { + setverdict(inconc, testcasename() & ": No notification received"); + } + } + + mcaPort.send(m_response(valueof(m_responseNotification(int2001)))); + + unmap(self:mcaPort, system:mcaPort); + unmap(self:acPort, system:acPort); + + } //end f_CSE_SUB_BV_008 }//end group g_CSE_SUB_BV_008 @@ -7710,16 +7658,15 @@ module OneM2M_Testcases { testcase TC_CSE_SUB_BV_009() runs on CseTester system CseSystem { // Local variables - var boolean v_boolNotification := false; - var boolean v_boolResponse := false; var MsgIn v_response; var integer v_aeIndex := -1; var integer v_subscriptionResourceIndex := -1; var integer v_containerResourceIndex := -1; - var ListOfURIs v_notificationURI := {"Not Initialized"}; var template RequestPrimitive v_createRequest; var RequestPrimitive v_deleteRequest; var template PrimitiveContent v_contentResponse; + var CseTester v_notifyHandler; + var integer v_ae2Index := -1; v_contentResponse.any_1[0].Container_optional := mw_contentContainer_rc1; // all attributes expected in notification @@ -7730,47 +7677,27 @@ module OneM2M_Testcases { // Preamble v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi; - - v_createRequest := m_createSubscriptionAdvanced(f_getResourceAddress(v_aeIndex), -, v_notificationURI, m_eventNotificationCriteria(int4)); - v_containerResourceIndex := f_cse_createResource(int3, m_createContainerBase, v_aeIndex);//Container + + f_cse_preamble_subscriptionVerification(v_notifyHandler, v_aeIndex, v_ae2Index, v_createRequest, int23); + v_createRequest := m_createSubscriptionAdvanced(f_getResourceAddress(v_aeIndex), -, {f_getResourceAddress(v_ae2Index)}, m_eventNotificationCriteria(int4)); + v_subscriptionResourceIndex := f_cse_createResource(int23, v_createRequest, v_aeIndex);//Subscription (with name attribute omitted) v_deleteRequest := valueof(m_deleteRequest(f_getResourceAddress(v_containerResourceIndex)));// Container deletion request - + + f_is_component_done(v_notifyHandler); + + //Test Body + v_notifyHandler.start(f_match_notification_primitive(v_contentResponse)); // check if the notification is well received and if its content matchs + mcaPort.send(m_request(v_deleteRequest)); tc_ac.start; alt { - [(not v_boolResponse)] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response { + [] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response { tc_ac.stop; setverdict(pass, testcasename() & ": Container resource deleted successfuly"); - v_boolResponse := true; - if(not v_boolNotification){repeat;} - } - [(not v_boolNotification)] mcaPort.receive(mw_request(mw_notify(?))) -> value v_response { - tc_ac.stop; - if(ischosen(v_response.primitive.requestPrimitive.primitiveContent.any_1[0].Notification.notificationEvent.representation.resource)) { - if(match(v_response.primitive.requestPrimitive.primitiveContent.any_1[0].Notification.notificationEvent.representation.resource.Container_optional, v_contentResponse.any_1[0].Container_optional)) { - setverdict(pass, testcasename() & ": Notification received"); - } - else{ - setverdict(fail, testcasename() & ": Notification received but the content doesn't match"); - } - } else if (ischosen(v_response.primitive.requestPrimitive.primitiveContent.any_1[0].Notification.notificationEvent.representation.responsePrimitive)) { - if(match(v_response.primitive.requestPrimitive.primitiveContent.any_1[0].Notification.notificationEvent.representation.responsePrimitive.primitiveContent.any_1[0].Container_optional, v_contentResponse.any_1[0].Container_optional)) { - setverdict(pass, testcasename() & ": Notification received"); - } - else{ - setverdict(fail, testcasename() & ": Notification received but the content doesn't match"); - } - } else { - setverdict(fail, testcasename() & ": Notification not received"); - } - - v_boolNotification := true; - if(not v_boolResponse){repeat;} - } [] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value v_response { tc_ac.stop; @@ -7781,7 +7708,7 @@ module OneM2M_Testcases { setverdict(fail, testcasename() & ": Error, unexpected message received"); } [] tc_ac.timeout { - setverdict(inconc, testcasename() & ": No answer while deleting resource type int3 (Container) or None notification received"); + setverdict(inconc, testcasename() & ": No answer while deleting resource type int3 (Container)"); } } @@ -7798,58 +7725,7 @@ module OneM2M_Testcases { group g_CSE_SUB_BV_010 { testcase TC_CSE_SUB_BV_010() runs on CseTester system CseSystem { - // Local variables - var MsgIn v_response; - var integer v_aeIndex := -1; - var template RequestPrimitive v_createRequest := m_createSubscriptionBase; - var RequestPrimitive v_request; - var ResponsePrimitive v_responsePrimitive; - var template PrimitiveContent v_contentResponse; - var template Notification v_notification := mw_contentNotificationBase; - - - // Test control - - // Test component configuration - f_cf01Up(); - - // Test adapter configuration - - // Preamble - v_aeIndex := f_cse_preamble_registerAe();//c_CUDNDi); - v_notification.creator := f_getResourceAddress(v_aeIndex); // Creator ID is required (AE1 in this case) - v_notification.verificationRequest := true; - - v_request := f_getCreateRequestPrimitive(int23, v_createRequest, v_aeIndex);//Subscription with Notification URI != Originator - v_request.primitiveContent.any_1[0].Subscription_optional.notificationURI := {"Not Initialized"};// TODO set notificationURI to AE2 URI - - mcaPort.send(m_request(v_request)); - - alt { - [] mcaPort.receive(mw_request(mw_notify_2(v_notification))) -> value v_response { - tc_ac.stop; - setverdict(pass, testcasename() & ": Notification received"); - } - [] mcaPort.receive(mw_request(mw_notify(?))) -> value v_response { - tc_ac.stop; - setverdict(fail, testcasename() & ": Notification received but verificationRequest isn't set to TRUE"); - } - [] mcaPort.receive{ - tc_ac.stop; - setverdict(fail, testcasename() & ": Error, unexpected message received"); - } - [] tc_ac.timeout { - setverdict(inconc, testcasename() & ": No answer while deleting resource type int3 (Container) or None notification received"); - } - } - - //Postamble - f_cse_postamble_deleteResources(); - - //Tear down - f_cf01Down(); - } // end TC_CSE_SUB_BV_010 }//end group g_CSE_SUB_BV_010 @@ -7858,17 +7734,16 @@ module OneM2M_Testcases { testcase TC_CSE_SUB_BV_011() runs on CseTester system CseSystem { // Local variables - var boolean v_boolNotification := false; - var boolean v_boolResponse := false; var MsgIn v_response; var integer v_aeIndex := -1; var integer v_resourceIndex := -1; var Labels v_labels_1:= {"VALUE_1"}; - var ListOfURIs v_notificationURI := {"Not Initialized"}; var template PrimitiveContent v_contentResponse; var template RequestPrimitive v_createRequest; var template RequestPrimitive v_updateRequest := m_updateAeBase; var RequestPrimitive v_request; + var CseTester v_notifyHandler; + var integer v_ae2Index := -1; v_updateRequest.primitiveContent.any_1[0].AE_optional.labels := v_labels_1; v_contentResponse.any_1[0].AE_optional := mw_contentAe_allOmit; // only modified attribute expected @@ -7884,45 +7759,27 @@ module OneM2M_Testcases { // Preamble v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi); - v_createRequest := m_createSubscriptionAdvanced(f_getResourceAddress(v_aeIndex), -, v_notificationURI, omit, omit, omit, omit, omit, int2); //notificationContentType ="modified attributes" - + f_cse_preamble_subscriptionVerification(v_notifyHandler, v_aeIndex, v_ae2Index, v_createRequest, int23); + + v_createRequest := m_createSubscriptionAdvanced(f_getResourceAddress(v_aeIndex), -, {f_getResourceAddress(v_ae2Index)}, omit, omit, omit, omit, omit, int2); //notificationContentType ="modified attributes" + v_resourceIndex := f_cse_createResource(int23, v_createRequest, v_aeIndex); //Subscription v_request:= f_getUpdateRequestPrimitive(int2, v_aeIndex, v_updateRequest); + f_is_component_done(v_notifyHandler); + + // Test Body + v_notifyHandler.start(f_match_notification_primitive(v_contentResponse)); // check if the notification is well received and if its content matchs + mcaPort.send(m_request(v_request)); tc_ac.start; alt { - [(not v_boolResponse)] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response { + [] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response { tc_ac.stop; setverdict(pass, testcasename() & ": Attribute of resource type int2 (Ae) updated successfuly"); - v_boolResponse := true; - if(not v_boolNotification){repeat;} - } - [(not v_boolNotification)] mcaPort.receive(mw_request(mw_notify(?))) -> value v_response { - tc_ac.stop; - if(ischosen(v_response.primitive.requestPrimitive.primitiveContent.any_1[0].Notification.notificationEvent.representation.resource)) { - if(match(v_response.primitive.requestPrimitive.primitiveContent.any_1[0].Notification.notificationEvent.representation.resource.AE_optional, v_contentResponse.any_1[0].AE_optional)) { - setverdict(pass, testcasename() & ": Notification received"); - } - else{ - setverdict(fail, testcasename() & ": Notification received but the content doesn't match"); - } - } else if (ischosen(v_response.primitive.requestPrimitive.primitiveContent.any_1[0].Notification.notificationEvent.representation.responsePrimitive)) { - if(match(v_response.primitive.requestPrimitive.primitiveContent.any_1[0].Notification.notificationEvent.representation.responsePrimitive.primitiveContent.any_1[0].AE_optional, v_contentResponse.any_1[0].AE_optional)) { - setverdict(pass, testcasename() & ": Notification received"); - } - else{ - setverdict(fail, testcasename() & ": Notification received but the content doesn't match"); - } - } else { - setverdict(fail, testcasename() & ": Notification not received"); - } - - v_boolNotification := true; - if(not v_boolResponse){repeat;} - } + [] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value v_response { tc_ac.stop; setverdict(fail, testcasename() & ": Error while updating resource type int2 (Ae)"); @@ -7932,7 +7789,7 @@ module OneM2M_Testcases { setverdict(fail, testcasename() & ": Error, unexpected message received"); } [] tc_ac.timeout { - setverdict(inconc, testcasename() & ": No answer while updating resource type int2 (Ae) or None notification received"); + setverdict(inconc, testcasename() & ": No answer while updating resource type int2 (Ae)"); } } @@ -7949,18 +7806,17 @@ module OneM2M_Testcases { testcase TC_CSE_SUB_BV_012() runs on CseTester system CseSystem { // Local variables - var boolean v_boolNotification := false; - var boolean v_boolResponse := false; var MsgIn v_response; var integer v_aeIndex := -1; var integer v_resourceIndex := -1; var Labels v_labels_1:= {"VALUE_1"}; - var ListOfURIs v_notificationURI := {"Not Initialized"}; var template RequestPrimitive v_createRequest; var template PrimitiveContent v_contentResponse; var template RequestPrimitive v_updateRequest := m_updateAeBase; var RequestPrimitive v_request; - + var CseTester v_notifyHandler; + var integer v_ae2Index := -1; + v_updateRequest.primitiveContent.any_1[0].AE_optional.labels := v_labels_1; v_contentResponse.any_1[0].AE_optional := mw_contentAe_allOmit; // only modified attribute expected v_contentResponse.any_1[0].AE_optional.resourceID := ?; @@ -7975,44 +7831,25 @@ module OneM2M_Testcases { // Preamble v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi); - v_createRequest := m_createSubscriptionAdvanced(f_getResourceAddress(v_aeIndex), -, v_notificationURI, omit, omit, omit, omit, omit, int3); // notificationContentType ="ResourceID" - + f_cse_preamble_subscriptionVerification(v_notifyHandler, v_aeIndex, v_ae2Index, v_createRequest, int23); + + v_createRequest := m_createSubscriptionAdvanced(f_getResourceAddress(v_aeIndex), -, {f_getResourceAddress(v_ae2Index)}, omit, omit, omit, omit, omit, int3); // notificationContentType ="ResourceID" + v_resourceIndex := f_cse_createResource(int23, v_createRequest, v_aeIndex);//Subscription v_request:= f_getUpdateRequestPrimitive(int2, v_aeIndex, v_updateRequest); + f_is_component_done(v_notifyHandler); + + // Test Body + v_notifyHandler.start(f_match_notification_primitive(v_contentResponse)); // check if the notification is well received and if its content matchs + mcaPort.send(m_request(v_request)); tc_ac.start; alt { - [(not v_boolResponse)] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response { + [] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response { tc_ac.stop; setverdict(pass, testcasename() & ": Attribute of resource type int2 (Ae) updated successfuly"); - v_boolResponse := true; - if(not v_boolNotification){repeat;} - } - [(not v_boolNotification)] mcaPort.receive(mw_request(mw_notify(?))) -> value v_response { - tc_ac.stop; - if(ischosen(v_response.primitive.requestPrimitive.primitiveContent.any_1[0].Notification.notificationEvent.representation.resource)) { - if(match(v_response.primitive.requestPrimitive.primitiveContent.any_1[0].Notification.notificationEvent.representation.resource.AE_optional, v_contentResponse.any_1[0].AE_optional)) { - setverdict(pass, testcasename() & ": Notification received"); - } - else{ - setverdict(fail, testcasename() & ": Notification received but the content doesn't match"); - } - } else if (ischosen(v_response.primitive.requestPrimitive.primitiveContent.any_1[0].Notification.notificationEvent.representation.responsePrimitive)) { - if(match(v_response.primitive.requestPrimitive.primitiveContent.any_1[0].Notification.notificationEvent.representation.responsePrimitive.primitiveContent.any_1[0].AE_optional, v_contentResponse.any_1[0].AE_optional)) { - setverdict(pass, testcasename() & ": Notification received"); - } - else{ - setverdict(fail, testcasename() & ": Notification received but the content doesn't match"); - } - } else { - setverdict(fail, testcasename() & ": Notification not received"); - } - - v_boolNotification := true; - if(not v_boolResponse){repeat;} - } [] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value v_response { tc_ac.stop; @@ -8027,7 +7864,6 @@ module OneM2M_Testcases { } } - //Postamble f_cse_postamble_deleteResources(); @@ -8044,12 +7880,13 @@ module OneM2M_Testcases { var integer v_aeIndex := -1; var integer v_resourceIndex := -1; var Labels v_labels_1:= {"VALUE_1"}; - var ListOfURIs v_notificationURI := {"Not Initialized"}; var template PrimitiveContent v_contentResponse; var template RequestPrimitive v_createRequest; var template RequestPrimitive v_updateRequest := m_updateAeBase; var RequestPrimitive v_request; var template PrimitiveContent v_retrieveContentResponse; + var CseTester v_notifyHandler; + var integer v_ae2Index := -1; v_updateRequest.primitiveContent.any_1[0].AE_optional.labels := v_labels_1; v_contentResponse.any_1[0].AE_optional := mw_contentAeBase; // all attributes expected @@ -8065,16 +7902,25 @@ module OneM2M_Testcases { // Preamble v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi); - v_createRequest := m_createSubscriptionAdvanced(f_getResourceAddress(v_aeIndex), -, v_notificationURI, omit, 3); //expirationCounter set to 3 - + f_cse_preamble_subscriptionVerification(v_notifyHandler, v_aeIndex, v_ae2Index, v_createRequest, int23); + + v_createRequest := m_createSubscriptionAdvanced(f_getResourceAddress(v_aeIndex), -, {f_getResourceAddress(v_ae2Index)}, omit, 3); //expirationCounter set to 3 + v_resourceIndex := f_cse_createResource(int23, v_createRequest, v_aeIndex); // Subscription + + f_is_component_done(v_notifyHandler); + + // Test Body + v_notifyHandler.start(f_match_notification_primitive(v_contentResponse)); // check if the notification is well received and if its content matchs v_request:= f_getUpdateRequestPrimitive(int2, v_aeIndex, v_updateRequest); // AE update request - - f_CSE_SUB_BV_013_AND_014(v_request,v_contentResponse); // AE update and notification receipt - - mcaPort.send(m_request(m_retrieveResource(f_getResourceAddress(v_resourceIndex)))); - + f_update_attribute_request(v_request); // AE update + + //TODO See if we keep this f_is_component_done, it assure that the retrieve operation is executed after having sent and received the Notification + f_is_component_done(v_notifyHandler); + + mcaPort.send(m_request(m_retrieveResource(f_getResourceAddress(v_resourceIndex), f_getOriginator(v_resourceIndex)))); + tc_ac.start; alt { [] mcaPort.receive(mw_response(mw_responsePrimitiveOK(v_retrieveContentResponse))) -> value v_response { @@ -8106,6 +7952,7 @@ module OneM2M_Testcases { f_cf01Down(); } // end TC_CSE_SUB_BV_013 + }//end group g_CSE_SUB_BV_013 group g_CSE_SUB_BV_014 { @@ -8116,12 +7963,13 @@ module OneM2M_Testcases { var integer v_aeIndex := -1; var integer v_resourceIndex := -1; var Labels v_labels_1:= {"VALUE_1"}; - var ListOfURIs v_notificationURI := {"Not Initialized"}; var template PrimitiveContent v_contentResponse; var template RequestPrimitive v_createRequest; var template RequestPrimitive v_updateRequest := m_updateAeBase; var RequestPrimitive v_request; - + var CseTester v_notifyHandler; + var integer v_ae2Index := -1; + v_updateRequest.primitiveContent.any_1[0].AE_optional.labels := v_labels_1; v_contentResponse.any_1[0].AE_optional := mw_contentAeBase; // all attributes expected @@ -8135,15 +7983,25 @@ module OneM2M_Testcases { // Preamble v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi); - v_createRequest := m_createSubscriptionAdvanced(f_getResourceAddress(v_aeIndex), -, v_notificationURI, omit, 1); //expirationCounter set to 1 - + f_cse_preamble_subscriptionVerification(v_notifyHandler, v_aeIndex, v_ae2Index, v_createRequest, int23); + + v_createRequest := m_createSubscriptionAdvanced(f_getResourceAddress(v_aeIndex), -, {f_getResourceAddress(v_ae2Index)}, omit, 1); //expirationCounter set to 1 + v_resourceIndex := f_cse_createResource(int23, v_createRequest, v_aeIndex);// Subscription - v_request:= f_getUpdateRequestPrimitive(int2, v_aeIndex, v_updateRequest); // AE update request + f_is_component_done(v_notifyHandler); + + // Test Body + + v_notifyHandler.start(f_match_notification_primitive(v_contentResponse)); // check if the notification is well received and if its content matchs - f_CSE_SUB_BV_013_AND_014(v_request,v_contentResponse); // AE update and notification receipt + v_request:= f_getUpdateRequestPrimitive(int2, v_aeIndex, v_updateRequest); // AE update request + f_update_attribute_request(v_request); // AE update + + //TODO See if we keep this f_is_component_done, it assure that the retrieve operation is executed after having sent and received the Notification + f_is_component_done(v_notifyHandler); - mcaPort.send(m_request(m_retrieveResource(f_getResourceAddress(v_resourceIndex)))); + mcaPort.send(m_request(m_retrieveResource(f_getResourceAddress(v_resourceIndex), f_getOriginator(v_resourceIndex)))); tc_ac.start; alt { @@ -8173,77 +8031,23 @@ module OneM2M_Testcases { } // end TC_CSE_SUB_BV_014 }//end of group g_CSE_SUB_BV_014 - - function f_CSE_SUB_BV_013_AND_014(in RequestPrimitive p_requestPrimitive, template PrimitiveContent p_reponsePrimitive) runs on CseTester { - var MsgIn v_response; - var boolean v_boolNotification := false; - var boolean v_boolResponse := false; - - mcaPort.send(m_request(p_requestPrimitive)); - tc_ac.start; - alt { - [(not v_boolResponse)] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response { - tc_ac.stop; - setverdict(pass, testcasename() & ": Attribute of resource type int2 (Ae) updated successfuly"); - v_boolResponse := true; - if(not v_boolNotification){repeat;} - } - [(not v_boolNotification)] mcaPort.receive(mw_request(mw_notify(?))) -> value v_response { - tc_ac.stop; - if(ischosen(v_response.primitive.requestPrimitive.primitiveContent.any_1[0].Notification.notificationEvent.representation.resource)) { - if(match(v_response.primitive.requestPrimitive.primitiveContent.any_1[0].Notification.notificationEvent.representation.resource.AE_optional, p_reponsePrimitive.any_1[0].AE_optional)) { - setverdict(pass, testcasename() & ": Notification received"); - } - else{ - setverdict(fail, testcasename() & ": Notification received but the content doesn't match"); - } - } else if (ischosen(v_response.primitive.requestPrimitive.primitiveContent.any_1[0].Notification.notificationEvent.representation.responsePrimitive)) { - if(match(v_response.primitive.requestPrimitive.primitiveContent.any_1[0].Notification.notificationEvent.representation.responsePrimitive.primitiveContent.any_1[0].AE_optional, p_reponsePrimitive.any_1[0].AE_optional)) { - setverdict(pass, testcasename() & ": Notification received"); - } - else{ - setverdict(fail, testcasename() & ": Notification received but the content doesn't match"); - } - } else { - setverdict(fail, testcasename() & ": Notification not received"); - } - - v_boolNotification := true; - if(not v_boolResponse){repeat;} - - } - [] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value v_response { - tc_ac.stop; - setverdict(fail, testcasename() & ": Error while updating resource type int2 (Ae)"); - } - [] mcaPort.receive{ - tc_ac.stop; - setverdict(fail, testcasename() & ": Error, unexpected message received"); - } - [] tc_ac.timeout { - setverdict(inconc, testcasename() & ": No answer while updating resource type int2 (Ae) or None notification received"); - } - } - }// end f_CSE_SUB_BV_013_AND_014 group g_CSE_SUB_BV_015 { testcase TC_CSE_SUB_BV_015() runs on CseTester system CseSystem { // Local variables - var boolean v_boolNotification := false; - var boolean v_boolResponse := false; var MsgIn v_response; var Labels v_labels_1:= {"VALUE_1"}; - var ListOfURIs v_notificationURI := {"Not Initialized"}; - var Attribute v_attribute := {"labels",{omit,omit,{"VALUE_1"}}}; // TODO normaly value isn't expected + var Attribute v_attribute := {"labels",{omit,omit,{"VALUE_1"}}};// TODO normaly value isn't expected var integer v_aeIndex := -1; var integer v_resourceIndex := -1; var template RequestPrimitive v_createRequest; var template PrimitiveContent v_contentResponse; var template RequestPrimitive v_updateRequest := m_updateAeBase; var RequestPrimitive v_request; - var PoaList v_poaList := {"http://" & PX_TESTER_ADDRESS & "/monitor"};//TODO Set a proper poa - + var CseTester v_notifyHandler; + var integer v_ae2Index := -1; + v_updateRequest.primitiveContent.any_1[0].AE_optional.labels := v_labels_1; v_contentResponse.any_1[0].AE_optional := mw_contentAeBase; // all attributes expected @@ -8253,49 +8057,29 @@ module OneM2M_Testcases { f_cf01Up(); // Test adapter configuration - //TODO Add a notification recepient in order to be able to create a subscription resource // Preamble - v_aeIndex := f_cse_preamble_registerAe(-, v_poaList);//c_CRUDNDi); + v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi); + + f_cse_preamble_subscriptionVerification(v_notifyHandler, v_aeIndex, v_ae2Index, v_createRequest, int23); - v_createRequest := m_createSubscriptionAdvanced(f_getResourceAddress(v_aeIndex), -, v_notificationURI, m_eventNotificationCriteria(int1, {v_attribute})); + v_createRequest := m_createSubscriptionAdvanced(f_getResourceAddress(v_aeIndex), -, {f_getResourceAddress(v_ae2Index)}, m_eventNotificationCriteria(int1, {v_attribute})); v_resourceIndex := f_cse_createResource(int23, v_createRequest, v_aeIndex);//Subscription v_request:= f_getUpdateRequestPrimitive(int2, v_aeIndex, v_updateRequest); // Update request - + + f_is_component_done(v_notifyHandler); + + // Test Body + v_notifyHandler.start(f_match_notification_primitive(v_contentResponse)); // check if the notification is well received and if its content matchs + mcaPort.send(m_request(v_request)); tc_ac.start; alt { - [(not v_boolResponse)] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response { + [] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response { tc_ac.stop; setverdict(pass, testcasename() & ": Attribute of resource type int2 (Ae) updated successfuly"); - v_boolResponse := true; - if(not v_boolNotification){repeat;} - } - [(not v_boolNotification)] mcaPort.receive(mw_request(mw_notify(?))) -> value v_response { - tc_ac.stop; - if(ischosen(v_response.primitive.requestPrimitive.primitiveContent.any_1[0].Notification.notificationEvent.representation.resource)) { - if(match(v_response.primitive.requestPrimitive.primitiveContent.any_1[0].Notification.notificationEvent.representation.resource.AE_optional, v_contentResponse.any_1[0].AE_optional)) { - setverdict(pass, testcasename() & ": Notification received"); - } - else{ - setverdict(fail, testcasename() & ": Notification received but the content doesn't match"); - } - } else if (ischosen(v_response.primitive.requestPrimitive.primitiveContent.any_1[0].Notification.notificationEvent.representation.responsePrimitive)) { - if(match(v_response.primitive.requestPrimitive.primitiveContent.any_1[0].Notification.notificationEvent.representation.responsePrimitive.primitiveContent.any_1[0].AE_optional, v_contentResponse.any_1[0].AE_optional)) { - setverdict(pass, testcasename() & ": Notification received"); - } - else{ - setverdict(fail, testcasename() & ": Notification received but the content doesn't match"); - } - } else { - setverdict(fail, testcasename() & ": Wrong Notification received"); - } - - v_boolNotification := true; - if(not v_boolResponse){repeat;} - } [] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value v_response { tc_ac.stop; @@ -8324,17 +8108,16 @@ module OneM2M_Testcases { testcase TC_CSE_SUB_BV_016() runs on CseTester system CseSystem { // Local variables - var boolean v_boolResponse := false; var MsgIn v_response; var Labels v_labels_1:= {"VALUE_1"}; - var ListOfURIs v_notificationURI := {"Not Initialized"}; var Attribute v_attribute := {"appName",{omit,omit,{"VALUE_1"}}}; // TODO normaly value isn't expected var integer v_aeIndex := -1; var integer v_resourceIndex := -1; var template RequestPrimitive v_createRequest; var template RequestPrimitive v_updateRequest := m_updateAeBase; var RequestPrimitive v_request; - var PoaList v_poaList := {"http://" & PX_TESTER_ADDRESS & "/monitor"};//TODO Set a proper poa + var CseTester v_notifyHandler; + var integer v_ae2Index := -1; v_updateRequest.primitiveContent.any_1[0].AE_optional.labels := v_labels_1; @@ -8344,42 +8127,36 @@ module OneM2M_Testcases { f_cf01Up(); // Test adapter configuration - //TODO Add a notification recepient in order to be able to create a subscription resource // Preamble - v_aeIndex := f_cse_preamble_registerAe(-, v_poaList);//c_CRUDNDi); - - v_createRequest := m_createSubscriptionAdvanced(f_getResourceAddress(v_aeIndex), -, v_notificationURI, m_eventNotificationCriteria(int1, {v_attribute})); + v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi); + + f_cse_preamble_subscriptionVerification(v_notifyHandler, v_aeIndex, v_ae2Index, v_createRequest, int23); + + v_createRequest := m_createSubscriptionAdvanced(f_getResourceAddress(v_aeIndex), -, {f_getResourceAddress(v_ae2Index)}, m_eventNotificationCriteria(int1, {v_attribute})); v_resourceIndex := f_cse_createResource(int23, v_createRequest, v_aeIndex);//Subscription v_request:= f_getUpdateRequestPrimitive(int2, v_aeIndex, v_updateRequest); // Update request + f_is_component_done(v_notifyHandler); + + // Test Body + v_notifyHandler.start(f_CSE_SUB_BV_016()); // check that no notification is received + mcaPort.send(m_request(v_request)); - tc_ac.start(5.0); + tc_ac.start; alt { - [(not v_boolResponse)] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response { + [] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response { tc_ac.stop; setverdict(pass, testcasename() & ": Attribute of resource type int2 (Ae) updated successfuly"); - v_boolResponse := true; - repeat; } - [] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value v_response { tc_ac.stop; setverdict(fail, testcasename() & ": Error while updating resource type int2 (Ae)"); } - [] mcaPort.receive{ - tc_ac.stop; - setverdict(fail, testcasename() & ": Error, unexpected message received, In this case an unexpected notification might have been sent"); - } [] tc_ac.timeout { - if(v_boolResponse){ - setverdict(pass, testcasename() & ": No notification has been sent"); - } - else{ - setverdict(inconc, testcasename() & ": No answer while updating resource type int2 (Ae) or None notification received"); - } + setverdict(inconc, testcasename() & ": No answer while updating resource type int2 (Ae) or None notification received"); } } @@ -8390,21 +8167,42 @@ module OneM2M_Testcases { f_cf01Down(); } // end TC_CSE_SUB_BV_016 + + function f_CSE_SUB_BV_016() runs on CseTester { + // Local variables + var MsgIn v_response; + + map(self:mcaPort, system:mcaPort); + map(self:acPort, system:acPort); + + tc_ac.start(10.0); + alt { + [] mcaPort.receive{ + tc_ac.stop; + setverdict(fail, testcasename() & ": Error, Notification isn't expected "); + } + [] tc_ac.timeout { + setverdict(pass, testcasename() & ": No notification received"); + } + } + + unmap(self:mcaPort, system:mcaPort); + unmap(self:acPort, system:acPort); + + } //end f_CSE_SUB_BV_016 }//end group g_CSE_SUB_BV_016 group g_CSE_SUB_BV_017{ testcase TC_CSE_SUB_BV_017() runs on CseTester system CseSystem { // Local variables - var boolean v_boolNotification := false; - var boolean v_boolResponse := false; var MsgIn v_response; var integer v_aeIndex := -1; var integer v_resourceIndex := -1; - var ListOfURIs v_notificationURI := {"Not Initialized"}; - var template RequestPrimitive v_createSubscriptionRequest; + var template RequestPrimitive v_createRequest; var RequestPrimitive v_request; - var template Notification v_notification := mw_contentNotificationBase; + var CseTester v_notifyHandler; + var integer v_ae2Index := -1; // Test control @@ -8416,38 +8214,35 @@ module OneM2M_Testcases { // Preamble v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi); - v_createSubscriptionRequest := m_createSubscriptionAdvanced(f_getResourceAddress(v_aeIndex), -, v_notificationURI, omit, omit, omit, omit,f_getResourceAddress(v_aeIndex)); // SubscriberURI ="ResourceID" - v_notification.subscriptionDeletion := true; - v_notification.subscriptionReference := f_getResourceAddress(v_aeIndex);// shall be set to the same value than subscriberURI + f_cse_preamble_subscriptionVerification(v_notifyHandler, v_aeIndex, v_ae2Index, v_createRequest, int23); + + v_createRequest := m_createSubscriptionAdvanced(f_getResourceAddress(v_aeIndex), -, {f_getResourceAddress(v_ae2Index)}, omit, omit, omit, omit,f_getResourceAddress(v_ae2Index)); // SubscriberURI ="ResourceID" + + v_resourceIndex := f_cse_createResource(int23, v_createRequest, v_aeIndex); // Subsciption - v_resourceIndex := f_cse_createResource(int23, v_createSubscriptionRequest, v_aeIndex); // Subsciption - v_request := valueof(m_deleteRequest(f_getResourceAddress(v_resourceIndex))); // Subscription resource deletion request + + f_is_component_done(v_notifyHandler); + // Test Body + v_notifyHandler.start(f_CSE_SUB_BV_017(f_getResourceAddress(v_resourceIndex))); // check that no notification is received + mcaPort.send(m_request(v_request)); alt { - [(not v_boolResponse)] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response { - tc_ac.stop; - setverdict(pass, testcasename() & ": Container resource deleted successfuly"); - v_boolResponse := true; - if(not v_boolNotification){repeat;} - } - [(not v_boolNotification)] mcaPort.receive(mw_request(mw_notify_2(v_notification))) -> value v_response { + [] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response { tc_ac.stop; - setverdict(pass, testcasename() & ": Notification received"); - v_boolNotification := true; - if(not v_boolResponse){repeat;} + setverdict(pass, testcasename() & ": Subscription resource deleted successfuly"); } [] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value v_response { tc_ac.stop; - setverdict(fail, testcasename() & ": Error while deleting resource type int3 (Container)"); + setverdict(fail, testcasename() & ": Error while deleting resource type int23 (Subscription)"); } [] mcaPort.receive{ tc_ac.stop; setverdict(fail, testcasename() & ": Error, unexpected message received"); } [] tc_ac.timeout { - setverdict(inconc, testcasename() & ": No answer while deleting resource type int3 (Container) or None notification received"); + setverdict(inconc, testcasename() & ": No answer while deleting resource type int23 (Subscription)"); } } @@ -8458,6 +8253,40 @@ module OneM2M_Testcases { f_cf01Down(); } // end TC_CSE_SUB_BV_017 + + function f_CSE_SUB_BV_017(in XSD.AnyURI p_subscriptionReference) runs on CseTester { + // Local variables + var MsgIn v_response; + var template Notification v_notificationRequest := mw_contentNotificationBase; + + v_notificationRequest.subscriptionDeletion := true; + v_notificationRequest.subscriptionReference := p_subscriptionReference; + + + map(self:mcaPort, system:mcaPort); + map(self:acPort, system:acPort); + + tc_ac.start; + alt { + [] mcaPort.receive(mw_request(mw_notify(v_notificationRequest))) -> value v_response { + tc_ac.stop; + setverdict(pass, testcasename() & ": Notification received"); + } + [] mcaPort.receive{ + tc_ac.stop; + setverdict(fail, testcasename() & ": Error, unexpected message received"); + } + [] tc_ac.timeout { + setverdict(inconc, testcasename() & ": No notification received"); + } + } + + unmap(self:mcaPort, system:mcaPort); + unmap(self:acPort, system:acPort); + + } //end f_CSE_SUB_BV_017 + + }//end group g_CSE_SUB_BV_017 group g_CSE_SUB_BV_018 { @@ -8465,22 +8294,19 @@ module OneM2M_Testcases { testcase TC_CSE_SUB_BV_018() runs on CseTester system CseSystem { // Local variables const integer numberOfAggregatedNotification := 3; - var integer i; - var boolean v_boolNotification := false; - var boolean v_boolResponse := false; var MsgIn v_response; var Labels v_labels_1:= {"VALUE_1"}; var Labels v_labels_2:= {"VALUE_2"}; var Labels v_labels_3:= {"VALUE_3"}; - var ListOfURIs v_notificationURI := {"Not Initialized"}; var integer v_aeIndex := -1; var integer v_resourceIndex := -1; var template RequestPrimitive v_createRequest; var template PrimitiveContent v_contentResponse; var template RequestPrimitive v_updateRequest := m_updateAeBase; var RequestPrimitive v_request; - var PoaList v_poaList := {"http://" & PX_TESTER_ADDRESS & "/monitor"};//TODO Set a proper poa - + var CseTester v_notifyHandler; + var integer v_ae2Index := -1; + v_contentResponse.any_1[0].AE_optional := mw_contentAeBase; // all attributes expected // Test control @@ -8489,77 +8315,32 @@ module OneM2M_Testcases { f_cf01Up(); // Test adapter configuration - //TODO Add a notification recepient in order to be able to create a subscription resource // Preamble - v_aeIndex := f_cse_preamble_registerAe(-, v_poaList);//c_CRUDNDi); + v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi); - v_createRequest := m_createSubscriptionAdvanced(f_getResourceAddress(v_aeIndex), -, v_notificationURI,omit,omit,m_batchNotifyNumber3Duration1(numberOfAggregatedNotification));// TODO fix the duration + f_cse_preamble_subscriptionVerification(v_notifyHandler, v_aeIndex, v_ae2Index, v_createRequest, int23); + + v_createRequest := m_createSubscriptionAdvanced(f_getResourceAddress(v_aeIndex), -, {f_getResourceAddress(v_ae2Index)},omit,omit,m_batchNotifyNumber3Duration1(numberOfAggregatedNotification));// TODO fix the duration v_resourceIndex := f_cse_createResource(int23, v_createRequest, v_aeIndex);//Subscription - v_updateRequest.primitiveContent.any_1[0].AE_optional.labels := v_labels_1; + f_is_component_done(v_notifyHandler); + + // Test Body + v_notifyHandler.start(f_CSE_SUB_BV_018(v_contentResponse, numberOfAggregatedNotification)); // check that no notification is received + + v_updateRequest.primitiveContent.any_1[0].AE_optional.labels := v_labels_1; v_request:= f_getUpdateRequestPrimitive(int2, v_aeIndex, v_updateRequest); // Update request 1 - f_CSE_SUB_BV_UPDATE_WITHOUT_NOTIFY(v_request); + f_update_attribute_request(v_request); v_updateRequest.primitiveContent.any_1[0].AE_optional.labels := v_labels_2; v_request:= f_getUpdateRequestPrimitive(int2, v_aeIndex, v_updateRequest); // Update request 2 - f_CSE_SUB_BV_UPDATE_WITHOUT_NOTIFY(v_request); + f_update_attribute_request(v_request); v_updateRequest.primitiveContent.any_1[0].AE_optional.labels := v_labels_3; v_request:= f_getUpdateRequestPrimitive(int2, v_aeIndex, v_updateRequest); // Update request 3 - - mcaPort.send(m_request(v_request)); - tc_ac.start; - alt { - [(not v_boolResponse)] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response { - tc_ac.stop; - setverdict(pass, testcasename() & ": Attribute of resource type int2 (Ae) updated successfuly"); - v_boolResponse := true; - if(not v_boolNotification){repeat;} - } - [(not v_boolNotification)] mcaPort.receive(mw_request(mw_aggregatedNotifyBase)) -> value v_response { - tc_ac.stop; - if(lengthof(v_response.primitive.requestPrimitive.primitiveContent.any_1[0].AggregatedNotification.notification_list) == numberOfAggregatedNotification){ - for(i := 0; i<numberOfAggregatedNotification; i := i + 1){ - if(ischosen(v_response.primitive.requestPrimitive.primitiveContent.any_1[0].AggregatedNotification.notification_list[i].notificationEvent.representation.resource)) { - if(match(v_response.primitive.requestPrimitive.primitiveContent.any_1[0].AggregatedNotification.notification_list[i].notificationEvent.representation.resource.AE_optional, v_contentResponse.any_1[0].AE_optional)) { - setverdict(pass, testcasename() & ": Notification received"); - } - else{ - setverdict(fail, testcasename() & ": Notification received but the content doesn't match"); - } - } else if (ischosen(v_response.primitive.requestPrimitive.primitiveContent.any_1[0].AggregatedNotification.notification_list[i].notificationEvent.representation.responsePrimitive)) { - if(match(v_response.primitive.requestPrimitive.primitiveContent.any_1[0].AggregatedNotification.notification_list[i].notificationEvent.representation.responsePrimitive.primitiveContent.any_1[0].AE_optional, v_contentResponse.any_1[0].AE_optional)) { - setverdict(pass, testcasename() & ": Notification received"); - } - else{ - setverdict(fail, testcasename() & ": Notification received but the content doesn't match"); - } - } else { - setverdict(fail, testcasename() & ": Notification not received"); - } - } - - v_boolNotification := true; - if(not v_boolResponse){repeat;} - } - else { - setverdict(fail, testcasename() & ": Aggregated Notification is not composed of 3 notifications"); - } - } - [] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value v_response { - tc_ac.stop; - setverdict(fail, testcasename() & ": Error while updating resource type int2 (Ae)"); - } - [] mcaPort.receive{ - tc_ac.stop; - setverdict(fail, testcasename() & ": Error, unexpected message received"); - } - [] tc_ac.timeout { - setverdict(inconc, testcasename() & ": No answer while updating resource type int2 (Ae) or None notification received"); - } - } + f_update_attribute_request(v_request); //Postamble f_cse_postamble_deleteResources(); @@ -8568,81 +8349,28 @@ module OneM2M_Testcases { f_cf01Down(); } // end TC_CSE_SUB_BV_018 - - }//end group g_CSE_SUB_BV_018 - - group g_CSE_SUB_BV_019 { - testcase TC_CSE_SUB_BV_019() runs on CseTester system CseSystem { + function f_CSE_SUB_BV_018(template PrimitiveContent p_primitiveContent,in integer p_numberOfAggregatedNotification) runs on CseTester { // Local variables - const integer numberOfAggregatedNotification := 3; - var integer i; - var boolean v_boolNotification := false; - var boolean v_boolResponse := false; var MsgIn v_response; - var Labels v_labels_1:= {"VALUE_1"}; - var Labels v_labels_2:= {"VALUE_2"}; - var ListOfURIs v_notificationURI := {"Not Initialized"}; - var integer v_aeIndex := -1; - var integer v_resourceIndex := -1; - var template RequestPrimitive v_createRequest; - var template PrimitiveContent v_contentResponse; - var template RequestPrimitive v_updateRequest := m_updateAeBase; - var RequestPrimitive v_request; - var PoaList v_poaList := {"http://" & PX_TESTER_ADDRESS & "/monitor"};//TODO Set a proper poa - - v_contentResponse.any_1[0].AE_optional := mw_contentAeBase; // all attributes expected - - // Test control - - // Test component configuration - f_cf01Up(); - // Test adapter configuration - //TODO Add a notification recepient in order to be able to create a subscription resource + map(self:mcaPort, system:mcaPort); + map(self:acPort, system:acPort); - // Preamble - v_aeIndex := f_cse_preamble_registerAe(-, v_poaList);//c_CRUDNDi); - - v_createRequest := m_createSubscriptionAdvanced(f_getResourceAddress(v_aeIndex), -, v_notificationURI,omit,omit,m_batchNotifyNumber3Duration1(numberOfAggregatedNotification));// TODO fix the duration to 3* 5s - - v_resourceIndex := f_cse_createResource(int23, v_createRequest, v_aeIndex);//Subscription - - v_updateRequest.primitiveContent.any_1[0].AE_optional.labels := v_labels_1; - v_request:= f_getUpdateRequestPrimitive(int2, v_aeIndex, v_updateRequest); // Update request 1 - f_CSE_SUB_BV_UPDATE_WITHOUT_NOTIFY(v_request); - - v_updateRequest.primitiveContent.any_1[0].AE_optional.labels := v_labels_2; - v_request:= f_getUpdateRequestPrimitive(int2, v_aeIndex, v_updateRequest); // Update request 2 - f_CSE_SUB_BV_UPDATE_WITHOUT_NOTIFY(v_request); - tc_ac.start; alt { [] mcaPort.receive(mw_request(mw_aggregatedNotifyBase)) -> value v_response { tc_ac.stop; - if(lengthof(v_response.primitive.requestPrimitive.primitiveContent.any_1[0].AggregatedNotification.notification_list) == 2){ - for(i := 0; i<2; i := i + 1){ - if(ischosen(v_response.primitive.requestPrimitive.primitiveContent.any_1[0].AggregatedNotification.notification_list[i].notificationEvent.representation.resource)) { - if(match(v_response.primitive.requestPrimitive.primitiveContent.any_1[0].AggregatedNotification.notification_list[i].notificationEvent.representation.resource.AE_optional, v_contentResponse.any_1[0].AE_optional)) { - setverdict(pass, testcasename() & ": Notification received"); - } - else{ - setverdict(fail, testcasename() & ": Notification received but the content doesn't match"); - } - } else if (ischosen(v_response.primitive.requestPrimitive.primitiveContent.any_1[0].AggregatedNotification.notification_list[i].notificationEvent.representation.responsePrimitive)) { - if(match(v_response.primitive.requestPrimitive.primitiveContent.any_1[0].AggregatedNotification.notification_list[i].notificationEvent.representation.responsePrimitive.primitiveContent.any_1[0].AE_optional, v_contentResponse.any_1[0].AE_optional)) { - setverdict(pass, testcasename() & ": Notification received"); - } - else{ - setverdict(fail, testcasename() & ": Notification received but the content doesn't match"); - } - } else { - setverdict(fail, testcasename() & ": Notification not received"); - } - } + if(p_numberOfAggregatedNotification == lengthof(v_response.primitive.requestPrimitive.primitiveContent.any_1[0].AggregatedNotification.notification_list)){ + if(f_match_contentNotificationRequest(v_response.primitive.requestPrimitive, p_primitiveContent)){ + setverdict(pass, testcasename() & ": Notification received"); + } + else{ + setverdict(fail, testcasename() & ": Notification received but the content doesn't match"); + } } else { - setverdict(fail, testcasename() & ": Aggregated Notification is not composed of 3 notifications"); + setverdict(fail, testcasename() & ": Number of Notification in Aggregatednotification isn't right"); } } [] mcaPort.receive{ @@ -8650,15 +8378,70 @@ module OneM2M_Testcases { setverdict(fail, testcasename() & ": Error, unexpected message received"); } [] tc_ac.timeout { - setverdict(inconc, testcasename() & ": No answer while updating resource type int2 (Ae) or None notification received"); + setverdict(inconc, testcasename() & ": No notification received"); } - } - - //Postamble - f_cse_postamble_deleteResources(); + } + + unmap(self:mcaPort, system:mcaPort); + unmap(self:acPort, system:acPort); - //Tear down - f_cf01Down(); + } //end f_CSE_SUB_BV_018 + + }//end group g_CSE_SUB_BV_018 + + group g_CSE_SUB_BV_019 { + + testcase TC_CSE_SUB_BV_019() runs on CseTester system CseSystem { + // Local variables + const integer numberOfAggregatedNotification := 3; + var MsgIn v_response; + var Labels v_labels_1:= {"VALUE_1"}; + var Labels v_labels_2:= {"VALUE_2"}; + var integer v_aeIndex := -1; + var integer v_resourceIndex := -1; + var template RequestPrimitive v_createRequest; + var template PrimitiveContent v_contentResponse; + var template RequestPrimitive v_updateRequest := m_updateAeBase; + var RequestPrimitive v_request; + var CseTester v_notifyHandler; + var integer v_ae2Index := -1; + + v_contentResponse.any_1[0].AE_optional := mw_contentAeBase; // all attributes expected + + // Test control + + // Test component configuration + f_cf01Up(); + + // Test adapter configuration + + // Preamble + v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi); + + f_cse_preamble_subscriptionVerification(v_notifyHandler, v_aeIndex, v_ae2Index, v_createRequest, int23); + + v_createRequest := m_createSubscriptionAdvanced(f_getResourceAddress(v_aeIndex), -, {f_getResourceAddress(v_ae2Index)},omit,omit,m_batchNotifyNumber3Duration1(numberOfAggregatedNotification));// TODO fix the duration + + v_resourceIndex := f_cse_createResource(int23, v_createRequest, v_aeIndex);//Subscription + + f_is_component_done(v_notifyHandler); + + // Test Body + v_notifyHandler.start(f_CSE_SUB_BV_018(v_contentResponse, 2)); // check that no notification is received + + v_updateRequest.primitiveContent.any_1[0].AE_optional.labels := v_labels_1; + v_request:= f_getUpdateRequestPrimitive(int2, v_aeIndex, v_updateRequest); // Update request 1 + f_update_attribute_request(v_request); + + v_updateRequest.primitiveContent.any_1[0].AE_optional.labels := v_labels_2; + v_request:= f_getUpdateRequestPrimitive(int2, v_aeIndex, v_updateRequest); // Update request 2 + f_update_attribute_request(v_request); + + //Postamble + f_cse_postamble_deleteResources(); + + //Tear down + f_cf01Down(); } // end TC_CSE_SUB_BV_019 @@ -8669,21 +8452,18 @@ module OneM2M_Testcases { testcase TC_CSE_SUB_BV_020() runs on CseTester system CseSystem { // Local variables const integer numberOfAggregatedNotification := 3; - var integer i; - var boolean v_boolNotification := false; - var boolean v_boolResponse := false; var MsgIn v_response; var Labels v_labels_1:= {"VALUE_1"}; var Labels v_labels_2:= {"VALUE_2"}; var Labels v_labels_3:= {"VALUE_3"}; - var ListOfURIs v_notificationURI := {"Not Initialized"}; var integer v_aeIndex := -1; var integer v_resourceIndex := -1; var template RequestPrimitive v_createRequest; var template PrimitiveContent v_contentResponse; var template RequestPrimitive v_updateRequest := m_updateAeBase; var RequestPrimitive v_request; - var PoaList v_poaList := {"http://" & PX_TESTER_ADDRESS & "/monitor"};//TODO Set a proper poa + var CseTester v_notifyHandler; + var integer v_ae2Index := -1; v_contentResponse.any_1[0].AE_optional := mw_contentAeBase; // all attributes expected @@ -8693,74 +8473,37 @@ module OneM2M_Testcases { f_cf01Up(); // Test adapter configuration - //TODO Add a notification recepient in order to be able to create a subscription resource // Preamble - v_aeIndex := f_cse_preamble_registerAe(-, v_poaList);//c_CRUDNDi); - - v_createRequest := m_createSubscriptionAdvanced(f_getResourceAddress(v_aeIndex), -, v_notificationURI,omit,omit,m_batchNotifyNumber3Duration1(numberOfAggregatedNotification), true);// TODO fix the duration - + v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi); + + f_cse_preamble_subscriptionVerification(v_notifyHandler, v_aeIndex, v_ae2Index, v_createRequest, int23); + + v_createRequest := m_createSubscriptionAdvanced(f_getResourceAddress(v_aeIndex), -, {f_getResourceAddress(v_ae2Index)},omit,omit,m_batchNotifyNumber3Duration1(numberOfAggregatedNotification), true);// TODO fix the duration + + //TODO We Need to check if the IUT send a notification only for the latest update operation + // like we match a Notification we have to verify if it is the first (unvalid behavior) or the last (valid behavior) + // maybe we need to synchronise our components + v_resourceIndex := f_cse_createResource(int23, v_createRequest, v_aeIndex);//Subscription + f_is_component_done(v_notifyHandler); + + // Test Body + v_notifyHandler.start(f_match_notification_primitive(v_contentResponse)); // check if the notification is well received and if its content matchs + v_updateRequest.primitiveContent.any_1[0].AE_optional.labels := v_labels_1; v_request:= f_getUpdateRequestPrimitive(int2, v_aeIndex, v_updateRequest); // Update request 1 - f_CSE_SUB_BV_UPDATE_WITHOUT_NOTIFY(v_request); + f_update_attribute_request(v_request); v_updateRequest.primitiveContent.any_1[0].AE_optional.labels := v_labels_2; v_request:= f_getUpdateRequestPrimitive(int2, v_aeIndex, v_updateRequest); // Update request 2 - f_CSE_SUB_BV_UPDATE_WITHOUT_NOTIFY(v_request); + f_update_attribute_request(v_request); v_updateRequest.primitiveContent.any_1[0].AE_optional.labels := v_labels_3; v_request:= f_getUpdateRequestPrimitive(int2, v_aeIndex, v_updateRequest); // Update request 3 - - mcaPort.send(m_request(v_request)); - tc_ac.start; - alt { - [(not v_boolResponse)] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response { - tc_ac.stop; - setverdict(pass, testcasename() & ": Attribute of resource type int2 (Ae) updated successfuly"); - v_boolResponse := true; - if(not v_boolNotification){repeat;} - } - [(not v_boolNotification)] mcaPort.receive(mw_request(mw_notify(?))) -> value v_response { - tc_ac.stop; - if(ischosen(v_response.primitive.requestPrimitive.primitiveContent.any_1[0].Notification.notificationEvent.representation.resource)) { - if(match(v_response.primitive.requestPrimitive.primitiveContent.any_1[0].Notification.notificationEvent.representation.resource.AE_optional, v_contentResponse.any_1[0].AE_optional)) { - setverdict(pass, testcasename() & ": Notification received"); - } - else{ - setverdict(fail, testcasename() & ": Notification received but the content doesn't match"); - } - } else if (ischosen(v_response.primitive.requestPrimitive.primitiveContent.any_1[0].Notification.notificationEvent.representation.responsePrimitive)) { - if(match(v_response.primitive.requestPrimitive.primitiveContent.any_1[0].Notification.notificationEvent.representation.responsePrimitive.primitiveContent.any_1[0].AE_optional, v_contentResponse.any_1[0].AE_optional)) { - setverdict(pass, testcasename() & ": Notification received"); - } - else{ - setverdict(fail, testcasename() & ": Notification received but the content doesn't match"); - } - } else { - setverdict(fail, testcasename() & ": Wrong Notification received"); - } - v_boolNotification := true; - if(not v_boolResponse){repeat;} - } - [] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value v_response { - tc_ac.stop; - setverdict(fail, testcasename() & ": Error while updating resource type int2 (Ae)"); - } - [] mcaPort.receive(mw_request(mw_aggregatedNotifyBase)) -> value v_response { - tc_ac.stop; - setverdict(fail, testcasename() & ": Error Aggregated notification is not expected"); - } - [] mcaPort.receive{ - tc_ac.stop; - setverdict(fail, testcasename() & ": Error, unexpected message received"); - } - [] tc_ac.timeout { - setverdict(inconc, testcasename() & ": No answer while updating resource type int2 (Ae) or None notification received"); - } - } - + f_update_attribute_request(v_request); + //Postamble f_cse_postamble_deleteResources(); @@ -8770,39 +8513,6 @@ module OneM2M_Testcases { } // end TC_CSE_SUB_BV_020 }//end group g_CSE_SUB_BV_020 - - function f_CSE_SUB_BV_UPDATE_WITHOUT_NOTIFY(in RequestPrimitive p_requestPrimitive) runs on CseTester { - var MsgIn v_response; - var boolean v_boolResponse := false; - - mcaPort.send(m_request(p_requestPrimitive)); - tc_ac.start(5.0); - alt { - [(not v_boolResponse)] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response { - tc_ac.stop; - setverdict(pass, testcasename() & ": Attribute of resource type int2 (Ae) updated successfuly"); - v_boolResponse := true; - repeat; - } - - [] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value v_response { - tc_ac.stop; - setverdict(fail, testcasename() & ": Error while updating resource type int2 (Ae)"); - } - [] mcaPort.receive{ - tc_ac.stop; - setverdict(fail, testcasename() & ": Error, unexpected message received, In this case an unexpected notification might have been sent"); - } - [] tc_ac.timeout { - if(v_boolResponse){ - setverdict(pass, testcasename() & ": No notification has been sent"); - } - else{ - setverdict(inconc, testcasename() & ": No answer while updating resource type int2 (Ae) or None notification received"); - } - } - } - }// end f_CSE_SUB_BV_UPDATE_WITHOUT_NOTIFY }//end group Subscription_And_Notification