diff --git a/LibOneM2M/OneM2M_Functions.ttcn b/LibOneM2M/OneM2M_Functions.ttcn index ed533f0c4aeceba7ef90f6252445b8ed3f941640..20f6f49ecc4239fee0fa293265b14a3fba668445 100644 --- a/LibOneM2M/OneM2M_Functions.ttcn +++ b/LibOneM2M/OneM2M_Functions.ttcn @@ -1521,6 +1521,13 @@ module OneM2M_Functions { v_remoteCSEResource := f_cse_generateLocalResource(v_request.primitive.requestPrimitive.primitiveContent, 1, int16);//TODO Get index from v_request.primitive.requestPrimitive.to_ v_localResourceIndex := f_setLocalResource(v_remoteCSEResource, int16, -1); + + v_response := m_responsePrimitive(int2001,v_request.primitive.requestPrimitive.requestIdentifier); + v_response.from_ := PX_CSE1_ID; + v_response.to_ := v_request.primitive.requestPrimitive.from_; + v_response.primitiveContent.remoteCSE := vc_localResourcesList[v_localResourceIndex].resource.remoteCSE; + mccPort.send(m_response(v_response)); + v_resourceIndex := f_setResource(v_request.primitive.responsePrimitive.primitiveContent, int16, -1); } diff --git a/OneM2M_Testcases_CSE.ttcn b/OneM2M_Testcases_CSE.ttcn index 76f6d2e6949e3db9d7f443e38d9a06b4a11495b0..e7967e7e262178350b7b6946983faed8053269b9 100644 --- a/OneM2M_Testcases_CSE.ttcn +++ b/OneM2M_Testcases_CSE.ttcn @@ -2233,65 +2233,81 @@ kk testcase TC_CSE_REG_RET_004_LBL() runs on Tester system CseSystem { // Local variables + var Labels v_labels_1 := {"VALUE_1"}; + var template RequestPrimitive v_createRequest := m_createAe(PX_APP_ID); var AeSimu v_ae1 := AeSimu.create("AE1") alive; var template PrimitiveContent v_contentResponse; + + v_createRequest.primitiveContent.aE.labels := v_labels_1; v_contentResponse.aE := mw_contentAeBase; v_contentResponse.aE.labels := ?; - v_ae1.start(f_CSE_REG_RET_004(v_contentResponse)); + v_ae1.start(f_CSE_REG_RET_004(v_createRequest, v_contentResponse)); v_ae1.done; } testcase TC_CSE_REG_RET_004_APN() runs on Tester system CseSystem { //Local variables var AeSimu v_ae1 := AeSimu.create("AE1") alive; + var template RequestPrimitive v_createRequest := m_createAe(PX_APP_ID); var template PrimitiveContent v_contentResponse; + + v_createRequest.primitiveContent.aE.appName := "AeAppName"; v_contentResponse.aE := mw_contentAeBase; v_contentResponse.aE.appName := ?; - v_ae1.start(f_CSE_REG_RET_004(v_contentResponse)); + v_ae1.start(f_CSE_REG_RET_004(v_createRequest,v_contentResponse)); v_ae1.done; } testcase TC_CSE_REG_RET_004_POA() runs on Tester system CseSystem { //Local variables var AeSimu v_ae1 := AeSimu.create("AE1") alive; + var template RequestPrimitive v_createRequest := m_createAe(PX_APP_ID); var template PrimitiveContent v_contentResponse; + + v_createRequest.primitiveContent.aE.pointOfAccess := {PX_AE1_ADDRESS}; v_contentResponse.aE := mw_contentAeBase; v_contentResponse.aE.pointOfAccess := ?; - v_ae1.start(f_CSE_REG_RET_004(v_contentResponse)); + v_ae1.start(f_CSE_REG_RET_004(v_createRequest, v_contentResponse)); v_ae1.done; } testcase TC_CSE_REG_RET_004_NL() runs on Tester system CseSystem { //Local variables var AeSimu v_ae1 := AeSimu.create("AE1") alive; + var template RequestPrimitive v_createRequest := m_createAe(PX_APP_ID); var template PrimitiveContent v_contentResponse; + + v_createRequest.primitiveContent.aE.nodeLink := "http://127.0.0.1/"; v_contentResponse.aE := mw_contentAeBase; v_contentResponse.aE.nodeLink := ?; - v_ae1.start(f_CSE_REG_RET_004(v_contentResponse)); + v_ae1.start(f_CSE_REG_RET_004(v_createRequest,v_contentResponse)); v_ae1.done; } testcase TC_CSE_REG_RET_004_CSZ() runs on Tester system CseSystem { //Local variables var AeSimu v_ae1 := AeSimu.create("AE1") alive; + var template RequestPrimitive v_createRequest := m_createAe(PX_APP_ID); var template PrimitiveContent v_contentResponse; + + v_createRequest.primitiveContent.aE.contentSerialization := {applicationxml}; v_contentResponse.aE := mw_contentAeBase; v_contentResponse.aE.contentSerialization := ?; - v_ae1.start(f_CSE_REG_RET_004(v_contentResponse)); + v_ae1.start(f_CSE_REG_RET_004(v_createRequest,v_contentResponse)); v_ae1.done; } - function f_CSE_REG_RET_004(template PrimitiveContent p_contentResponse) runs on AeSimu { + function f_CSE_REG_RET_004(template RequestPrimitive p_createRequestPrimitive, template PrimitiveContent p_contentResponse) runs on AeSimu { //Local variables var MsgIn v_response; var integer v_aeIndex := -1; @@ -2304,7 +2320,7 @@ kk // Test adapter configuration // Preamble - v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi); + v_aeIndex := f_cse_createResource(int2, p_createRequestPrimitive, -1); mcaPort.send(m_request(m_retrieveResource(f_getResourceAddress(), f_getOriginator(v_aeIndex))));//TODO Maybe PX_SUPER_AE_ID tc_ac.start; @@ -2497,52 +2513,65 @@ kk testcase TC_CSE_REG_RET_007_LBL() runs on Tester system CseSystem { // Local variables var CseSimu v_cse1 := CseSimu.create("CSE1") alive; + var Labels v_labels_1 := {"VALUE_1"}; + var template RequestPrimitive v_createRequest := m_createRemoteCSEBase; var template PrimitiveContent v_contentResponse; + + v_createRequest.primitiveContent.remoteCSE.labels := v_labels_1; v_contentResponse.remoteCSE := mw_contentRemoteCSEBase; v_contentResponse.remoteCSE.labels := ?; - v_cse1.start(f_CSE_REG_RET_007(v_contentResponse)); + v_cse1.start(f_CSE_REG_RET_007(v_createRequest, v_contentResponse)); v_cse1.done; } testcase TC_CSE_REG_RET_007_CST() runs on Tester system CseSystem { // Local variables var CseSimu v_cse1 := CseSimu.create("CSE1") alive; + var template RequestPrimitive v_createRequest := m_createRemoteCSEBase; var template PrimitiveContent v_contentResponse; + + v_createRequest.primitiveContent.remoteCSE.cseType := int1; v_contentResponse.remoteCSE := mw_contentRemoteCSEBase; v_contentResponse.remoteCSE.cseType := ?; - v_cse1.start(f_CSE_REG_RET_007(v_contentResponse)); + v_cse1.start(f_CSE_REG_RET_007(v_createRequest, v_contentResponse)); v_cse1.done; } testcase TC_CSE_REG_RET_007_POA() runs on Tester system CseSystem { // Local variables var CseSimu v_cse1 := CseSimu.create("CSE1") alive; + var template RequestPrimitive v_createRequest := m_createRemoteCSEBase; var template PrimitiveContent v_contentResponse; + + v_createRequest.primitiveContent.remoteCSE.pointOfAccess := {"http://" & PX_CSE1_ADDRESS & "/"}; v_contentResponse.remoteCSE := mw_contentRemoteCSEBase; v_contentResponse.remoteCSE.pointOfAccess := ?; - v_cse1.start(f_CSE_REG_RET_007(v_contentResponse)); + v_cse1.start(f_CSE_REG_RET_007(v_createRequest, v_contentResponse)); v_cse1.done; } testcase TC_CSE_REG_RET_007_NL() runs on Tester system CseSystem { // Local variables var CseSimu v_cse1 := CseSimu.create("CSE1") alive; + var template RequestPrimitive v_createRequest := m_createRemoteCSEBase; var template PrimitiveContent v_contentResponse; + + v_createRequest.primitiveContent.remoteCSE.nodeLink := c_defaultNodeID; v_contentResponse.remoteCSE := mw_contentRemoteCSEBase; v_contentResponse.remoteCSE.nodeLink := ?; - v_cse1.start(f_CSE_REG_RET_007(v_contentResponse)); + v_cse1.start(f_CSE_REG_RET_007(v_createRequest, v_contentResponse)); v_cse1.done; } - function f_CSE_REG_RET_007(template PrimitiveContent p_contentResponse) runs on CseSimu { + function f_CSE_REG_RET_007(template RequestPrimitive p_createRequestPrimitive, template PrimitiveContent p_contentResponse) runs on CseSimu { var MsgIn v_response; var RequestPrimitive v_request; var ResourceType v_resourceType := int16; //remoteCSE @@ -2557,7 +2586,7 @@ kk // Preamble if(PICS_IN_CSE){ - vc_remoteCseIndex := f_cse_registerRemoteCse(m_createRemoteCSEBase); + vc_remoteCseIndex := f_cse_registerRemoteCse(p_createRequestPrimitive); mccPort.send(m_request(m_retrieveResource(f_getResourceAddress(), f_getOriginator(vc_remoteCseIndex)))); tc_ac.start; alt { @@ -2582,7 +2611,7 @@ kk } } } else if (PICS_MN_CSE){ - vc_remoteCseIndex := f_cse_registrationRemoteCse(m_createRemoteCSEBase); + vc_remoteCseIndex := f_cse_registrationRemoteCse(p_createRequestPrimitive); mccPort.send(m_request(m_retrieveResource(f_getResourceAddress(), f_getOriginator(vc_remoteCseIndex)))); tc_ac.start; alt { @@ -2686,6 +2715,10 @@ kk }//end TC_CSE_REG_RET_008 + /** + * @desc Check that the IUT sends a <remoteCSE> retrieve request on TARGET_REMOTE_CSE_ADDRESS + * + */ testcase TC_CSE_REG_RET_009() runs on CseSimu system CseSystem { //Local variables //Local variables @@ -2715,7 +2748,19 @@ kk f_sendUtPrimitive(v_utRequest); tc_ac.start; - mccPort.send(m_request(m_retrieveResource(f_getResourceAddress(), f_getOriginator(vc_remoteCseIndex)))); + alt { + [] mccPort.receive(mw_request(m_retrieveResource(f_getResourceAddress(), f_getOriginator(vc_remoteCseIndex)))) -> value v_response { + tc_ac.stop; + setverdict(pass, __SCOPE__ & ": Retrieve Request received successfully"); + } + [] mccPort.receive { + tc_ac.stop; + setverdict(fail, __SCOPE__ & ": Error Retrieve request was not received"); + } + [] tc_ac.timeout { + setverdict(fail, __SCOPE__ & ": No answer while waiting to receive Retrieve request"); + } + } // Postamble f_cse_postamble_deleteResourcesCSE(); @@ -2723,8 +2768,67 @@ kk f_cf04Down(); }//end TC_CSE_REG_RET_009 + + /** + * @desc Check that IUT accepts a <remoteCSE> retrieve request + * + */ + testcase TC_CSE_REG_RET_010() runs on CseSimu system CseSystem { + //Local variables + var MsgIn v_response; + var RequestPrimitive v_request; + var ResourceType v_resourceType := int16; //remoteCSE + var template PrimitiveContent v_contentResponse; + var template UtTriggerPrimitive v_utRequest := m_utCreateRemoteCSE; + + // Test control + if(not(PICS_MN_CSE)) { + setverdict(inconc, __SCOPE__ & ": IUT shall be MN-CSE to run this test case"); + stop; + } + + // Test component configuration + f_cf04Up(); + + // Test adapter configuration + + // Preamble + vc_remoteCseIndex := f_cse_registrationRemoteCse(m_createRemoteCSEBase); + + v_contentResponse.remoteCSE := mw_contentRemoteCSEBase; + + mccPort.send(m_request(m_retrieveResource(f_getResourceAddress(), 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"); + } + } + // Postamble + f_cse_postamble_deleteResourcesCSE(); + + // Tear down + f_cf04Down(); + + }//end TC_CSE_REG_RET_010 - } //end group Retrieve + }//end group Retrieve group Update{