Skip to content
Snippets Groups Projects
Commit 6302abff authored by Carlos Arroyo Narvaez's avatar Carlos Arroyo Narvaez
Browse files

group Schedule_functionality

  TC_CSE_SCH_001
  TC_CSE_SCH_002
  TC_CSE_SCH_003
parent d61787ef
No related branches found
No related tags found
1 merge request!63Merge Release4-onwards into Release4
......@@ -552,7 +552,226 @@ module OneM2M_Testcases_CSE_Release_4 {
}//end group Delete
}//end group Data_Management_and_Repository
group Schedule_functionality {
/**
* @desc Check that the IUT rejects the CREATE request for the <schedule> resource, with the networkCoordinated attribute set, when the parent resource is of type <subscription>
*
*/
testcase TC_CSE_SCH_001() runs on Tester system CseSystem {
var AeSimu v_ae1 := AeSimu.create("AE1") alive;
v_ae1.start(f_CSE_SCH_001());
v_ae1.done;
}
function f_CSE_SCH_001() runs on AeSimu system CseSystem {
// Local variables
var integer v_aeIndex, v_resourceIndex := -1;
var template RequestPrimitive v_createRequestSchedule := m_createScheduleBase;
var RequestPrimitive v_request;
// Test component configuration
f_cf01Up();
// Test adapter configuration
// Preamble
v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi);
v_resourceIndex := f_cse_createResource(int23, m_createSubscriptionBase, v_aeIndex);//Subscription
// Test Body
v_createRequestSchedule.primitiveContent.schedule.networkCoordinated := true;
v_request := f_getCreateRequestPrimitive(int18, v_createRequestSchedule, v_resourceIndex);
f_send(e_mcaPort, m_request(valueof(v_request)));
tc_ac.start;
alt {
[] mcaPort.receive(mw_response(mw_responsePrimitive(int4102))) {
tc_ac.stop;
setverdict(pass, __SCOPE__ & ": Schedule request creation rejected.");
}
[] mcaPort.receive(mw_response(mw_responsePrimitive(int2001))) {
tc_ac.stop;
setverdict(fail, __SCOPE__ & ": Schedule request successfully created.");
}
[] mcaPort.receive(mw_response(mw_responsePrimitiveInverse(int4102))) -> value vc_response{
tc_ac.stop;
setverdict(fail, __SCOPE__ & ": Unexpected status code " & int2str(enum2int(vc_response.primitive.responsePrimitive.responseStatusCode)));
}
[] tc_ac.timeout {
setverdict(fail, __SCOPE__ & ": No answer while creating resource");
}
}
f_checkAeSimuStatus();
// Postamble
f_cse_postamble_deleteResources();
// Tear down
f_cf01Down();
} // f_CSE_SCH_001
/**
* @desc Check that the IUT rejects the UPDATE request for the <schedule> resource, with the networkCoordinated attribute set, when the parent resource is of type <subscription>
*
*/
testcase TC_CSE_SCH_002() runs on Tester system CseSystem {
var AeSimu v_ae1 := AeSimu.create("AE1") alive;
v_ae1.start(f_CSE_SCH_002());
v_ae1.done;
}
function f_CSE_SCH_002() runs on AeSimu system CseSystem {
// Local variables
var integer v_aeIndex, v_resourceIndex, v_childscheduleResourceIndex := -1;
var template RequestPrimitive v_contentUpdateSchedule := m_updateScheduleBase;
var RequestPrimitive v_request;
var ResourceType v_scheduleresourceType := int18; //schedule
// Test component configuration
f_cf01Up();
// Test adapter configuration
// Preamble
v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi);
v_resourceIndex := f_cse_createResource(int23, m_createSubscriptionBase, v_aeIndex);//Subscription
v_childscheduleResourceIndex := f_cse_createResource(v_scheduleresourceType, m_updateScheduleBase, v_resourceIndex);
v_contentUpdateSchedule.primitiveContent.schedule.networkCoordinated := true;
// Test Body
v_request := f_getUpdateRequestPrimitive(v_scheduleresourceType, v_resourceIndex, v_contentUpdateSchedule);
f_send(e_mcaPort, m_request(valueof(v_request)));
tc_ac.start;
alt {
[] mcaPort.receive(mw_response(mw_responsePrimitive(int4102))) {
tc_ac.stop;
setverdict(pass, __SCOPE__ & ": Schedule request update rejected.");
}
[] mcaPort.receive(mw_response(mw_responsePrimitive(int2001))) {
tc_ac.stop;
setverdict(fail, __SCOPE__ & ": Schedule request successfully updated.");
}
[] mcaPort.receive(mw_response(mw_responsePrimitiveInverse(int4102))) -> value vc_response{
tc_ac.stop;
setverdict(fail, __SCOPE__ & ": Unexpected status code " & int2str(enum2int(vc_response.primitive.responsePrimitive.responseStatusCode)));
}
[] tc_ac.timeout {
setverdict(fail, __SCOPE__ & ": No answer while creating resource");
}
}
f_checkAeSimuStatus();
// Postamble
f_cse_postamble_deleteResources();
// Tear down
f_cf01Down();
} // f_CSE_SCH_002
/**
* @desc Check that the IUT delivers notifications for the subscribed-to events of the <subscription> resource according to the allowed time window specified in the scheduleElement of the associated child <schedule> resource.
*
*/
testcase TC_CSE_SCH_003() runs on Tester system CseSystem {
var AeSimu v_ae1 := AeSimu.create("AE1") alive;
v_ae1.start(f_CSE_SCH_003());
v_ae1.done;
}
function f_CSE_SCH_003() runs on AeSimu system CseSystem {
// Local variables
timer t_batchNotificationTimer := PX_TAC * 2.0; //just gives enough time to execute
const ResourceType c_containerResourceType := int3;
var float v_elapsedTime;
var integer v_ae1Index, v_ae2Index, v_containerResourceIndex, v_childScheduleIndex := -1;
var template RequestPrimitive v_updateRequestPrimitive := m_updateContainerBase;
var template RequestPrimitive v_updateRequest;
var template (value) RequestPrimitive v_createRequestSubscription;
var template RequestPrimitive v_createRequest := m_createScheduleBase;
// 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
f_cf01Up(true);
// Test adapter configuration
// Preamble
f_cse_createAccessControlPolicyAux("SubscriptionVerificationAcp",{"all"}, int63);
v_ae1Index := f_cse_createResource_withAcpAux(int2, m_createAe(vc_aeSimuDesc.appId, -, vc_aeSimuDesc.aeIdStem, c_defaultAe1ResourceName, {f_getLocalPoA(vc_aeSimuDesc.mcaPortIn, "")}), -1);
// AE1 is registered
vc_ae2.start(f_cse_createResource_withAcpAux(int2, m_createAe(PX_TS_AE2.appId, -, PX_TS_AE2.aeIdStem, c_defaultAe2ResourceName, {f_getLocalPoA(PX_TS_AE2.mcaPortIn, "")}), -1));
// AE2 is registered
f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2);
v_ae2Index := f_getResourceFromAeSimu(vc_ae2);
v_containerResourceIndex := f_cse_createResource(c_containerResourceType, m_createContainerBase, v_ae1Index);
v_createRequestSubscription := m_createSubscription(f_getResourceAddress(v_ae2Index), omit, {f_getResourceAddress(v_ae1Index)});
vc_ae2.start(f_cse_createResource(int23, v_createRequestSubscription, v_containerResourceIndex));//Subscription
v_createRequest.primitiveContent.schedule.scheduleElement := {{"*/5 0 0 * * * *"}};//scheduled every 5 seconds
v_childScheduleIndex := f_cse_createResource(int18, v_createRequest, v_containerResourceIndex); //schedule resource child
v_updateRequest := f_getUpdateRequestPrimitive(c_containerResourceType, v_containerResourceIndex, v_updateRequestPrimitive);
// Test Body
t_batchNotificationTimer.start;
f_send(e_mcaPort, m_request(valueof(v_updateRequest)));
tc_ac.start;
alt {
[] mcaPort.receive(mw_response(mw_responsePrimitive(int2004))) -> value vc_response {
tc_ac.stop;
setverdict(pass, __SCOPE__&":INFO: Attribute of resource updated successfuly");
v_elapsedTime := t_batchNotificationTimer.read;
t_batchNotificationTimer.stop;
if(float2int(v_elapsedTime) mod 5 != 0) {
setverdict(fail, __SCOPE__ & ": Notifications sent before SCHEDULE_TIME is reached");
}
}
[] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value vc_response {
tc_ac.stop;
setverdict(fail, __SCOPE__ & ": Wrong response status code");
}
[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value vc_response {
tc_ac.stop;
setverdict(fail, __SCOPE__ & ": Error while updating scheduling resource ");
}
[] tc_ac.timeout {
setverdict(fail, __SCOPE__ & ": No answer while updating scheduling resource ");
}
}
f_checkAeSimuStatus();
// Postamble
f_cse_postamble_deleteResources();
// Tear down
f_cf01Down();
} // f_CSE_SCH_003
}//end group Schedule_functionality
group Subscription_And_Notification {
group Create {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment