Retargeting test cases implemented (see notes)

CRE permutations finalized
Other permutations to be finalized once a merge from Release1 branch is
done (some functions already defined there)
Signed-off-by: Miguel Angel Reina Ortega's avatarreinaortega <miguelangel.reinaortega@etsi.org>
parent b9bd8987
......@@ -413,6 +413,28 @@ module OneM2M_Functions {
return v_resourceIndex;
}
/**
* @desc Getting the address of the last local resource saved in the vc_localResourcesList
* @param p_tester Given component
*/
function f_getLatestLocalResourceAddress(in CseSimu p_component, AddressingMethod p_addressingMethod := PX_ADDRESSING_METHOD, PrimitiveScope p_primitiveScope := PX_PRIMITIVE_SCOPE) runs on Tester return XSD.ID {
var XSD.ID v_localResourceAddress;
f_connectInfoPort(p_component);
p_component.start(f_sendLatestLocalResourceAddress(p_addressingMethod, p_primitiveScope));
alt {
[]infoPort.receive(mw_resourceAddress) -> value v_localResourceAddress{
}
}
p_component.done;
f_disconnectInfoPort(p_component);
return v_localResourceAddress;
}
/**
* @desc Getting primitiveContent retrieved in an AeSimu component
......@@ -460,6 +482,31 @@ module OneM2M_Functions {
}
/**
* @desc Getting the latest resource from an AeSimu component
* @param p_tester AeSimu component
* @param p_resourceIndex Index of resource to be retrieved
*/
function f_getLatestResource(in Tester p_component) runs on Tester return integer {
var MyResource v_resource;
var integer v_resourceIndex := -1;
f_connectInfoPort(p_component);
p_component.start(f_sendLatestResource());
alt {
[]infoPort.receive(mw_resource) -> value v_resource {
v_resourceIndex := f_setResource(v_resource.resource, v_resource.resourceType, v_resource.parentIndex, false);
}
}
p_component.done;
f_disconnectInfoPort(p_component);
return v_resourceIndex;
}
/**
* @desc Getting a specific resource from an AeSimu component
* @param p_tester AeSimu component
......@@ -512,6 +559,15 @@ module OneM2M_Functions {
}
/**
* @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
*/
......@@ -563,6 +619,14 @@ module OneM2M_Functions {
} 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]);
}
......@@ -1324,6 +1388,36 @@ module OneM2M_Functions {
}// end f_cse_deleteResource
/**
* @desc Message exchange for any operation on a resource
* @param p_requestPrimitive Request primitive to be sent
* @return PrimitiveContent parameter of the operation response
* @verdict
*/
function f_cse_operationResource(template RequestPrimitive p_requestPrimitive) runs on AeSimu return PrimitiveContent{
mcaPort.send(f_getMsgOutPrimitive(m_request(valueof(p_requestPrimitive))));
tc_ac.start;
alt {
[] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value vc_response {
tc_ac.stop;
setverdict(pass, __SCOPE__&":INFO: Success operation on resource");
}
[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value vc_response {
tc_ac.stop;
setverdict(inconc, __SCOPE__&":INFO: Error on the operation on resource");
}
[] tc_ac.timeout {
setverdict(inconc, __SCOPE__&":INFO: No answer while operation on resource");
}
}
f_checkAeSimuStatus();
return vc_response.primitive.responsePrimitive.primitiveContent;
}// end f_cse_operationResource
/**
* @desc Check that a resource is present in the IUT (resourceId is known) by using RETRIEVE operation
* @param p_resourceIndex Resource index of the resource to be checked
......@@ -2428,6 +2522,26 @@ module OneM2M_Functions {
f_checkCseSimuStatus();
}
/**
* @desc Creation and save a local resource (Test System simulating a CSE)
* @param p_resource Resource to be created
* @param p_parentIndex Parent resource index of resource to be saved
* @param p_resourceType Type of the resource to be created
* @return Index of internal created resource
*/
function f_generateAndSetLocalResource(in template(omit) PrimitiveContent p_resource := omit, in integer p_parentIndex, in ResourceType p_resourceType) runs on CseSimu return Integer {
var PrimitiveContent v_localResource;
var integer v_localResourceIndex;
v_localResource := f_generateLocalResource(p_resource, p_parentIndex, p_resourceType);
v_localResourceIndex := f_setLocalResource(v_localResource, p_resourceType, p_parentIndex);
return v_localResourceIndex;
}//End of function
/**
* @desc Creation of a local resource (Test System simulating a CSE)
......@@ -3196,8 +3310,10 @@ module OneM2M_Functions {
}
}
}
p_request.to_ := f_getResourceAddress(p_parentIndex);
//Only set To parameter if it has not been set yet
if(valueof(p_request.to_) == "NotInitialized") {
p_request.to_ := f_getResourceAddress(p_parentIndex);
}
if (p_resourceType == int1) {//AccessControlPolicy
......@@ -3211,9 +3327,7 @@ module OneM2M_Functions {
p_request.primitiveContent.group_.memberIDs := {f_getResourceId(vc_resourcesList[p_parentIndex].resource)};
}
}
}
if(p_resourceType == int3){//container
} else if(p_resourceType == int3){//container
//when a container is created by hosting cse for storing location information, the container is seen as a location container
if(PX_IS_LOC_CONTAINER){
p_request.primitiveContent.container.locationID := f_getResourceId(vc_resourcesList[p_parentIndex].resource);//resourceID of the locationPolicy
......@@ -3223,18 +3337,12 @@ module OneM2M_Functions {
p_request.primitiveContent.container.accessControlPolicyIDs := {f_getResourceId(vc_resourcesList[vc_acpAuxIndex].resource)};
}
}
}
if (p_resourceType == int15) {//pollingChannel
} else if (p_resourceType == int15) {//pollingChannel
if(ischosen(vc_resourcesList[p_parentIndex].resource.aE)) {
p_request.from_ := vc_resourcesList[p_parentIndex].resource.aE.aE_ID;
}
}
if (p_resourceType == int18) {//schedule
}
if (p_resourceType == int23) {//subscription
} else if (p_resourceType == int18) {//schedule
} else if (p_resourceType == int23) {//subscription
//notificationURI
if(match(valueof(p_request.primitiveContent.subscription.notificationURI), v_defaultListOfURIs )){
p_request.primitiveContent.subscription.notificationURI := {f_getResourceAddress(p_parentIndex)};
......@@ -3251,8 +3359,7 @@ module OneM2M_Functions {
p_request.primitiveContent.subscription.accessControlPolicyIDs := {f_getResourceId(vc_resourcesList[vc_acpAuxIndex].resource)};
}
}
}
if (p_resourceType == int4) {//contentInstance
} else if (p_resourceType == int4) {//contentInstance
//creator attribute
if(ispresent(p_request.primitiveContent.contentInstance.creator)) {
p_request.primitiveContent.contentInstance.creator := f_getCreator(p_parentIndex);
......@@ -3320,7 +3427,10 @@ module OneM2M_Functions {
if(p_resourceType != int10002) {
p_request.from_ := f_getOriginator(p_resourceIndex);
p_request.to_ := f_getResourceAddress(p_resourceIndex);
//Only set To parameter if it has not been set yet
if(valueof(p_request.to_) == "NotInitialized") {
p_request.to_ := f_getResourceAddress(p_resourceIndex);
}
} else {
p_request.from_ := PX_CSE1_ID & "/" & f_getResourceId(vc_resourcesList[p_resourceIndex].resource);
......
......@@ -14,6 +14,7 @@
module OneM2M_Ports {
import from OneM2M_Types all;
import from XSD all;
/* ***************************************
* oneM2M Ports
* ***************************************
......@@ -47,9 +48,9 @@ module OneM2M_Ports {
*/
type port InfoPort message {
in
RequestPrimitive, ResponsePrimitive, PrimitiveContent, MyResource, integer;
RequestPrimitive, ResponsePrimitive, PrimitiveContent, MyResource, integer, XSD.ID;
out
RequestPrimitive, ResponsePrimitive, PrimitiveContent, MyResource, integer;
RequestPrimitive, ResponsePrimitive, PrimitiveContent, MyResource, integer, XSD.ID;
}
......
......@@ -5036,6 +5036,7 @@ module OneM2M_Templates {
template MyResource mw_resource := ?;
template integer mw_resourceIndex := ?;
template XSD.ID mw_resourceAddress := ?;
}//end group InfoPortTemplates
......
This diff is collapsed.
......@@ -377,6 +377,125 @@ module OneM2M_Testcases_CSE_Release_2 {
group Data_Management_and_Repository {
group g_CSE_DMR_001 {
/**
* @desc Check that the IUT rejects a Non-Blocking Synchronous Request if the IUT does not support the <request> resource
*
*/
testcase TC_CSE_DMR_001_CRE() runs on Tester system CseSystem {
// Local variables
var template RequestPrimitive v_createRequest := m_createContainerBase;
var CseSimu v_cse1 := CseSimu.create("CSE1") alive;
v_cse1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_CSE1));
v_cse1.done;
v_cse1.start(f_CSE_DMR_001(v_createRequest)); //Create Container
v_cse1.done;
}
testcase TC_CSE_DMR_001_UPD() runs on Tester system CseSystem {
// Local variables
var template RequestPrimitive v_createRequest := m_createContainerBase;
var template RequestPrimitive v_updateRequest := m_updateContainerBase;
var CseSimu v_cse1 := CseSimu.create("CSE1") alive;
var Labels v_labels_1 := {"VALUE_1"};
v_cse1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_CSE1));
v_cse1.done;
v_updateRequest.primitiveContent.container.labels := v_labels_1;
v_cse1.start(f_CSE_DMR_001(v_updateRequest)); //Update Container
v_cse1.done;
}
testcase TC_CSE_DMR_001_RET() runs on Tester system CseSystem {
// Local variables
var template RequestPrimitive v_createRequest := m_createContainerBase;
var CseSimu v_cse1 := CseSimu.create("CSE1") alive;
v_cse1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_CSE1));
v_cse1.done;
v_cse1.start(f_CSE_DMR_001(m_retrieve("NotInitialized", "NotInitialized"))); //Retrieve Container
v_cse1.done;
}
testcase TC_CSE_DMR_001_DEL() runs on Tester system CseSystem {
// Local variables
var template RequestPrimitive v_createRequest := m_createContainerBase;
var CseSimu v_cse1 := CseSimu.create("CSE1") alive;
v_cse1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_CSE1));
v_cse1.done;
v_cse1.start(f_CSE_DMR_001(m_delete("NotInitialized", "NotInitialized"))); //Delete Container
v_cse1.done;
}
}// end group g_CSE_DMR_001
group g_CSE_DMR_002 {
/**
* @desc Check that the IUT rejects a Non-Blocking Synchronous Request if the IUT does not support the <request> resource
*
*/
testcase TC_CSE_DMR_002_CRE() runs on Tester system CseSystem {
// Local variables
var template RequestPrimitive v_createRequest := m_createContainerBase;
var AeSimu v_ae1 := AeSimu.create("AE1") alive;
v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
v_ae1.done;
v_ae1.start(f_CSE_DMR_002(v_createRequest)); //Create Container
v_ae1.done;
}
testcase TC_CSE_DMR_002_UPD() runs on Tester system CseSystem {
// Local variables
var template RequestPrimitive v_createRequest := m_createContainerBase;
var template RequestPrimitive v_updateRequest := m_updateContainerBase;
var AeSimu v_ae1 := AeSimu.create("AE1") alive;
var Labels v_labels_1 := {"VALUE_1"};
v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
v_ae1.done;
v_updateRequest.primitiveContent.container.labels := v_labels_1;
v_ae1.start(f_CSE_DMR_002(v_updateRequest)); //Update Container
v_ae1.done;
}
testcase TC_CSE_DMR_002_RET() runs on Tester system CseSystem {
// Local variables
var template RequestPrimitive v_createRequest := m_createContainerBase;
var AeSimu v_ae1 := AeSimu.create("AE1") alive;
v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
v_ae1.done;
v_ae1.start(f_CSE_DMR_002(m_retrieve("NotInitialized", "NotInitialized"))); //Retrieve Container
v_ae1.done;
}
testcase TC_CSE_DMR_002_DEL() runs on Tester system CseSystem {
// Local variables
var template RequestPrimitive v_createRequest := m_createContainerBase;
var AeSimu v_ae1 := AeSimu.create("AE1") alive;
v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1));
v_ae1.done;
v_ae1.start(f_CSE_DMR_002(m_delete("NotInitialized", "NotInitialized"))); //Delete Container
v_ae1.done;
}
}// end group g_CSE_DMR_002
group Create {
group g_CSE_DMR_CRE_001 {
......
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