From 6edf5edb1f0c556f4fe0da351630801ec867fd72 Mon Sep 17 00:00:00 2001 From: reinaortega <miguelangel.reinaortega@etsi.org> Date: Thu, 12 Jul 2018 23:33:28 +0200 Subject: [PATCH] Completion of TC_CSE_REG_RET_009, TC_CSE_REG_RET_010, TC_CSE_REG_DEL_004 and TC_CSE_REG_CRE_010 Signed-off-by: reinaortega <miguelangel.reinaortega@etsi.org> --- LibOneM2M/OneM2M_Functions.ttcn | 21 +++++++ OneM2M_PermutationFunctions.ttcn | 21 ++++--- OneM2M_Testcases_AE_Release_1.ttcn | 6 +- OneM2M_Testcases_CSE_Release_1.ttcn | 89 +++++++++++++++++++++-------- 4 files changed, 103 insertions(+), 34 deletions(-) diff --git a/LibOneM2M/OneM2M_Functions.ttcn b/LibOneM2M/OneM2M_Functions.ttcn index a09f204..354933d 100644 --- a/LibOneM2M/OneM2M_Functions.ttcn +++ b/LibOneM2M/OneM2M_Functions.ttcn @@ -2392,6 +2392,27 @@ module OneM2M_Functions { tc_ac.start(10.0); repeat; } + [] mccPortIn.receive(mw_request(mw_delete())) -> value v_request { + tc_ac.stop; + log(__SCOPE__&": WARNING: Unexpected DELETE message received"); + + v_localResourceIndex := f_getResourceIndex(v_request.primitive.requestPrimitive.to_); + if(v_localResourceIndex == -1) + { + log(__SCOPE__&": ERROR: Resource Index not valid"); + v_response := valueof(m_responsePrimitive(int4004,v_request.primitive.requestPrimitive.requestIdentifier)); + v_response.from_ := PX_CSE1_ID; + v_response.to_ := v_request.primitive.requestPrimitive.from_; + mccPortIn.send(f_getMsgOutPrimitive(m_response(v_response))); + } else { + v_response := valueof(m_responsePrimitive(int2002,v_request.primitive.requestPrimitive.requestIdentifier)); + v_response.from_ := PX_CSE1_ID; + v_response.to_ := v_request.primitive.requestPrimitive.from_; + mccPortIn.send(f_getMsgOutPrimitive(m_response(v_response))); + } + tc_ac.start(10.0); + repeat; + } [] mccPortIn.receive (mw_request(?)){ log(__SCOPE__&": WARNING: Unexpected message received"); repeat; diff --git a/OneM2M_PermutationFunctions.ttcn b/OneM2M_PermutationFunctions.ttcn index a8dd117..bf34ee7 100644 --- a/OneM2M_PermutationFunctions.ttcn +++ b/OneM2M_PermutationFunctions.ttcn @@ -393,7 +393,8 @@ module OneM2M_PermutationFunctions { f_cf03Up(); - //Send Trigger Mesf_generateLocalResource := f_ae_generateLocalResource(valueof(m_primitiveContentContainer(m_contentCreateContainer)), vc_cSEBaseIndex, int3); + //Send Trigger Message + v_localResource := f_generateLocalResource(valueof(m_primitiveContentContainer(m_contentCreateContainer)), vc_cSEBaseIndex, int3); v_auxInteger := f_setLocalResource(v_localResource, int3, vc_cSEBaseIndex); v_utRequest.requestPrimitive.to_ := f_getLocalResourceAddress(v_auxInteger, e_hierarchical, p_primitiveScope); f_sendUtPrimitive(v_utRequest,v_action); @@ -500,7 +501,8 @@ module OneM2M_PermutationFunctions { //Test component configuration f_cf03Up(); - //send triggeringf_generateLocalResourcelocalResource := f_ae_generateLocalResource(valueof(m_primitiveContentContainer(m_contentCreateContainer)), vc_cSEBaseIndex, int3); + //send triggering + v_localResource := f_generateLocalResource(valueof(m_primitiveContentContainer(m_contentCreateContainer)), vc_cSEBaseIndex, int3); v_containerIndex := f_setLocalResource(v_localResource, int3, vc_cSEBaseIndex); p_utRequest.requestPrimitive.to_ := f_getLocalResourceAddress(v_containerIndex, -, -); p_request.to_ := p_utRequest.requestPrimitive.to_; @@ -598,7 +600,8 @@ module OneM2M_PermutationFunctions { //Preamble - //Send Trf_generateLocalResourcelResource := f_ae_generateLocalResource(valueof(m_primitiveContentAe(m_contentCreateAe(omit, omit, omit, omit))), vc_cSEBaseIndex, int2); + //Send Tr + v_localResource := f_generateLocalResource(valueof(m_primitiveContentAe(m_contentCreateAe(omit, omit, omit, omit))), vc_cSEBaseIndex, int2); v_resourceIndex := f_setLocalResource(v_localResource, int2, vc_cSEBaseIndex); p_utRequest.requestPrimitive.to_ := f_getLocalResourceAddress(v_resourceIndex); f_sendUtPrimitive(p_utRequest,p_action); @@ -639,7 +642,8 @@ module OneM2M_PermutationFunctions { //Test component configuration f_cf03Up(); - //send triggering f_generateLocalResourceocalResource := f_ae_generateLocalResource(valueof(m_primitiveContentContainer(m_contentCreateContainer)), vc_cSEBaseIndex, int3); + //send triggering + v_localResource := f_generateLocalResource(valueof(m_primitiveContentContainer(m_contentCreateContainer)), vc_cSEBaseIndex, int3); v_resourceIndex := f_setLocalResource(v_localResource, int3, vc_cSEBaseIndex); p_utRequest.requestPrimitive.to_ := f_getLocalResourceAddress(v_resourceIndex); f_sendUtPrimitive(p_utRequest,p_action); @@ -685,19 +689,18 @@ module OneM2M_PermutationFunctions { var ResponsePrimitive v_responsePrimitive; var PrimitiveContent v_localResource; var integer v_resourceIndex := -1; - + //Test component configuration f_cf03Up(); - //send triggerinf_generateLocalResource_localResource := f_ae_generateLocalResource(valueof(p_primitiveContent), vc_cSEBaseIndex, p_resourceType); - v_resourceIndex := f_setLocalResource(v_localResource, p_resourceType, vc_cSEBaseIndex); - v_utRequest := m_utRetrieve(f_getLocalResourceAddress(v_resourceIndex)); + //send triggerin + v_utRequest := m_utRetrieve(f_getLocalResourceAddress(vc_cSEBaseIndex)); f_sendUtPrimitive(v_utRequest,p_action); //Test behavior tc_ac.start; alt{ - [] mcaPortIn.receive(mw_request(mw_retrieve(f_getLocalResourceAddress(v_resourceIndex)))) -> value v_request { + [] mcaPortIn.receive(mw_request(mw_retrieve(f_getLocalResourceAddress(vc_cSEBaseIndex)))) -> value v_request { tc_ac.stop; setverdict(pass, __SCOPE__, " : retrieve resource type request is accepted!!"); v_resourceIndex := f_getResourceIndex(v_request.primitive.requestPrimitive.to_); diff --git a/OneM2M_Testcases_AE_Release_1.ttcn b/OneM2M_Testcases_AE_Release_1.ttcn index 5d78b90..ca7fa6c 100644 --- a/OneM2M_Testcases_AE_Release_1.ttcn +++ b/OneM2M_Testcases_AE_Release_1.ttcn @@ -1631,8 +1631,10 @@ module OneM2M_Testcases_AE_Release_1 { f_cf03Up(); //send triggering primitive to SUT - v_localResource := f_generateLocalResource(valueof(m_primitiveContentContentInstance(m_contentCreateContentInstance)), vc_cSEBaseIndex, int4); - v_resourceIndex := f_setLocalResource(v_localResource, int4, vc_cSEBaseIndex); + v_localResource := f_generateLocalResource(valueof(m_primitiveContentContainer(m_contentCreateContainer)), vc_cSEBaseIndex, int3); + v_resourceIndex := f_setLocalResource(v_localResource, int3, vc_cSEBaseIndex); + v_localResource := f_generateLocalResource(valueof(m_primitiveContentContentInstance(m_contentCreateContentInstance)), v_resourceIndex, int4); + v_resourceIndex := f_setLocalResource(v_localResource, int4, v_resourceIndex); v_utRequest.requestPrimitive.to_ := f_getLocalResourceAddress(v_resourceIndex); f_sendUtPrimitive(v_utRequest,v_action); diff --git a/OneM2M_Testcases_CSE_Release_1.ttcn b/OneM2M_Testcases_CSE_Release_1.ttcn index 753628f..b5d907d 100644 --- a/OneM2M_Testcases_CSE_Release_1.ttcn +++ b/OneM2M_Testcases_CSE_Release_1.ttcn @@ -1813,7 +1813,11 @@ module OneM2M_Testcases_CSE_Release_1 { function f_CSE_REG_CRE_024() runs on CseSimu { // Local variables - var ResponsePrimitive v_responsePrimitive; + var ResponsePrimitive v_response; + var MsgIn v_request; + var PrimitiveContent v_localResource; + var integer v_parentResourceIndex := -1; + var integer v_localResourceIndex := -1; 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"; @@ -1835,22 +1839,30 @@ module OneM2M_Testcases_CSE_Release_1 { // Test Body tc_ac.start; alt { - [] mccPortIn.receive(mw_request(mw_createRemoteCSEBase)) { + [] mccPortIn.receive(mw_request(mw_createRemoteCSEBase)) -> value v_request { tc_ac.stop; - setverdict(pass, __SCOPE__&":INFO: Resource type remoteCSE created successfuly"); - - //set responseStatusCode back to SUT - v_responsePrimitive := valueof(m_responsePrimitive(int2001, "To_be_defined", omit)); - - //send back responsePrimitive - mccPortIn.send(f_getMsgOutPrimitive(m_response(v_responsePrimitive))); - } + setverdict(pass, __SCOPE__&":INFO: CREATE remoteCSE request received"); + v_parentResourceIndex := f_getResourceIndex(v_request.primitive.requestPrimitive.to_); + if(v_parentResourceIndex == -1) { + log(__SCOPE__&": ERROR: Target resource not found"); + v_response := valueof(m_responsePrimitive(int4004,v_request.primitive.requestPrimitive.requestIdentifier)); + + } 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); + + v_response := valueof(m_responsePrimitive(int2001,v_request.primitive.requestPrimitive.requestIdentifier)); + v_response.primitiveContent := vc_localResourcesList[v_localResourceIndex].resource; + } + 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(inconc, __SCOPE__&":INFO: Unexpected message received"); + setverdict(fail, __SCOPE__&":INFO: Unexpected message received"); } [] tc_ac.timeout { - setverdict(inconc, __SCOPE__&":INFO: No request received for creating resource type remoteCSE"); + setverdict(fail, __SCOPE__&":INFO: No request received for creating resource type remoteCSE"); } } // Postamble @@ -2733,13 +2745,13 @@ module OneM2M_Testcases_CSE_Release_1 { } function f_CSE_REG_RET_009() runs on CseSimu { - //Local variables //Local variables - var MsgIn v_response; - var RequestPrimitive v_request; + var MsgIn v_request; var ResourceType v_resourceType := int16; //remoteCSE + var ResponsePrimitive v_response; var template PrimitiveContent v_contentResponse; var template UtTriggerPrimitive v_utRequest; + var integer v_localResourceIndex := -1; var universal charstring v_action := __SCOPE__ & ": Please, send a valid RETRIEVE Request containing To set to " & PX_CSE1_ADDRESS; // Test control @@ -2762,9 +2774,24 @@ module OneM2M_Testcases_CSE_Release_1 { tc_ac.start; alt { - [] mccPortIn.receive(mw_request(mw_retrieve(f_getResourceAddress()))) -> value v_response { - tc_ac.stop; - setverdict(pass, __SCOPE__ & ": Retrieve Request received successfully"); + [] mccPortIn.receive(mw_request(mw_retrieve(?))) -> value v_request { + tc_ac.stop; + v_localResourceIndex := f_getResourceIndex(v_request.primitive.requestPrimitive.to_); + if(v_localResourceIndex == -1) + { + log(__SCOPE__&": ERROR: Retrieve request target not found"); + v_response := valueof(m_responsePrimitive(int4004,v_request.primitive.requestPrimitive.requestIdentifier)); + } else if(v_localResourceIndex != vc_remoteCseIndex) { + log(__SCOPE__&": ERROR: Retrieve request target not expected"); + v_response := valueof(m_responsePrimitive(int4004,v_request.primitive.requestPrimitive.requestIdentifier)); + } else { + setverdict(pass, __SCOPE__ & ": Retrieve Request received successfully"); + v_response := valueof(m_responsePrimitive(int2000,v_request.primitive.requestPrimitive.requestIdentifier)); + v_response.primitiveContent := vc_localResourcesList[v_localResourceIndex].resource; + } + 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; @@ -3279,7 +3306,10 @@ module OneM2M_Testcases_CSE_Release_1 { //Local variables var template UtTriggerPrimitive v_utRequest := m_utDelete; var UtTriggerAckPrimitive v_trigger_response; + var ResponsePrimitive v_response; var integer v_auxInteger; + var integer v_localResourceIndex := -1; + var MsgIn v_request; var universal charstring v_action := __SCOPE__ & ": Please, send a valid DELETE Request containing To set to " & PX_CSE1_ADDRESS; //Test control @@ -3297,16 +3327,29 @@ module OneM2M_Testcases_CSE_Release_1 { vc_remoteCseIndex := f_cse_registrationRemoteCse(mw_createRemoteCSE); //Send Trigger Message - v_auxInteger := f_setResource(valueof(m_primitiveContentRemoteCSE(m_contentCreateRemoteCSE(omit,omit,-,-))), int16); - v_utRequest.requestPrimitive.to_ := f_getResourceAddress(v_auxInteger); + v_utRequest.requestPrimitive.to_ := f_getResourceAddress(vc_remoteCseIndex); f_sendUtPrimitive(v_utRequest, v_action); // Test Body tc_ac.start; alt { - [] mccPortIn.receive(mw_request(mw_delete( f_getResourceAddress(vc_remoteCseIndex), PX_CSE_ID))) { - tc_ac.stop; - setverdict(pass, __SCOPE__ & ": <remoteCSE> delete request has been received"); + [] mccPortIn.receive(mw_request(mw_delete(?, PX_CSE_ID))) -> value v_request { + tc_ac.stop; + v_localResourceIndex := f_getResourceIndex(v_request.primitive.requestPrimitive.to_); + if(v_localResourceIndex == -1) + { + log(__SCOPE__&": ERROR: Delete request target not found"); + v_response := valueof(m_responsePrimitive(int4004,v_request.primitive.requestPrimitive.requestIdentifier)); + } else if(v_localResourceIndex != vc_remoteCseIndex) { + log(__SCOPE__&": ERROR: Delete request target not expected"); + v_response := valueof(m_responsePrimitive(int4004,v_request.primitive.requestPrimitive.requestIdentifier)); + } else { + setverdict(pass, __SCOPE__ & ": <remoteCSE> delete request has been received"); + v_response := valueof(m_responsePrimitive(int2002,v_request.primitive.requestPrimitive.requestIdentifier)); + } + 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; -- GitLab