From eb79c8724b8e0099bb63235d7b13c14914dc7a56 Mon Sep 17 00:00:00 2001 From: reinaortega <miguelangel.reinaortega@etsi.org> Date: Tue, 11 Jan 2022 14:51:15 +0100 Subject: [PATCH] Enhancement of initialization/shut down of test cases - Connection of InfoPort during config up - Disconnection of InfoPort during config down - Creation of mccPortInternal interface for communication between CSE Simus - Improvement of postamble for test cases Signed-off-by: reinaortega <miguelangel.reinaortega@etsi.org> --- LibOneM2M/OneM2M_Functions.ttcn | 243 +++++++++++++++++++--------- LibOneM2M/OneM2M_Ports.ttcn | 12 ++ LibOneM2M/OneM2M_TestSystem.ttcn | 2 + OneM2M_Testcases_CSE_Release_3.ttcn | 2 +- 4 files changed, 186 insertions(+), 73 deletions(-) diff --git a/LibOneM2M/OneM2M_Functions.ttcn b/LibOneM2M/OneM2M_Functions.ttcn index f9e2008..f6af89f 100644 --- a/LibOneM2M/OneM2M_Functions.ttcn +++ b/LibOneM2M/OneM2M_Functions.ttcn @@ -57,6 +57,7 @@ module OneM2M_Functions { vc_ae2 := AeSimu.create("AE2") alive; vc_ae2.start(f_cf01UpAe2()); vc_ae2.done; + f_connectInfoPort(vc_ae2); } //Initialze the IUT @@ -127,6 +128,7 @@ module OneM2M_Functions { vc_cse1.done; // Connect + f_connectInfoPort(vc_cse1); //Initialze the IUT @@ -205,6 +207,7 @@ module OneM2M_Functions { vc_cseSimu := activate(a_cse_cf02_cse1()); vc_ae1.start(f_cf02UpAe1()); vc_ae1.done; + f_connectInfoPort(vc_ae1); //Initialize CSE2 if(p_auxiliaryCse2Required) { @@ -212,6 +215,8 @@ module OneM2M_Functions { vc_cse2 := CseSimu.create("CSE2") alive; vc_cse2.start(f_cf02UpCse2()); vc_cse2.done; + connect(self:mccPortInternal, vc_cse2:mccPortInternal); + f_connectInfoPort(vc_cse2); } //Initialze the IUT @@ -248,7 +253,7 @@ module OneM2M_Functions { vc_myInterfaces[enum2int(valueof(InterfaceIds:e_mccPort))] := { mccPort, v_host, v_binding, vc_cseSimuDesc.mccPort.serialization }; vc_myInterfaces[enum2int(valueof(InterfaceIds:e_mccPortIn))] := { mccPortIn, v_host, v_binding_in, vc_cseSimuDesc.mccPortIn.serialization }; - + activate(a_default()); vc_cseSimu := activate(a_cse_cf02_cse1()); @@ -326,6 +331,7 @@ module OneM2M_Functions { vc_cse2 := CseSimu.create("CSE2") alive; vc_cse2.start(f_cf03UpCse2()); vc_cse2.done; + f_connectInfoPort(vc_cse2); } //Initialze the IUT @@ -408,6 +414,7 @@ module OneM2M_Functions { vc_cse2 := CseSimu.create("CSE2") alive; vc_cse2.start(f_cf04UpCse2()); vc_cse2.done; + f_connectInfoPort(vc_cse2); } // Connect @@ -474,6 +481,8 @@ module OneM2M_Functions { vc_ae1 := AeSimu.create("AE1") alive; vc_ae1.start(f_cf01Up()); vc_ae1.done; + f_connectInfoPort(vc_ae1); + } // end f_cf05Up /** @@ -509,6 +518,8 @@ module OneM2M_Functions { vc_das := AeSimu.create("DAS") alive; vc_das.start(f_cf06UpDas()); vc_das.done; + f_connectInfoPort(vc_das); + } // end f_cf06Up @@ -570,6 +581,8 @@ module OneM2M_Functions { vc_ae1 := AeSimu.create("AE1") alive; vc_ae1.start(f_cf06UpAe1()); vc_ae1.done; + f_connectInfoPort(vc_ae1); + } // end f_cf06UpDasSimuMaster @@ -657,6 +670,7 @@ module OneM2M_Functions { if(vc_ae2.alive) { vc_ae2.start(f_cf01DownAe2()); vc_ae2.done; + f_disconnectInfoPort(vc_ae2); } } @@ -683,9 +697,12 @@ module OneM2M_Functions { if(PX_UT_IMPLEMENTED){ unmap(self:utPort, system:utPort); } - unmap(vc_cse1:mccPort, system:mccPort); - unmap(vc_cse1:mccPortIn, system:mccPortIn); - unmap(vc_cse1:acPort, system:acPort); + + if(vc_cse1.alive) { + vc_cse1.start(f_cf02DownCse()); + vc_cse1.done; + f_disconnectInfoPort(vc_cse1); + } }// end f_cf02Down @@ -700,11 +717,54 @@ module OneM2M_Functions { if(PX_UT_IMPLEMENTED){ unmap(self:utPort, system:utPort); } - unmap(vc_ae1:mcaPort, system:mcaPort); - unmap(vc_ae1:acPort, system:acPort); + if (vc_cseSimuDesc.cseName != "CSE2_NAME") { + if(vc_ae1.alive) { + vc_ae1.start(f_cf02DownAe()); + vc_ae1.done; + f_disconnectInfoPort(vc_ae1); + } + if(vc_auxiliaryCse2Up) { + if(vc_cse2.alive) { + vc_cse2.start(f_cf02DownCse()); + vc_cse2.done; + disconnect(self:mccPortInternal, vc_cse2:mccPortInternal); + f_disconnectInfoPort(vc_cse2); + } + } + } }// end f_cf02DownCseSimuMaster + /** + * @desc Ports unmapping + */ + function f_cf02DownCse() runs on CseSimu { + + unmap(self:mccPort, system:mccPort); + unmap(self:mccPortIn, system:mccPortIn); + unmap(self:acPort, system:acPort); + if(PX_UT_IMPLEMENTED){ + unmap(self:utPort, system:utPort); + } + + + }// end f_cf02DownCse + + /** + * @desc Ports unmapping + */ + function f_cf02DownAe() runs on AeSimu { + + unmap(self:mcaPort, system:mcaPort); + unmap(self:mcaPortIn, system:mcaPortIn); + unmap(self:acPort, system:acPort); + if(PX_UT_IMPLEMENTED){ + unmap(self:utPort, system:utPort); + } + + + }// end f_cf02DownCse + /** * @desc Ports unmapping for Config 03 */ @@ -719,6 +779,8 @@ module OneM2M_Functions { if(vc_cse2.alive) { vc_cse2.start(f_cf03DownCse2()); vc_cse2.done; + disconnect(self:mccPortInternal, vc_cse2:mccPortInternal); + f_disconnectInfoPort(vc_cse2); } } }// end f_cf03Down @@ -749,6 +811,8 @@ module OneM2M_Functions { if(vc_cse2.alive) { vc_cse2.start(f_cf04DownCse2()); vc_cse2.done; + disconnect(self:mccPortInternal, vc_cse2:mccPortInternal); + f_disconnectInfoPort(vc_cse2); } } }// end f_cf04Down @@ -765,15 +829,18 @@ module OneM2M_Functions { }// end f_cf04DownCse2 function f_cf05Down() runs on ScefSimu system ScefSystem { + + unmap(self:mcnPort, system:mcnPort); + unmap(self:mcnPortIn, system:mcnPortIn); + unmap(self:acPort, system:acPort); + if(vc_ae1.alive) { vc_ae1.start(f_cf01Down()); vc_ae1.done; + f_disconnectInfoPort(vc_ae1); } - deactivate; - unmap(self:mcnPort, system:mcnPort); - unmap(self:mcnPortIn, system:mcnPortIn); - unmap(self:acPort, system:acPort); + } // end f_cf05Down /** @@ -787,9 +854,12 @@ module OneM2M_Functions { if(PX_UT_IMPLEMENTED){ unmap(self:utPort, system:utPort); } - unmap(vc_das:mcaPort, system:mcaPort); - unmap(vc_das:mcaPort, system:mcaPort); - unmap(vc_das:acPort, system:acPort); + if(vc_das.alive) { + vc_das.start(f_cf01Down()); + vc_das.done; + f_disconnectInfoPort(vc_das); + } + }// end f_cf06Down /** @@ -803,9 +873,13 @@ module OneM2M_Functions { if(PX_UT_IMPLEMENTED) { unmap(self:utPort, system:utPort); } - unmap(vc_ae2:mcaPort, system:mcaPort); - unmap(vc_ae2:mcaPortIn, system:mcaPortIn); - unmap(vc_ae2:acPort, system:acPort); + + if(vc_ae1.alive) { + vc_ae1.start(f_cf01Down()); + vc_ae1.done; + f_disconnectInfoPort(vc_ae1); + } + }// end f_cf06DownCseSimuMaster @@ -851,7 +925,7 @@ module OneM2M_Functions { var ResponsePrimitive v_response; f_connectInfoPort(p_component); - + p_component.start(f_sendResponsePrimitive()); alt { []infoPort.receive(mw_responsePrimitiveforInfoPort) -> value v_response { @@ -859,8 +933,9 @@ module OneM2M_Functions { } p_component.done; + f_disconnectInfoPort(p_component); - + return v_response; } @@ -873,7 +948,7 @@ module OneM2M_Functions { var RequestPrimitive v_request; f_connectInfoPort(p_component); - + p_component.start(f_sendRequestPrimitive()); alt { []infoPort.receive(mw_requestPrimitiveforInfoPort) -> value v_request { @@ -881,8 +956,9 @@ module OneM2M_Functions { } p_component.done; + f_disconnectInfoPort(p_component); - + return v_request; } @@ -895,7 +971,6 @@ module OneM2M_Functions { var PrimitiveContent v_primitiveContent; f_connectInfoPort(p_ae); - p_ae.start(f_sendPrimitiveContentRetrievedResource()); alt { []infoPort.receive(mw_primitiveContent) -> value v_primitiveContent { @@ -917,8 +992,6 @@ module OneM2M_Functions { var MyResource v_resource; var integer v_resourceIndex := -1; - f_connectInfoPort(p_cse); - p_cse.start(f_sendRemoteCseResource()); alt { []infoPort.receive(mw_resource) -> value v_resource { @@ -927,8 +1000,7 @@ module OneM2M_Functions { } p_cse.done; - f_disconnectInfoPort(p_cse); - + return v_resourceIndex; } @@ -942,8 +1014,6 @@ module OneM2M_Functions { var MyResource v_resource; var integer v_resourceIndex := -1; - f_connectInfoPort(p_component); - p_component.start(f_sendResourceAeSimu(p_resourceIndex)); alt { @@ -953,7 +1023,6 @@ module OneM2M_Functions { } p_component.done; - f_disconnectInfoPort(p_component); return v_resourceIndex; @@ -969,8 +1038,6 @@ module OneM2M_Functions { var MyResource v_resource; var integer v_resourceIndex := -1; - f_connectInfoPort(p_component); - p_component.start(f_sendResourceCseSimu(p_resourceIndex)); alt { @@ -980,7 +1047,6 @@ module OneM2M_Functions { } p_component.done; - f_disconnectInfoPort(p_component); return v_resourceIndex; @@ -995,8 +1061,6 @@ module OneM2M_Functions { var MyResource v_resource; var integer v_resourceIndex := -1; - f_connectInfoPort(p_component); - p_component.start(f_sendLatestResource()); alt { []infoPort.receive(mw_resource) -> value v_resource { @@ -1005,8 +1069,7 @@ module OneM2M_Functions { } p_component.done; - f_disconnectInfoPort(p_component); - + return v_resourceIndex; } @@ -1018,8 +1081,6 @@ module OneM2M_Functions { function f_getLatestResourceIndex(in Tester p_component) runs on Tester return integer { var integer v_resourceIndex; - f_connectInfoPort(p_component); - p_component.start(f_sendLatestResourceIndex()); alt { []infoPort.receive(mw_resourceIndex) -> value v_resourceIndex{ @@ -1027,8 +1088,7 @@ module OneM2M_Functions { } p_component.done; - f_disconnectInfoPort(p_component); - + return v_resourceIndex; } @@ -1040,8 +1100,6 @@ module OneM2M_Functions { function f_getLatestResourceAddress(in Tester p_component, AddressingMethod p_addressingMethod := PX_ADDRESSING_METHOD, PrimitiveScope p_primitiveScope := PX_PRIMITIVE_SCOPE) runs on Tester return XSD.ID { var XSD.ID v_resourceAddress; - f_connectInfoPort(p_component); - p_component.start(f_sendLatestResourceAddress(p_addressingMethod, p_primitiveScope)); alt { []infoPort.receive(mw_resourceAddress) -> value v_resourceAddress{ @@ -1049,8 +1107,7 @@ module OneM2M_Functions { } p_component.done; - f_disconnectInfoPort(p_component); - + return v_resourceAddress; } @@ -1064,7 +1121,6 @@ module OneM2M_Functions { var MyResource v_resource; var integer v_resourceIndex := -1; - f_connectInfoPort(p_component); p_component.start(f_sendLatestLocalResource()); alt { @@ -1074,8 +1130,7 @@ module OneM2M_Functions { } p_component.done; - f_disconnectInfoPort(p_component); - + return v_resourceIndex; } @@ -1087,8 +1142,6 @@ module OneM2M_Functions { function f_getLatestLocalResourceIndex(in CseSimu p_component) runs on Tester return integer { var integer v_resourceIndex; - f_connectInfoPort(p_component); - p_component.start(f_sendLatestLocalResourceIndex()); alt { []infoPort.receive(mw_resourceIndex) -> value v_resourceIndex{ @@ -1096,8 +1149,7 @@ module OneM2M_Functions { } p_component.done; - f_disconnectInfoPort(p_component); - + return v_resourceIndex; } @@ -1109,8 +1161,6 @@ module OneM2M_Functions { function f_getLatestLocalResourceAddress(in CseSimu p_component, AddressingMethod p_addressingMethod := PX_ADDRESSING_METHOD, PrimitiveScope p_primitiveScope := PX_PRIMITIVE_SCOPE) runs on Tester return XSD.ID { var XSD.ID v_localResourceAddress; - f_connectInfoPort(p_component); - p_component.start(f_sendLatestLocalResourceAddress(p_addressingMethod, p_primitiveScope)); alt { []infoPort.receive(mw_resourceAddress) -> value v_localResourceAddress{ @@ -1118,8 +1168,7 @@ module OneM2M_Functions { } p_component.done; - f_disconnectInfoPort(p_component); - + return v_localResourceAddress; } @@ -1567,6 +1616,10 @@ module OneM2M_Functions { if(vc_auxiliaryAe2Up) { if (vc_ae2.alive) { f_cse_postamble_aeSimu(vc_ae2); + f_cse_defaultHandler_aeSimu(); + f_disconnectInfoPort(vc_ae2); + vc_ae2.start(f_cf01DownAe2()); + vc_ae2.kill; } } @@ -1575,11 +1628,12 @@ module OneM2M_Functions { vc_cse1.stop; } if(vc_cse1.alive) { - f_connectInfoPort(vc_cse1); f_cse_postamble_cse1(); f_cse_defaultHandler_aeSimu(); f_disconnectInfoPort(vc_cse1); - + vc_cse1.start(f_cf02DownCse()); + vc_cse1.kill; + } } @@ -1611,7 +1665,11 @@ module OneM2M_Functions { } } - + if((vc_config == e_cf02CseSimuMaster) or ((vc_config == e_cf01) and (vc_aeSimuDesc.appId == "NMyApp2Id"))){ + if(infoPort.checkstate("Connected")) { + infoPort.send(SyncPoints:e_done); + } + } } /** @@ -1650,6 +1708,18 @@ module OneM2M_Functions { vc_cse1.done; } + /** + * @desc Calls to postamble for CseSimu component (i.e. CSE2) on CseSimu + * @verdict + */ + function f_cse_postamble_cse2() runs on CseSimu { + if(vc_cse2.running) { + vc_cse2.stop; + } + vc_cse2.start(f_cse_postamble_deleteResourcesCSE()); + vc_cse2.done; + } + /** * @desc Deletion of all resources created during the test case execution. IUT gets clean and ready for next execution * @verdict @@ -1666,14 +1736,35 @@ module OneM2M_Functions { if (PX_RUN_POSTAMBLE) { - if(vc_config == e_cf02CseSimuMaster) { + if((vc_config == e_cf02CseSimuMaster) and (vc_cseSimuDesc.cseName != "CSE2_NAME")) { + if(vc_ae1.running) { + vc_ae1.stop; + } if(vc_ae1.alive) { + if(vc_auxiliaryCse2Up) { + if(vc_cse2.running) { + vc_cse2.stop; + } + vc_cse2.start(f_cse_defaultHandler()); + } f_cse_postamble_ae1(); + f_cse_defaultHandler(); + f_disconnectInfoPort(vc_ae1); + vc_ae1.start(f_cf02DownAe()); + vc_ae1.kill; + } if(vc_auxiliaryCse2Up) { - if(vc_cse2.alive) { + if(vc_cse2.running) { vc_cse2.stop; } + if(vc_cse2.alive) { + f_cse_postamble_cse2(); + f_cse_defaultHandler(); + f_disconnectInfoPort(vc_cse2); + vc_cse2.start(f_cf02DownCse()); + vc_cse2.kill; + } } }; @@ -1762,12 +1853,11 @@ module OneM2M_Functions { } } - if(vc_config == e_cf02) { + if((vc_config == e_cf02) or ((vc_config == e_cf02CseSimuMaster) and (vc_cseSimuDesc.cseName == "CSE2_NAME"))) { if(infoPort.checkstate("Connected")) { infoPort.send(SyncPoints:e_done); } } - } }//end group postambleFunctions @@ -6404,15 +6494,21 @@ module OneM2M_Functions { function f_checkAeSimuStatus() runs on AeSimu { if (getverdict != pass) { - f_cse_postamble_deleteResources(); + if ((vc_config == e_cf02CseSimuMaster) or (vc_aeSimuDesc.appId == "NMyApp2Id")) { + infoPort.send(SyncPoints:e_error); + } else { + f_cse_postamble_deleteResources(); + f_cf02DownAe(); + kill; + } - // Tear down + /* // Tear down if(vc_config == e_cf01) { f_cf01Down(); } else if (vc_config ==e_cf02) { f_cf02Down(); } - kill; + kill;*/ } else { log(__SCOPE__, ":INFO: AeSimu status OK"); } @@ -6428,11 +6524,14 @@ module OneM2M_Functions { function f_checkCseSimuStatus() runs on CseSimu { if (getverdict != pass) { - //f_ae_postamble_deleteResources(); - // Tear down - //f_cfAeTesterDown(); - f_cse_postamble_deleteResourcesCSE(); - //Tear down + if((vc_config == e_cf02) or (vc_cseSimuDesc.cseName == "CSE2_NAME")) { + infoPort.send(SyncPoints:e_error); + } else { + f_cse_postamble_deleteResourcesCSE(); + f_cf02DownCse(); + kill; + }/* + // Tear down if(vc_config == e_cf03) { f_cf03Down(); } else if (vc_config ==e_cf04) { @@ -6440,7 +6539,7 @@ module OneM2M_Functions { } else if (vc_config == e_cf02CseSimuMaster) { f_cf02DownCseSimuMaster(); } - kill; + kill;*/ } else { log(__SCOPE__, ":INFO: CseSimu status OK"); } @@ -6472,7 +6571,7 @@ module OneM2M_Functions { setverdict(inconc); // Component was not completed successfully } - f_checkAeSimuStatus(); + //f_checkAeSimuStatus(); } /** @@ -6501,7 +6600,7 @@ module OneM2M_Functions { setverdict(inconc); // Component was not completed successfully } - f_checkCseSimuStatus(); + //f_checkCseSimuStatus(); } }//end of group ComponentStatus diff --git a/LibOneM2M/OneM2M_Ports.ttcn b/LibOneM2M/OneM2M_Ports.ttcn index 61fe7b7..e631865 100644 --- a/LibOneM2M/OneM2M_Ports.ttcn +++ b/LibOneM2M/OneM2M_Ports.ttcn @@ -36,6 +36,18 @@ module OneM2M_Ports { map param (in PortDesc p_portDesc); }; + /** + * @desc Port to transport oneM2M primitives internally (between CseSimu components) + * @desc Output RequestPrimitives, ResponsePrimitives + * @desc Input RequestPrimitives, ResponsePrimitives + * @desc this port is allowed to extend for futher usage + * @desc e.g. extend OneM2MPort to dual-faced port + */ + type port OneM2MPortInternal message { + inout + RequestPrimitive, ResponsePrimitive; + }; + /** * @desc Port to transport different underlying 3GPP T8 network primitives * @desc Output MsgOut diff --git a/LibOneM2M/OneM2M_TestSystem.ttcn b/LibOneM2M/OneM2M_TestSystem.ttcn index 5496914..b78c80d 100644 --- a/LibOneM2M/OneM2M_TestSystem.ttcn +++ b/LibOneM2M/OneM2M_TestSystem.ttcn @@ -98,6 +98,7 @@ module OneM2M_TestSystem { port OneM2MPort mcaPortIn; port OneM2MPort mccPort; port OneM2MPort mccPortIn; + port OneM2MPortInternal mccPortInternal; //global variables //About configuration of the component var CseSimuComponentDesc vc_cseSimuDesc; @@ -108,6 +109,7 @@ module OneM2M_TestSystem { var integer vc_cSEBaseIndex := -1; //Index of the CSEBase resource of the Tester inside vc_localResourcesList var integer vc_remoteCseIndex := -1;//Specific to CseSimu var integer vc_localRemoteCseIndex := -1; + var integer vc_localCSEBaseAnncIndex := -1;//Index of the CSEBaseAnnc resource of the remote CSE //Status of attached component var boolean vc_auxiliaryCse2Up := false; }; diff --git a/OneM2M_Testcases_CSE_Release_3.ttcn b/OneM2M_Testcases_CSE_Release_3.ttcn index 5493bec..babb859 100644 --- a/OneM2M_Testcases_CSE_Release_3.ttcn +++ b/OneM2M_Testcases_CSE_Release_3.ttcn @@ -11161,7 +11161,7 @@ module OneM2M_Testcases_CSE_Release_3 { } } - vc_cse1.done; + f_aeSimu_checkComponentDoneAndGetVerdict(vc_cse1); // Postamble f_cse_postamble_deleteResources(); -- GitLab