Skip to content
Snippets Groups Projects
Commit 3aa37135 authored by Miguel Angel Reina Ortega's avatar Miguel Angel Reina Ortega
Browse files

Some corrections to f_cse_postamble_deleteResources, f_cse_retrieveResource,...

Some corrections to f_cse_postamble_deleteResources, f_cse_retrieveResource, f_cse_deleteResource, f_checkAttributesToBeSaved, f_getResourceId to support contentInstance and correct use of f_checkCseTesterStatus

Signed-off-by: Miguel Angel Reina Ortega's avatarMiguel Angel Reina Ortega <miguelangel.reinaortega@etsi.org>
parent 5b008fda
No related branches found
No related tags found
1 merge request!25Ae fixes
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* @author oneM2M * @author oneM2M
* @version $URL: https://forge.etsi.org/svn/oneM2M/trunk/ttcn/LibOneM2M/OneM2M_Functions.ttcn $ * @version $URL: https://forge.etsi.org/svn/oneM2M/trunk/ttcn/LibOneM2M/OneM2M_Functions.ttcn $
* $Id: OneM2M_Functions.ttcn 242 2017-03-24 15:18:47Z reinaortega $ * $Id: OneM2M_Functions.ttcn 247 2017-03-27 17:09:55Z reinaortega $
* @desc Module containing functions for oneM2M * @desc Module containing functions for oneM2M
* *
*/ */
...@@ -331,7 +331,22 @@ module OneM2M_Functions { ...@@ -331,7 +331,22 @@ module OneM2M_Functions {
// } // }
// } // }
f_cse_deleteResource(v_request); mcaPort.send(m_request(v_request));
tc_ac.start;
alt {
[] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) {
tc_ac.stop;
log(__SCOPE__&" INFO: Resource" & v_request.to_ & " deleted");
}
[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) {
tc_ac.stop;
log(__SCOPE__&" INFO: Error while deleting resource " & v_request.to_);
}
[] tc_ac.timeout {
log(__SCOPE__&" INFO: No answer while deleting resource " & v_request.to_);
}
}
} }
} }
...@@ -514,6 +529,40 @@ module OneM2M_Functions { ...@@ -514,6 +529,40 @@ module OneM2M_Functions {
}// end f_cse_updateResource }// end f_cse_updateResource
/**
* @desc
* @param p_resourceIndex
* @verdict
*/
function f_cse_retrieveResource(integer p_resourceIndex) runs on CseTester return PrimitiveContent{
var MsgIn v_response;
mcaPort.send(m_request(m_retrieveResource(f_getResourceAddress(p_resourceIndex), f_getOriginator(p_resourceIndex))));
tc_ac.start;
alt {
[] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response {
tc_ac.stop;
setverdict(pass, __SCOPE__&":INFO: Resource retrieved successfuly");
}
[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value v_response {
tc_ac.stop;
setverdict(fail, __SCOPE__&":ERROR: Error while retrieving resource");
}
[] mcaPort.receive{
tc_ac.stop;
setverdict(fail, __SCOPE__&":ERROR: Unexpected message received");
}
[] tc_ac.timeout {
setverdict(inconc, __SCOPE__&":INFO: No answer while retrieving resource");
}
}
f_checkCseTesterStatus();
return v_response.primitive.responsePrimitive.primitiveContent;
}// end f_cse_retrievingResource
/** /**
* @desc * @desc
* @param p_requestPrimitive * @param p_requestPrimitive
...@@ -528,17 +577,19 @@ module OneM2M_Functions { ...@@ -528,17 +577,19 @@ module OneM2M_Functions {
alt { alt {
[] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) { [] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) {
tc_ac.stop; tc_ac.stop;
log(__SCOPE__&"INFO: Resource" & p_requestPrimitive.to_ & " deleted"); setverdict(pass, __SCOPE__&" INFO: Resource" & p_requestPrimitive.to_ & " deleted");
} }
[] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) { [] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) {
tc_ac.stop; tc_ac.stop;
log(__SCOPE__&"INFO: Error while deleting resource " & p_requestPrimitive.to_); setverdict(inconc, __SCOPE__&" INFO: Error while deleting resource " & p_requestPrimitive.to_);
} }
[] tc_ac.timeout { [] tc_ac.timeout {
log(__SCOPE__&"INFO: No answer while deleting resource " & p_requestPrimitive.to_); setverdict(inconc, __SCOPE__&" INFO: No answer while deleting resource " & p_requestPrimitive.to_);
} }
} }
f_checkCseTesterStatus();
}// end f_cse_deleteResource }// end f_cse_deleteResource
/** /**
...@@ -688,6 +739,12 @@ module OneM2M_Functions { ...@@ -688,6 +739,12 @@ module OneM2M_Functions {
p_response.primitiveContent.any_1[0].Container_optional.resourceName := p_request.primitiveContent.any_1[0].Container_optional.resourceName; p_response.primitiveContent.any_1[0].Container_optional.resourceName := p_request.primitiveContent.any_1[0].Container_optional.resourceName;
} }
} }
case (int4) {
if(isvalue(p_response.primitiveContent.any_1[0].ContentInstance_optional) and
not(ispresent(p_response.primitiveContent.any_1[0].ContentInstance_optional.resourceName))) {
p_response.primitiveContent.any_1[0].ContentInstance_optional.resourceName := p_request.primitiveContent.any_1[0].ContentInstance_optional.resourceName;
}
}
case (int15) { case (int15) {
if (isvalue(p_response.primitiveContent.any_1[0].PollingChannel_optional) and if (isvalue(p_response.primitiveContent.any_1[0].PollingChannel_optional) and
not(ispresent(p_response.primitiveContent.any_1[0].PollingChannel_optional.resourceName))) { not(ispresent(p_response.primitiveContent.any_1[0].PollingChannel_optional.resourceName))) {
...@@ -714,9 +771,6 @@ module OneM2M_Functions { ...@@ -714,9 +771,6 @@ module OneM2M_Functions {
} }
case else { case else {
log(__SCOPE__&":WARNING: Resource Type "&int2str(enum2int(p_resourceType))&" not implemented"); log(__SCOPE__&":WARNING: Resource Type "&int2str(enum2int(p_resourceType))&" not implemented");
if (not PX_DISABLE_STOP_ON_ERROR) {
testcase.stop;
}
} }
} }
...@@ -1159,6 +1213,9 @@ module OneM2M_Functions { ...@@ -1159,6 +1213,9 @@ module OneM2M_Functions {
if(ischosen(p_contentResource.any_1[0].Container_optional)) { if(ischosen(p_contentResource.any_1[0].Container_optional)) {
return f_resourceIdCleaner(p_contentResource.any_1[0].Container_optional.resourceID); return f_resourceIdCleaner(p_contentResource.any_1[0].Container_optional.resourceID);
} }
if(ischosen(p_contentResource.any_1[0].ContentInstance_optional)) {
return f_resourceIdCleaner(p_contentResource.any_1[0].ContentInstance_optional.resourceID);
}
if(ischosen(p_contentResource.any_1[0].Schedule_optional)) { if(ischosen(p_contentResource.any_1[0].Schedule_optional)) {
return f_resourceIdCleaner(p_contentResource.any_1[0].Schedule_optional.resourceID); return f_resourceIdCleaner(p_contentResource.any_1[0].Schedule_optional.resourceID);
} }
...@@ -1178,12 +1235,8 @@ module OneM2M_Functions { ...@@ -1178,12 +1235,8 @@ module OneM2M_Functions {
return f_resourceIdCleaner(p_contentResource.any_1[0].ServiceSubscribedAppRule_optional.resourceID); return f_resourceIdCleaner(p_contentResource.any_1[0].ServiceSubscribedAppRule_optional.resourceID);
} }
log(""&__SCOPE__&":WARNING: Primitive Content Kind not implemented"); log(""&__SCOPE__&":WARNING: Primitive Content Kind not implemented");
if (PX_DISABLE_STOP_ON_ERROR) {
return "1"; return "resourceIDNotFound";
} else {
testcase.stop;
return "1";
}
} }
...@@ -1201,6 +1254,9 @@ module OneM2M_Functions { ...@@ -1201,6 +1254,9 @@ module OneM2M_Functions {
if(ischosen(p_contentResource.any_1[0].Container_optional)) { if(ischosen(p_contentResource.any_1[0].Container_optional)) {
return p_contentResource.any_1[0].Container_optional.resourceName; return p_contentResource.any_1[0].Container_optional.resourceName;
} }
if(ischosen(p_contentResource.any_1[0].ContentInstance_optional)) {
return p_contentResource.any_1[0].ContentInstance_optional.resourceName;
}
if(ischosen(p_contentResource.any_1[0].Schedule_optional)) { if(ischosen(p_contentResource.any_1[0].Schedule_optional)) {
return p_contentResource.any_1[0].Schedule_optional.resourceName; return p_contentResource.any_1[0].Schedule_optional.resourceName;
} }
...@@ -1220,12 +1276,9 @@ module OneM2M_Functions { ...@@ -1220,12 +1276,9 @@ module OneM2M_Functions {
return p_contentResource.any_1[0].ServiceSubscribedAppRule_optional.resourceName; return p_contentResource.any_1[0].ServiceSubscribedAppRule_optional.resourceName;
} }
log(__SCOPE__&":WARNING: Primitive Content Kind not implemented"); log(__SCOPE__&":WARNING: Primitive Content Kind not implemented");
if (PX_DISABLE_STOP_ON_ERROR) {
return "1"; return "resourceNameNotFound";
} else {
testcase.stop;
return "1";
}
} }
/** /**
...@@ -1421,7 +1474,8 @@ module OneM2M_Functions { ...@@ -1421,7 +1474,8 @@ module OneM2M_Functions {
* @verdict * @verdict
*/ */
function f_checkCseTesterStatus() runs on CseTester { function f_checkCseTesterStatus() runs on CseTester {
log(getverdict());
if (getverdict != pass) { if (getverdict != pass) {
f_cse_postamble_deleteResources(); f_cse_postamble_deleteResources();
// Tear down // Tear down
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* @author oneM2M * @author oneM2M
* @version $URL: https://forge.etsi.org/svn/oneM2M/trunk/ttcn/LibOneM2M/OneM2M_Pixits.ttcn $ * @version $URL: https://forge.etsi.org/svn/oneM2M/trunk/ttcn/LibOneM2M/OneM2M_Pixits.ttcn $
* $Id: OneM2M_Pixits.ttcn 234 2017-03-20 16:37:29Z reinaortega $ * $Id: OneM2M_Pixits.ttcn 247 2017-03-27 17:09:55Z reinaortega $
* @desc Module containing Pixits for oneM2M * @desc Module containing Pixits for oneM2M
* *
*/ */
...@@ -74,5 +74,4 @@ module OneM2M_Pixits { ...@@ -74,5 +74,4 @@ module OneM2M_Pixits {
modulepar Labels PX_LABELS := {"VALUE_1"}; modulepar Labels PX_LABELS := {"VALUE_1"};
modulepar boolean PX_IS_LOC_CONTAINER := false;//default //set it to true when the container is created to store location information modulepar boolean PX_IS_LOC_CONTAINER := false;//default //set it to true when the container is created to store location information
modulepar boolean PX_DISABLE_STOP_ON_ERROR := false;
} // end of module } // end of module
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment