diff --git a/LibOneM2M/OneM2M_Functions.ttcn b/LibOneM2M/OneM2M_Functions.ttcn index 163acc704b67f27fd9bbd3b2a48bf37eb5ef378a..c6c8d18024954147f9e66e8dc0d998e858820241 100644 --- a/LibOneM2M/OneM2M_Functions.ttcn +++ b/LibOneM2M/OneM2M_Functions.ttcn @@ -39,7 +39,7 @@ module OneM2M_Functions { map(self:acPort, system:acPort); activate(a_default()); - vc_a_cse := activate(a_cse_cf01()); + vc_aeSimu := activate(a_cse_cf01()); // Initialize AE2 if(p_auxiliaryAe2Required) { @@ -92,7 +92,7 @@ module OneM2M_Functions { map(self:utPort, system:utPort); } activate(a_default()); - vc_a_cse := activate(a_cse_cf02_ae1()); + vc_aeSimu := activate(a_cse_cf02_ae1()); vc_cse1.start(f_cf02UpCse1()); vc_cse1.done; @@ -148,7 +148,7 @@ module OneM2M_Functions { map(self:mccPortIn, system:mccPortIn); map(self:acPort, system:acPort); activate(a_default()); - vc_a_cse := activate(a_cse_cf02_cse1()); + vc_cseSimu := activate(a_cse_cf02_cse1()); vc_ae1.start(f_cf02UpAe1()); vc_ae1.done; @@ -198,7 +198,7 @@ module OneM2M_Functions { map(self:utPort, system:utPort); } activate(a_default()); - vc_a_ae := activate(a_ae_cf03()); + vc_cseSimu := activate(a_cse_cf03()); // Connect @@ -225,7 +225,7 @@ module OneM2M_Functions { map(self:mccPortIn, system:mccPortIn); map(self:acPort, system:acPort); activate(a_default()); - vc_a_cse := activate(a_cse_cf04()); + vc_cseSimu := activate(a_cse_cf04()); // Connect @@ -938,7 +938,10 @@ module OneM2M_Functions { var integer i; var XSD.ID v_resourceAddress; var RequestPrimitive v_request; - + var boolean v_deregistrationPerformed := false; + var template UtTriggerPrimitive v_utRequest := m_utDelete; + var universal charstring v_action := __SCOPE__ & ": Please, perform deregistration by sending a valid DELETE Request for remoteCSE to "; + if (PX_RUN_POSTAMBLE) { if(vc_config == e_cf02CseSimuMaster) { @@ -949,13 +952,14 @@ module OneM2M_Functions { for(i := lengthof(vc_resourcesIndexToBeDeleted) -1; i >=0; i := i - 1) { - if(ischosen(vc_resourcesList[vc_resourcesIndexToBeDeleted[i]].resource.remoteCSE) and PX_MN_CSE) { + if(ischosen(vc_resourcesList[vc_resourcesIndexToBeDeleted[i]].resource.remoteCSE)) { v_resourceAddress := f_getResourceAddress(vc_resourcesIndexToBeDeleted[i], e_nonHierarchical, e_spRelative); + v_deregistrationPerformed := true; } else { v_resourceAddress := f_getResourceAddress(vc_resourcesIndexToBeDeleted[i]); } - v_request := valueof(m_delete(v_resourceAddress, f_getOriginator(vc_resourcesIndexToBeDeleted[i],false))); + v_request := valueof(m_delete(v_resourceAddress, f_getOriginator(vc_resourcesIndexToBeDeleted[i], vc_testSystemRole))); mccPort.send(f_getMsgOutPrimitive(m_request(v_request))); @@ -973,8 +977,68 @@ module OneM2M_Functions { log(__SCOPE__&" INFO: No answer while deleting resource " & v_request.to_); } } - } + + if(not(v_deregistrationPerformed)) { + if(vc_localRemoteCseIndex != -1) { + //Deregistration by Registrar (Test System) + mccPort.send(f_getMsgOutPrimitive(m_request(m_retrieveChildReferences(f_getResourceAddress(), f_getOriginator(vc_remoteCseIndex), {int16})))); + tc_ac.start; + alt { + [] mccPort.receive(mw_response(mw_responsePrimitiveOK)) -> value vc_response { + tc_ac.stop; + log(__SCOPE__&":INFO: Resource retrieved successfuly"); + v_resourceAddress := vc_response.primitive.responsePrimitive.primitiveContent.cSEBase.choice.childResource_list[0].base; + v_request := valueof(m_delete(v_resourceAddress, PX_CSE1_ID)); + + mccPort.send(f_getMsgOutPrimitive(m_request(v_request))); + + tc_ac.start; + alt { + [] mccPort.receive(mw_response(mw_responsePrimitiveOK)) { + tc_ac.stop; + log(__SCOPE__&" INFO: Resource " & v_request.to_ & " deleted"); + v_deregistrationPerformed := true; + } + [] mccPort.receive(mw_response(mw_responsePrimitiveKO)) { + tc_ac.stop; + log(__SCOPE__&" INFO: Error while deleting resource " & v_request.to_); + } + [] tc_ac.timeout { + log(__SCOPE__&" INFO: No answer while deleting resource " & v_request.to_); + } + } + } + [] mccPort.receive(mw_response(mw_responsePrimitiveKO)) -> value vc_response { + tc_ac.stop; + log(__SCOPE__&":INFO: Error while retrieving resource"); + } + [] tc_ac.timeout { + log(__SCOPE__&":INFO: No answer while retrieving resource"); + } + } + + if(not(v_deregistrationPerformed)) { + //Deregistration by Registree (IUT) + //Send trigger message for deregistration + v_utRequest.requestPrimitive.to_ := f_getLocalResourceAddress(vc_localRemoteCseIndex); + f_sendUtPrimitive(v_utRequest, v_action & f_getLocalResourceAddress(vc_localRemoteCseIndex)); + + tc_ac.start; + alt { + [] mccPortIn.receive(mw_request(mw_delete(f_getLocalResourceAddress(vc_localRemoteCseIndex)))) -> value vc_request { + tc_ac.stop; + f_processDeleteRequestPrimitive(vc_request.primitive.requestPrimitive); + mccPortIn.send(f_getMsgOutPrimitive(m_response(vc_response.primitive.responsePrimitive))); + log(__SCOPE__&": INFO: Deregistration performed successfully"); + } + [] tc_ac.timeout { + log(__SCOPE__&": INFO: No deregistration performed"); + } + } + } + } + } } } @@ -1234,7 +1298,7 @@ module OneM2M_Functions { v_request := f_getUpdateRequestPrimitive(p_resourceType, p_resourceIndex, p_request); - mcaPort.send(f_getMsgOutPrimitive(m_request(valueof(p_request), p_nullFields))); + mcaPort.send(f_getMsgOutPrimitive(m_request(valueof(v_request), p_nullFields))); tc_ac.start; alt { [] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value vc_response { @@ -2443,7 +2507,7 @@ module OneM2M_Functions { setverdict(pass, __SCOPE__&":INFO: Resource type remoteCSE created successfuly"); f_checkAttributesToBeSaved(int16, v_request, v_response.primitive.responsePrimitive); vc_remoteCseIndex := f_setResource(v_response.primitive.responsePrimitive.primitiveContent, int16, -1); - v_localRemoteCSEResource := f_generateLocalResource(m_primitiveContentRemoteCSE(m_contentCreateRemoteCSE(PX_CSE_NAME,omit,PX_CSE_ID,PX_CSE_ID)),vc_cSEBaseIndex, int16); + v_localRemoteCSEResource := f_generateLocalResource(valueof(m_primitiveContentRemoteCSE(m_contentLocalRemoteCSEResource)), vc_cSEBaseIndex, int16); vc_localRemoteCseIndex := f_setLocalResource(v_localRemoteCSEResource, int16, vc_cSEBaseIndex); } [] mccPort.receive(mw_response(mw_responsePrimitiveKO)) { @@ -2474,15 +2538,12 @@ module OneM2M_Functions { var MsgIn v_request; var ResponsePrimitive v_response; - var PrimitiveContent v_remoteCSEResource; + var PrimitiveContent v_localRemoteCSEResource; var integer v_resourceIndex := -1; var template UtTriggerPrimitive v_utRequest := m_utCreateRemoteCSE; var charstring v_action := "Please, send a CSE registration request"; - var integer v_parentIndex := vc_localRemoteCseIndex; var ResponsePrimitive v_responsePrimitive; - var PrimitiveContent v_announcedResource; var boolean v_remoteCSERegistered:=false; - var integer v_ResourceIndex := -1; //Activate defaults when running on a PTC f_cse_activateDefaults_cse1(); @@ -2495,8 +2556,8 @@ module OneM2M_Functions { [not v_remoteCSERegistered] mccPortIn.receive(mw_request(p_requestPrimitive)) -> value v_request { tc_ac.stop; setverdict(pass, __SCOPE__&":INFO: Resource type remoteCSE created successfuly"); - v_remoteCSEResource := f_generateLocalResource(v_request.primitive.requestPrimitive.primitiveContent, vc_cSEBaseIndex, int16);//TODO Get index from v_request.primitive.requestPrimitive.to_ - vc_localRemoteCseIndex := f_setLocalResource(v_remoteCSEResource, int16, vc_cSEBaseIndex); + v_localRemoteCSEResource := f_generateLocalResource(v_request.primitive.requestPrimitive.primitiveContent, vc_cSEBaseIndex, int16);//TODO Get index from v_request.primitive.requestPrimitive.to_ + vc_localRemoteCseIndex := f_setLocalResource(v_localRemoteCSEResource, int16, vc_cSEBaseIndex); v_response := valueof(m_responsePrimitive(int2001,v_request.primitive.requestPrimitive.requestIdentifier)); v_response.from_ := PX_CSE1_ID; @@ -2504,7 +2565,7 @@ module OneM2M_Functions { v_response.primitiveContent.remoteCSE := vc_localResourcesList[vc_localRemoteCseIndex].resource.remoteCSE; mccPortIn.send(f_getMsgOutPrimitive(m_response(v_response))); - vc_remoteCseIndex := f_setResource(valueof(m_primitiveContentRemoteCSE(m_contentMyRemoteCSEResource)), int16, -1); + vc_remoteCseIndex := f_setResource(valueof(m_primitiveContentRemoteCSE(m_contentMyRemoteCSEResource)), int16, -1, false); v_resourceIndex := vc_remoteCseIndex; v_remoteCSERegistered:=true; tc_ac.start(10.0); @@ -2941,12 +3002,40 @@ module OneM2M_Functions { log(__SCOPE__&": WARNING: Unexpected Notification for Subscription Verification message received"); repeat; } - } + } - /** - * @desc Cse altstep for config 02 on CSE1 (AE1 as master) + /** + * @desc Cse altstep for config 02 */ + altstep a_cse_cf02_ae1() runs on AeSimu { + [] a_cse_aeSimu(); + } + + /** + * @desc Cse altstep for config 02 + */ altstep a_cse_cf02_cse1() runs on CseSimu { + [] a_cse_cseSimu(); + } + + /** + * @desc Cse altstep for config 03 + */ + altstep a_cse_cf03() runs on CseSimu { + [] a_ae_cseSimu(); + } + + /** + * @desc Cse altstep for config 04 + */ + altstep a_cse_cf04() runs on CseSimu { + [] a_cse_cseSimu(); + } + + /** + * @desc Altstep for CseSimu + */ + altstep a_cse_cseSimu() runs on CseSimu { var PrimitiveContent v_localResource; var integer v_localResourceIndex := -1; @@ -2960,7 +3049,7 @@ module OneM2M_Functions { v_localResourceIndex := f_processCreateRequestPrimitive(v_request.primitive.requestPrimitive); - mccPortIn.send(f_getMsgOutPrimitive(m_response(v_response))); + mccPortIn.send(f_getMsgOutPrimitive(m_response(vc_response.primitive.responsePrimitive))); tc_ac.start(10.0); repeat; } @@ -3002,7 +3091,7 @@ module OneM2M_Functions { //Send response in any case v_response := valueof(m_responseNotification(int2000, omit)); v_response.requestIdentifier := vc_request.primitive.requestPrimitive.requestIdentifier; - mcaPortIn.send(f_getMsgOutPrimitive(m_response(v_response))); + mccPortIn.send(f_getMsgOutPrimitive(m_response(v_response))); tc_ac.start(10.0); repeat; } @@ -3017,27 +3106,61 @@ module OneM2M_Functions { } /** - * @desc Cse altstep for config 02 on AE1 (CSE1 as master) + * @desc Altstep for AeSimu */ - altstep a_cse_cf02_ae1() runs on AeSimu - { + altstep a_cse_aeSimu() runs on AeSimu { + var MsgIn v_request; + var ResponsePrimitive v_response; + + [] mcaPortIn.receive(mw_request(mw_notify)) -> value v_request { + tc_ac.stop; + log(__SCOPE__&": WARNING: Unexpected NOTIFY message received"); + + //Send response in any case + v_response := valueof(m_responseNotification(int2000, omit)); + v_response.requestIdentifier := vc_request.primitive.requestPrimitive.requestIdentifier; + mcaPortIn.send(f_getMsgOutPrimitive(m_response(v_response))); + tc_ac.start(10.0); + repeat; + } + [] mcaPortIn.receive { + log(__SCOPE__&": WARNING: Unexpected message received"); + repeat; + } [] mcaPort.receive { log(__SCOPE__&": WARNING: Unexpected message received"); repeat; } - } - + } + /** - * @desc Cse altstep for config 04 + * @desc Altstep for AeSimu */ - altstep a_cse_cf04() runs on CseSimu { + altstep a_ae_cseSimu() runs on CseSimu { + var MsgIn v_request; + var ResponsePrimitive v_response; + + [] mcaPortIn.receive(mw_request(mw_notify)) -> value v_request { + tc_ac.stop; + log(__SCOPE__&": WARNING: Unexpected NOTIFY message received"); - [] mccPort.receive { + //Send response in any case + v_response := valueof(m_responseNotification(int2000, omit)); + v_response.requestIdentifier := vc_request.primitive.requestPrimitive.requestIdentifier; + mcaPortIn.send(f_getMsgOutPrimitive(m_response(v_response))); + tc_ac.start(10.0); + repeat; + } + [] mcaPortIn.receive { log(__SCOPE__&": WARNING: Unexpected message received"); repeat; } - } - + [] mcaPort.receive { + log(__SCOPE__&": WARNING: Unexpected message received"); + repeat; + } + } + }//end group altstepFunctions function f_cse_activateDefaults_cse1() runs on CseSimu { @@ -3298,11 +3421,7 @@ module OneM2M_Functions { if(p_resourceType == int16) { p_request.from_ := PX_CSE1_ID; } else { - if(vc_testSystemRole == e_ae) { - p_request.from_ := f_getOriginator(p_parentIndex); - } else {//vc_testSystemRole == e_cse - p_request.from_ := f_getOriginator(p_parentIndex, false); - } + p_request.from_ := f_getOriginator(p_parentIndex, vc_testSystemRole); } } //Only set To parameter if it has not been set yet @@ -3596,16 +3715,16 @@ module OneM2M_Functions { /** * @desc Resolution of the originator field (from) for a given resource * @param p_targetResourceIndex Internal resource index of the given resource - * @param p_testSystemRole True if TS acting as an AE, False if TS acting as a CSE + * @param p_testSystemRole TS acting as an AE or a CSE * @return Originator for a given resource * @verdict */ - function f_getOriginator(integer p_targetResourceIndex := -1, boolean p_testSystemRole := true) runs on Tester return XSD.AnyURI { + function f_getOriginator(integer p_targetResourceIndex := -1, TestSystemRole p_testSystemRole := e_ae) runs on Tester return XSD.AnyURI { if(p_targetResourceIndex == -1) { - if(p_testSystemRole) { + if(p_testSystemRole == e_ae) { return PX_SUPER_AE_ID; - } else { + } else if (p_testSystemRole == e_cse) { return PX_SUPER_CSE_ID; } } @@ -4437,17 +4556,17 @@ module OneM2M_Functions { activate(a_default()); if(vc_config == e_cf01) { - vc_a_cse := activate(a_cse_cf01()); + vc_aeSimu := activate(a_cse_cf01()); } else if ((vc_config == e_cf02) or (vc_config == e_cf02CseSimuMaster)) { if(vc_testSystemRole == e_ae) { - vc_a_cse := activate(a_cse_cf02_ae1()); + vc_aeSimu := activate(a_cse_cf02_ae1()); } else if (vc_testSystemRole == e_cse) { - vc_a_cse := activate(a_cse_cf02_cse1()); + vc_cseSimu := activate(a_cse_cf02_cse1()); } } else if (vc_config == e_cf03) { - vc_a_ae := activate(a_ae_cf03()); + vc_cseSimu := activate(a_ae_cf03()); } else if (vc_config == e_cf04) { - vc_a_cse := activate(a_cse_cf04()); + vc_cseSimu := activate(a_cse_cf04()); } }else{ diff --git a/LibOneM2M/OneM2M_Templates.ttcn b/LibOneM2M/OneM2M_Templates.ttcn index 74e868b9b2ec497c3ce7ee00dfc6ec56263e5daf..d58fc36efe61fa0c2fe7e03a0b7322e31693900d 100644 --- a/LibOneM2M/OneM2M_Templates.ttcn +++ b/LibOneM2M/OneM2M_Templates.ttcn @@ -128,6 +128,39 @@ module OneM2M_Templates { vendorInformation := omit }; + /** + * @desc RETRIEVE request primitive for child references + * @param p_targetResourceAddress Target resource address + * @param p_originator Originator (from) + */ + template (value) RequestPrimitive m_retrieveChildReferences(XSD.ID p_targetResourceAddress, in XSD.ID p_originator, template (omit) ResourceTypeList p_resourceTypeList := omit) modifies m_retrieve := { + resultContent := int6, + filterCriteria := { + createdBefore := omit, + createdAfter := omit, + modifiedSince := omit, + unmodifiedSince := omit, + stateTagSmaller := omit, + stateTagBigger := omit, + expireBefore := omit, + expireAfter := omit, + labels := omit, + resourceType := p_resourceTypeList, + sizeAbove := omit, + sizeBelow := omit, + contentType_list := {}, + attribute_list := {}, + filterUsage := omit, + limit := omit, + semanticsFilter_list := {}, + filterOperation := omit, + contentFilterSyntax := omit, + contentFilterQuery := omit, + level := omit, + offset := omit + } + }; + /** * @desc Base Receive RETRIEVE request primitive * @param p_targetResourceAddress Target resource address @@ -3896,6 +3929,16 @@ module OneM2M_Templates { requestReachability := true//M }; + template RemoteCSE_optional m_contentLocalRemoteCSEResource modifies m_contentRemoteCSE_allOmit := { + resourceName := PX_CSE_NAME,//M + resourceType := int16,//M + resourceID := PX_CSE_RESOURCE_ID,//M + pointOfAccess := {PX_SUT_ADDRESS},//O + cSEBase := PX_CSE_ID & "/" & PX_CSE_NAME,//M + cSE_ID := PX_CSE_ID,//M + requestReachability := true//M + }; + template RemoteCSE_optional mw_contentRemoteCSEBase := { resourceName := ?,//M resourceType := ?,//M diff --git a/LibOneM2M/OneM2M_TestSystem.ttcn b/LibOneM2M/OneM2M_TestSystem.ttcn index a5b1777ea193fb9b5c69cf7dda95e0ea5ee003fe..d0fc01784fc74161bdd31087c257f9f399126d2d 100644 --- a/LibOneM2M/OneM2M_TestSystem.ttcn +++ b/LibOneM2M/OneM2M_TestSystem.ttcn @@ -41,8 +41,8 @@ module OneM2M_TestSystem { var AccessControlPolicy_optional vc_acpAux; var MsgIn vc_request; var MsgIn vc_response; - var default vc_a_ae := null; - var default vc_a_cse := null; + var default vc_aeSimu := null; + var default vc_cseSimu := null; }; type component AeSimu extends Tester { diff --git a/OneM2M_PermutationFunctions.ttcn b/OneM2M_PermutationFunctions.ttcn index 5bca1a11cd0dc6d0217e8df5482a4fcf845486fe..c6144cca5fd2e02477a0507f182200e98b1b2621 100644 --- a/OneM2M_PermutationFunctions.ttcn +++ b/OneM2M_PermutationFunctions.ttcn @@ -1574,57 +1574,30 @@ module OneM2M_PermutationFunctions { // Test adapter configuration // Preamble - if(PICS_IN_CSE){ - vc_remoteCseIndex := f_cse_registerRemoteCse(p_createRequestPrimitive); - mccPort.send(f_getMsgOutPrimitive(m_request(m_retrieve(f_getResourceAddress(vc_remoteCseIndex), f_getOriginator(vc_remoteCseIndex))))); - tc_ac.start; - alt { - [] mccPort.receive(mw_response(mw_responsePrimitive(int2000, p_contentResponse))) -> value v_response { - tc_ac.stop; - setverdict(pass, __SCOPE__ & ": Response OK for retrieving for attribute"); - } - [] mccPort.receive(mw_response(mw_responsePrimitiveOK(p_contentResponse))) -> value v_response { - tc_ac.stop; - setverdict(fail, __SCOPE__ & ": Wrong response status code"); - } - [] mccPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response { - tc_ac.stop; - setverdict(fail, __SCOPE__ & ": Error, resource elements provided not matching expected resource elements"); - } - [] mccPort.receive(mw_response(mw_responsePrimitiveKO)) -> value v_response { - tc_ac.stop; - setverdict(fail, __SCOPE__ & ": Error while retrieving resource"); - } - [] tc_ac.timeout { - setverdict(fail, __SCOPE__ & ": No answer while retrieving resource"); - } + vc_remoteCseIndex := f_cse_registerRemoteCse(p_createRequestPrimitive); + mccPort.send(f_getMsgOutPrimitive(m_request(m_retrieve(f_getResourceAddress(vc_remoteCseIndex), f_getOriginator(vc_remoteCseIndex))))); + tc_ac.start; + alt { + [] mccPort.receive(mw_response(mw_responsePrimitive(int2000, p_contentResponse))) -> value v_response { + tc_ac.stop; + setverdict(pass, __SCOPE__ & ": Response OK for retrieving for attribute"); + } + [] mccPort.receive(mw_response(mw_responsePrimitiveOK(p_contentResponse))) -> value v_response { + tc_ac.stop; + setverdict(fail, __SCOPE__ & ": Wrong response status code"); + } + [] mccPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response { + tc_ac.stop; + setverdict(fail, __SCOPE__ & ": Error, resource elements provided not matching expected resource elements"); + } + [] mccPort.receive(mw_response(mw_responsePrimitiveKO)) -> value v_response { + tc_ac.stop; + setverdict(fail, __SCOPE__ & ": Error while retrieving resource"); + } + [] tc_ac.timeout { + setverdict(fail, __SCOPE__ & ": No answer while retrieving resource"); } - } else if (PICS_MN_CSE){ - vc_remoteCseIndex := f_cse_registrationRemoteCse(p_createRequestPrimitive); - mccPort.send(f_getMsgOutPrimitive(m_request(m_retrieve(f_getResourceAddress(vc_remoteCseIndex), f_getOriginator(vc_remoteCseIndex))))); - tc_ac.start; - alt { - [] mccPort.receive(mw_response(mw_responsePrimitive(int2000, p_contentResponse))) -> value v_response { - tc_ac.stop; - setverdict(pass, __SCOPE__ & ": Response OK for retrieving for attribute"); - } - [] mccPort.receive(mw_response(mw_responsePrimitiveOK(p_contentResponse))) -> value v_response { - tc_ac.stop; - setverdict(fail, __SCOPE__ & ": Wrong response status code"); - } - [] mccPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response { - tc_ac.stop; - setverdict(fail, __SCOPE__ & ": Error, resource elements provided not matching expected resource elements"); - } - [] mccPort.receive(mw_response(mw_responsePrimitiveKO)) -> value v_response { - tc_ac.stop; - setverdict(fail, __SCOPE__ & ": Error while retrieving resource"); - } - [] tc_ac.timeout { - setverdict(fail, __SCOPE__ & ": No answer while retrieving resource"); - } } - } //Postamble f_cse_postamble_deleteResourcesCSE(); @@ -1660,7 +1633,7 @@ module OneM2M_PermutationFunctions { alt { [] mccPort.receive(mw_response(mw_responsePrimitive(int2004, f_getTemplateFromPrimitiveContent(v_request.primitiveContent)))) -> value v_response { tc_ac.stop; - setverdict(pass, __SCOPE__ & ": Accepted updation for resource type remoteCSE containing attribute "); + setverdict(pass, __SCOPE__ & ": Accepted update for resource type remoteCSE containing attribute "); } [] mccPort.receive(mw_response(mw_responsePrimitiveOK(f_getTemplateFromPrimitiveContent(v_request.primitiveContent)))) -> value v_response { tc_ac.stop; @@ -1668,11 +1641,11 @@ module OneM2M_PermutationFunctions { } [] mccPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response { tc_ac.stop; - setverdict(fail, __SCOPE__ & ": Accepted updation for resource type remoteCSE without containing attribute "); + setverdict(fail, __SCOPE__ & ": Accepted update for resource type remoteCSE without containing attribute "); } [] mccPort.receive(mw_response(mw_responsePrimitiveKO)) -> value v_response { tc_ac.stop; - setverdict(fail, __SCOPE__ & ": Rejected updation of resource type remoteCSE containing attribute"); + setverdict(fail, __SCOPE__ & ": Rejected update of resource type remoteCSE containing attribute"); } [] tc_ac.timeout { setverdict(fail, __SCOPE__ & ": No answer while updating resource type remoteCSE"); diff --git a/OneM2M_Testcases_CSE_Release_1.ttcn b/OneM2M_Testcases_CSE_Release_1.ttcn index da3d0ba34a57db18a06b98632d43296777cf46b9..8e5e1acf4b94435af1dcd50d283db60176e83b45 100644 --- a/OneM2M_Testcases_CSE_Release_1.ttcn +++ b/OneM2M_Testcases_CSE_Release_1.ttcn @@ -1829,6 +1829,7 @@ module OneM2M_Testcases_CSE_Release_1 { var PrimitiveContent v_localResource; var integer v_parentResourceIndex := -1; var integer v_localResourceIndex := -1; + var boolean v_cseRegistered := false; var template UtTriggerPrimitive v_utRequest := m_utCreateRemoteCSE; var universal charstring v_action := __SCOPE__ & ": Please, send a CSE registration request with attributes multiplicity equals to 1"; @@ -1850,7 +1851,7 @@ module OneM2M_Testcases_CSE_Release_1 { // Test Body tc_ac.start; alt { - [] mccPortIn.receive(mw_request(mw_createRemoteCSEBase)) -> value v_request { + [not(v_cseRegistered)] mccPortIn.receive(mw_request(mw_createRemoteCSEBase)) -> value v_request { tc_ac.stop; setverdict(pass, __SCOPE__&":INFO: CREATE remoteCSE request received"); v_parentResourceIndex := f_getResourceIndex(v_request.primitive.requestPrimitive.to_); @@ -1860,20 +1861,19 @@ module OneM2M_Testcases_CSE_Release_1 { } else { v_localResource := f_generateLocalResource(v_request.primitive.requestPrimitive.primitiveContent, v_parentResourceIndex, v_request.primitive.requestPrimitive.resourceType); - v_localResourceIndex := f_setLocalResource(v_localResource, v_request.primitive.requestPrimitive.resourceType, v_parentResourceIndex); + vc_localRemoteCseIndex := f_setLocalResource(v_localResource, v_request.primitive.requestPrimitive.resourceType, v_parentResourceIndex); v_response := valueof(m_responsePrimitive(int2001,v_request.primitive.requestPrimitive.requestIdentifier)); - v_response.primitiveContent := vc_localResourcesList[v_localResourceIndex].resource; + v_response.primitiveContent := vc_localResourcesList[vc_localRemoteCseIndex].resource; + v_cseRegistered := true; } v_response.from_ := PX_CSE1_ID; v_response.to_ := v_request.primitive.requestPrimitive.from_; mccPortIn.send(f_getMsgOutPrimitive(m_response(v_response))); } - [] mccPortIn.receive { - tc_ac.stop; - setverdict(fail, __SCOPE__&":INFO: Unexpected message received"); - } [] tc_ac.timeout { - setverdict(fail, __SCOPE__&":INFO: No request received for creating resource type remoteCSE"); + if(not(v_cseRegistered)) { + setverdict(fail, __SCOPE__&":INFO: No request received for creating resource type remoteCSE"); + } } } // Postamble @@ -2514,62 +2514,31 @@ module OneM2M_Testcases_CSE_Release_1 { // Test adapter configuration // Preamble - if(PX_IN_CSE){ - vc_remoteCseIndex := f_cse_registerRemoteCse(m_createRemoteCSEBase); - - v_contentResponse.remoteCSE := mw_contentRemoteCSEBase; - - mccPort.send(f_getMsgOutPrimitive(m_request(m_retrieve(f_getResourceAddress(vc_remoteCseIndex), f_getOriginator(vc_remoteCseIndex))))); - tc_ac.start; - alt { - [] mccPort.receive(mw_response(mw_responsePrimitive(int2000, v_contentResponse))) -> value v_response { - tc_ac.stop; - setverdict(pass, __SCOPE__ & ": Response OK for retrieving"); - } - [] mccPort.receive(mw_response(mw_responsePrimitiveOK(v_contentResponse))) -> value v_response { - tc_ac.stop; - setverdict(fail, __SCOPE__ & ": Wrong response status code"); - } - [] mccPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response { - tc_ac.stop; - setverdict(fail, __SCOPE__ & ": Error, resource elements provided not matching expected resource elements"); - } - [] mccPort.receive(mw_response(mw_responsePrimitiveKO)) -> value v_response { - tc_ac.stop; - setverdict(fail, __SCOPE__ & ": Error while retrieving resource"); - } - [] tc_ac.timeout { - setverdict(fail, __SCOPE__ & ": No answer while retrieving resource"); - } + vc_remoteCseIndex := f_cse_registerRemoteCse(m_createRemoteCSEBase); + + v_contentResponse.remoteCSE := mw_contentRemoteCSEBase; + + mccPort.send(f_getMsgOutPrimitive(m_request(m_retrieve(f_getResourceAddress(vc_remoteCseIndex), f_getOriginator(vc_remoteCseIndex))))); + tc_ac.start; + alt { + [] mccPort.receive(mw_response(mw_responsePrimitive(int2000, v_contentResponse))) -> value v_response { + tc_ac.stop; + setverdict(pass, __SCOPE__ & ": Response OK for retrieving"); } - - } else if (PX_MN_CSE) { - vc_remoteCseIndex := f_cse_registrationRemoteCse(mw_createRemoteCSEBase); - - v_contentResponse.remoteCSE := mw_contentRemoteCSEBase; - - mccPort.send(f_getMsgOutPrimitive(m_request(m_retrieve(f_getResourceAddress(vc_remoteCseIndex), f_getOriginator(vc_remoteCseIndex))))); - tc_ac.start; - alt { - [] mccPort.receive(mw_response(mw_responsePrimitive(int2000, v_contentResponse))) -> value v_response { - tc_ac.stop; - setverdict(pass, __SCOPE__ & ": Response OK for retrieving"); - } - [] mccPort.receive(mw_response(mw_responsePrimitiveOK(v_contentResponse))) -> value v_response { - tc_ac.stop; - setverdict(fail, __SCOPE__ & ": Wrong response status code"); - } - [] mccPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response { - tc_ac.stop; - setverdict(fail, __SCOPE__ & ": Error, resource elements provided not matching expected resource elements"); - } - [] mccPort.receive(mw_response(mw_responsePrimitiveKO)) -> value v_response { - tc_ac.stop; - setverdict(fail, __SCOPE__ & ": Error while retrieving resource"); - } - [] tc_ac.timeout { - setverdict(fail, __SCOPE__ & ": No answer while retrieving resource"); - } + [] mccPort.receive(mw_response(mw_responsePrimitiveOK(v_contentResponse))) -> value v_response { + tc_ac.stop; + setverdict(fail, __SCOPE__ & ": Wrong response status code"); + } + [] mccPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response { + tc_ac.stop; + setverdict(fail, __SCOPE__ & ": Error, resource elements provided not matching expected resource elements"); + } + [] mccPort.receive(mw_response(mw_responsePrimitiveKO)) -> value v_response { + tc_ac.stop; + setverdict(fail, __SCOPE__ & ": Error while retrieving resource"); + } + [] tc_ac.timeout { + setverdict(fail, __SCOPE__ & ": No answer while retrieving resource"); } } @@ -2852,15 +2821,9 @@ module OneM2M_Testcases_CSE_Release_1 { // Test adapter configuration // Preamble - if (PX_IN_CSE){ - vc_remoteCseIndex := f_cse_registerRemoteCse(m_createRemoteCSEBase); - } - - if (PX_MN_CSE){ - vc_remoteCseIndex := f_cse_registrationRemoteCse(mw_createRemoteCSEBase); - } + vc_remoteCseIndex := f_cse_registerRemoteCse(m_createRemoteCSEBase); - v_contentResponse.remoteCSE := mw_contentRemoteCSEBase; + v_contentResponse.remoteCSE := mw_contentRemoteCSEBase; mccPort.send(f_getMsgOutPrimitive(m_request(m_retrieve(f_getResourceAddress(vc_remoteCseIndex), f_getOriginator(vc_remoteCseIndex))))); tc_ac.start; @@ -2957,7 +2920,7 @@ module OneM2M_Testcases_CSE_Release_1 { // Tear down f_cf01Down(); - }; //end TC_CSE_REG_UPD_BI_001 + }; //end TC_CSE_REG_UPD_001 /** * @desc Check that the IUT accepts an update request of <remoteCSE> resource with OPTIONAL_ATTRIBUTE. @@ -3187,13 +3150,7 @@ module OneM2M_Testcases_CSE_Release_1 { // Test adapter configuration // Preamble - if (PX_MN_CSE){ - vc_remoteCseIndex := f_cse_registrationRemoteCse(mw_createRemoteCSE); - } - - if (PX_IN_CSE){ - vc_remoteCseIndex := f_cse_registerRemoteCse(m_createRemoteCSEBase); - } + vc_remoteCseIndex := f_cse_registerRemoteCse(m_createRemoteCSEBase); // Test Body v_request := valueof(m_delete(f_getResourceAddress(vc_remoteCseIndex), f_getOriginator(vc_remoteCseIndex))); @@ -3228,8 +3185,7 @@ module OneM2M_Testcases_CSE_Release_1 { } // Postamble - f_cse_postamble_deleteResourcesCSE(); - + // Tear down f_cf04Down(); @@ -8317,97 +8273,106 @@ module OneM2M_Testcases_CSE_Release_1 { };//end of group g_CSE_DMR_DEL_002 - group g_CSE_DMR_DEL_005{ + /** + * @desc Check that the stateTag attribute of a container resource is increased when a child resource is deleted + * + */ + testcase TC_CSE_DMR_DEL_005() runs on Tester system CseSystem { + + var AeSimu v_ae1 := AeSimu.create("AE1") alive; + v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1)); + v_ae1.done; + + v_ae1.start(f_CSE_DMR_DEL_005()); + + v_ae1.done; + + } - /** - * @desc Check that the stateTag attribute of a container resource is increased when a child resource is deleted - * - */ - testcase TC_CSE_DMR_DEL_005() runs on AeSimu system CseSystem { - // Local variables - var MsgIn v_response; - var RequestPrimitive v_request; - var integer v_aeIndex := -1; - var integer v_resourceIndex := -1; - var integer v_childResourceIndex := -1; - const ResourceType c_containerResourceType := int3; - - // Test control - - // Test component configuration - f_cf01Up(); - - // Test adapter configuration - - // Preamble - v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi); - - v_resourceIndex := f_cse_createResource(c_containerResourceType, m_createContainerBase, v_aeIndex); - - if(ispresent(vc_resourcesList[v_resourceIndex].resource.container.stateTag)) { - - v_childResourceIndex := f_cse_createResource(c_containerResourceType, m_createContainerBase, v_resourceIndex); - - // Test Body - mcaPort.send(f_getMsgOutPrimitive(m_request(m_delete(f_getResourceAddress(v_childResourceIndex), f_getOriginator(v_childResourceIndex))))); - - tc_ac.start; - alt { - [] mcaPort.receive(mw_response(mw_responsePrimitive(int2002))) -> value v_response { - tc_ac.stop; - setverdict(pass, __SCOPE__ & ": Resource type " & int2str(enum2int(c_containerResourceType)) & " delete successfully"); - } - [] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response { - tc_ac.stop; - setverdict(fail, __SCOPE__ & ": Wrong response status code"); - } - [] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value v_response { - tc_ac.stop; - setverdict(fail, __SCOPE__ & ": Error while deleting resource type " & int2str(enum2int(c_containerResourceType))); - } - [] tc_ac.timeout { - setverdict(fail, __SCOPE__ & ": No answer while deleting resource type " & int2str(enum2int(c_containerResourceType))); - } + function f_CSE_DMR_DEL_005() runs on AeSimu system CseSystem { + // Local variables + var MsgIn v_response; + var RequestPrimitive v_request; + var integer v_aeIndex := -1; + var integer v_resourceIndex := -1; + var integer v_childResourceIndex := -1; + const ResourceType c_containerResourceType := int3; + + // Test control + + // Test component configuration + f_cf01Up(); + + // Test adapter configuration + + // Preamble + v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi); + + v_resourceIndex := f_cse_createResource(c_containerResourceType, m_createContainerBase, v_aeIndex); + + if(ispresent(vc_resourcesList[v_resourceIndex].resource.container.stateTag)) { + + v_childResourceIndex := f_cse_createResource(c_containerResourceType, m_createContainerBase, v_resourceIndex); + + // Test Body + mcaPort.send(f_getMsgOutPrimitive(m_request(m_delete(f_getResourceAddress(v_childResourceIndex), f_getOriginator(v_childResourceIndex))))); + + tc_ac.start; + alt { + [] mcaPort.receive(mw_response(mw_responsePrimitive(int2002))) -> value v_response { + tc_ac.stop; + setverdict(pass, __SCOPE__ & ": Resource type " & int2str(enum2int(c_containerResourceType)) & " delete successfully"); } - - - - mcaPort.send(f_getMsgOutPrimitive(m_request(m_retrieve(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.container.stateTag == 2) { //(Create and Delete) - setverdict(pass, __SCOPE__ & ": The stateTag attribute is incremented"); - } - else{ - setverdict(fail, __SCOPE__ & ": Error the stateTag attribute is not incremented"); - } - } - [] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) { - tc_ac.stop; - setverdict(fail, __SCOPE__ & ": Error while retrieving resource attributes"); + [] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response { + tc_ac.stop; + setverdict(fail, __SCOPE__ & ": Wrong response status code"); + } + [] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value v_response { + tc_ac.stop; + setverdict(fail, __SCOPE__ & ": Error while deleting resource type " & int2str(enum2int(c_containerResourceType))); + } + [] tc_ac.timeout { + setverdict(fail, __SCOPE__ & ": No answer while deleting resource type " & int2str(enum2int(c_containerResourceType))); + } + } + + + + mcaPort.send(f_getMsgOutPrimitive(m_request(m_retrieve(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.container.stateTag == 2) { //(Create and Delete) + setverdict(pass, __SCOPE__ & ": The stateTag attribute is incremented"); } - [] tc_ac.timeout { - setverdict(fail, __SCOPE__ & ": No answer while retrieving resource attributes"); + else{ + setverdict(fail, __SCOPE__ & ": Error the stateTag attribute is not incremented"); } - } - - }//end if - else{ - setverdict(fail, __SCOPE__ & ": Error the stateTag attribute is empty"); - } - - // Postamble - f_cse_postamble_deleteResources(); - - // Tear down - f_cf01Down(); - - }//end f_CSE_DMR_DEL_005 - } // end group g_CSE_DMR_DEL_005 - + } + [] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) { + tc_ac.stop; + setverdict(fail, __SCOPE__ & ": Error while retrieving resource attributes"); + } + [] tc_ac.timeout { + setverdict(fail, __SCOPE__ & ": No answer while retrieving resource attributes"); + } + } + + }//end if + else{ + setverdict(fail, __SCOPE__ & ": Error the stateTag attribute is empty"); + } + + // Postamble + f_cse_postamble_deleteResources(); + + // Tear down + f_cf01Down(); + + }//end f_CSE_DMR_DEL_005 + /** * @desc Check that the IUT decreases the field value of attribute currentNrOfInstances and currentByteSize of parent container when a latest contentInstance resource is deleted successfully * @@ -9700,8 +9665,8 @@ module OneM2M_Testcases_CSE_Release_1 { v_aeIndex := f_cse_preamble_registerAe({f_getResourceId(vc_resourcesList[v_acpIndex1].resource)}, -); - v_accessControlRule_1 := valueof(m_createAcr({f_getOriginator(v_aeIndex)}, int59)); // c_CRUDNDi - v_accessControlRule_2 := valueof(m_createAcr({PX_SUPER_AE_ID, f_getOriginator(v_aeIndex)}, int63)); // c_CRDNDi + v_accessControlRule_1 := valueof(m_createAcr({f_getOriginator(v_aeIndex)}, int59)); // c_CRDNDi + v_accessControlRule_2 := valueof(m_createAcr({PX_SUPER_AE_ID, f_getOriginator(v_aeIndex)}, int63)); // c_CRUDNDi v_setOfArcs_1.accessControlRule_list := {v_accessControlRule_1}; v_setOfArcs_2.accessControlRule_list := {v_accessControlRule_2}; v_updateRequest := valueof(m_updateAcpPrivileges(v_setOfArcs_1, v_setOfArcs_2));