Skip to content
Snippets Groups Projects
Commit 35addd17 authored by Miguel Angel Reina Ortega's avatar Miguel Angel Reina Ortega
Browse files

TC_CSE_SUB_NTF_003 - Implemented a different approach to calculate the elapsed...

TC_CSE_SUB_NTF_003 - Implemented a different approach to calculate the elapsed time before sending notification

Signed-off-by: Miguel Angel Reina Ortega's avatarreinaortega <miguelangel.reinaortega@etsi.org>
parent d524e066
No related branches found
No related tags found
No related merge requests found
...@@ -2917,7 +2917,7 @@ module OneM2M_Testcases_CSE_Release_2 { ...@@ -2917,7 +2917,7 @@ module OneM2M_Testcases_CSE_Release_2 {
} // end TC_CSE_SUB_NTF_002 } // end TC_CSE_SUB_NTF_002
/** /**
* @desc Check that the IUT sends aggregated notification to the subscriber resource when the duration value of the batchNotify attribute is set to TIME_LIMIT and when this timer expires * @desc Check that the IUT sends batched notifications to the subscriber resource when the duration value of the batchNotify attribute is set to TIME_LIMIT and when this timer expires
* *
*/ */
testcase TC_CSE_SUB_NTF_003() runs on Tester system CseSystem { testcase TC_CSE_SUB_NTF_003() runs on Tester system CseSystem {
...@@ -2934,20 +2934,24 @@ module OneM2M_Testcases_CSE_Release_2 { ...@@ -2934,20 +2934,24 @@ module OneM2M_Testcases_CSE_Release_2 {
// Local variables // Local variables
timer t_batchNotificationTimer := PX_TAC * 2.0; timer t_batchNotificationTimer := PX_TAC * 2.0;
var float v_elapsedTime; var float v_elapsedTime;
const integer c_numberOfAggregatedNotification := 2;
var Labels v_labels_1:= {"VALUE_1"}; var Labels v_labels_1:= {"VALUE_1"};
var Labels v_labels_2:= {"VALUE_2"}; var integer v_ae1Index := -1;
var integer v_aeIndex := -1;
var integer v_resourceIndex := -1; var integer v_resourceIndex := -1;
var template RequestPrimitive v_createRequest := omit; var template RequestPrimitive v_createRequest := omit;
var template PrimitiveContent v_contentResponse; var template PrimitiveContent v_contentResponse;
var template RequestPrimitive v_updateRequest := m_updateAeBase; var template RequestPrimitive v_updateRequest := m_updateAeBase;
var RequestPrimitive v_request; var RequestPrimitive v_request;
var ResponsePrimitive v_responsePrimitive;
var integer v_ae2Index := -1; var integer v_ae2Index := -1;
var integer v_ae2LocalIndex := -1;
v_contentResponse.aE := mw_contentAeBase; // all attributes expected v_contentResponse.aE := mw_contentAeBase; // all attributes expected
// Test control // Test control
if(PX_TAC < 10.0) {
setverdict(inconc, __SCOPE__ & ": PX_TAC is required to be bigger than 10 seconds to run this test case");
stop;
}
// Test component configuration // Test component configuration
f_cf01Up(true); f_cf01Up(true);
...@@ -2955,36 +2959,80 @@ module OneM2M_Testcases_CSE_Release_2 { ...@@ -2955,36 +2959,80 @@ module OneM2M_Testcases_CSE_Release_2 {
// Test adapter configuration // Test adapter configuration
// Preamble // Preamble
v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi); f_cse_createAccessControlPolicyAux("SubscriptionVerificationAcp",{"all"}, int63);
f_cse_preamble_subscriptionVerification(v_ae2Index, v_createRequest, int23); v_ae1Index := f_cse_createResource_withAcpAux(int2, m_createAe(PX_TS_AE1.appId, -, PX_TS_AE1.aeIdStem, c_aeAuxName, {f_getCompletePoA(PX_TS_AE1.mcaPortIn, "")}), -1); // AE1 is registred
v_createRequest := m_createSubscriptionAdvanced(f_getResourceAddress(v_aeIndex), -, {f_getResourceAddress(v_ae2Index)},omit,omit,m_batchNotify(c_numberOfAggregatedNotification + 1, "PT10S" ), omit, omit, -, int2);//batchNotify/number greater than number of notifications to be sent so that batchNotify/duration expires before vc_ae2.start(f_cse_createResource(int2, m_createAe(PX_TS_AE2.appId, -, PX_TS_AE2.aeIdStem, c_defaultAE2Name, omit), -1)); // AE2 is registred
v_resourceIndex := f_cse_createResource(int23, v_createRequest, v_aeIndex);//Subscription f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2);
if(vc_ae2.running) { v_ae2LocalIndex := f_getResourceFromAeSimu(vc_ae2);
vc_ae2.stop;
};
// Test Body v_ae2Index := f_getLatestResourceIndex(vc_ae2);
vc_ae2.start(f_cse_notifyProcedure_aggregatedNoficationHandler(v_contentResponse, c_numberOfAggregatedNotification));
v_updateRequest.primitiveContent.aE.labels := v_labels_1; v_createRequest := m_createSubscriptionAdvanced(f_getResourceAddress(v_ae2LocalIndex), -, {f_getResourceAddress(v_ae1Index)},omit,omit,m_batchNotify(2, "PT10S" ), omit, omit, -, int2);//batchNotify/number greater than number of notifications to be sent so that batchNotify/duration expires before
f_cse_updateResource(int2, v_aeIndex, v_updateRequest); // Update request 1
vc_ae2.start(f_cse_createResource(int23, v_createRequest, v_ae2Index));//Subscription
tc_ac.start;
alt {
[] mcaPortIn.receive(mw_request(mw_notifyNotification(mw_contentNotificationVerification))) -> value vc_request {
tc_ac.stop;
setverdict(pass, __SCOPE__ & ":INFO: Notification received");
v_responsePrimitive := valueof(m_responseNotification(int2000, omit));
v_responsePrimitive.requestIdentifier := vc_request.primitive.requestPrimitive.requestIdentifier;
f_send(e_mca_in_port, m_httpResponse(v_responsePrimitive));
}
[] mcaPortIn.receive(mw_request(mw_notifyNotification(mw_contentNotification(?)))) -> value vc_request {
tc_ac.stop;
setverdict(inconc, __SCOPE__ & ":ERROR: Notification received but verificationRequest isn't set to TRUE");
v_responsePrimitive := valueof(m_responseNotification(int4000, omit));
v_responsePrimitive.requestIdentifier := vc_request.primitive.requestPrimitive.requestIdentifier;
f_send(e_mca_in_port, m_httpResponse(v_responsePrimitive));
}
[] tc_ac.timeout {
if (not(vc_ae2.running)){
setverdict(pass, __SCOPE__ & ":INFO: No subscription verification received but subscription resource was created");
}
}
}
f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2);
f_checkAeSimuStatus();
// Test Body
t_batchNotificationTimer.start; t_batchNotificationTimer.start;
v_updateRequest := m_updateAeBase; v_updateRequest.primitiveContent.aE.labels := v_labels_1;
v_updateRequest.primitiveContent.aE.appName := "MyAppName2"; vc_ae2.start(f_cse_updateResource(int2, v_ae2Index, v_updateRequest)); // Update request 1
f_cse_updateResource(int2, v_aeIndex, v_updateRequest); // Update request 2
vc_ae2.done; tc_ac.start;
alt {
[] mcaPortIn.receive(mw_request(mw_notifyNotification(mw_contentNotification(?)))) -> value vc_request {
tc_ac.stop;
if(f_check_notificationContent(vc_request.primitive.requestPrimitive, v_contentResponse)){
setverdict(pass, __SCOPE__ & ":INFO: Notification received");
v_elapsedTime := t_batchNotificationTimer.read; v_elapsedTime := t_batchNotificationTimer.read;
t_batchNotificationTimer.stop; t_batchNotificationTimer.stop;
if(v_elapsedTime < 10.0) { if(v_elapsedTime < 10.0) {
setverdict(fail, __SCOPE__ & ": Notifications sent before bathNotify/duration expired"); setverdict(fail, __SCOPE__ & ": Notifications sent before bathNotify/duration expired");
} }
}
else{
setverdict(fail, __SCOPE__ & ":ERROR: Notification received but the content doesn't match");
}
//Send response in any case
v_responsePrimitive := valueof(m_responseNotification(int2000, omit));
v_responsePrimitive.requestIdentifier := vc_request.primitive.requestPrimitive.requestIdentifier;
f_send(e_mca_in_port, m_response(v_responsePrimitive));
}
[] tc_ac.timeout {
setverdict(fail, __SCOPE__ & ": No notification received");
}
}
f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2); f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment