Fixing handling of PTC sync when errors occur to avoid wrong code behaviour

Signed-off-by: Miguel Angel Reina Ortega's avatarreinaortega <miguelangel.reinaortega@etsi.org>
parent 9176ee90
......@@ -682,11 +682,10 @@ module OneM2M_Functions {
if(p_resourceType == int23){
vc_ae2.start(f_cse_createAccessControlPolicyAux("SubscriptionVerificationAcp",{"all"}, int63));
vc_ae2.done;
vc_ae2.start(f_cse_createResource_withAcpAux(int2, m_createAe(PX_APP_ID, -, PX_AE2_ID_STEM, c_defaultAE2Name, {f_getAnnouncementTargetPoA("HTTP", PX_AE2_ADDRESS, "")}), -1)); // AE2 is registred
vc_ae2.done;
f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2);
f_checkComponentDoneAndGetVerdict(vc_ae2);
vc_ae2.start(f_cse_createResource_withAcpAux(int2, m_createAe(PX_APP_ID, -, PX_AE2_ID_STEM, c_defaultAE2Name, {f_getAnnouncementTargetPoA("HTTP", PX_AE2_ADDRESS, "")}), -1)); // AE2 is registred
f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2);
p_ae2Index := f_getResource(vc_ae2);
if(ischosen(p_createRequestPrimitive.primitiveContent.subscription)){ //this condition is necessary for Subscription TCs where notification URI is set in m_createSubscriptionAdvanced
......@@ -712,12 +711,15 @@ module OneM2M_Functions {
if (PX_RUN_POSTAMBLE) {
if(vc_config == e_cf02) {
vc_cse1.start(f_cse_postamble_deleteResourcesCSE());
vc_cse1.done;
if(vc_cse1.alive) {
f_cse_postamble_cse1();
}
}
if(vc_auxiliaryAe2Up) {
f_cse_postamble_aeSimu(vc_ae2);
if (vc_ae2.alive) {
f_cse_postamble_aeSimu(vc_ae2);
}
}
for(i := lengthof(vc_resourcesIndexToBeDeleted) -1; i >=0; i := i - 1) {
......@@ -774,6 +776,18 @@ module OneM2M_Functions {
vc_ae1.done;
}
/**
* @desc Calls to postamble for CseSimu component (i.e. CSE1) on AeSimu
* @verdict
*/
function f_cse_postamble_cse1() runs on AeSimu {
if(vc_cse1.running) {
vc_cse1.stop;
}
vc_cse1.start(f_cse_postamble_deleteResourcesCSE());
vc_cse1.done;
}
/**
* @desc Deletion of all resources created during the test case execution. IUT gets clean and ready for next execution
* @verdict
......@@ -786,7 +800,9 @@ module OneM2M_Functions {
if (PX_RUN_POSTAMBLE) {
if(vc_config == e_cf02CseSimuMaster) {
f_cse_postamble_ae1();
if(vc_ae1.alive) {
f_cse_postamble_ae1();
}
};
for(i := lengthof(vc_resourcesIndexToBeDeleted) -1; i >=0; i := i - 1) {
......@@ -3376,15 +3392,14 @@ module OneM2M_Functions {
if (getverdict != pass) {
f_cse_postamble_deleteResources();
// Tear down
if(vc_config == e_cf01) {
f_cf01Down();
} else if (vc_config ==e_cf02) {
vc_cse1.start(f_cse_postamble_deleteResourcesCSE());
vc_cse1.done;
f_cf02Down();
}
stop;
kill;
}
}
......@@ -3394,7 +3409,7 @@ module OneM2M_Functions {
* @param data Corresponding information for the correct execution of the given action
* @verdict
*/
function f_checkComponentDoneAndGetVerdict(AeSimu p_ae) runs on AeSimu {
function f_aeSimu_checkComponentDoneAndGetVerdict(AeSimu p_ae) runs on AeSimu {
var verdicttype v_verdict := none;
......@@ -3417,6 +3432,35 @@ module OneM2M_Functions {
f_checkAeSimuStatus();
}
/**
* @desc Sending of an Adapter Control primitive
* @param event Action to be performed by TA
* @param data Corresponding information for the correct execution of the given action
* @verdict
*/
function f_cseSimu_checkComponentDoneAndGetVerdict(AeSimu p_ae) runs on CseSimu {
var verdicttype v_verdict := none;
tc_ac.start(15.0);
alt {
[] p_ae.done -> value v_verdict {
tc_ac.stop;
}
[] tc_ac.timeout {
setverdict(inconc, __SCOPE__ & "INFO: Component did not finish");
}
}
if(v_verdict == pass) { // Component was successfully completed and got stopped state
setverdict(pass);
} else {
setverdict(inconc); // Component was not completed successfully
}
f_checkCseSimuStatus();
}
/**
* @desc Sending of an Adapter Control primitive
* @param event Action to be performed by TA
......@@ -3430,16 +3474,15 @@ module OneM2M_Functions {
// Tear down
//f_cfAeTesterDown();
f_cse_postamble_deleteResourcesCSE();
//Tear down
if(vc_config == e_cf03) {
f_cf03Down();
stop;
} else if (vc_config ==e_cf04) {
} else if (vc_config ==e_cf04) {
f_cf04Down();
stop;
} else if (vc_config == e_cf02CseSimuMaster) {
f_cf02DownCseSimuMaster();
stop;
}
kill;
}
}
......
......@@ -1796,9 +1796,11 @@ module OneM2M_PermutationFunctions {
if(ispresent(p_parentRequestPrimitive)) {
if(match(int23, p_parentRequestPrimitive.resourceType)){
vc_ae2.start(f_cse_preamble_createAcpAux("SubscriptionVerificationAcp", int63));
vc_ae2.done;
f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2);
vc_ae2.start(f_cse_createResource_withAcpAux(int2, m_createAe(PX_APP_ID, -, PX_AE2_ID_STEM, c_defaultAE2Name, v_poaList), -1)); // AE2 is registred
vc_ae2.done;
f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2);
v_ae2Index := f_getResource(vc_ae2);
p_parentRequestPrimitive.primitiveContent.subscription.notificationURI := {f_getResourceAddress(v_ae2Index)};
vc_ae2.start(f_cse_notifyProcedure_subscriptionVerificationHandler());
......@@ -1833,9 +1835,9 @@ module OneM2M_PermutationFunctions {
if(match(int23, p_requestPrimitive.resourceType)){
vc_ae2.start(f_cse_preamble_createAcpAux("SubscriptionVerificationAcp", int63));
vc_ae2.done;
f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2);
vc_ae2.start(f_cse_createResource_withAcpAux(int2, m_createAe(PX_APP_ID, -, PX_AE2_ID_STEM, c_defaultAE2Name, v_poaList), -1)); // AE2 is registred
vc_ae2.done;
f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2);
v_ae2Index := f_getResource(vc_ae2);
p_requestPrimitive.primitiveContent.subscription.notificationURI := {f_getResourceAddress(v_ae2Index)};
vc_ae2.start(f_cse_notifyProcedure_subscriptionVerificationHandler());
......@@ -1907,9 +1909,9 @@ module OneM2M_PermutationFunctions {
if(match(int23, p_resourceType)){
vc_ae1.start(f_cse_preamble_createAcpAux("SubscriptionVerificationAcp", int63));
vc_ae1.done;
f_cseSimu_checkComponentDoneAndGetVerdict(vc_ae1);
vc_ae1.start(f_cse_createResource_withAcpAux(int2, m_createAe(PX_APP_ID, -, PX_AE1_ID_STEM, "MyAe", v_poaList), -1)); // AE1 is registered
vc_ae1.done;
f_cseSimu_checkComponentDoneAndGetVerdict(vc_ae1);
v_ae1Index := f_getResource(vc_ae1);
p_requestPrimitive.primitiveContent.subscription.notificationURI := {f_getResourceAddress(v_ae1Index)};
vc_ae1.start(f_cse_notifyProcedure_subscriptionVerificationHandler());
......
......@@ -745,7 +745,8 @@ module OneM2M_Testcases_CSE_Release_1 {
vc_remoteCseIndex := f_cse_registrationRemoteCse(mw_createRemoteCSE);
vc_ae1.start(f_cse_createResource(int2, m_createAe(PX_APP_ID, omit, "S")));
vc_ae1.done;
f_cseSimu_checkComponentDoneAndGetVerdict(vc_ae1);
//TODO:
//v_request := valueof(m_delete(f_getResourceAddress(v_aeIndex), f_getOriginator(v_aeIndex)));
......@@ -7962,7 +7963,7 @@ module OneM2M_Testcases_CSE_Release_1 {
vc_ae2.stop;
};
f_checkComponentDoneAndGetVerdict(vc_ae2);
f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2);
// Test Body
v_notificationRequest := f_getRequestPrimitive(vc_ae2);
......@@ -8041,7 +8042,7 @@ module OneM2M_Testcases_CSE_Release_1 {
}
}
f_checkComponentDoneAndGetVerdict(vc_ae2);
f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2);
//Postamble
f_cse_postamble_deleteResources();
......@@ -8116,7 +8117,7 @@ module OneM2M_Testcases_CSE_Release_1 {
}
};
f_checkComponentDoneAndGetVerdict(vc_ae2);
f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2);
//Postamble
f_cse_postamble_deleteResources();
......@@ -8192,7 +8193,7 @@ module OneM2M_Testcases_CSE_Release_1 {
}
}
f_checkComponentDoneAndGetVerdict(vc_ae2);
f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2);
v_notificationRequest := f_getRequestPrimitive(vc_ae2);
......
......@@ -5850,7 +5850,7 @@ module OneM2M_Testcases_CSE_Release_2 {
}
}
f_checkComponentDoneAndGetVerdict(vc_ae2);
f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2);
//Check to see if the resource is NOT present
if(f_isResourceNotPresent(v_aeIndex, f_getResourceName(v_request.primitiveContent))){
......@@ -5915,7 +5915,7 @@ module OneM2M_Testcases_CSE_Release_2 {
}
}
f_checkComponentDoneAndGetVerdict(vc_ae2);
f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2);
//Check to see if the resource is NOT present
if(f_isResourceNotPresent(v_aeIndex, f_getResourceName(v_request.primitiveContent))){
......@@ -5994,7 +5994,7 @@ module OneM2M_Testcases_CSE_Release_2 {
setverdict(fail, __SCOPE__ & ": Notifications sent before bathNotify/duration expired");
}
f_checkComponentDoneAndGetVerdict(vc_ae2);
f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2);
//Postamble
f_cse_postamble_deleteResources();
......@@ -6075,7 +6075,7 @@ module OneM2M_Testcases_CSE_Release_2 {
}
}
f_checkComponentDoneAndGetVerdict(vc_ae2);
f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2);
//Postamble
f_cse_postamble_deleteResources();
......@@ -6121,7 +6121,7 @@ module OneM2M_Testcases_CSE_Release_2 {
v_resourceIndex := f_cse_createResource(int23, v_createRequest, v_aeIndex);//Subscription
f_checkComponentDoneAndGetVerdict(vc_ae2);
f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2);
// Test Body
vc_ae2.start(f_cse_notifyProcedure_representationHandler(v_contentResponse)); // check if the notification is well received and if its content matchs
......@@ -6148,7 +6148,7 @@ module OneM2M_Testcases_CSE_Release_2 {
}
}
f_checkComponentDoneAndGetVerdict(vc_ae2);
f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2);
//Postamble
f_cse_postamble_deleteResources();
......@@ -6205,7 +6205,7 @@ module OneM2M_Testcases_CSE_Release_2 {
v_request:= f_getUpdateRequestPrimitive(int2, v_aeIndex, v_updateRequest); // AE update request
f_cse_updateResource(v_request); // AE update
f_checkComponentDoneAndGetVerdict(vc_ae2);
f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2);
mcaPort.send(m_request(m_retrieve(f_getResourceAddress(v_resourceIndex), f_getOriginator(v_resourceIndex))));
......@@ -6233,7 +6233,7 @@ module OneM2M_Testcases_CSE_Release_2 {
}
}
f_checkComponentDoneAndGetVerdict(vc_ae2);
f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2);
//Postamble
f_cse_postamble_deleteResources();
......@@ -6287,7 +6287,7 @@ module OneM2M_Testcases_CSE_Release_2 {
v_request:= f_getUpdateRequestPrimitive(int2, v_aeIndex, v_updateRequest); // AE update request
f_cse_updateResource(v_request); // AE update
f_checkComponentDoneAndGetVerdict(vc_ae2);
f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2);
mcaPort.send(m_request(m_retrieve(f_getResourceAddress(v_resourceIndex), f_getOriginator(v_resourceIndex))));
......@@ -6310,7 +6310,7 @@ module OneM2M_Testcases_CSE_Release_2 {
}
}
f_checkComponentDoneAndGetVerdict(vc_ae2);
f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2);
//Postamble
f_cse_postamble_deleteResources();
......@@ -6383,7 +6383,7 @@ module OneM2M_Testcases_CSE_Release_2 {
}
}
f_checkComponentDoneAndGetVerdict(vc_ae2);
f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2);
//Postamble
f_cse_postamble_deleteResources();
......@@ -6448,7 +6448,7 @@ module OneM2M_Testcases_CSE_Release_2 {
v_request:= f_getUpdateRequestPrimitive(int2, v_aeIndex, v_updateRequest); // Update request 3
f_cse_updateResource(v_request);
f_checkComponentDoneAndGetVerdict(vc_ae2);
f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2);
//Postamble
f_cse_postamble_deleteResources();
......@@ -6517,7 +6517,7 @@ module OneM2M_Testcases_CSE_Release_2 {
v_request:= f_getUpdateRequestPrimitive(int2, v_aeIndex, v_updateRequest); // Update request 3
f_cse_updateResource(v_request);
f_checkComponentDoneAndGetVerdict(vc_ae2);
f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2);
//Postamble
f_cse_postamble_deleteResources();
......@@ -6592,7 +6592,7 @@ module OneM2M_Testcases_CSE_Release_2 {
}
}
f_checkComponentDoneAndGetVerdict(vc_ae2);
f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2);
//Postamble
f_cse_postamble_deleteResources();
......@@ -6671,7 +6671,7 @@ module OneM2M_Testcases_CSE_Release_2 {
}
}
f_checkComponentDoneAndGetVerdict(vc_ae2);
f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2);
//Postamble
f_cse_postamble_deleteResources();
......@@ -6743,7 +6743,7 @@ module OneM2M_Testcases_CSE_Release_2 {
}
}
f_checkComponentDoneAndGetVerdict(vc_ae2);
f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2);
//Postamble
f_cse_postamble_deleteResources();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment