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 <miguelangel.reinaortega@etsi.org>
... | @@ -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 | ||
... | ... |