diff --git a/LibOneM2M/OneM2M_Functions.ttcn b/LibOneM2M/OneM2M_Functions.ttcn index 3bb342aaf5555db36d6b2987b53892ee18a2d534..5f3c722cc048d7d18d93fa05601938bae853cc47 100644 --- a/LibOneM2M/OneM2M_Functions.ttcn +++ b/LibOneM2M/OneM2M_Functions.ttcn @@ -1289,6 +1289,59 @@ module OneM2M_Functions { f_checkAeSimuStatus(); return vc_aeIndex; } + + /** + * @desc Creation of auxiliar resource AE for correct execution of the test case containing POINT_OF_ACCESS attribute and REQUEST_REACHABILITY set to true + * @param p_accessControlPolicyIDs AccessControlPolicyIDs for the auxiliar AE resource + * @param p_poaList Point of contact of the auxiliar AE resource + * @return Internal AE resource index + * @verdict + */ + function f_cse_preamble_registerAeWithRequestReachability(template (omit) AcpType p_accessControlPolicyIDs := omit, in template (omit) PoaList p_poaList := omit) runs on AeSimu return integer {//c_CRUDNDi + + var RequestPrimitive v_request; + var MsgIn v_response; + + //Activate defaults when running on a PTC + f_cse_activateDefaults_ae(); + + v_request := valueof(m_createAe(vc_aeSimuDesc.appId, p_accessControlPolicyIDs, vc_aeSimuDesc.aeIdStem, c_defaultAe1ResourceName, p_poaList)); + v_request.primitiveContent.aE.requestReachability := true; + + v_request := f_getCreateRequestPrimitive(int2, v_request, -1); + + f_send(e_mcaPort, m_request(v_request)); + + tc_ac.start; + alt { + [] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response { + tc_ac.stop; + setverdict(pass,__SCOPE__&":INFO: Application registered successfuly"); + if(ischosen(v_response.primitive.responsePrimitive.primitiveContent.aE)) { + + f_checkAttributesToBeSaved(int2, v_request, v_response.primitive.responsePrimitive); + + vc_aeIndex := f_setResource(v_response.primitive.responsePrimitive.primitiveContent, int2); + + if(ispresent(v_response.primitive.responsePrimitive.primitiveContent.aE.aE_ID)){ + f_sendAcPrimitive("AE-ID_changed", vc_aeIndex); + } + } + } + [] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) { + tc_ac.stop; + setverdict(inconc, __SCOPE__&":INFO: Error while registering application"); + stop; + } + [] tc_ac.timeout { + setverdict(inconc, __SCOPE__&":INFO: No answer while registering resource"); + stop; + } + } + + f_checkAeSimuStatus(); + return vc_aeIndex; + } /** * @desc Creation of auxiliar resources ACP and AE for correct execution of the test case @@ -2551,7 +2604,51 @@ module OneM2M_Functions { f_checkCseSimuStatus(); - } //end f_cse_notifyProcedure_notify + } //end f_cse_notifyProcedure_notify + + /** + * @desc Handling of valid NOTIFY and send to POINT_OF_ACCESS to finish a notification procedure + * @verdict + */ + function f_cse_notifyProcedure_SendtoPOA() runs on AeSimu { + // Local variables + var ResponsePrimitive v_responsePrimitive; + + //Activate defaults when running on a PTC + f_cse_activateDefaults_ae(); + + tc_ac.start; + alt { + [] mcaPortIn.receive(mw_request(mw_notifyNotification(mw_contentNotification(?)))) -> value vc_request { + tc_ac.stop; + + setverdict(pass, __SCOPE__ & ":INFO: Notification received"); + + //Send response in any case + v_responsePrimitive := valueof(m_responseNotification(int2000, omit)); + v_responsePrimitive.requestIdentifier := vc_request.primitive.requestPrimitive.requestIdentifier; + v_responsePrimitive.to_ := f_getLocalPoA(vc_aeSimuDesc.mcaPortIn); + f_send(e_mcaPortIn, m_response(v_responsePrimitive)); + tc_ac.start; + repeat; + } + [] mcaPortIn.receive(mw_request(mw_notifyResponsePrimitive(?))) -> value vc_request { + tc_ac.stop; + setverdict(fail, __SCOPE__ & ": Error, Non expected notification received"); + //Send response in any case + v_responsePrimitive := valueof(m_responseNotification(int2000, omit)); + v_responsePrimitive.requestIdentifier := vc_request.primitive.requestPrimitive.requestIdentifier; + f_send(e_mcaPortIn, m_response(v_responsePrimitive)); + } + [] mcaPortIn.receive{ + tc_ac.stop; + setverdict(inconc, __SCOPE__ & ":ERROR: unexpected message received"); + tc_ac.start; + repeat; + } + } + + } //end f_cse_notifyProcedure_SendtoPOA /** * @desc Handling message exchange for the dynamic authorization procedure diff --git a/OneM2M_Testcases_CSE_Release_3.ttcn b/OneM2M_Testcases_CSE_Release_3.ttcn index 798a5f4793ef1186f70ccf7798bf8647d83c36ab..483cda1315183d0c12b0f41528419f4ed62eed99 100644 --- a/OneM2M_Testcases_CSE_Release_3.ttcn +++ b/OneM2M_Testcases_CSE_Release_3.ttcn @@ -7942,7 +7942,7 @@ module OneM2M_Testcases_CSE_Release_3 { v_request.from_ := f_getResourceAddress(v_aeIndex); // Test Body - f_send(e_mcaPort, m_request(v_request)); + f_send(e_mcaPort, m_request(valueof(v_request))); tc_ac.start; alt { [] mcaPort.receive(mw_response(mw_responsePrimitive(int2001))) -> value v_response { //CREATED - TS-004 - Table 6.6.3.3 1: RSCs for successful response class @@ -8591,12 +8591,11 @@ module OneM2M_Testcases_CSE_Release_3 { function f_CSE_SUB_NTF_007() runs on AeSimu system CseSystem { // Local variables - var MsgIn v_response; + var MsgIn v_response; var integer v_aeIndex := -1; var RequestPrimitive v_request; var template RequestPrimitive v_requestCreateAE := m_createAe(vc_aeSimuDesc.appId, omit, vc_aeSimuDesc.aeIdStem, c_defaultAe1ResourceName, {f_getLocalPoA(vc_aeSimuDesc.mcaPortIn)}); - var RequestPrimitive v_reqNotify; - //var XSD.ID v_targetResourceAddress; + var RequestPrimitive v_reqNotify; // Test control @@ -8606,50 +8605,19 @@ module OneM2M_Testcases_CSE_Release_3 { // Test adapter configuration // Preamble - f_cse_activateDefaults_ae(); //Activate defaults when running on a PTC - - v_requestCreateAE.primitiveContent.aE.requestReachability := true; - v_request := f_getCreateRequestPrimitive(int2, valueof(v_requestCreateAE), -1);//c_CRUDNDi - f_send(e_mcaPort, m_request(v_request)); - - tc_ac.start; - alt { - [] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response { - tc_ac.stop; - setverdict(pass,__SCOPE__&":INFO: Application registered successfuly"); - if(ischosen(v_response.primitive.responsePrimitive.primitiveContent.aE)) { - - f_checkAttributesToBeSaved(int2, v_request, v_response.primitive.responsePrimitive); - - v_aeIndex := f_setResource(v_response.primitive.responsePrimitive.primitiveContent, int2); - - if(ispresent(v_response.primitive.responsePrimitive.primitiveContent.aE.aE_ID)){ - f_sendAcPrimitive("AE-ID_changed", v_aeIndex); - } - } - } - [] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) { - tc_ac.stop; - setverdict(inconc, __SCOPE__&":INFO: Error while registering application"); - stop; - } - [] tc_ac.timeout { - setverdict(inconc, __SCOPE__&":INFO: No answer while registering resource"); - stop; - } - } - - f_checkAeSimuStatus(); + v_aeIndex := f_cse_preamble_registerAeWithRequestReachability(-, {f_getLocalPoA(vc_aeSimuDesc.mcaPortIn, "")});//c_CRUDNDi); // Test Body v_reqNotify := valueof(m_notifyNotification(f_getResourceAddress(v_aeIndex), m_contentNotification_subscriptionVerification(PX_TS_CSE1.cseId))); vc_cse1.start(f_cse_notifyProcedure_notify(v_reqNotify)); //Message exchange for notification - f_cseSimu_checkComponentDoneAndGetVerdict(vc_ae1); + vc_cse1.start(f_cse_notifyProcedure_SendtoPOA()); //The IUT sends the valid NOTIFY to POINT_OF_ACCESS + + f_aeSimu_checkComponentDoneAndGetVerdict(vc_cse1); // Postamble - f_cse_postamble_deleteResourcesCSE(); + f_cse_postamble_deleteResources(); // Tear down f_cf02Down(); @@ -15893,7 +15861,7 @@ module OneM2M_Testcases_CSE_Release_3 { var XSD.ID v_remoteOntologyAddress; var integer v_remoteOntologyRepoIndex := -1; var integer v_remoteOntologyIndex := -1; - var RequestPrimitive v_updateSdRequestPrimitive := m_updateSemanticDescriptorBase; + var template RequestPrimitive v_updateSdRequestPrimitive := m_updateSemanticDescriptorBase; // Test control