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

Finalization of all retargeting test cases


Signed-off-by: Miguel Angel Reina Ortega's avatarreinaortega <miguelangel.reinaortega@etsi.org>
parent aaa2bde1
......@@ -1039,13 +1039,10 @@ module OneM2M_Functions {
* @param p_resourceIndex Internal resource index which indicates the resource to be updated
* @verdict
*/
function f_cse_createResourceHandler(template RequestPrimitive p_request) runs on CseSimu return integer{
var integer v_localResourceIndex := -1;
var integer v_parentResourceIndex := -1;
var ResponsePrimitive v_response;
var PrimitiveContent v_localResource;
function f_cse_createResourceHandler(template RequestPrimitive p_request := mw_create) runs on CseSimu return integer{
var integer v_localResourceIndex;
//Activate defaults when running on a PTC
f_cse_activateDefaults_cse1();
......@@ -1053,21 +1050,8 @@ module OneM2M_Functions {
alt {
[] mccPortIn.receive(mw_request(p_request)) -> value vc_request {
tc_ac.stop;
v_parentResourceIndex := f_getResourceIndex(vc_request.primitive.requestPrimitive.to_);
if(v_parentResourceIndex == -1) {
log(__SCOPE__&": ERROR: Target resource not found");
v_response := valueof(m_responsePrimitive(int4004,vc_request.primitive.requestPrimitive.requestIdentifier));
} else {
v_localResource := f_generateLocalResource(vc_request.primitive.requestPrimitive.primitiveContent, v_parentResourceIndex, vc_request.primitive.requestPrimitive.resourceType);
v_localResourceIndex := f_setLocalResource(v_localResource, vc_request.primitive.requestPrimitive.resourceType, v_parentResourceIndex);
v_response := valueof(m_responsePrimitive(int2001,vc_request.primitive.requestPrimitive.requestIdentifier));
v_response.primitiveContent := vc_localResourcesList[v_localResourceIndex].resource;
}
v_response.from_ := PX_CSE1_ID;
v_response.to_ := vc_request.primitive.requestPrimitive.from_;
mccPortIn.send(f_getMsgOutPrimitive(m_response(v_response)));
v_localResourceIndex := f_processCreateRequestPrimitive(vc_request.primitive.requestPrimitive);
mccPortIn.send(f_getMsgOutPrimitive(m_response(vc_response.primitive.responsePrimitive)));
}
[] tc_ac.timeout {
setverdict(inconc, __SCOPE__&":INFO: No creation for resource received");
......@@ -1276,15 +1260,13 @@ module OneM2M_Functions {
/**
* @desc Message exchange for the update of a resource
* @param p_resourceType Resource type of the resource to be created
* @param p_requestPrimitive UPDATE request primitive to be used
* @param p_resourceIndex Internal resource index which indicates the resource to be updated
* @param p_requestPrimitive UPDATE request primitive to be used
* @verdict
*/
function f_cse_updateResourceHandler(integer p_resourceIndex, template RequestPrimitive p_request) runs on CseSimu {
function f_cse_updateResourceHandler(integer p_resourceIndex, template RequestPrimitive p_request := mw_update) runs on CseSimu {
var integer v_targetResourceIndex := -1;
var ResponsePrimitive v_response;
//Activate defaults when running on a PTC
f_cse_activateDefaults_cse1();
......@@ -1293,22 +1275,14 @@ module OneM2M_Functions {
alt {
[] mccPortIn.receive(mw_request(p_request)) -> value vc_request {
tc_ac.stop;
v_targetResourceIndex := f_getResourceIndex(vc_request.primitive.requestPrimitive.to_);
v_targetResourceIndex := f_processUpdateRequestPrimitive(vc_request.primitive.requestPrimitive);
if(v_targetResourceIndex == p_resourceIndex) {
setverdict(pass, __SCOPE__&":INFO: Resource updated successfuly");
v_response := valueof(m_responsePrimitive(int2004,vc_request.primitive.requestPrimitive.requestIdentifier));
v_response.from_ := vc_localResourcesList[vc_cSEBaseIndex].resource.cSEBase.cSE_ID;
v_response.to_ := vc_request.primitive.requestPrimitive.from_;
f_updateLocalResource(v_targetResourceIndex, vc_request.primitive.requestPrimitive.primitiveContent);
v_response.primitiveContent := vc_localResourcesList[v_targetResourceIndex].resource;
} else {
setverdict(inconc, __SCOPE__&":INFO: Unexpected resource update");
log(__SCOPE__&": ERROR: Resource Index not valid");
v_response := valueof(m_responsePrimitive(int4004,vc_request.primitive.requestPrimitive.requestIdentifier));
v_response.from_ := PX_CSE1_ID;
v_response.to_ := vc_request.primitive.requestPrimitive.from_;
}
mccPortIn.send(f_getMsgOutPrimitive(m_response(v_response)));
mccPortIn.send(f_getMsgOutPrimitive(m_response(vc_response.primitive.responsePrimitive)));
}
[] tc_ac.timeout {
setverdict(inconc, __SCOPE__&":INFO: No answer while updating resource");
......@@ -1349,6 +1323,40 @@ module OneM2M_Functions {
}// end f_cse_retrieveResource
/**
* @desc Message exchange for the retrieve of a resource
* @param p_resourceIndex Internal resource index which indicates the expected resource to be retrieved
* @param p_requestPrimitive RETRIEVE request primitive to be used
* @verdict
*/
function f_cse_retrieveResourceHandler(integer p_resourceIndex, template RequestPrimitive p_request := mw_retrieve(?)) runs on CseSimu {
var integer v_targetResourceIndex := -1;
//Activate defaults when running on a PTC
f_cse_activateDefaults_cse1();
tc_ac.start;
alt {
[] mccPortIn.receive(mw_request(p_request)) -> value vc_request {
tc_ac.stop;
v_targetResourceIndex := f_processRetrieveRequestPrimitive(vc_request.primitive.requestPrimitive);
if(v_targetResourceIndex == p_resourceIndex) {
setverdict(pass, __SCOPE__&":INFO: Resource retrieved successfuly");
} else {
setverdict(inconc, __SCOPE__&":INFO: Unexpected resource retrieval");
}
mccPortIn.send(f_getMsgOutPrimitive(m_response(vc_response.primitive.responsePrimitive)));
}
[] tc_ac.timeout {
setverdict(inconc, __SCOPE__&":INFO: No answer while retrieving resource");
}
}
f_checkCseSimuStatus();
}// end f_cse_retrieveResourceHandler
/**
* @desc Message exchange for the deletion of a resource
* @param p_index Resource index of the resource to be deleted
......@@ -1386,7 +1394,41 @@ module OneM2M_Functions {
f_checkAeSimuStatus();
}// end f_cse_deleteResource
/**
* @desc Message exchange for the delete of a resource
* @param p_resourceIndex Internal resource index which indicates the expected resource to be deleted
* @param p_requestPrimitive DELETE request primitive to be used
* @verdict
*/
function f_cse_deleteResourceHandler(integer p_resourceIndex, template RequestPrimitive p_request := mw_delete) runs on CseSimu {
var integer v_targetResourceIndex := -1;
//Activate defaults when running on a PTC
f_cse_activateDefaults_cse1();
tc_ac.start;
alt {
[] mccPortIn.receive(mw_request(p_request)) -> value vc_request {
tc_ac.stop;
v_targetResourceIndex := f_processDeleteRequestPrimitive(vc_request.primitive.requestPrimitive);
if(v_targetResourceIndex == p_resourceIndex) {
setverdict(pass, __SCOPE__&":INFO: Resource deleted successfuly");
} else {
setverdict(inconc, __SCOPE__&":INFO: Unexpected resource retrieval");
}
mccPortIn.send(f_getMsgOutPrimitive(m_response(vc_response.primitive.responsePrimitive)));
}
[] tc_ac.timeout {
setverdict(inconc, __SCOPE__&":INFO: No answer while retrieving resource");
}
}
f_checkCseSimuStatus();
}// end f_cse_deleteResourceHandler
/**
* @desc Message exchange for any operation on a resource
* @param p_requestPrimitive Request primitive to be sent
......@@ -4062,7 +4104,7 @@ module OneM2M_Functions {
* @desc Proccessing of the UPDATE request primitive
* @param p_request Request primitive to be processed
*/
function f_processUpdateRequestPrimitive(in RequestPrimitive p_request) runs on CseSimu {
function f_processUpdateRequestPrimitive(in RequestPrimitive p_request) runs on CseSimu return integer {
var integer v_targetLocalResourceIndex := -1;
v_targetLocalResourceIndex := f_getResourceIndex(p_request.to_);
......@@ -4078,6 +4120,8 @@ module OneM2M_Functions {
}
vc_response.primitive.responsePrimitive.from_ := PX_CSE1_ID;
vc_response.primitive.responsePrimitive.to_ := p_request.from_;
return v_targetLocalResourceIndex;
}
......@@ -4085,7 +4129,7 @@ module OneM2M_Functions {
* @desc Proccessing of the RETRIEVE request primitive
* @param p_request Request primitive to be processed
*/
function f_processRetrieveRequestPrimitive(in RequestPrimitive p_request) runs on CseSimu {
function f_processRetrieveRequestPrimitive(in RequestPrimitive p_request) runs on CseSimu return integer {
var integer v_targetLocalResourceIndex := -1;
v_targetLocalResourceIndex := f_getResourceIndex(p_request.to_);
......@@ -4101,13 +4145,14 @@ module OneM2M_Functions {
vc_response.primitive.responsePrimitive.from_ := PX_CSE1_ID;
vc_response.primitive.responsePrimitive.to_ := p_request.from_;
return v_targetLocalResourceIndex;
}
/**
* @desc Proccessing of the DELETE request primitive
* @param p_request Request primitive to be processed
*/
function f_processDeleteRequestPrimitive(in RequestPrimitive p_request) runs on CseSimu {
function f_processDeleteRequestPrimitive(in RequestPrimitive p_request) runs on CseSimu return integer {
var integer v_targetLocalResourceIndex := -1;
v_targetLocalResourceIndex := f_getResourceIndex(p_request.to_);
......@@ -4122,6 +4167,7 @@ module OneM2M_Functions {
vc_response.primitive.responsePrimitive.from_ := PX_CSE1_ID;
vc_response.primitive.responsePrimitive.to_ := p_request.from_;
return v_targetLocalResourceIndex;
}
}//end group getSetFunctions
......
......@@ -1803,19 +1803,19 @@ module OneM2M_PermutationFunctions {
[v_responseStatusCode == int2000] mccPortIn.receive(mw_request(mw_retrieve(v_targetResourceAddress))) -> value vc_request {
tc_ac.stop;
setverdict(pass, __SCOPE__ & ": Request primitive retargeted successfully");
//f_processRetrieveRequestPrimitive(vc_request.primitive.requestPrimitive);
f_processRetrieveRequestPrimitive(vc_request.primitive.requestPrimitive);
mccPortIn.send(m_response(vc_response.primitive.responsePrimitive));
}
[v_responseStatusCode == int2004] mccPortIn.receive(mw_request(mw_update(-, v_targetResourceAddress))) -> value vc_request {
tc_ac.stop;
setverdict(pass, __SCOPE__ & ": Request primitive retargeted successfully");
//f_processUpdateRequestPrimitive(vc_request.primitive.requestPrimitive);
f_processUpdateRequestPrimitive(vc_request.primitive.requestPrimitive);
mccPortIn.send(m_response(vc_response.primitive.responsePrimitive));
}
[v_responseStatusCode == int2002] mccPortIn.receive(mw_request(mw_delete(v_targetResourceAddress))) -> value vc_request {
tc_ac.stop;
setverdict(pass, __SCOPE__ & ": Request primitive retargeted successfully");
//f_processDeleteRequestPrimitive(vc_request.primitive.requestPrimitive);
f_processDeleteRequestPrimitive(vc_request.primitive.requestPrimitive);
mccPortIn.send(m_response(vc_response.primitive.responsePrimitive));
}
[] mccPortIn.receive(mw_request(?)) -> value vc_request {
......@@ -1878,13 +1878,13 @@ module OneM2M_PermutationFunctions {
vc_cse1.start(f_cse_createResourceHandler(mw_create(-, v_targetResourceAddress )));
} else if(valueof(p_requestPrimitive.operation) == int2) {
v_responseStatusCode := int2000;
//vc_cse1.start(f_cse_retrieveResourceHandler());
vc_cse1.start(f_cse_retrieveResourceHandler(v_targetResourceIndex));
} else if(valueof(p_requestPrimitive.operation) == int3) {
v_responseStatusCode := int2004;
vc_cse1.start(f_cse_updateResourceHandler(v_targetResourceIndex ,mw_update()));
vc_cse1.start(f_cse_updateResourceHandler(v_targetResourceIndex));
} else if(valueof(p_requestPrimitive.operation) == int4) {
v_responseStatusCode := int2002;
//vc_cse1.start(f_cse_deleteResourceHandler());
vc_cse1.start(f_cse_deleteResourceHandler(v_targetResourceIndex));
}
mcaPort.send(f_getMsgOutPrimitive(m_request(valueof(p_requestPrimitive))));
......
......@@ -5169,7 +5169,6 @@ module OneM2M_Testcases_CSE_Release_2 {
}
}
}
} // end g_CSE_DMR_UPD_006
testcase TC_CSE_DMR_UPD_006_TS_LBL() runs on Tester system CseSystem {
// Local variable
......@@ -5197,8 +5196,7 @@ module OneM2M_Testcases_CSE_Release_2 {
}
}
} // end g_CSE_DMR_UPD_006
} // end g_CSE_DMR_UPD_006
group g_CSE_DMR_UPD_007{
......
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