diff --git a/LibOneM2M/OneM2M_Functions.ttcn b/LibOneM2M/OneM2M_Functions.ttcn index 7ee3c5455187ae83c41db1ff3353295fcbe79ebb..f02c7a8aafeed51f8824df5fce6d3e20b50119b1 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 144 2016-10-24 10:28:51Z reinaortega $ + * $Id: OneM2M_Functions.ttcn 145 2016-10-24 14:37:40Z reinaortega $ * @desc Module containing functions for oneM2M * */ @@ -84,6 +84,19 @@ module OneM2M_Functions { group cseFunctions { group preambleFunctions { + + /** + * @desc Creation of auxiliar resources ACP for correct execution of the test case + * @param p_allowedOperations Allowed operations for the auxiliar AE resource + * @return Internal ACP resource index + * @verdict + */ + function f_cse_preamble_createAcpAux(in template (value) XSD.String p_acpName := c_acpAuxName, in template (value) AccessControlOperations p_allowedOperations := int63) runs on CseTester return integer {//c_CRUDNDi + + return f_cse_createAccessControlPolicyAux(p_acpName, p_allowedOperations); + + } + /** * @desc Creation of auxiliar resources ACP and AE for correct execution of the test case @@ -91,27 +104,15 @@ module OneM2M_Functions { * @return Internal AE resource index * @verdict */ - function f_cse_preamble_registerAe(in template (value) AccessControlOperations p_allowedOperations := int63, in template (omit) PoaList p_poaList := omit) runs on CseTester return integer {//c_CRUDNDi + function f_cse_preamble_registerAe(template (omit) AcpType p_accessControlPolicyIDs := omit, in template (omit) PoaList p_poaList := omit) runs on CseTester return integer {//c_CRUDNDi var RequestPrimitive v_request; var MsgIn v_response; var integer v_aeAuxIndex := -1; - var integer v_acpAuxIndex := -1; - - if(PX_ACP_SUPPORT){ - v_acpAuxIndex := f_cse_createAccessControlPolicyAux(p_allowedOperations := p_allowedOperations); - vc_acpAuxIndex := v_acpAuxIndex; - } - - if(v_acpAuxIndex != -1) { - vc_resourcesIndexToBeDeleted := {v_acpAuxIndex}; - v_request := valueof(m_createAeAux({f_getResourceId(vc_resourcesList[v_acpAuxIndex].resource)}, p_poaList)); - //mcaPort.send(m_request(m_createAeAux(p_name, {PX_URI_CSE & PX_CSE_NAME & "/" & PX_ACPAUX_NAME}))); - } else { - v_request := valueof(m_createAeAux(-, p_poaList)); - } - - v_request.to_ := f_addPrefix(f_getResourceAddress()); + + v_request := valueof(m_createAeAux(-, p_poaList)); + v_request.to_ := f_addPrefix(f_getResourceAddress()); + mcaPort.send(m_request(v_request)); tc_ac.start; @@ -291,8 +292,9 @@ module OneM2M_Functions { tc_ac.stop; setverdict(pass, "f_createAccessControlPolicy: Resource type " & int2str(1) & " created successfuly"); v_acpAuxIndex := f_setResource(v_response.primitive.responsePrimitive.primitiveContent); - vc_acpAux := v_response.primitive.responsePrimitive.primitiveContent.any_1[0].AccessControlPolicy_optional;//TODO To be removed - } + vc_acpAuxIndex := v_acpAuxIndex; + vc_resourcesIndexToBeDeleted := vc_resourcesIndexToBeDeleted & {v_acpAuxIndex}; + } [] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) { tc_ac.stop; setverdict(inconc, "f_createAccessControlPolicy: Error while creating resource type " & int2str(1)); diff --git a/LibOneM2M/OneM2M_Pics.ttcn b/LibOneM2M/OneM2M_Pics.ttcn new file mode 100644 index 0000000000000000000000000000000000000000..925348efd49431ebad1beb27eec89785751d6b43 --- /dev/null +++ b/LibOneM2M/OneM2M_Pics.ttcn @@ -0,0 +1,23 @@ +/* + * Copyright Notification + * No part of this document may be reproduced, in an electronic retrieval system or otherwise, except as authorized by written permission. + * The copyright and the foregoing restriction extend to reproduction in all media. + * © 2016, oneM2M Partners Type 1 (ARIB, ATIS, CCSA, ETSI, TIA, TSDSI, TTA, TTC). + * All rights reserved. + * + * @author ETSI + * @version $URL: https://forge.etsi.org/svn/oneM2M/trunk/ttcn/LibOneM2M/OneM2M_Pics.ttcn $ + * $Id: OneM2M_Pics.ttcn 145 2016-10-24 14:37:40Z reinaortega $ + * @desc Module containing Pixits for oneM2M + * + */ +module OneM2M_Pics { + + /** + * @desc AccessControlPolicy resource support + * @see oneM2M TS-0017 A.5.5.1/1 + */ + modulepar boolean PICS_ACP_SUPPORT := true; + + +} // end of module diff --git a/LibOneM2M/OneM2M_Pixits.ttcn b/LibOneM2M/OneM2M_Pixits.ttcn index 83aff06a5eb94f2bd36ebc152c7376b276b24b6b..cdfcb71da1634a1abfef1bac8ecc60ca04d523c9 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 144 2016-10-24 10:28:51Z reinaortega $ + * $Id: OneM2M_Pixits.ttcn 145 2016-10-24 14:37:40Z reinaortega $ * @desc Module containing Pixits for oneM2M * */ @@ -51,9 +51,7 @@ module OneM2M_Pixits { modulepar charstring PX_SERIALIZATION := "XML"; modulepar charstring PX_PROTOCOL_BINDING := "HTTP"; - - modulepar boolean PX_ACP_SUPPORT := true; - + modulepar XSD.ID PX_CSE_ID := "in-cse"; modulepar boolean PX_FROM_IS_AE_ID := true; diff --git a/OneM2M_Testcases.ttcn b/OneM2M_Testcases.ttcn index 3040e34661f135c84e4a2595af1d35b169f34d0f..9b6f187cc539f22d2501453e1ae009f2a5cb08db 100644 --- a/OneM2M_Testcases.ttcn +++ b/OneM2M_Testcases.ttcn @@ -7,7 +7,7 @@ * * @author ETSI * @version $URL: https://forge.etsi.org/svn/oneM2M/trunk/ttcn/OneM2M_Testcases.ttcn $ - * $Id: OneM2M_Testcases.ttcn 144 2016-10-24 10:28:51Z reinaortega $ + * $Id: OneM2M_Testcases.ttcn 146 2016-10-24 16:11:32Z reinaortega $ * @desc Module containing test cases for oneM2M * */ @@ -20,6 +20,7 @@ module OneM2M_Testcases { import from OneM2M_Types all;//{type XSD.ID}; import from OneM2M_TypesAndValues all; import from OneM2M_Pixits all; + import from OneM2M_Pics all; import from OneM2M_Functions all; import from LibCommon_Time {modulepar all}; import from XSD all; @@ -1520,10 +1521,14 @@ module OneM2M_Testcases { // Local variables var MsgIn v_response; var RequestPrimitive v_request; - + var integer v_acpAuxIndex := -1; var integer v_aeIndex := -1; // Test control + if(not(PICS_ACP_SUPPORT)) { + setverdict(inconc, testcasename() & ": AccessControlPolicy support is required to run this test case"); + stop; + } // Test component configuration f_cf01Up(); @@ -1532,11 +1537,13 @@ module OneM2M_Testcases { // Preamble if (p_resourceType != int23) { - v_aeIndex := f_cse_preamble_registerAe(int62);//c_RUDNDi); + v_acpAuxIndex := f_cse_preamble_createAcpAux(-, int62);//c_RUDNDi) } else { - v_aeIndex := f_cse_preamble_registerAe(int60);//c_UDNDi); - } - + v_acpAuxIndex := f_cse_preamble_createAcpAux(-, int60);//c_UDNDi); + } + + v_aeIndex := f_cse_preamble_registerAe({f_getResourceId(vc_resourcesList[v_acpAuxIndex].resource)}, -); + // Test Body if(p_resourceType == int15) { v_request := valueof(m_createPollingChannel(f_getResourceAddress(v_aeIndex), PX_AE_ID_STEM, omit)); @@ -1808,10 +1815,11 @@ module OneM2M_Testcases { var XSD.ID v_acpId; var integer v_aeIndex := -1; + var integer v_acpAuxIndex := -1; var integer v_resourceIndex := -1; // Test control - if(not(PX_ACP_SUPPORT)) { + if(not(PICS_ACP_SUPPORT)) { log(testcasename() & ":AccessControlPolicy support is required for executing this test case"); stop; } @@ -1822,7 +1830,9 @@ module OneM2M_Testcases { // Test adapter configuration // Preamble - v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi; + v_acpAuxIndex := f_cse_preamble_createAcpAux(-, -);//c_RUDNDi) + + v_aeIndex := f_cse_preamble_registerAe({f_getResourceId(vc_resourcesList[v_acpAuxIndex].resource)});//c_CRUDNDi; v_resourceIndex := f_cse_createResource(p_resourceType, p_requestPrimitive, v_aeIndex); @@ -3529,9 +3539,14 @@ module OneM2M_Testcases { var MsgIn v_response; var RequestPrimitive v_request; var integer v_aeIndex := -1; + var integer v_acpAuxIndex := -1; var integer v_resourceIndex := -1; // Test control + if(not(PICS_ACP_SUPPORT)) { + setverdict(inconc, testcasename() & ": AccessControlPolicy support is required to run this test case"); + stop; + } // Test component configuration f_cf01Up(); @@ -3539,8 +3554,9 @@ module OneM2M_Testcases { // Test adapter configuration // Preamble - v_aeIndex := f_cse_preamble_registerAe(int59);//c_CRDNDi); + v_acpAuxIndex := f_cse_preamble_createAcpAux(-, int59);//c_CRDNDi) + v_aeIndex := f_cse_preamble_registerAe({f_getResourceId(vc_resourcesList[v_acpAuxIndex].resource)}, -);//c_CRDNDi); v_resourceIndex := f_cse_createResource(p_resourceType, p_createRequestPrimitive, v_aeIndex); @@ -4413,19 +4429,28 @@ module OneM2M_Testcases { testcase TC_CSE_LOC_BO_001() runs on CseTester system CseSystem {//the originator has no privileges to create a locationPolicy resource!! var integer v_aeAuxIndex := -1; + var integer v_acpAuxIndex := -1; var LocationSource v_locationSource := int1;//Network-based var XSD.Duration locationUpdatePeriod := PX_LOCATION_UPDATE_PERIOD; var XSD.Token locationTargetID := PX_LOCATION_TARGET_ID; var XSD.AnyURI locationServerAddress := PX_LOCATION_SERVER_ADDRESS; var RequestPrimitive v_request; var MsgIn v_response; + + // Test control + if(not(PICS_ACP_SUPPORT)) { + setverdict(inconc, testcasename() & ": AccessControlPolicy support is required to run this test case"); + stop; + } //Test component configuration f_cf01Up(); //Preamble - v_aeAuxIndex := f_cse_preamble_registerAe(int62);//c_RUDNDi //No resource creation privilege - + v_acpAuxIndex := f_cse_preamble_createAcpAux(-, int62);//c_RUDNDi) //No resource creation privilege + + v_aeAuxIndex := f_cse_preamble_registerAe({f_getResourceId(vc_resourcesList[v_acpAuxIndex].resource)}, -); + //Set requestPrimitive v_request := f_getCreateRequestPrimitive(int10, m_createLocationPolicy(v_locationSource,omit, locationUpdatePeriod, locationTargetID, locationServerAddress), v_aeAuxIndex); @@ -6968,10 +6993,15 @@ module OneM2M_Testcases { // Local variables var MsgIn v_response; var integer v_aeIndex := -1; + var integer v_acpAuxIndex := -1; var template RequestPrimitive v_createRequest := m_createSubscriptionBase; var RequestPrimitive v_request; // Test control + if(not(PICS_ACP_SUPPORT)) { + setverdict(inconc, testcasename() & ": AccessControlPolicy support is required to run this test case"); + stop; + } // Test component configuration f_cf01Up(); @@ -6979,8 +7009,10 @@ module OneM2M_Testcases { // Test adapter configuration // Preamble - v_aeIndex := f_cse_preamble_registerAe(int61);//c_CUDNDi); - + v_acpAuxIndex := f_cse_preamble_createAcpAux(-, int61);//c_CUDNDi) + + v_aeIndex := f_cse_preamble_registerAe({f_getResourceId(vc_resourcesList[v_acpAuxIndex].resource)}, -);//c_CRDNDi); + v_request := f_getCreateRequestPrimitive(int23, v_createRequest, v_aeIndex);//Subscription mcaPort.send(m_request(v_request)); @@ -8318,7 +8350,7 @@ module OneM2M_Testcases { } [(not v_boolNotification)] mcaPort.receive(mw_request(mw_aggregatedNotifyBase)) -> value v_response { tc_ac.stop; - if(sizeof(v_response.primitive.requestPrimitive.primitiveContent.any_1[0].AggregatedNotification.notification_list) == numberOfAggregatedNotification){ + if(lengthof(v_response.primitive.requestPrimitive.primitiveContent.any_1[0].AggregatedNotification.notification_list) == numberOfAggregatedNotification){ for(i := 0; i<numberOfAggregatedNotification; i := i + 1){ if(ischosen(v_response.primitive.requestPrimitive.primitiveContent.any_1[0].AggregatedNotification.notification_list[i].notificationEvent.representation.resource)) { if(match(v_response.primitive.requestPrimitive.primitiveContent.any_1[0].AggregatedNotification.notification_list[i].notificationEvent.representation.resource.AE_optional, v_contentResponse.any_1[0].AE_optional)) { @@ -8418,7 +8450,7 @@ module OneM2M_Testcases { alt { [] mcaPort.receive(mw_request(mw_aggregatedNotifyBase)) -> value v_response { tc_ac.stop; - if(sizeof(v_response.primitive.requestPrimitive.primitiveContent.any_1[0].AggregatedNotification.notification_list) == 2){ + if(lengthof(v_response.primitive.requestPrimitive.primitiveContent.any_1[0].AggregatedNotification.notification_list) == 2){ for(i := 0; i<2; i := i + 1){ if(ischosen(v_response.primitive.requestPrimitive.primitiveContent.any_1[0].AggregatedNotification.notification_list[i].notificationEvent.representation.resource)) { if(match(v_response.primitive.requestPrimitive.primitiveContent.any_1[0].AggregatedNotification.notification_list[i].notificationEvent.representation.resource.AE_optional, v_contentResponse.any_1[0].AE_optional)) {