Cleanup of test component variables according to TST-2018-0159

Signed-off-by: Miguel Angel Reina Ortega's avatarreinaortega <miguelangel.reinaortega@etsi.org>
parent f2c47fdf
...@@ -418,13 +418,41 @@ module OneM2M_Functions { ...@@ -418,13 +418,41 @@ module OneM2M_Functions {
* @param p_tester AeSimu component * @param p_tester AeSimu component
* @param p_resourceIndex Index of resource to be retrieved * @param p_resourceIndex Index of resource to be retrieved
*/ */
function f_getResource(in Tester p_component, in integer p_resourceIndex := -1) runs on Tester return integer { function f_getResourceFromAeSimu(in AeSimu p_component, in integer p_resourceIndex := -1) runs on Tester return integer {
var MyResource v_resource; var MyResource v_resource;
var integer v_resourceIndex := -1; var integer v_resourceIndex := -1;
f_connectInfoPort(p_component); f_connectInfoPort(p_component);
p_component.start(f_sendResourceAeSimu(p_resourceIndex));
alt {
[]infoPort.receive(mw_resource) -> value v_resource {
v_resourceIndex := f_setResource(v_resource.resource, v_resource.resourceType, v_resource.parentIndex, false);
}
}
p_component.start(f_sendResource(p_resourceIndex)); p_component.done;
f_disconnectInfoPort(p_component);
return v_resourceIndex;
}
/**
* @desc Getting a specific resource from an CseSimu component
* @param p_tester AeSimu component
* @param p_resourceIndex Index of resource to be retrieved
*/
function f_getResourceFromCseSimu(in CseSimu p_component, in integer p_resourceIndex := -1) runs on Tester return integer {
var MyResource v_resource;
var integer v_resourceIndex := -1;
f_connectInfoPort(p_component);
p_component.start(f_sendResourceCseSimu(p_resourceIndex));
alt { alt {
[]infoPort.receive(mw_resource) -> value v_resource { []infoPort.receive(mw_resource) -> value v_resource {
v_resourceIndex := f_setResource(v_resource.resource, v_resource.resourceType, v_resource.parentIndex, false); v_resourceIndex := f_setResource(v_resource.resource, v_resource.resourceType, v_resource.parentIndex, false);
...@@ -491,7 +519,7 @@ module OneM2M_Functions { ...@@ -491,7 +519,7 @@ module OneM2M_Functions {
* @desc Sending of a specific resource through InfoPort * @desc Sending of a specific resource through InfoPort
* @param p_resourceIndex Index of resource to be sent * @param p_resourceIndex Index of resource to be sent
*/ */
function f_sendResource(in integer p_resourceIndex) runs on Tester { function f_sendResourceAeSimu(in integer p_resourceIndex) runs on AeSimu {
if(p_resourceIndex == -1) { if(p_resourceIndex == -1) {
infoPort.send(vc_resourcesList[vc_aeAuxIndex]); //TODO To send Ae or RemoteCSE depending on the component type infoPort.send(vc_resourcesList[vc_aeAuxIndex]); //TODO To send Ae or RemoteCSE depending on the component type
...@@ -500,6 +528,57 @@ module OneM2M_Functions { ...@@ -500,6 +528,57 @@ module OneM2M_Functions {
} }
} }
/**
* @desc Sending of a specific resource through InfoPort
* @param p_resourceIndex Index of resource to be sent
*/
function f_sendResourceCseSimu(in integer p_resourceIndex) runs on CseSimu {
if(p_resourceIndex == -1) {
infoPort.send(vc_resourcesList[vc_remoteCseIndex]); //TODO To send Ae or RemoteCSE depending on the component type
} else {
infoPort.send(vc_resourcesList[p_resourceIndex]);
}
}
/**
* @desc Sending of the latest resource through InfoPort
*/
function f_sendLatestResource() runs on Tester {
infoPort.send(vc_resourcesList[lengthof(vc_resourcesList)-1]);
}
/**
* @desc Sending of last resourceIndex saved in the vc_resourcesList
*/
function f_sendLatestResourceIndex() runs on Tester {
infoPort.send(lengthof(vc_resourcesList)-1);
}
/**
* @desc Sending the address of the last resource saved in the vc_resourcesList
*/
function f_sendLatestLocalResourceAddress(AddressingMethod p_addressingMethod := PX_ADDRESSING_METHOD, PrimitiveScope p_primitiveScope := PX_PRIMITIVE_SCOPE) runs on CseSimu {
infoPort.send(f_getLocalResourceAddress(lengthof(vc_localResourcesList)-1, p_addressingMethod, p_primitiveScope));
}
/**
* @desc Sending of last local resourceIndex saved in the vc_localResourcesList
*/
function f_sendLatestLocalResourceIndex() runs on CseSimu {
infoPort.send(lengthof(vc_localResourcesList)-1);
}
}//end of group sendFunctions }//end of group sendFunctions
}// end of gropu InfoPortCommunication }// end of gropu InfoPortCommunication
...@@ -599,7 +678,7 @@ module OneM2M_Functions { ...@@ -599,7 +678,7 @@ module OneM2M_Functions {
} }
if(vc_acpAuxIndex != -1) { if(vc_acpAuxIndex != -1) {
vc_resourcesIndexToBeDeleted := {vc_acpAuxIndex}; vc_resourcesIndexToBeDeleted := {vc_acpAuxIndex};//TODO Not needed
v_request := valueof(m_createAe(p_appId, {f_getResourceId(vc_resourcesList[vc_acpAuxIndex].resource)}, -)); v_request := valueof(m_createAe(p_appId, {f_getResourceId(vc_resourcesList[vc_acpAuxIndex].resource)}, -));
//TODO Test, to be removed //TODO Test, to be removed
...@@ -702,7 +781,7 @@ module OneM2M_Functions { ...@@ -702,7 +781,7 @@ module OneM2M_Functions {
vc_ae2.start(f_cse_createResource_withAcpAux(int2, m_createAe(PX_APP_ID, -, PX_AE2_ID_STEM, c_defaultAE2Name, {f_getCompletePoA("HTTP", PX_AE2_ADDRESS, "")}), -1)); // AE2 is registred vc_ae2.start(f_cse_createResource_withAcpAux(int2, m_createAe(PX_APP_ID, -, PX_AE2_ID_STEM, c_defaultAE2Name, {f_getCompletePoA("HTTP", PX_AE2_ADDRESS, "")}), -1)); // AE2 is registred
f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2); f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2);
p_ae2Index := f_getResource(vc_ae2); p_ae2Index := f_getResourceFromAeSimu(vc_ae2);
if(ischosen(p_createRequestPrimitive.primitiveContent.subscription)){ //this condition is necessary for Subscription TCs where notification URI is set in m_createSubscriptionAdvanced 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_createRequestPrimitive.primitiveContent.subscription.notificationURI := {f_getResourceAddress(p_ae2Index)};
} }
...@@ -1027,7 +1106,8 @@ module OneM2M_Functions { ...@@ -1027,7 +1106,8 @@ module OneM2M_Functions {
* @return Internal resource index of the created auxiliar ACP resource * @return Internal resource index of the created auxiliar ACP resource
* @verdict * @verdict
*/ */
function f_cse_createAccessControlPolicyAux(in template (value) XSD.String p_acpName := c_acpAuxName, in template (value) ListOfURIs p_acor := PX_ACOR, in template (value) AccessControlOperations p_allowedOperations := int63) runs on AeSimu return integer{ var RequestPrimitive v_request; function f_cse_createAccessControlPolicyAux(in template (value) XSD.String p_acpName := c_acpAuxName, in template (value) ListOfURIs p_acor := PX_ACOR, in template (value) AccessControlOperations p_allowedOperations := int63) runs on AeSimu return integer{
var RequestPrimitive v_request;
var integer v_acpAuxIndex := -1; var integer v_acpAuxIndex := -1;
v_request := valueof(m_createAcpAux(p_acpName := p_acpName, p_acor := p_acor, p_allowedOperations := p_allowedOperations)); v_request := valueof(m_createAcpAux(p_acpName := p_acpName, p_acor := p_acor, p_allowedOperations := p_allowedOperations));
...@@ -1565,6 +1645,10 @@ module OneM2M_Functions { ...@@ -1565,6 +1645,10 @@ module OneM2M_Functions {
tc_ac.stop; tc_ac.stop;
setverdict(fail, __SCOPE__ & ": Error, Non expected notification received"); setverdict(fail, __SCOPE__ & ": Error, Non expected notification received");
} }
[] mcaPortIn.receive(mw_request(mw_notifyResponsePrimitive(?))) -> value vc_request {
tc_ac.stop;
setverdict(fail, __SCOPE__ & ": Error, Non expected notification received");
}
[] tc_ac.timeout { [] tc_ac.timeout {
setverdict(pass, __SCOPE__ & ": No notification received"); setverdict(pass, __SCOPE__ & ": No notification received");
} }
...@@ -2878,8 +2962,8 @@ module OneM2M_Functions { ...@@ -2878,8 +2962,8 @@ module OneM2M_Functions {
if (p_resourceType == int9) {//group if (p_resourceType == int9) {//group
if(match(valueof(p_request.primitiveContent.group_.memberIDs), v_defaultListOfURIs )){ if(match(valueof(p_request.primitiveContent.group_.memberIDs), v_defaultListOfURIs )){
if ((p_parentIndex == -1) and (isbound(vc_aeAuxIndex))){ if (p_parentIndex == -1){
p_request.primitiveContent.group_.memberIDs := {f_getResourceId(vc_resourcesList[vc_aeAuxIndex].resource)}; p_request.primitiveContent.group_.memberIDs := {};
}else{ }else{
p_request.primitiveContent.group_.memberIDs := {f_getResourceId(vc_resourcesList[p_parentIndex].resource)}; p_request.primitiveContent.group_.memberIDs := {f_getResourceId(vc_resourcesList[p_parentIndex].resource)};
} }
...@@ -2915,7 +2999,7 @@ module OneM2M_Functions { ...@@ -2915,7 +2999,7 @@ module OneM2M_Functions {
//subscriberURI //subscriberURI
if(ispresent(p_request.primitiveContent.subscription.subscriberURI)) { if(ispresent(p_request.primitiveContent.subscription.subscriberURI)) {
if(match(valueof(p_request.primitiveContent.subscription.subscriberURI), "NotInitialized" )){ if(match(valueof(p_request.primitiveContent.subscription.subscriberURI), "NotInitialized" )){
p_request.primitiveContent.subscription.subscriberURI := f_getResourceAddress(vc_aeAuxIndex); p_request.primitiveContent.subscription.subscriberURI := valueof(p_request.from_);
} }
} }
//accessControlPolicyIds //accessControlPolicyIds
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
module OneM2M_Ports { module OneM2M_Ports {
import from OneM2M_Types all; import from OneM2M_Types all;
import from XSD all;
/* *************************************** /* ***************************************
* oneM2M Ports * oneM2M Ports
* *************************************** * ***************************************
...@@ -47,9 +48,9 @@ module OneM2M_Ports { ...@@ -47,9 +48,9 @@ module OneM2M_Ports {
*/ */
type port InfoPort message { type port InfoPort message {
in in
RequestPrimitive, ResponsePrimitive, PrimitiveContent, MyResource; RequestPrimitive, ResponsePrimitive, PrimitiveContent, MyResource, integer, XSD.ID;
out out
RequestPrimitive, ResponsePrimitive, PrimitiveContent, MyResource; RequestPrimitive, ResponsePrimitive, PrimitiveContent, MyResource, integer, XSD.ID;
} }
......
...@@ -1191,6 +1191,13 @@ module OneM2M_Templates { ...@@ -1191,6 +1191,13 @@ module OneM2M_Templates {
primitiveContent := {notification := p_notification} primitiveContent := {notification := p_notification}
}; };
/**
* @desc Base NOTIFY request primitive for ResponsePrimitive
*/
template RequestPrimitive mw_notifyResponsePrimitive(in template (present) ResponsePrimitive p_responsePrimitive) modifies mw_notify := {
primitiveContent := {responsePrimitive := p_responsePrimitive}
};
......
...@@ -35,13 +35,12 @@ module OneM2M_TestSystem { ...@@ -35,13 +35,12 @@ module OneM2M_TestSystem {
var TestSystemRole vc_testSystemRole; var TestSystemRole vc_testSystemRole;
var MyResourcesList vc_resourcesList; var MyResourcesList vc_resourcesList;
var IntegerList vc_resourcesIndexToBeDeleted := {}; var IntegerList vc_resourcesIndexToBeDeleted := {};
var integer vc_aeAuxIndex := -1;//TODO To be removed
var integer vc_acpAuxIndex := -1; var integer vc_acpAuxIndex := -1;
var AccessControlPolicy_optional vc_acpAux;
var MsgIn vc_request; var MsgIn vc_request;
var MsgIn vc_response; var MsgIn vc_response;
var default vc_aeSimu := null; var default vc_aeSimu := null;
var default vc_cseSimu := null; var default vc_cseSimu := null;
var PrimitiveContent vc_primitiveContentRetrievedResource;
}; };
type component AeSimu extends Tester { type component AeSimu extends Tester {
...@@ -50,10 +49,11 @@ module OneM2M_TestSystem { ...@@ -50,10 +49,11 @@ module OneM2M_TestSystem {
port OneM2MPort mcaPortIn; port OneM2MPort mcaPortIn;
//global variables //global variables
var PrimitiveContent vc_primitiveContentRetrievedResource; //var PrimitiveContent vc_primitiveContentRetrievedResource;
var CseSimu vc_cse1;//For CF02 when AeSimu is master var CseSimu vc_cse1;//For CF02 when AeSimu is master
var boolean vc_auxiliaryAe2Up := false; var boolean vc_auxiliaryAe2Up := false;
var integer vc_aeAuxIndex := -1;//Specific to AeSimu
}; };
type component CseSimu extends Tester { type component CseSimu extends Tester {
...@@ -65,10 +65,10 @@ module OneM2M_TestSystem { ...@@ -65,10 +65,10 @@ module OneM2M_TestSystem {
//global variables //global variables
var MyResourcesList vc_localResourcesList := {}; var MyResourcesList vc_localResourcesList := {};
var AeSimu vc_ae1;//For CF02 when CseSimu is master var AeSimu vc_ae1;//For CF02 when CseSimu is master
var integer vc_remoteCseIndex := -1;
var integer vc_localRemoteCseIndex := -1; var integer vc_localRemoteCseIndex := -1;
var integer vc_cSEBaseIndex := -1; //Index of the CSEBase resource of the Tester inside vc_localResourcesList var integer vc_cSEBaseIndex := -1; //Index of the CSEBase resource of the Tester inside vc_localResourcesList
var CseTypeID vc_cseType; //cseType of the simulated CSE. IN =1, MN = 2 var CseTypeID vc_cseType; //cseType of the simulated CSE. IN =1, MN = 2
var integer vc_remoteCseIndex := -1;//Specific to CseSimu
}; };
type component InCseSimu extends CseSimu {} type component InCseSimu extends CseSimu {}
......
...@@ -2865,7 +2865,7 @@ module OneM2M_Types { ...@@ -2865,7 +2865,7 @@ module OneM2M_Types {
MemberType memberType, MemberType memberType,
XSD.NonNegativeInteger currentNrOfMembers, XSD.NonNegativeInteger currentNrOfMembers,
XSD.PositiveInteger maxNrOfMembers, XSD.PositiveInteger maxNrOfMembers,
record of XSD.AnyURI memberIDs, record length(0 .. infinity) of XSD.AnyURI memberIDs,//TODO A list that can be empty
ListOfURIs membersAccessControlPolicyIDs optional, ListOfURIs membersAccessControlPolicyIDs optional,
XSD.Boolean memberTypeValidated optional, XSD.Boolean memberTypeValidated optional,
ConsistencyStrategy consistencyStrategy optional, ConsistencyStrategy consistencyStrategy optional,
...@@ -4619,7 +4619,7 @@ group optionalResourceTypes { ...@@ -4619,7 +4619,7 @@ group optionalResourceTypes {
MemberType memberType optional, MemberType memberType optional,
XSD.NonNegativeInteger currentNrOfMembers optional, XSD.NonNegativeInteger currentNrOfMembers optional,
XSD.PositiveInteger maxNrOfMembers optional, XSD.PositiveInteger maxNrOfMembers optional,
ListOfURIs memberIDs optional, record length(0 .. infinity) of XSD.AnyURI memberIDs optional,//TODO A list that can be empty
ListOfURIs membersAccessControlPolicyIDs optional, ListOfURIs membersAccessControlPolicyIDs optional,
XSD.Boolean memberTypeValidated optional, XSD.Boolean memberTypeValidated optional,
ConsistencyStrategy consistencyStrategy optional, ConsistencyStrategy consistencyStrategy optional,
......
...@@ -1752,7 +1752,7 @@ module OneM2M_PermutationFunctions { ...@@ -1752,7 +1752,7 @@ module OneM2M_PermutationFunctions {
vc_ae2.start(f_cse_createResource_withAcpAux(int2, m_createAe(PX_APP_ID, -, PX_AE2_ID_STEM, c_defaultAE2Name, v_poaList), -1)); // AE2 is registred vc_ae2.start(f_cse_createResource_withAcpAux(int2, m_createAe(PX_APP_ID, -, PX_AE2_ID_STEM, c_defaultAE2Name, v_poaList), -1)); // AE2 is registred
f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2); f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2);
v_ae2Index := f_getResource(vc_ae2); v_ae2Index := f_getResourceFromAeSimu(vc_ae2);
p_parentRequestPrimitive.primitiveContent.subscription.notificationURI := {f_getResourceAddress(v_ae2Index)}; p_parentRequestPrimitive.primitiveContent.subscription.notificationURI := {f_getResourceAddress(v_ae2Index)};
vc_ae2.start(f_cse_notifyProcedure_subscriptionVerificationHandler()); vc_ae2.start(f_cse_notifyProcedure_subscriptionVerificationHandler());
} }
...@@ -1789,7 +1789,7 @@ module OneM2M_PermutationFunctions { ...@@ -1789,7 +1789,7 @@ module OneM2M_PermutationFunctions {
f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2); f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2);
vc_ae2.start(f_cse_createResource_withAcpAux(int2, m_createAe(PX_APP_ID, -, PX_AE2_ID_STEM, c_defaultAE2Name, v_poaList), -1)); // AE2 is registred vc_ae2.start(f_cse_createResource_withAcpAux(int2, m_createAe(PX_APP_ID, -, PX_AE2_ID_STEM, c_defaultAE2Name, v_poaList), -1)); // AE2 is registred
f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2); f_aeSimu_checkComponentDoneAndGetVerdict(vc_ae2);
v_ae2Index := f_getResource(vc_ae2); v_ae2Index := f_getResourceFromAeSimu(vc_ae2);
p_requestPrimitive.primitiveContent.subscription.notificationURI := {f_getResourceAddress(v_ae2Index)}; p_requestPrimitive.primitiveContent.subscription.notificationURI := {f_getResourceAddress(v_ae2Index)};
vc_ae2.start(f_cse_notifyProcedure_subscriptionVerificationHandler()); vc_ae2.start(f_cse_notifyProcedure_subscriptionVerificationHandler());
} }
...@@ -1863,7 +1863,7 @@ module OneM2M_PermutationFunctions { ...@@ -1863,7 +1863,7 @@ module OneM2M_PermutationFunctions {
f_cseSimu_checkComponentDoneAndGetVerdict(vc_ae1); f_cseSimu_checkComponentDoneAndGetVerdict(vc_ae1);
vc_ae1.start(f_cse_createResource_withAcpAux(int2, m_createAe(PX_APP_ID, -, PX_AE1_ID_STEM, "MyAe", v_poaList), -1)); // AE1 is registered vc_ae1.start(f_cse_createResource_withAcpAux(int2, m_createAe(PX_APP_ID, -, PX_AE1_ID_STEM, "MyAe", v_poaList), -1)); // AE1 is registered
f_cseSimu_checkComponentDoneAndGetVerdict(vc_ae1); f_cseSimu_checkComponentDoneAndGetVerdict(vc_ae1);
v_ae1Index := f_getResource(vc_ae1); v_ae1Index := f_getResourceFromAeSimu(vc_ae1);
p_requestPrimitive.primitiveContent.subscription.notificationURI := {f_getResourceAddress(v_ae1Index)}; p_requestPrimitive.primitiveContent.subscription.notificationURI := {f_getResourceAddress(v_ae1Index)};
vc_ae1.start(f_cse_notifyProcedure_subscriptionVerificationHandler()); vc_ae1.start(f_cse_notifyProcedure_subscriptionVerificationHandler());
} }
......
...@@ -1414,7 +1414,7 @@ module OneM2M_Testcases_CSE_Release_1 { ...@@ -1414,7 +1414,7 @@ module OneM2M_Testcases_CSE_Release_1 {
tc_ac.stop; tc_ac.stop;
setverdict(pass, __SCOPE__ & ": Resource type remoteCSE created successfully"); setverdict(pass, __SCOPE__ & ": Resource type remoteCSE created successfully");
f_checkAttributesToBeSaved(int16, v_request, v_response.primitive.responsePrimitive); f_checkAttributesToBeSaved(int16, v_request, v_response.primitive.responsePrimitive);
vc_aeAuxIndex := f_setResource(v_response.primitive.responsePrimitive.primitiveContent, int16); vc_remoteCseIndex := f_setResource(v_response.primitive.responsePrimitive.primitiveContent, int16);
} }
[] mccPort.receive(mw_response(mw_responsePrimitiveOK)) { [] mccPort.receive(mw_response(mw_responsePrimitiveOK)) {
tc_ac.stop; tc_ac.stop;
...@@ -1480,7 +1480,7 @@ module OneM2M_Testcases_CSE_Release_1 { ...@@ -1480,7 +1480,7 @@ module OneM2M_Testcases_CSE_Release_1 {
tc_ac.stop; tc_ac.stop;
setverdict(pass, __SCOPE__ & ": Resource type remoteCSE created successfully"); setverdict(pass, __SCOPE__ & ": Resource type remoteCSE created successfully");
f_checkAttributesToBeSaved(int16, v_request, v_response.primitive.responsePrimitive); f_checkAttributesToBeSaved(int16, v_request, v_response.primitive.responsePrimitive);
vc_aeAuxIndex := f_setResource(v_response.primitive.responsePrimitive.primitiveContent, int16); vc_remoteCseIndex := f_setResource(v_response.primitive.responsePrimitive.primitiveContent, int16);
} }
[] mccPort.receive(mw_response(mw_responsePrimitiveKO)) -> value v_response { [] mccPort.receive(mw_response(mw_responsePrimitiveKO)) -> value v_response {
tc_ac.stop; tc_ac.stop;
......
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