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

Subscription and Notification

3 tests - cl. 7.2.2.4.1	CREATE Operation (006, 007, 008)
6 tests - cl. 7.2.2.4.4 NOTIFY Operation (004-009)
parent 7beb43c2
No related branches found
No related tags found
1 merge request!63Merge Release4-onwards into Release4
...@@ -18,6 +18,7 @@ module OneM2M_Testcases_CSE_Release_3 { ...@@ -18,6 +18,7 @@ module OneM2M_Testcases_CSE_Release_3 {
import from OneM2M_Types all;//{type XSD.ID}; import from OneM2M_Types all;//{type XSD.ID};
import from OneM2M_TypesAndValues all; import from OneM2M_TypesAndValues all;
import from OneM2M_Pixits all; import from OneM2M_Pixits all;
import from LibCommon_Time all;
import from OneM2M_Pics all; import from OneM2M_Pics all;
import from OneM2M_Functions all; import from OneM2M_Functions all;
import from OneM2M_PermutationFunctions all; import from OneM2M_PermutationFunctions all;
...@@ -7613,7 +7614,376 @@ module OneM2M_Testcases_CSE_Release_3 { ...@@ -7613,7 +7614,376 @@ module OneM2M_Testcases_CSE_Release_3 {
} }
   
}// end group g_CSE_SUB_CRE_001 }// end group g_CSE_SUB_CRE_001
group g_CSE_SUB_CRE_006 {
/**
* @desc Check that the IUT accepts the creation of a subscription resource with the eventNotificationCriteria attribute which includes a CONDITION_TAG condition provided
*
*/
testcase TC_CSE_SUB_CRE_006_CRB() runs on Tester system CseSystem {
var AeSimu v_ae1 := AeSimu.create("AE1") alive;
var Timestamp v_timeStamp := fx_generateTimestamp();
var template RequestPrimitive v_createRequest := m_createSubscriptionBase;
v_createRequest.primitiveContent.subscription.eventNotificationCriteria.createdBefore := v_timeStamp;
v_ae1.start(f_CSE_SUB_CRE_006(v_createRequest));//createdBefore
v_ae1.done;
}
testcase TC_CSE_SUB_CRE_006_CRA() runs on Tester system CseSystem {
var AeSimu v_ae1 := AeSimu.create("AE1") alive;
var Timestamp v_timeStamp := fx_generateTimestamp();
var template RequestPrimitive v_createRequest := m_createSubscriptionBase;
v_createRequest.primitiveContent.subscription.eventNotificationCriteria.createdAfter := v_timeStamp;
v_ae1.start(f_CSE_SUB_CRE_006(v_createRequest));//createdAfter
v_ae1.done;
}
testcase TC_CSE_SUB_CRE_006_MS() runs on Tester system CseSystem {
var AeSimu v_ae1 := AeSimu.create("AE1") alive;
var Timestamp v_timeStamp := fx_generateTimestamp();
var template RequestPrimitive v_createRequest := m_createSubscriptionBase;
v_createRequest.primitiveContent.subscription.eventNotificationCriteria.modifiedSince := v_timeStamp;
v_ae1.start(f_CSE_SUB_CRE_006(v_createRequest));//modifiedSince
v_ae1.done;
}
testcase TC_CSE_SUB_CRE_006_US() runs on Tester system CseSystem {
var AeSimu v_ae1 := AeSimu.create("AE1") alive;
var Timestamp v_timeStamp := fx_generateTimestamp();
var template RequestPrimitive v_createRequest := m_createSubscriptionBase;
v_createRequest.primitiveContent.subscription.eventNotificationCriteria.unmodifiedSince := v_timeStamp;
v_ae1.start(f_CSE_SUB_CRE_006(v_createRequest)); //unmodifiedSince
v_ae1.done;
}
testcase TC_CSE_SUB_CRE_006_STS() runs on Tester system CseSystem {
var AeSimu v_ae1 := AeSimu.create("AE1") alive;
var XSD.PositiveInteger v_stateTagSmaller := 5;
var template RequestPrimitive v_createRequest := m_createSubscriptionBase;
v_createRequest.primitiveContent.subscription.eventNotificationCriteria.stateTagSmaller := v_stateTagSmaller;
v_ae1.start(f_CSE_SUB_CRE_006(v_createRequest)); //stateTagSmaller
v_ae1.done;
}
testcase TC_CSE_SUB_CRE_006_STB() runs on Tester system CseSystem {
var AeSimu v_ae1 := AeSimu.create("AE1") alive;
var XSD.PositiveInteger v_stateTagBigger := 5;
var template RequestPrimitive v_createRequest := m_createSubscriptionBase;
v_createRequest.primitiveContent.subscription.eventNotificationCriteria.stateTagBigger := v_stateTagBigger;
v_ae1.start(f_CSE_SUB_CRE_006(v_createRequest)); // stateTagBigger
v_ae1.done;
}
testcase TC_CSE_SUB_CRE_006_EXB() runs on Tester system CseSystem {
var AeSimu v_ae1 := AeSimu.create("AE1") alive;
var Timestamp v_timeStamp := fx_generateTimestamp();
var template RequestPrimitive v_createRequest := m_createSubscriptionBase;
v_createRequest.primitiveContent.subscription.eventNotificationCriteria.expireBefore := v_timeStamp;
v_ae1.start(f_CSE_SUB_CRE_006(v_createRequest)); //expireBefore
v_ae1.done;
}
testcase TC_CSE_SUB_CRE_006_EXA() runs on Tester system CseSystem {
var AeSimu v_ae1 := AeSimu.create("AE1") alive;
var Timestamp v_timeStamp := fx_generateTimestamp();
var template RequestPrimitive v_createRequest := m_createSubscriptionBase;
v_createRequest.primitiveContent.subscription.eventNotificationCriteria.expireAfter := v_timeStamp;
v_ae1.start(f_CSE_SUB_CRE_006(v_createRequest)); //expireAfter
v_ae1.done;
}
testcase TC_CSE_SUB_CRE_006_SZA() runs on Tester system CseSystem {
var AeSimu v_ae1 := AeSimu.create("AE1") alive;
var XSD.PositiveInteger v_sizeAbove := 5;
var template RequestPrimitive v_createRequest := m_createSubscriptionBase;
v_createRequest.primitiveContent.subscription.eventNotificationCriteria.sizeAbove := v_sizeAbove;
v_ae1.start(f_CSE_SUB_CRE_006(v_createRequest)); //sizeAbove
v_ae1.done;
}
testcase TC_CSE_SUB_CRE_006_SZB() runs on Tester system CseSystem {
var AeSimu v_ae1 := AeSimu.create("AE1") alive;
var XSD.PositiveInteger v_sizeBelow := 5;
var template RequestPrimitive v_createRequest := m_createSubscriptionBase;
v_createRequest.primitiveContent.subscription.eventNotificationCriteria.sizeBelow := v_sizeBelow;
v_ae1.start(f_CSE_SUB_CRE_006(v_createRequest)); //sizeBelow
v_ae1.done;
}
testcase TC_CSE_SUB_CRE_006_ET() runs on Tester system CseSystem {
var AeSimu v_ae1 := AeSimu.create("AE1") alive;
var EventNotificationCriteria.notificationEventType_list v_notificationEventType := {int1}; // Example value taken from TS-001, cl 9.6.8, Table 9.6.8-3 -> A. Update to attributes of the subscribed-to resource
var template RequestPrimitive v_createRequest := m_createSubscriptionBase;
v_createRequest.primitiveContent.subscription.eventNotificationCriteria.notificationEventType_list := v_notificationEventType;
v_ae1.start(f_CSE_SUB_CRE_006(v_createRequest)); //eventType
v_ae1.done;
}
testcase TC_CSE_SUB_CRE_006_OM() runs on Tester system CseSystem {
var AeSimu v_ae1 := AeSimu.create("AE1") alive;
var template RequestPrimitive v_createRequest := m_createSubscriptionBase;
var template OperationMonitor v_OperationMonitor;
v_OperationMonitor.operations := int1;
v_OperationMonitor.originator := PX_SUPER_CSE_ID;
v_createRequest.primitiveContent.subscription.eventNotificationCriteria.operationMonitor_list := {v_OperationMonitor};
v_ae1.start(f_CSE_SUB_CRE_006(v_createRequest)); //operationMonitor
v_ae1.done;
}
testcase TC_CSE_SUB_CRE_006_ATR() runs on Tester system CseSystem {
var AeSimu v_ae1 := AeSimu.create("AE1") alive;
var EventNotificationCriteria.attribute v_attributeList := {"apn"};
var template RequestPrimitive v_createRequest := m_createSubscriptionBase;
v_createRequest.primitiveContent.subscription.eventNotificationCriteria := m_eventNotificationCriteria({int1}); //notificationEventType = "Update to attributes of the subscribed-to resource"
v_createRequest.primitiveContent.subscription.eventNotificationCriteria.attribute := v_attributeList; // value taken as example
// TS-001, cl 9.6.8, Table 9.6.8-3 -> the attributes list is only applicable when notificationEventType has a value of "Update to attributes of the subscribed-to resource" or "Update to attributes of the subscribed-to resource with blocking of the triggering UPDATE operation"
v_ae1.start(f_CSE_SUB_CRE_006(v_createRequest)); //eventType
v_ae1.done;
}
testcase TC_CSE_SUB_CRE_006_CRT() runs on Tester system CseSystem {
var AeSimu v_ae1 := AeSimu.create("AE1") alive;
var template RequestPrimitive v_createRequest := m_createSubscriptionBase;
v_createRequest.primitiveContent.subscription.eventNotificationCriteria := m_eventNotificationCriteria({int3}); //notificationEventType = "Creation of a direct child of the subscribed-to resource"
// TS-001, cl 9.6.8, Table 9.6.8-3 -> childResource list is only applicable when notificationEventType has a value of "Creation of a direct child of the subscribed-to resource" or "Deletion of a direct child of the subscribed-to resource".4
v_createRequest.primitiveContent.subscription.eventNotificationCriteria.childResourceType := {int23};
v_ae1.start(f_CSE_SUB_CRE_006(v_createRequest)); //childResourceType
v_ae1.done;
} // acc. to TS-0001, clause 9.6.8, conditions "missingData" and "filterOperation" could be added. Also "attribute" is duplicated in TS-00018 TP/oneM2M/CSE/SUB/CRE/006
}// end group g_CSE_SUB_CRE_006
group g_CSE_SUB_CRE_007 {
/**
* @desc Check that the IUT accepts the creation of a subscription resource with the eventNotificationCriteria attribute which includes a missingData condition provided
*
*/
testcase TC_CSE_SUB_CRE_007() runs on Tester system CseSystem {
var AeSimu v_ae1 := AeSimu.create("AE1") alive;
v_ae1.start(f_CSE_SUB_CRE_007());
v_ae1.done;
} // end TC_CSE_SUB_CRE_007
function f_CSE_SUB_CRE_007() runs on AeSimu system CseSystem {
// Local variables
var MsgIn v_response;
var integer v_aeIndex := -1;
var integer v_resourceIndex := -1;
var integer v_timeSeriesIndex := -1;
var template (value) EventNotificationCriteria v_eventNotificationCriteria := m_eventNotificationCriteria; // parameter notificationEventType_list
var template RequestPrimitive v_createRequest := omit;
var RequestPrimitive v_request;
var XSD.PositiveInteger v_missingDataPointNumber := 1;
// Test control
// Test component configuration
f_cf01Up(true);
// Test adapter configuration
// Preamble
v_aeIndex := f_cse_preamble_registerAe();
v_eventNotificationCriteria.missingData := valueof(m_missingData(v_missingDataPointNumber, "PT1M"));//1 missing data, duration 1 Minute
v_timeSeriesIndex := f_cse_createResource(int23, m_createTimeSeries(-, true, 5, -, 2000), v_aeIndex);
v_createRequest := m_createSubscriptionAdvanced(f_getResourceAddress(v_aeIndex), -, {f_getResourceAddress(v_timeSeriesIndex)}, v_eventNotificationCriteria, omit, omit, omit, omit, omit, omit);
f_cse_preamble_subscriptionVerification(v_timeSeriesIndex, v_createRequest, int23);
v_request := f_getCreateRequestPrimitive(int23, v_createRequest, v_aeIndex);//Subscription
v_request.to_ := f_getResourceAddress(v_timeSeriesIndex);
// Test Body
f_send(e_mcaPort, m_request(v_request));
tc_ac.start;
alt {
[] mcaPort.receive(mw_response(mw_responsePrimitive(int2001))) -> value v_response {
tc_ac.stop;
setverdict(pass, __SCOPE__ & ": Resource created successfully");
f_checkAttributesToBeSaved(int23, v_request, v_response.primitive.responsePrimitive);
v_resourceIndex := f_setResource(v_response.primitive.responsePrimitive.primitiveContent, int23, vc_aeIndex);
}
[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) {
tc_ac.stop;
setverdict(inconc, __SCOPE__&":INFO: Error while creating resource");
}
[] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) {
tc_ac.stop;
setverdict(fail, __SCOPE__ & ": Wrong response status code in the response");
}
[] tc_ac.timeout {
setverdict(fail, __SCOPE__ & ": No answer while creating resource");
}
}
f_checkAeSimuStatus();
//Check to see if the resource is present or not
if (f_cse_isResourcePresent(v_resourceIndex)){
setverdict(pass, __SCOPE__ & ":INFO: Resource created");
} else {
setverdict(fail, __SCOPE__ & ":ERROR: Resource not created");
}
//Postamble
f_cse_postamble_deleteResources();
//Tear down
f_cf01Down();
} // end f_CSE_SUB_CRE_007
}// end group g_CSE_SUB_CRE_007
group g_CSE_SUB_CRE_008 {
/**
* @desc Check that the IUT accepts the creation of a subscription resource with the optional attributes notificationForwardingURI and groupID provided
*
*/
testcase TC_CSE_SUB_CRE_008() runs on Tester system CseSystem {
var AeSimu v_ae1 := AeSimu.create("AE1") alive;
v_ae1.start(f_CSE_SUB_CRE_008());
v_ae1.done;
} // end TC_CSE_SUB_CRE_008
function f_CSE_SUB_CRE_008() runs on AeSimu system CseSystem {
// Local variables
var MsgIn v_response;
var integer v_containerIndex := -1;
var integer v_aeIndex := -1;
var integer v_resourceIndex := -1;
var XSD.ID v_memberID;
var template RequestPrimitive v_request := m_createSubscriptionBase;
var template RequestPrimitive v_groupRequest;
var integer v_groupIndex := -1;
// Test control
// Test component configuration
f_cf01Up();
// Test adapter configuration
// Preamble
v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi
v_containerIndex := f_cse_createResource(int3, m_createContainerBase, v_aeIndex); // child resource
v_memberID := f_getResourceId(vc_resourcesList[v_containerIndex].resource);
v_groupRequest := valueof(m_createGroup(1, {v_memberID}, omit, int3));
v_groupIndex := f_cse_createResource(int9, v_groupRequest, v_aeIndex); // initial conditions
v_request.primitiveContent.subscription.groupID := f_getResourceId(vc_resourcesList[v_groupIndex].resource);
v_request.primitiveContent.subscription.notificationURI := {v_memberID};
v_request.primitiveContent.subscription.notificationForwardingURI := v_memberID;
//notificationForwardingURI shall be present only for group related subscriptions. If the subscriber intends the Group Hosting CSE to aggregate the notifications, the attribute shall be set identical to the notificationURI attribute
v_request.primitiveContent.group_.memberIDs := {f_getResourceId(vc_resourcesList[v_groupIndex].resource)};
v_request.requestIdentifier := valueof(v_groupRequest.requestIdentifier) & f_rnd(1, 1000000);
v_request := f_getCreateRequestPrimitive(int23, v_request, v_aeIndex);//Subscription
v_request.to_ := f_getResourceAddress(v_groupIndex) & "/fopt";
v_request.from_ := f_getResourceAddress(v_aeIndex);
// Test Body
f_send(e_mcaPort, m_request(v_request));
tc_ac.start;
alt {
[] mcaPort.receive(mw_response(mw_responsePrimitive(int2001))) -> value v_response { //CREATED - TS-004 - Table 6.6.3.3 1: RSCs for successful response class
tc_ac.stop;
setverdict(pass, __SCOPE__ & ": Resource created successfully");
f_checkAttributesToBeSaved(int23, valueof(v_request), v_response.primitive.responsePrimitive);
v_resourceIndex := f_setResource(v_response.primitive.responsePrimitive.primitiveContent, int23, vc_aeIndex);
}
[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) {
tc_ac.stop;
setverdict(inconc, __SCOPE__&":INFO: Error while creating resource");
}
[] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) {
tc_ac.stop;
setverdict(fail, __SCOPE__ & ": Wrong response status code in the response");
}
[] tc_ac.timeout {
setverdict(fail, __SCOPE__ & ": No answer while creating resource");
}
}
f_checkAeSimuStatus();
//Check to see if the resource is present or not
if (f_cse_isResourcePresent(v_resourceIndex)){
setverdict(pass, __SCOPE__ & ":INFO: Resource created");
} else {
setverdict(fail, __SCOPE__ & ":ERROR: Resource not created");
}
//Postamble
f_cse_postamble_deleteResources();
//Tear down
f_cf01Down();
} // end f_CSE_SUB_CRE_008
} // end g_CSE_SUB_CRE_008
group g_CSE_SUB_CRE_009 { group g_CSE_SUB_CRE_009 {
/** /**
* @desc Check that the IUT rejects a CREATE request when the notificationEventType is set to 6(Trigger_Received_For_AE_Resource) in combination of NOTIFICATION_EVENT_TYPE. * @desc Check that the IUT rejects a CREATE request when the notificationEventType is set to 6(Trigger_Received_For_AE_Resource) in combination of NOTIFICATION_EVENT_TYPE.
...@@ -7902,7 +8272,610 @@ module OneM2M_Testcases_CSE_Release_3 { ...@@ -7902,7 +8272,610 @@ module OneM2M_Testcases_CSE_Release_3 {
}//end group Create }//end group Create
group Notify{ group Notify{
/**
* @desc Check that the IUT sends the latest notification to the subscriber resource when latestNotify is set to TRUE, the duration value of the batchNotify attribute is set to TIME_LIMIT and when this timer expires
*
*/
testcase TC_CSE_SUB_NTF_004() runs on Tester system CseSystem {
var AeSimu v_ae1 := AeSimu.create("AE1") alive;
v_ae1.start(f_CSE_SUB_NTF_004());
v_ae1.done;
}
function f_CSE_SUB_NTF_004() runs on AeSimu system CseSystem {
// Local variables
timer t_batchNotificationTimer := PX_TAC * 2.0;
var float v_elapsedTime;
var Labels v_labels_1:= {"VALUE_1"};
var integer v_ae1Index := -1;
var template RequestPrimitive v_createRequest := omit;
var template PrimitiveContent v_contentResponse;
var template RequestPrimitive v_updateRequest := m_updateAeBase;
var ResponsePrimitive v_responsePrimitive;
var integer v_ae2Index := -1;
var integer v_ae2LocalIndex := -1;
v_contentResponse.aE := mw_contentAeBase; // all attributes expected
// 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); // 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);
// subscription child resource having notificationURI attribute set to AE2_RESOURCE_ADDRESS and latestNotify attribute set to TRUE and batchNotify attribute containing duration attribute set to TIME_LIMIT
v_createRequest := m_createSubscriptionAdvanced(f_getResourceAddress(v_ae2LocalIndex), -, {f_getResourceAddress(v_ae1Index)},omit,omit,m_batchNotify(2, "PT10S" ), true, omit, -, int2); //batchNotify/number greater than number of notifications to be sent so that batchNotify/duration expires before along with latestNotify
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_mcaPortIn, 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_mcaPortIn, 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);
// Test Body
t_batchNotificationTimer.start; // Timer to control requisite on duration attribute
v_updateRequest.primitiveContent.aE.labels := v_labels_1;
vc_ae2.start(f_cse_updateResource(int2, v_ae2Index, 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");
v_elapsedTime := t_batchNotificationTimer.read;
t_batchNotificationTimer.stop;
if(v_elapsedTime < 10.0) {
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_mcaPortIn, m_response(v_responsePrimitive));
}
[] mcaPortIn.receive(mw_request(mw_notifyAggregatedNotification({{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;
t_batchNotificationTimer.stop;
if(v_elapsedTime < 10.0) {
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_mcaPortIn, m_response(v_responsePrimitive));
}
[] tc_ac.timeout {
setverdict(fail, __SCOPE__ & ": No notification received");
}
}
f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2);
//Postamble
f_cse_postamble_deleteResources();
//Tear down
f_cf01Down();
} // end TC_CSE_SUB_NTF_004
/**
* @desc Check that the IUT sends the latest cached notification after IUT escapes from connectionless state when the pendingNotification is set to 1 (sendLatest)
*
*/
testcase TC_CSE_SUB_NTF_005() runs on Tester system CseSystem {
var AeSimu v_ae1 := AeSimu.create("AE1") alive;
v_ae1.start(f_CSE_SUB_NTF_005());
v_ae1.done;
}
function f_CSE_SUB_NTF_005() runs on AeSimu system CseSystem {
// Local variables
const integer receivedUpdateCounter := 3;
var Labels v_labels[receivedUpdateCounter];
var integer i;
var integer v_ae1Index := -1;
var integer v_resourceIndex := -1;
var template RequestPrimitive v_createRequest := omit;
var template PrimitiveContent v_contentResponse;
var template RequestPrimitive v_updateRequest := m_updateAeBase;
var integer v_ae2Index := -1;
var integer v_ae2LocalIndex := -1;
v_contentResponse.aE := mw_contentAeBase; // all attributes expected
v_labels[0] := {"VALUE_1"};
v_labels[1] := {"VALUE_2"};
v_labels[2] := {"VALUE_3"};
// Test control
// Test component configuration
f_cf01Up(true);
// Test adapter configuration
// Preamble
v_ae1Index := f_cse_preamble_registerAe();//c_CRUDNDi);
f_cse_preamble_subscriptionVerification(v_ae2Index, v_createRequest, int23);
// subscription child resource containing notificationURI attribute set to AE2_RESOURCE_ADDRESS and pendingNotification attribute set to 1 (sendLatest)
v_createRequest := m_createSubscriptionAdvanced(f_getResourceAddress(v_ae2LocalIndex), -, {f_getResourceAddress(v_ae2Index)},omit,omit,omit,omit,omit, -, int1);
v_resourceIndex := f_cse_createResource(int23, v_createRequest, v_ae1Index);//Subscription
//IUT being in the "connectionless state" with AE2
/*if(vc_ae2.running) {
vc_ae2.stop;
};*/
vc_auxiliaryAe2Up := false;
vc_ae2.start(f_cf01DownAe2());
vc_ae2.done;
for (i := 0; i < receivedUpdateCounter; i := i+1 ) {// Update request, see TS-001 - cl. 10.2.10.7
v_updateRequest.primitiveContent.aE.labels := v_labels[i];
f_cse_updateResource(int2, v_ae1Index, v_updateRequest); //IUT having frequently received from AE1 a valid UPDATE Request to subscribed-to resource
}
// Test Body
vc_ae2.start(f_cf01UpAe2());
vc_ae2.done;
vc_auxiliaryAe2Up := true; //the IUT escapes from the “connectionless state”
v_contentResponse.aE.labels := v_labels[2];
vc_ae2.start(f_cse_notifyProcedure_aggregatedNoficationHandler(v_contentResponse, 1)); // check if the Rx. of notification and match contents
f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2);
//Postamble
f_cse_postamble_deleteResources();
//Tear down
f_cf01Down();
} // end TC_CSE_SUB_NTF_005
/**
* @desc Check that the IUT sends the notifications of cached notification messages after IUT escapes from connectionless state when the pendingNotification is set to 2 (sendAllPending)
*
*/
testcase TC_CSE_SUB_NTF_006() runs on Tester system CseSystem {
var AeSimu v_ae1 := AeSimu.create("AE1") alive;
v_ae1.start(f_CSE_SUB_NTF_006());
v_ae1.done;
}
function f_CSE_SUB_NTF_006() runs on AeSimu system CseSystem {
// Local variables
const integer receivedUpdateCounter := 3;
var Labels v_labels[receivedUpdateCounter];
var integer i;
var integer v_ae1Index := -1;
var integer v_resourceIndex := -1;
var template RequestPrimitive v_createRequest := m_createSubscriptionBase;
var template PrimitiveContent v_contentResponse;
var template RequestPrimitive v_updateRequest := m_updateAeBase;
var integer v_ae2Index := -1;
var integer v_ae2LocalIndex := -1;
v_contentResponse.aE := mw_contentAeBase; // all attributes expected
v_labels[0] := {"VALUE_1"};
v_labels[1] := {"VALUE_2"};
v_labels[2] := {"VALUE_3"};
// Test control
// Test component configuration
f_cf01Up(true);
// Test adapter configuration
// Preamble
v_ae1Index := f_cse_preamble_registerAe();//c_CRUDNDi);
f_cse_preamble_subscriptionVerification(v_ae2Index, v_createRequest, int23);
// subscription child resource having notificationURI attribute set to AE2_RESOURCE_ADDRESS and pendingNotification attribute set to 2 (sendAllPending)
v_createRequest := m_createSubscriptionAdvanced(f_getResourceAddress(v_ae2LocalIndex), -, {f_getResourceAddress(v_ae1Index)},omit,omit,omit,omit,omit, -, int2);
v_resourceIndex := f_cse_createResource(int23, v_createRequest, v_ae1Index);//Subscription
//IUT being in the "connectionless state" with AE2
/*if(vc_ae2.running) {
vc_ae2.stop;
};*/
vc_auxiliaryAe2Up := false;
vc_ae2.start(f_cf01DownAe2());
vc_ae2.done;
for (i := 0; i < receivedUpdateCounter; i := i+1 ) {// Update request, see TS-001 - cl. 10.2.10.7
v_updateRequest.primitiveContent.aE.labels := v_labels[i];
f_cse_updateResource(int2, v_ae1Index, v_updateRequest); //IUT having received from AE1 a NUMBER of valid UPDATE Requests to subscribed-to resource
}
// Test Body
vc_ae2.start(f_cf01UpAe2());
vc_ae2.done;
vc_auxiliaryAe2Up := true; //the IUT escapes from the “connectionless state”
vc_ae2.start(f_cse_notifyProcedure_aggregatedNoficationHandler(v_contentResponse, receivedUpdateCounter)); // check if the Rz. of notification and match contents
f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2);
//Postamble
f_cse_postamble_deleteResources();
//Tear down
f_cf01Down();
} // end TC_CSE_SUB_NTF_006
/**
* @desc Check that the IUT retargets the notification to the AE according to pointOfAccess in the <AE> resource
*/
testcase TC_CSE_SUB_NTF_007() runs on Tester system CseSystem {
var AeSimu v_ae1 := AeSimu.create("AE1") alive;
v_ae1.start(f_CSE_SUB_NTF_007());
v_ae1.done;
}
function f_CSE_SUB_NTF_007() runs on AeSimu system CseSystem {
// Local variables
var MsgIn v_response;
var integer v_aeIndex := -1;
var RequestPrimitive v_request;
var template RequestPrimitive v_requestCreateAE := m_createAe(vc_aeSimuDesc.appId, omit, vc_aeSimuDesc.aeIdStem, c_defaultAe1ResourceName, {f_getLocalPoA(vc_aeSimuDesc.mcaPortIn)});
var RequestPrimitive v_reqNotify;
//var XSD.ID v_targetResourceAddress;
// Test control
// Test component configuration
f_cf02Up();
// Test adapter configuration
// Preamble
f_cse_activateDefaults_ae(); //Activate defaults when running on a PTC
v_requestCreateAE.primitiveContent.aE.requestReachability := true;
v_request := f_getCreateRequestPrimitive(int2, valueof(v_requestCreateAE), -1);//c_CRUDNDi
f_send(e_mcaPort, m_request(v_request));
tc_ac.start;
alt {
[] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response {
tc_ac.stop;
setverdict(pass,__SCOPE__&":INFO: Application registered successfuly");
if(ischosen(v_response.primitive.responsePrimitive.primitiveContent.aE)) {
f_checkAttributesToBeSaved(int2, v_request, v_response.primitive.responsePrimitive);
v_aeIndex := f_setResource(v_response.primitive.responsePrimitive.primitiveContent, int2);
if(ispresent(v_response.primitive.responsePrimitive.primitiveContent.aE.aE_ID)){
f_sendAcPrimitive("AE-ID_changed", v_aeIndex);
}
}
}
[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) {
tc_ac.stop;
setverdict(inconc, __SCOPE__&":INFO: Error while registering application");
stop;
}
[] tc_ac.timeout {
setverdict(inconc, __SCOPE__&":INFO: No answer while registering resource");
stop;
}
}
f_checkAeSimuStatus();
// Test Body
v_reqNotify := valueof(m_notifyNotification(f_getResourceAddress(v_aeIndex), m_contentNotification_subscriptionVerification(PX_TS_CSE1.cseId)));
vc_cse1.start(f_cse_notifyProcedure_notify(v_reqNotify)); //Message exchange for notification
f_cseSimu_checkComponentDoneAndGetVerdict(vc_ae1);
// Postamble
f_cse_postamble_deleteResourcesCSE();
// Tear down
f_cf02Down();
} // end TC_CSE_SUB_NTF_007
/**
* @desc Check that the IUT retargets the notification to the AE according to pointOfAccess in the <AE> resource and forward the response back to the CSE
*/
testcase TC_CSE_SUB_NTF_008() runs on Tester system CseSystem {
var AeSimu v_ae1 := AeSimu.create("AE1") alive;
v_ae1.start(f_CSE_SUB_NTF_008());
v_ae1.done;
}
function f_CSE_SUB_NTF_008() runs on AeSimu system CseSystem {
// Local variables
var MsgIn v_response, v_resp2;
var integer v_aeIndex := -1;
var RequestPrimitive v_request, v_req3;
var ResponsePrimitive v_req2;
var template RequestPrimitive v_requestCreateAE := m_createAe(vc_aeSimuDesc.appId, omit, vc_aeSimuDesc.aeIdStem, c_defaultAe1ResourceName, {f_getLocalPoA(vc_aeSimuDesc.mcaPortIn)});
var RequestPrimitive v_reqNotify;
// Test control
// Test component configuration
f_cf02Up();
// Test adapter configuration
// Preamble
f_cse_activateDefaults_ae(); //Activate defaults when running on a PTC
v_requestCreateAE.primitiveContent.aE.requestReachability := true;
v_request := f_getCreateRequestPrimitive(int2, valueof(v_requestCreateAE), -1);//c_CRUDNDi
f_send(e_mcaPort, m_request(v_request));
tc_ac.start;
alt {
[] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response {
tc_ac.stop;
setverdict(pass,__SCOPE__&":INFO: Application registered successfuly");
if(ischosen(v_response.primitive.responsePrimitive.primitiveContent.aE)) {
f_checkAttributesToBeSaved(int2, v_request, v_response.primitive.responsePrimitive);
v_aeIndex := f_setResource(v_response.primitive.responsePrimitive.primitiveContent, int2);
if(ispresent(v_response.primitive.responsePrimitive.primitiveContent.aE.aE_ID)){
f_sendAcPrimitive("AE-ID_changed", v_aeIndex);
}
}
}
[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) {
tc_ac.stop;
setverdict(inconc, __SCOPE__&":INFO: Error while registering application");
stop;
}
[] tc_ac.timeout {
setverdict(inconc, __SCOPE__&":INFO: No answer while registering resource");
stop;
}
}
f_checkAeSimuStatus();
// Test Body
v_reqNotify := valueof(m_notifyNotification(f_getResourceAddress(v_aeIndex), m_contentNotification_subscriptionVerification(PX_TS_CSE1.cseId)));
vc_cse1.start(f_cse_notifyProcedure_notify(v_reqNotify)); //Message exchange for notification
v_reqNotify.from_ := f_getOriginator(v_aeIndex);
f_send(e_mcaPort, m_request(valueof(v_reqNotify)));
//the IUT receives a valid NOTIFY RESPONSE from the AE
tc_ac.start;
alt {
[] mcaPort.receive(mw_response(mw_responseNotify(int2000))) -> value v_response {
tc_ac.stop;
}
[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) {
tc_ac.stop;
setverdict(inconc, __SCOPE__&":INFO: Error while performing notification");
}
[] mcaPort.receive {
tc_ac.stop;
setverdict(inconc, __SCOPE__&":INFO: Unexpected message received");
}
[] tc_ac.timeout {
setverdict(inconc, __SCOPE__&":INFO: No answer while performing notification");
}
}
//the IUT also sends NOTIFY RESPONSE to the CSE
v_req2 := valueof(m_responseNotification(int2000, omit));
v_req2.requestIdentifier := v_response.primitive.responsePrimitive.primitiveContent.requestPrimitive.requestIdentifier;
v_req3 := valueof(m_notifyResponsePrimitive(f_getResourceAddress(vc_aeIndex), v_req2));
v_req3.from_ := f_getOriginator(v_aeIndex);
f_send(e_mcaPort, m_request(v_req3));
tc_ac.start;
alt {
[] mcaPort.receive(mw_response(mw_responseNotify(int2000))) -> value v_resp2 {
tc_ac.stop;
setverdict(pass, __SCOPE__ & ": Polling response received");
}
[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) {
tc_ac.stop;
setverdict(fail, __SCOPE__&":INFO: Error while performing notification");
}
[] mcaPort.receive {
tc_ac.stop;
setverdict(fail, __SCOPE__&":INFO: Unexpected message received");
}
[] tc_ac.timeout {
setverdict(fail, __SCOPE__&":INFO: No answer while performing notification");
}
}
f_aeSimu_checkComponentDoneAndGetVerdict(vc_cse1);
//Postamble
f_cse_postamble_deleteResources();
// Tear down
f_cf02Down();
} // end f_CSE_SUB_NTF_008
/**
* @desc Check that the IUT sends an aggregatedNotification to the AE according to URI provided in notificationForwardingURI attribute when an event occurs on <group> resource with its members having group related subscriptions
*/
testcase TC_CSE_SUB_NTF_009() runs on Tester system CseSystem {
var AeSimu v_ae1 := AeSimu.create("AE1") alive;
v_ae1.start(f_CSE_SUB_NTF_009());
v_ae1.done;
}
function f_CSE_SUB_NTF_009() runs on AeSimu system CseSystem {
// Local variables
var MsgIn v_response;
var integer v_aeIndex := -1;
var integer v_ae2Index := -1;
var integer v_groupIndex := -1;
var integer v_containerIndex := -1;
var XSD.AnyURI v_memberID_1, v_memberID_2;
var integer v_resourceIndex;
var template RequestPrimitive v_groupRequest;
var XSD.AnyURI v_fanoutPointAddress;
var RequestPrimitive v_request;
var template RequestPrimitive v_createRequest := m_createSubscriptionBase;
var template PrimitiveContent v_contentResponse;
// Test control
// Test component configuration
f_cf02Up();
// Test adapter configuration
// Preamble
v_aeIndex := f_cse_preamble_registerAe();
f_cse_preamble_subscriptionVerification(v_ae2Index, v_createRequest, int23);
v_containerIndex := f_cse_createResource(int3, m_createContainerBase, v_aeIndex);
v_memberID_1 := f_getResourceId(vc_resourcesList[v_containerIndex].resource);
v_containerIndex := f_cse_createResource(int3, m_createContainerBase, v_aeIndex);
v_memberID_2 := f_getResourceId(vc_resourcesList[v_containerIndex].resource);
v_groupRequest := valueof(m_createGroup(2, {v_memberID_1, v_memberID_2}, omit, int3));
v_groupIndex := f_cse_createResource(int9, v_groupRequest, v_aeIndex);
v_fanoutPointAddress := f_getResourceAddress(v_groupIndex) & "/" & c_resourceShortNameFanOutPoint;
v_request.primitiveContent.subscription.groupID := f_getResourceId(vc_resourcesList[v_groupIndex].resource);
v_request.primitiveContent.subscription.notificationURI := {v_fanoutPointAddress};
v_request.primitiveContent.subscription.notificationForwardingURI := v_fanoutPointAddress;
//subscription created on these members with notificationForwardingURI attribute set identical to notificationURI
v_request.primitiveContent.group_.memberIDs := {v_memberID_1, v_memberID_2};
v_request := f_getCreateRequestPrimitive(int23, v_request, v_aeIndex);//Subscription
f_send(e_mcaPort, m_request(v_request));
tc_ac.start;
alt {
[] mcaPort.receive(mw_response(mw_responsePrimitive(int2001))) -> value v_response {
tc_ac.stop;
setverdict(pass, __SCOPE__ & ": Resource created successfully");
f_checkAttributesToBeSaved(int23, valueof(v_request), v_response.primitive.responsePrimitive);
v_resourceIndex := f_setResource(v_response.primitive.responsePrimitive.primitiveContent, int23, vc_aeIndex);
}
[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) {
tc_ac.stop;
setverdict(inconc, __SCOPE__&":INFO: Error while creating resource");
}
[] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) {
tc_ac.stop;
setverdict(fail, __SCOPE__ & ": Wrong response status code in the response");
}
[] tc_ac.timeout {
setverdict(fail, __SCOPE__ & ": No answer while creating resource");
}
}
// Test Body
v_contentResponse.notification.notificationForwardingURI := v_fanoutPointAddress;
vc_ae2.start(f_cse_notifyProcedure_aggregatedNoficationHandler(v_contentResponse, 1)); // check if the Rx. of notification and match contents
f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2);
//Postamble
f_cse_postamble_deleteResources();
// Tear down
f_cf02Down();
} // end f_CSE_SUB_NTF_009
/** /**
* @desc Check that the IUT doesn’t send a Notify request to the subscriber resource when “childResourceType” condition tag of eventNotificationCriteria attribute is set to LIST_OF_RESOURCE_TYPE and this list doesn’t contain the RESOURCE_TYPE created in the request. * @desc Check that the IUT doesn’t send a Notify request to the subscriber resource when “childResourceType” condition tag of eventNotificationCriteria attribute is set to LIST_OF_RESOURCE_TYPE and this list doesn’t contain the RESOURCE_TYPE created in the request.
* *
......
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