Commit ccdf6b0e authored by Miguel Angel Reina Ortega's avatar Miguel Angel Reina Ortega
Browse files

Subscription group verification:


- AE2 PTC integrated into AeSimu component
- AE2 PTC initialization integrated into f_cf01 functions
- Addition of URI element to Representation type
- Verification of all SUB test cases
Signed-off-by: Miguel Angel Reina Ortega's avatarMiguel Angel Reina Ortega <miguelangel.reinaortega@etsi.org>
parent 977bb88f
......@@ -28,7 +28,7 @@ module OneM2M_Functions {
/**
@desc Ports mapping and default behaviour activation for Config 1
*/
function f_cf01Up() runs on AeSimu {
function f_cf01Up(in boolean p_auxiliaryAe2Required := false) runs on AeSimu {
// Variables
vc_config := e_cf01;
......@@ -40,8 +40,34 @@ module OneM2M_Functions {
activate(a_default());
activate(a_cse_cf01());
// Connect
// Initialize AE2
if(p_auxiliaryAe2Required) {
vc_auxiliaryAe2Up := p_auxiliaryAe2Required;
vc_ae2 := AeSimu.create("AE2") alive;
vc_ae2.start(f_cf01UpAe2());
}
//Initialze the IUT
} // end f_cf01Up
/**
@desc Ports mapping and default behaviour activation for Config 1 on the auxiliary AE2
*/
function f_cf01UpAe2() runs on AeSimu {
// Variables
vc_config := e_cf01;
// Map
map(self:mcaPort, system:mcaPort);
map(self:mcaPortIn, system:mcaPortIn);
map(self:acPort, system:acPort);
activate(a_default());
activate(a_cse_cf01());
activate(a_cse_cf01_ae2()); //For mcaPortIn
//Initialze the IUT
} // end f_cf01Up
......@@ -67,30 +93,7 @@ module OneM2M_Functions {
//Initialze the IUT
} // end f_cf02Up
/**
* @desc Ports mapping and default behaviour activation for Config 01
*/
function f_cf01UpCseSimuMaster() runs on CseSimu {
// Variables
vc_config := e_cf01;
vc_aeSimu := AeSimu.create("AE1") alive;
// Map
map(self:mccPort, system:mcaPort);
map(vc_aeSimu:mcaPort, system:mcaPort);
map(self:acPort, system:acPort);
activate(a_default());
activate(a_cse_cseSimu());
// Connect
f_connectInfoPort(vc_aeSimu);
//Initialze the IUT
} // end f_cf01UpCseSimuMaster
/**
* @desc Ports mapping and default behaviour activation for Config 02
*/
......@@ -183,17 +186,20 @@ module OneM2M_Functions {
unmap(self:mcaPort, system:mcaPort);
unmap(self:acPort, system:acPort);
if(vc_auxiliaryAe2Up) {
vc_ae2.start(f_cf01DownAe2());
}
}
/**
* @desc Ports unmapping
* @verdict
*/
function f_cf01DownCseSimuMaster() runs on CseSimu {
unmap(self:mccPort, system:mccPort);
unmap(vc_aeSimu:mcaPort, system:mcaPort);
function f_cf01DownAe2() runs on AeSimu {
unmap(self:mcaPort, system:mcaPort);
unmap(self:acPort, system:acPort);
unmap(vc_aeSimu:acPort, system:acPort);
unmap(self:mcaPortIn, system:mcaPortIn);
}
/**
......@@ -414,19 +420,18 @@ module OneM2M_Functions {
}
function f_cse_preamble_subscriptionVerification(out AeSimu p_ae2,in integer p_aeIndex, inout integer p_ae2Index, inout template RequestPrimitive p_createRequestPrimitive,in ResourceType p_resourceType, in ResponseStatusCode p_responseStatusCode := int2001) runs on AeSimu {
function f_cse_preamble_subscriptionVerification(inout integer p_ae2Index, inout template RequestPrimitive p_createRequestPrimitive,in ResourceType p_resourceType, in ResponseStatusCode p_responseStatusCode := int2001) runs on AeSimu {
if(p_resourceType == int23){
p_ae2 := AeSimu.create("AE2") alive;
map(p_ae2:mcaPort, system:mcaPort);
map(p_ae2:mcaPortIn, system:mcaPortIn);
//TODO shall be unmapped?
p_ae2.start(f_cse_createResource(int2, m_createAe(PX_APP_ID, -, PX_AE2_ID_STEM, "MyAe2", {f_getAnnouncementTargetPoA("HTTP", PX_AE2_ADDRESS, "")}), -1)); // AE2 is registred
p_ae2.done;
p_ae2Index := f_getResource(p_ae2);
vc_ae2.start(f_cse_createResource(int2, m_createAe(PX_APP_ID, -, PX_AE2_ID_STEM, "MyAe2", {f_getAnnouncementTargetPoA("HTTP", PX_AE2_ADDRESS, "")}), -1)); // AE2 is registred
f_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
p_createRequestPrimitive.primitiveContent.subscription.notificationURI := {f_getResourceAddress(p_ae2Index)};
}
p_ae2.start(f_cse_notifyProcedure_subscriptionVerificationHandler(p_aeIndex, p_responseStatusCode));
vc_ae2.start(f_cse_notifyProcedure_subscriptionVerificationHandler(p_responseStatusCode));
}
}
......@@ -445,6 +450,10 @@ module OneM2M_Functions {
if (PX_RUN_POSTAMBLE) {
if(vc_auxiliaryAe2Up) {
f_cse_postamble_aeSimu(vc_ae2);
}
for(i := lengthof(vc_resourcesIndexToBeDeleted) -1; i >=0; i := i - 1) {
v_resourceAddress := f_getResourceAddress(vc_resourcesIndexToBeDeleted[i]);
......@@ -475,6 +484,17 @@ module OneM2M_Functions {
}
/**
* @desc Calls to postamble for AE2 entity
* @verdict
*/
function f_cse_postamble_aeSimu(in AeSimu p_ae) runs on AeSimu {
if(p_ae.running) {
p_ae.stop;
}
p_ae.start(f_cse_postamble_deleteResources());
}
/**
* @desc Deletion of all resources created during the test case execution. IUT gets clean and ready for next execution
* @verdict
......@@ -516,19 +536,6 @@ module OneM2M_Functions {
}
function f_is_component_done(in Tester p_ae2) runs on Tester {
tc_ac.start(10.0);
alt {
[] p_ae2.done {
tc_ac.stop;
}
[] tc_ac.timeout {
setverdict(inconc, __SCOPE__ & "INFO: Notify verification not received");
}
}
} //end f_is_component_done
/**
@desc
*/
......@@ -1196,9 +1203,8 @@ module OneM2M_Functions {
group NotificationFunctions {
function f_cse_notifyProcedure_subscriptionVerificationHandler(in integer p_creatorIndex, in ResponseStatusCode p_responseStatusCode := int2001) runs on AeSimu {
function f_cse_notifyProcedure_subscriptionVerificationHandler(in ResponseStatusCode p_responseStatusCode := int2001) runs on AeSimu {
// Local variables
var MsgIn v_request;
var ResponsePrimitive v_responsePrimitive;
var template Notification v_notificationRequest := mw_contentNotificationVerification;
......@@ -1213,28 +1219,18 @@ module OneM2M_Functions {
tc_ac.start;
alt {
[] mcaPortIn.receive(mw_request(mw_notify(v_notificationRequest))) -> value v_request {
[] mcaPortIn.receive(mw_request(mw_notify(v_notificationRequest))) -> value vc_request {
tc_ac.stop;
setverdict(pass, __SCOPE__ & ":INFO: Notification received");
// if(f_isHierarchical(v_request.primitive.requestPrimitive.primitiveContent.notification.creator)) {
// setverdict(fail, __SCOPE__ & ": Creator cannot contain a hierarchical address");
// v_responsePrimitive.responseStatusCode := int4000;
// }
// if(f_compareURIs(p_creatorIndex, v_request.primitive.requestPrimitive.primitiveContent.notification.creator)) {
// setverdict(pass, __SCOPE__ & ": Creator set to originator of the subscription creation primitive");
// } else {
// setverdict(fail, __SCOPE__ & ": Creator not set to originator of the subscription creation primitive");
// v_responsePrimitive.responseStatusCode := int4000;
// }
}
[] mcaPortIn.receive(mw_request(mw_notify(mw_contentNotification(?)))) -> value v_request {
[] mcaPortIn.receive(mw_request(mw_notify(mw_contentNotification(?)))) -> value vc_request {
tc_ac.stop;
setverdict(fail, __SCOPE__ & ":ERROR: Notification received but verificationRequest isn't set to TRUE");
}
[] mcaPortIn.receive{
tc_ac.stop;
setverdict(fail, __SCOPE__ & ":ERROR: unexpected message received");
stop;
}
[] tc_ac.timeout {
setverdict(fail, __SCOPE__ & ":ERROR: No notification received");
......@@ -1242,7 +1238,7 @@ module OneM2M_Functions {
}
}
v_responsePrimitive.requestIdentifier := v_request.primitive.requestPrimitive.requestIdentifier;
v_responsePrimitive.requestIdentifier := vc_request.primitive.requestPrimitive.requestIdentifier;
if(getverdict == pass) {
mcaPortIn.send(m_httpResponse(v_responsePrimitive));
} else {
......@@ -1256,22 +1252,22 @@ module OneM2M_Functions {
function f_cse_notifyProcedure_representationHandler(template PrimitiveContent p_primitiveContent) runs on AeSimu {
// Local variables
var MsgIn v_request;
map(self:mcaPortIn, system:mcaPort);
map(self:acPort, system:acPort);
var ResponsePrimitive v_responsePrimitive;
tc_ac.start;
alt {
[] mcaPortIn.receive(mw_request(mw_notify(mw_contentNotification(?)))) -> value v_request {
[] mcaPortIn.receive(mw_request(mw_notify(mw_contentNotification(?)))) -> value vc_request {
tc_ac.stop;
if(f_check_notificationContent(v_request.primitive.requestPrimitive, p_primitiveContent)){
if(f_check_notificationContent(vc_request.primitive.requestPrimitive, p_primitiveContent)){
setverdict(pass, __SCOPE__ & ":INFO: Notification received");
mcaPort.send(m_response(valueof(m_responseNotification(int2001))));
}
else{
setverdict(fail, __SCOPE__ & ":ERROR: Notification received but the content doesn't match");
}
//Send response in any case
v_responsePrimitive := valueof(m_responseNotification(int2001, omit));
v_responsePrimitive.requestIdentifier := vc_request.primitive.requestPrimitive.requestIdentifier;
mcaPortIn.send(m_response(v_responsePrimitive));
}
[] mcaPortIn.receive{
tc_ac.stop;
......@@ -1281,18 +1277,13 @@ module OneM2M_Functions {
setverdict(fail, __SCOPE__ & ":ERROR: No notification received");
}
}
unmap(self:mcaPortIn, system:mcaPort);
unmap(self:acPort, system:acPort);
} //end f_cse_notifyProcedure_representationHandler
function f_cse_notifyProcedure_aggregatedNoficationHandler(template PrimitiveContent p_primitiveContent,in integer p_numberOfAggregatedNotification) runs on AeSimu {
// Local variables
map(self:mcaPortIn, system:mcaPort);
map(self:acPort, system:acPort);
var ResponsePrimitive v_responsePrimitive;
var integer v_notificationsReceived := 0;
tc_ac.start;
alt {
......@@ -1309,6 +1300,28 @@ module OneM2M_Functions {
else {
setverdict(fail, __SCOPE__ & ": Number of Notification in Aggregatednotification isn't right");
}
//Send response in any case
v_responsePrimitive := valueof(m_responseNotification(int2001, omit));
v_responsePrimitive.requestIdentifier := vc_request.primitive.requestPrimitive.requestIdentifier;
mcaPortIn.send(m_response(v_responsePrimitive));
}
[] mcaPortIn.receive(mw_request(mw_notify(mw_contentNotification(?)))) -> value vc_request {
tc_ac.stop;
if(f_check_notificationContent(vc_request.primitive.requestPrimitive, p_primitiveContent)){
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(int2001, omit));
v_responsePrimitive.requestIdentifier := vc_request.primitive.requestPrimitive.requestIdentifier;
mcaPortIn.send(m_response(v_responsePrimitive));
v_notificationsReceived := v_notificationsReceived + 1;
if(v_notificationsReceived < p_numberOfAggregatedNotification) {
tc_ac.start;
repeat;
}
}
[] mcaPortIn.receive{
tc_ac.stop;
......@@ -1318,31 +1331,21 @@ module OneM2M_Functions {
setverdict(fail, __SCOPE__ & ": No notification received");
}
}
unmap(self:mcaPortIn, system:mcaPort);
unmap(self:acPort, system:acPort);
} //end f_cse_notifyProcedure_aggregatedNotificationHandler
function f_cse_notifyProcedure_subscriptionDeletionHandler( template PrimitiveContent p_primitiveContent) runs on AeSimu {
map(self:mcaPortIn, system:mcaPort);
map(self:acPort, system:acPort);
function f_cse_notifyProcedure_subscriptionDeletionHandler( template Notification p_notification) runs on AeSimu {
var ResponsePrimitive v_responsePrimitive;
tc_ac.start;
alt {
[] mcaPortIn.receive(mw_request(mw_notify(mw_contentNotification(?)))) -> value vc_request {
[] mcaPortIn.receive(mw_request(mw_notify(p_notification))) -> value vc_request {
tc_ac.stop;
mcaPort.send(m_response(valueof(m_responseNotification(int2001))));
v_responsePrimitive := valueof(m_responseNotification(int2001, omit));
v_responsePrimitive.requestIdentifier := vc_request.primitive.requestPrimitive.requestIdentifier;
mcaPortIn.send(m_response(v_responsePrimitive));
if(not(match(vc_request.primitive.requestPrimitive.primitiveContent.notification.subscriptionDeletion, true))) {
setverdict(fail, __SCOPE__ & ":ERROR: subscriptionDeletion attribute have to be set to TRUE");
}
if(f_check_notificationContent(vc_request.primitive.requestPrimitive, p_primitiveContent)){
setverdict(pass, __SCOPE__ & ":INFO: Notification received");
}
else{
setverdict(fail, __SCOPE__ & ":ERROR: Notification received but the content doesn't match");
}
}
[] mcaPortIn.receive{
tc_ac.stop;
......@@ -1352,17 +1355,11 @@ module OneM2M_Functions {
setverdict(fail, __SCOPE__ & ":ERROR: No notification received");
}
}
unmap(self:mcaPortIn, system:mcaPort);
unmap(self:acPort, system:acPort);
} //end f_cse_notifyProcedure_subscriptionDeletionHandler
function f_cse_notifyProcedure_noNotificationHandler() runs on AeSimu {
// Local variables
map(self:mcaPortIn, system:mcaPort);
map(self:acPort, system:acPort);
tc_ac.start(10.0);
alt {
......@@ -1374,10 +1371,7 @@ module OneM2M_Functions {
setverdict(pass, __SCOPE__ & ": No notification received");
}
}
unmap(self:mcaPortIn, system:mcaPort);
unmap(self:acPort, system:acPort);
} //end f_cse_notifyProcedure_noNotification Handler
function f_check_notificationContent(in RequestPrimitive p_requestPrimitive, template PrimitiveContent p_primitiveContent) runs on Tester return boolean{
......@@ -1387,11 +1381,13 @@ module OneM2M_Functions {
var integer v_numberOfAggregatedNotification;
if (ischosen(p_primitiveContent.aE)){
if(ischosen(p_requestPrimitive.primitiveContent.notification.notificationEvent.representation.resource)) {
v_matchResult := match(p_requestPrimitive.primitiveContent.notification.notificationEvent.representation.resource.aE, p_primitiveContent.aE)
log("Representation contains AE resource representation");
if(ischosen(p_requestPrimitive.primitiveContent.notification.notificationEvent.representation.resource.aE)) {
v_matchResult := match(p_requestPrimitive.primitiveContent.notification.notificationEvent.representation.resource.aE, p_primitiveContent.aE);
log("Expected primitiveContent");
}
else if(ischosen(p_requestPrimitive.primitiveContent.notification.notificationEvent.representation.responsePrimitive)) {
v_matchResult :=match(p_requestPrimitive.primitiveContent.notification.notificationEvent.representation.responsePrimitive.primitiveContent.aE, p_primitiveContent.aE)
v_matchResult :=match(p_requestPrimitive.primitiveContent.notification.notificationEvent.representation.responsePrimitive.primitiveContent.aE, p_primitiveContent.aE);
}
else if (ischosen(p_requestPrimitive.primitiveContent.aggregatedNotification)) {
v_matchResult := true;
......@@ -1416,7 +1412,7 @@ module OneM2M_Functions {
}
if (ischosen(p_primitiveContent.container)){
if(ischosen(p_requestPrimitive.primitiveContent.notification.notificationEvent.representation.resource)) {
if(ischosen(p_requestPrimitive.primitiveContent.notification.notificationEvent.representation.resource.container)) {
v_matchResult := match(p_requestPrimitive.primitiveContent.notification.notificationEvent.representation.resource.container, p_primitiveContent.container)
}
else if(ischosen(p_requestPrimitive.primitiveContent.notification.notificationEvent.representation.responsePrimitive)) {
......@@ -1616,6 +1612,24 @@ module OneM2M_Functions {
}
}
/**
* @desc Cse altstep for config 01 for AE2
*/
altstep a_cse_cf01_ae2() runs on AeSimu {
var MsgIn v_request;
var ResponsePrimitive v_responsePrimitive;
[] mcaPortIn.receive(mw_request(mw_notify(mw_contentNotification(?)))) -> value v_request {
//Send response
v_responsePrimitive := valueof(m_responseNotification(int2001, omit));
v_responsePrimitive.requestIdentifier := v_request.primitive.requestPrimitive.requestIdentifier;
mcaPortIn.send(m_response(v_responsePrimitive));
log(__SCOPE__&": WARNING: Unexpected Notification message received");
repeat;
}
}
/**
* @desc Cse altstep for config 02
*/
......@@ -2362,7 +2376,7 @@ module OneM2M_Functions {
var integer v_nbOfSlashes:= 0;
for (i := 0; i < lengthof(p_resourceAddress); i:= i+1){
if(match (p_resourceAddress[i], "/")){
if(p_resourceAddress[i] == "/"){
v_nbOfSlashes:= v_nbOfSlashes+1;
}
}
......@@ -2472,6 +2486,35 @@ module OneM2M_Functions {
}
}
/**
* @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_checkComponentDoneAndGetVerdict(AeSimu p_ae) runs on AeSimu {
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_checkAeSimuStatus();
}
/**
* @desc Sending of an Adapter Control primitive
* @param event Action to be performed by TA
......
......@@ -37,9 +37,10 @@ module OneM2M_TestSystem {
var integer vc_aeAuxIndex;//TODO To be removed
var integer vc_acpAuxIndex;
var AccessControlPolicy_optional vc_acpAux;
}
};
type component AeSimu extends Tester {
var AeSimu vc_ae2;
port OneM2MPort mcaPort;
port OneM2MPort mcaPortIn;
......@@ -49,8 +50,10 @@ module OneM2M_TestSystem {
var MsgIn vc_request;
var MsgIn vc_response;
var CseSimu vc_cseSimu;//For CF02 when AeSimu is master
var boolean vc_auxiliaryAe2Up := false;
//var AeSimu vc_ae2;
}
};
type component CseSimu extends Tester {
port OneM2MPort mcaPort;
......@@ -62,7 +65,7 @@ module OneM2M_TestSystem {
var integer vc_remoteCseIndex;
var MsgIn vc_request;
var MsgIn vc_response;
}
};
type component InCseSimu extends CseSimu {}
......
......@@ -3242,10 +3242,12 @@ module OneM2M_Types {
// TODO To be added
type union Representation {
Resource_2 resource,
ResponsePrimitive responsePrimitive
ResponsePrimitive responsePrimitive,
XSD.AnyURI uRI
}
with {
variant "name as 'representation'";
variant (uRI) "name as capitalized";
}
type record Notification_1
......@@ -3618,12 +3620,12 @@ module OneM2M_Types {
};
type record ResourceWrapper
type record ResourceWrapper//Make of union elements type _optional
{
union {
AccessControlPolicy accessControlPolicy,
AccessControlPolicy_optional accessControlPolicy,
ActiveCmdhPolicy activeCmdhPolicy,
AE aE,
AE_optional aE,
AreaNwkDeviceInfo areaNwkDeviceInfo,
AreaNwkInfo areaNwkInfo,
Battery battery,
......@@ -3635,36 +3637,36 @@ module OneM2M_Types {
CmdhNetworkAccessRules cmdhNetworkAccessRules,
CmdhNwAccessRule cmdhNwAccessRule,
CmdhPolicy cmdhPolicy,
Container container,
ContentInstance contentInstance,
CSEBase cSEBase,
Delivery delivery,
Container_optional container,
ContentInstance_optional contentInstance,
CSEBase_optional cSEBase,
Delivery_optional delivery,
DeviceCapability deviceCapability,
DeviceInfo deviceInfo,
EventConfig eventConfig,
EventLog eventLog,
ExecInstance execInstance,
Firmware firmware,
Group group_,
LocationPolicy locationPolicy,
M2mServiceSubscriptionProfile m2mServiceSubscriptionProfile,
Group_optional group_,
LocationPolicy_optional locationPolicy,
M2mServiceSubscriptionProfile_optional m2mServiceSubscriptionProfile,
Memory memory,
MgmtCmd mgmtCmd,
Node node,
MgmtCmd_optional mgmtCmd,
Node_optional node,
Notification notification,
PollingChannel pollingChannel,
PollingChannel_optional pollingChannel,
Reboot reboot,
RemoteCSE remoteCSE,
Request request,
RemoteCSE_optional remoteCSE,
Request_optional request,
RequestPrimitive requestPrimitive,
ResponsePrimitive responsePrimitive,
Schedule schedule,
ServiceSubscribedAppRule serviceSubscribedAppRule,
ServiceSubscribedNode serviceSubscribedNode,
Schedule_optional schedule,
ServiceSubscribedAppRule_optional serviceSubscribedAppRule,
ServiceSubscribedNode_optional serviceSubscribedNode,
Software software,
StatsCollect statsCollect,
StatsConfig statsConfig,
Subscription subscription
StatsCollect_optional statsCollect,
StatsConfig_optional statsConfig,
Subscription_optional subscription
} choice,
XSD.AnyURI uRI
}
......
......@@ -209,9 +209,9 @@ variant "XSD:double";
// Time types
type charstring Duration (pattern
"{dash}#(,1)P({nums}(Y({nums}(M({nums}D{durTime}#(,1)|{durTime}#(,1))|D{durTime}#(,1))|" &
"{durTime}#(,1))|M({nums}D{durTime}#(,1)|{durTime}#(,1))|D{durTime}#(,1))|{durTime})")
type charstring Duration //(pattern TODO Check the pattern "PT5S" not matching
//"{dash}#(,1)P({nums}(Y({nums}(M({nums}D{durTime}#(,1)|{durTime}#(,1))|D{durTime}#(,1))|" &
//"{durTime}#(,1))|M({nums}D{durTime}#(,1)|{durTime}#(,1))|D{durTime}#(,1))|{durTime})")
with {
variant "XSD:duration";
};
......
This diff is collapsed.
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