Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
A
ATS
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TST
ATS
Commits
cf117723
Commit
cf117723
authored
7 months ago
by
Miguel Angel Reina Ortega
Browse files
Options
Downloads
Patches
Plain Diff
Fix for schedule test cases
parent
40084764
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
OneM2M_Testcases_CSE_Release_4.ttcn
+149
-30
149 additions, 30 deletions
OneM2M_Testcases_CSE_Release_4.ttcn
with
149 additions
and
30 deletions
OneM2M_Testcases_CSE_Release_4.ttcn
+
149
−
30
View file @
cf117723
...
...
@@ -572,7 +572,7 @@ module OneM2M_Testcases_CSE_Release_4 {
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 template RequestPrimitive v_createRequestSchedule := m_createScheduleBase
_subscription
;
var RequestPrimitive v_request;
// Test component configuration
...
...
@@ -645,11 +645,11 @@ module OneM2M_Testcases_CSE_Release_4 {
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_
upd
ateScheduleBase, v_resourceIndex);
v_childscheduleResourceIndex := f_cse_createResource(v_scheduleresourceType, m_
cre
ateScheduleBase
_subscription
, v_resourceIndex);
v_contentUpdateSchedule.primitiveContent.schedule.networkCoordinated := true;
// Test Body
v_request := f_getUpdateRequestPrimitive(v_scheduleresourceType, v_
r
esourceIndex, v_contentUpdateSchedule);
v_request := f_getUpdateRequestPrimitive(v_scheduleresourceType, v_
childscheduleR
esourceIndex, v_contentUpdateSchedule);
f_send(e_mcaPort, m_request(valueof(v_request)));
tc_ac.start;
alt {
...
...
@@ -696,18 +696,21 @@ module OneM2M_Testcases_CSE_Release_4 {
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 RequestPrimitive v_createRequestSubscription;
var template RequestPrimitive v_createRequest := m_createScheduleBase;
var integer v_ae1Index, v_ae2LocalIndex, v_ae2Index, v_containerResourceIndex, v_subscriptionResourceIndex, v_childScheduleIndex := -1;
var template RequestPrimitive v_updateRequest := m_updateContainerBase;
var template RequestPrimitive v_createRequest := m_createScheduleBase_subscription;
var ResponsePrimitive v_responsePrimitive;
var integer v_actualYear;
var XSD.ID v_containerResourceAddress;
var template PrimitiveContent v_contentResponse := {container := mw_contentContainerBase};// all attributes expected
v_contentResponse.container.labels := ?;
// 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);
...
...
@@ -716,39 +719,123 @@ module OneM2M_Testcases_CSE_Release_4 {
// 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
v_ae1Index := f_cse_createResource_withAcpAux(int2, m_createAe(vc_aeSimuDesc.appId, -, vc_aeSimuDesc.aeIdStem, c_defaultAe1ResourceName, {f_getLocalPoA(vc_aeSimuDesc.mcaPortIn, "")}), -1); // now AE1 is registered
vc_ae2.start(f_cse_createResource(int2, m_createAe(PX_TS_AE2.appId, -, PX_TS_AE2.aeIdStem, c_defaultAe2ResourceName, omit), -1)); // AE2 is registered
f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2);
v_ae2LocalIndex := f_getResourceFromAeSimu(vc_ae2);
v_ae2Index := f_getLatestResourceIndex(vc_ae2);
vc_ae2.start(f_cse_createResource(c_containerResourceType, m_createContainerBase, v_ae2Index));
f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2);
v_ae2Index := f_getResourceFromAeSimu(vc_ae2);
v_containerResourceIndex := f_getLatestResourceIndex(vc_ae2);
v_containerResourceAddress := f_getLatestResourceAddress(vc_ae2);
v_containerResourceIndex := f_cse_createResource(c_containerResourceType, m_createContainerBase, v_ae1Index);
vc_ae2.start(f_cse_createResource(int23, m_createSubscription(v_containerResourceAddress, -, {f_getResourceAddress(v_ae1Index)}), v_containerResourceIndex));
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_mcaPortIn, m_response(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_mcaPortIn, m_response(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);
v_subscriptionResourceIndex := f_getLatestResourceIndex(vc_ae2);
v_actualYear := f_getYear(fx_generateTimestamp());
v_createRequest.primitiveContent.schedule.scheduleElement := {{"* * * * * * " & int2str(v_actualYear)}};//scheduled for this year
vc_ae2.start(f_cse_createResource(int18, v_createRequest, v_subscriptionResourceIndex));
f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2);
// Test Body
v_updateRequest.primitiveContent.container.labels := {"LABEL_1"};
vc_ae2.start(f_cse_updateResource(int3, v_containerResourceIndex, v_updateRequest)); // Update request 1
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");
}
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_mcaPortIn, m_response(v_responsePrimitive));
f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2);
setverdict(pass, __SCOPE__ & ": Notifications sent on scheduled time");
}
[] tc_ac.timeout {
setverdict(fail, __SCOPE__ & ": No notification received");
}
}
f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2);
//Postamble
f_cse_postamble_deleteResources();
//Tear down
f_cf01Down();
/*
// Test component configuration
f_cf01Up();
// Test adapter configuration
v_createRequestSubscription := m_createSubscription(f_getResourceAddress(v_ae2Index), omit, {f_getResourceAddress(v_ae1Index)});
// Preamble
v_aeIndex := f_cse_preamble_registerAe(-, {f_getLocalPoA(vc_aeSimuDesc.mcaPortIn, "")});
// AE1 is registered
v
c_ae2.start(f_cse_createResource(int23, v_createRequestSubscription
,
v
_container
ResourceIndex));//Subscription
v
_containerResourceIndex := f_cse_createResource(c_containerResourceType
,
m
_c
reateC
ontainer
Base, v_ae1Index);
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_subscriptionResourceIndex := f_cse_createResource(int23, m_createSubscriptionBase(), v_containerResourceIndex);//Subscription
v_updateRequest := f_getUpdateRequestPrimitive(c_containerResourceType, v_containerResourceIndex, v_updateRequestPrimitive);
v_createRequest.primitiveContent.schedule.scheduleElement := {{"*//*5 0 0 * * * *"}};//scheduled every 5 seconds
v_childScheduleIndex := f_cse_createResource(int18, v_createRequest, v_subscriptionResourceIndex); //schedule resource child
v_updateRequest := f_getUpdateRequestPrimitive(c_containerResourceType, v_containerResourceIndex, v_updateRequest);
v_updateRequest.primitiveContent.container.labels := {"LABEL_1"};
// 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");
}
if (v_firstNotification) {
}
}
[] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value vc_response {
tc_ac.stop;
...
...
@@ -758,6 +845,38 @@ module OneM2M_Testcases_CSE_Release_4 {
tc_ac.stop;
setverdict(fail, __SCOPE__ & ": Error while updating scheduling resource ");
}
[] mcaPortIn.receive(mw_request(mw_notifyNotification(mw_contentNotification(?)))) -> value vc_request {
tc_ac.stop;
if(f_check_notificationContent(vc_request.primitive.requestPrimitive, v_contentNotification)){
setverdict(pass, __SCOPE__ & ":INFO: Notification received");
}
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_mcaPortIn, m_response(v_responsePrimitive));
if (v_firstNotification){
t_batchNotificationTimer.start;
v_updateRequest := f_getUpdateRequestPrimitive(c_containerResourceType, v_containerResourceIndex, v_updateRequest);
v_updateRequest.primitiveContent.container.labels := {"LABEL_2"};
f_send(e_mcaPort, m_request(valueof(v_updateRequest)));
repeat;
} else {
v_elapsedTime := t_batchNotificationTimer.read;
t_batchNotificationTimer.stop;
if(v_elapsedTime < 5.0) {
setverdict(fail, __SCOPE__ & ": Notifications sent before SCHEDULE_TIME is reached");
} else {
setverdict(pass, __SCOPE__ & ": Notifications sent on scheduled time");
}
}
}
[] mcaPortIn.receive(mw_request(mw_notifyNotification(?))) -> value vc_request {
tc_ac.stop;
setverdict(fail, __SCOPE__ & ":ERROR: Notification received but the content doesn't match");
}
[] tc_ac.timeout {
setverdict(fail, __SCOPE__ & ": No answer while updating scheduling resource ");
}
...
...
@@ -769,7 +888,7 @@ module OneM2M_Testcases_CSE_Release_4 {
f_cse_postamble_deleteResources();
// Tear down
f_cf01Down();
f_cf01Down();
*/
} // f_CSE_SCH_003
}//end group Schedule_functionality
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment