diff --git a/LibOneM2M/OneM2M_Functions.ttcn b/LibOneM2M/OneM2M_Functions.ttcn index c2c38c8bac54826e84786229dade38c697a1a64d..23e6e6ae762d36b5b72700e5e3b19b0076aedad1 100644 --- a/LibOneM2M/OneM2M_Functions.ttcn +++ b/LibOneM2M/OneM2M_Functions.ttcn @@ -7,7 +7,7 @@ * * @author ETSI * @version $URL: https://forge.etsi.org/svn/oneM2M/trunk/ttcn/LibOneM2M/OneM2M_Functions.ttcn $ - * $Id: OneM2M_Functions.ttcn 197 2016-12-02 04:58:45Z reinaortega $ + * $Id: OneM2M_Functions.ttcn 199 2016-12-04 21:49:51Z reinaortega $ * @desc Module containing functions for oneM2M * */ @@ -494,6 +494,7 @@ module OneM2M_Functions { v_request := valueof(m_updateAcpBase); v_request.to_ := f_getResourceAddress(vc_acpAuxIndex); + v_request.from_ := f_getOriginator(vc_acpAuxIndex); v_request.primitiveContent.any_1[0].AccessControlPolicy_optional.privileges.accessControlRule_list := { { accessControlOriginators := PX_ACOR, //{"admin:admin"} @@ -571,27 +572,58 @@ module OneM2M_Functions { } //end f_subscriptionVerificationHandler function f_checkAttributesToBeSaved (ResourceType p_resourceType, RequestPrimitive p_request, inout ResponsePrimitive p_response) { - - if(p_resourceType == int2) { - if(not(ispresent(p_response.primitiveContent.any_1[0].AE_optional.resourceName))) { - p_response.primitiveContent.any_1[0].AE_optional.resourceName := p_request.primitiveContent.any_1[0].AE_optional.resourceName; - } - } - if(p_resourceType == int3) { - if(not(ispresent(p_response.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; + select (p_resourceType) { + case (int1) { + if(isvalue(p_response.primitiveContent.any_1[0].AccessControlPolicy_optional) and + not(ispresent(p_response.primitiveContent.any_1[0].AccessControlPolicy_optional.resourceName))) { + p_response.primitiveContent.any_1[0].AccessControlPolicy_optional.resourceName := p_request.primitiveContent.any_1[0].AccessControlPolicy_optional.resourceName; + } } - } - if(p_resourceType == int1) { - if(not(ispresent(p_response.primitiveContent.any_1[0].AccessControlPolicy_optional.resourceName))) { - p_response.primitiveContent.any_1[0].AccessControlPolicy_optional.resourceName := p_request.primitiveContent.any_1[0].AccessControlPolicy_optional.resourceName; + case (int2) { + if(isvalue(p_response.primitiveContent.any_1[0].AE_optional) and + not(ispresent(p_response.primitiveContent.any_1[0].AE_optional.resourceName))) { + p_response.primitiveContent.any_1[0].AE_optional.resourceName := p_request.primitiveContent.any_1[0].AE_optional.resourceName; + } } - } - if(p_resourceType == int2) { - if(not(ispresent(p_response.primitiveContent.any_1[0].AE_optional.resourceName))) { - p_response.primitiveContent.any_1[0].AE_optional.resourceName := p_request.primitiveContent.any_1[0].AE_optional.resourceName; + case (int3) { + if(isvalue(p_response.primitiveContent.any_1[0].Container_optional) and + not(ispresent(p_response.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 (int15) { + if (isvalue(p_response.primitiveContent.any_1[0].PollingChannel_optional) and + not(ispresent(p_response.primitiveContent.any_1[0].PollingChannel_optional.resourceName))) { + p_response.primitiveContent.any_1[0].PollingChannel_optional.resourceName := p_request.primitiveContent.any_1[0].PollingChannel_optional.resourceName; + } + } + case (int18) { + if (isvalue(p_response.primitiveContent.any_1[0].Schedule_optional) and + not(ispresent(p_response.primitiveContent.any_1[0].Schedule_optional.resourceName))) { + p_response.primitiveContent.any_1[0].Schedule_optional.resourceName := p_request.primitiveContent.any_1[0].Schedule_optional.resourceName; + } + } + case (int23) { + if (isvalue(p_response.primitiveContent.any_1[0].Subscription_optional) and + not(ispresent(p_response.primitiveContent.any_1[0].Subscription_optional.resourceName))) { + p_response.primitiveContent.any_1[0].Subscription_optional.resourceName := p_request.primitiveContent.any_1[0].Subscription_optional.resourceName; + } + } + case (int9) { + if (isvalue(p_response.primitiveContent.any_1[0].Group_optional) and + not(ispresent(p_response.primitiveContent.any_1[0].Group_optional.resourceName))) { + p_response.primitiveContent.any_1[0].Group_optional.resourceName := p_request.primitiveContent.any_1[0].Group_optional.resourceName; + } + } + case else { + log(__SCOPE__&":WARNING: Resource Type "&int2str(enum2int(p_resourceType))&" not implemented"); + if (not PX_DISABLE_STOP_ON_ERROR) { + testcase.stop; + } + } + } + + // TODO test that if the resource name is returned is the same resource name as used in the create message } function f_check_notificationContent(in RequestPrimitive p_requestPrimitive, template PrimitiveContent p_primitiveContent) runs on CseTester return boolean{ @@ -865,8 +897,14 @@ module OneM2M_Functions { if(ischosen(p_contentResource.any_1[0].ServiceSubscribedAppRule_optional)) { return p_contentResource.any_1[0].ServiceSubscribedAppRule_optional.resourceID; } - return "1"; - + log(""&__SCOPE__&":WARNING: Primitive Content Kind not implemented"); + if (PX_DISABLE_STOP_ON_ERROR) { + return "1"; + } else { + testcase.stop; + return "1"; + } + } /** @@ -901,9 +939,13 @@ module OneM2M_Functions { if(ischosen(p_contentResource.any_1[0].ServiceSubscribedAppRule_optional)) { return p_contentResource.any_1[0].ServiceSubscribedAppRule_optional.resourceName; } - - return "1"; - + log(__SCOPE__&":WARNING: Primitive Content Kind not implemented"); + if (PX_DISABLE_STOP_ON_ERROR) { + return "1"; + } else { + testcase.stop; + return "1"; + } } /** diff --git a/LibOneM2M/OneM2M_Pixits.ttcn b/LibOneM2M/OneM2M_Pixits.ttcn index d399632d80e03e85ae0c685f070f44040d81ff11..7b3d45d34c4b7d1339f5321d1a2f4c9fd0d41701 100644 --- a/LibOneM2M/OneM2M_Pixits.ttcn +++ b/LibOneM2M/OneM2M_Pixits.ttcn @@ -7,7 +7,7 @@ * * @author ETSI * @version $URL: https://forge.etsi.org/svn/oneM2M/trunk/ttcn/LibOneM2M/OneM2M_Pixits.ttcn $ - * $Id: OneM2M_Pixits.ttcn 195 2016-12-01 05:26:05Z reinaortega $ + * $Id: OneM2M_Pixits.ttcn 199 2016-12-04 21:49:51Z reinaortega $ * @desc Module containing Pixits for oneM2M * */ @@ -74,4 +74,5 @@ module OneM2M_Pixits { modulepar Labels 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_DISABLE_STOP_ON_ERROR := false; } // end of module