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

Signed-off-by: Miguel Angel Reina Ortega's avatarreinaortega <miguelangel.reinaortega@etsi.org>
parent c170c6e4
......@@ -423,13 +423,41 @@ module OneM2M_Functions {
* @param p_tester AeSimu component
* @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 integer v_resourceIndex := -1;
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 {
[]infoPort.receive(mw_resource) -> value v_resource {
v_resourceIndex := f_setResource(v_resource.resource, v_resource.resourceType, v_resource.parentIndex, false);
......@@ -586,7 +614,7 @@ module OneM2M_Functions {
* @desc Sending of a specific resource through InfoPort
* @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) {
infoPort.send(vc_resourcesList[vc_aeAuxIndex]); //TODO To send Ae or RemoteCSE depending on the component type
......@@ -596,6 +624,20 @@ 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
*/
......@@ -731,7 +773,7 @@ module OneM2M_Functions {
}
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)}, -));
//TODO Test, to be removed
......@@ -834,7 +876,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
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
p_createRequestPrimitive.primitiveContent.subscription.notificationURI := {f_getResourceAddress(p_ae2Index)};
}
......@@ -1128,7 +1170,8 @@ module OneM2M_Functions {
* @return Internal resource index of the created auxiliar ACP resource
* @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;
v_request := valueof(m_createAcpAux(p_acpName := p_acpName, p_acor := p_acor, p_allowedOperations := p_allowedOperations));
......@@ -1780,6 +1823,10 @@ module OneM2M_Functions {
tc_ac.stop;
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 {
setverdict(pass, __SCOPE__ & ": No notification received");
}
......@@ -3702,8 +3749,8 @@ module OneM2M_Functions {
}
} else if (p_resourceType == int9) {//group
if(match(valueof(p_request.primitiveContent.group_.memberIDs), v_defaultListOfURIs )){
if ((p_parentIndex == -1) and (isbound(vc_aeAuxIndex))){
p_request.primitiveContent.group_.memberIDs := {f_getResourceId(vc_resourcesList[vc_aeAuxIndex].resource)};
if (p_parentIndex == -1){
p_request.primitiveContent.group_.memberIDs := {};
}else{
p_request.primitiveContent.group_.memberIDs := {f_getResourceId(vc_resourcesList[p_parentIndex].resource)};
}
......@@ -3731,7 +3778,7 @@ module OneM2M_Functions {
//subscriberURI
if(ispresent(p_request.primitiveContent.subscription.subscriberURI)) {
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
......
......@@ -35,14 +35,12 @@ module OneM2M_TestSystem {
var TestSystemRole vc_testSystemRole;
var MyResourcesList vc_resourcesList;
var IntegerList vc_resourcesIndexToBeDeleted := {};
var integer vc_aeAuxIndex := -1;//TODO To be removed
var integer vc_remoteCseIndex := -1;
var integer vc_acpAuxIndex := -1;
var AccessControlPolicy_optional vc_acpAux;
var MsgIn vc_request;
var MsgIn vc_response;
var default vc_aeSimu := null;
var default vc_cseSimu := null;
var PrimitiveContent vc_primitiveContentRetrievedResource;
};
type component AeSimu extends Tester {
......@@ -51,10 +49,11 @@ module OneM2M_TestSystem {
port OneM2MPort mcaPortIn;
//global variables
var PrimitiveContent vc_primitiveContentRetrievedResource;
//var PrimitiveContent vc_primitiveContentRetrievedResource;
var CseSimu vc_cse1;//For CF02 when AeSimu is master
var boolean vc_auxiliaryAe2Up := false;
var integer vc_aeAuxIndex := -1;//Specific to AeSimu
};
type component CseSimu extends Tester {
......@@ -69,6 +68,7 @@ module OneM2M_TestSystem {
var integer vc_localRemoteCseIndex := -1;
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 integer vc_remoteCseIndex := -1;//Specific to CseSimu
};
type component InCseSimu extends CseSimu {
......
......@@ -7281,7 +7281,7 @@ group OptionalResourceTypes {
MemberType memberType optional,
XSD.NonNegativeInteger currentNrOfMembers 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,
XSD.Boolean memberTypeValidated optional,
ConsistencyStrategy consistencyStrategy optional,
......
This diff is collapsed.
......@@ -1424,7 +1424,7 @@ module OneM2M_Testcases_CSE_Release_1 {
tc_ac.stop;
setverdict(pass, __SCOPE__ & ": Resource type remoteCSE created successfully");
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)) {
tc_ac.stop;
......@@ -1490,7 +1490,7 @@ module OneM2M_Testcases_CSE_Release_1 {
tc_ac.stop;
setverdict(pass, __SCOPE__ & ": Resource type remoteCSE created successfully");
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 {
tc_ac.stop;
......
......@@ -12967,7 +12967,7 @@ module OneM2M_Testcases_CSE_Release_2 {
v_aeIndex := f_getLatestResourceIndex(vc_ae1);
v_aeIndexForResourceAddress := f_getResource(vc_ae1);
v_aeIndexForResourceAddress := f_getResourceFromAeSimu(vc_ae1);
vc_ae1.start(f_cse_createResource(int15, m_createPollingChannelBase, v_aeIndex));//PollingChannel is created;
f_cseSimu_checkComponentDoneAndGetVerdict(vc_ae1);
......
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