diff --git a/LibOneM2M/OneM2M_Functions.ttcn b/LibOneM2M/OneM2M_Functions.ttcn index f480e165c2b9cff202b204acca6b1f253b0a7870..7ee3c5455187ae83c41db1ff3353295fcbe79ebb 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 134 2016-10-11 09:33:13Z reinaortega $ + * $Id: OneM2M_Functions.ttcn 144 2016-10-24 10:28:51Z reinaortega $ * @desc Module containing functions for oneM2M * */ @@ -234,7 +234,7 @@ module OneM2M_Functions { * @return Internal resource index of the created resource * @verdict */ - function f_cse_createResource(in ResourceType p_resourceType, template RequestPrimitive p_requestPrimitive, integer p_parentIndex := -1) runs on CseTester return integer { + function f_cse_createResource(in ResourceType p_resourceType, template RequestPrimitive p_requestPrimitive := m_create, integer p_parentIndex := -1) runs on CseTester return integer { var MsgIn v_response; var RequestPrimitive v_request; @@ -437,7 +437,7 @@ module OneM2M_Functions { * @return Created CREATE request primitive * @verdict */ - function f_getCreateRequestPrimitive(in ResourceType p_resourceType, template RequestPrimitive p_request, integer p_parentIndex) runs on CseTester return RequestPrimitive { + function f_getCreateRequestPrimitive(in ResourceType p_resourceType, template RequestPrimitive p_request := m_create, integer p_parentIndex) runs on CseTester return RequestPrimitive { var integer p_locresourceIndex := p_parentIndex; p_request.from_ := f_getOriginator(p_parentIndex); @@ -676,15 +676,17 @@ module OneM2M_Functions { } else if (PX_ADDRESSING_FORMAT == e_absolute) { if(PX_UNSTRUCTURED) { if(p_targetResourceIndex == -1) { - return ""; + return "//" &"SpId" & "/" & PX_CSE_ID; } else { - return ""; + v_resourceAddress := f_getResourceAddress() & "/" & f_getResourceId(vc_resourcesList[p_targetResourceIndex].resource); + return v_resourceAddress; } } else { if(p_targetResourceIndex == -1) { - return ""; + return "//" &"SpId" & "/" & PX_CSE_ID & "/" & PX_CSE_NAME; } else { - return ""; + v_resourceAddress := f_getResourceAddress(vc_resourcesList[p_targetResourceIndex].parentIndex) & "/" & f_getResourceName(vc_resourcesList[p_targetResourceIndex].resource); + return v_resourceAddress; } } } else { @@ -745,8 +747,7 @@ module OneM2M_Functions { }//end group altstepFunctions }//end of commonFunctions - - + diff --git a/LibOneM2M/OneM2M_Pixits.ttcn b/LibOneM2M/OneM2M_Pixits.ttcn index db1b55fb85c3312ef839852ff84648e9503f1d30..83aff06a5eb94f2bd36ebc152c7376b276b24b6b 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 134 2016-10-11 09:33:13Z reinaortega $ + * $Id: OneM2M_Pixits.ttcn 144 2016-10-24 10:28:51Z reinaortega $ * @desc Module containing Pixits for oneM2M * */ @@ -15,6 +15,8 @@ module OneM2M_Pixits { import from XSD all; import from OneM2M_Types all; + + group testAdapterParameters {} modulepar boolean PX_DELETE_CREATED_RESOURCES := true; @@ -22,7 +24,7 @@ module OneM2M_Pixits { modulepar XSD.IDREFS PX_RESOURCES_TO_BE_DELETED := {"/ae_test", "/MyAcp"}; - modulepar charstring PX_HOST_ADDRESS := "127.0.0.1:8080"; + modulepar charstring PX_SUT_ADDRESS := "127.0.0.1:8080"; modulepar charstring PX_TESTER_ADDRESS := "127.0.0.1:1400"; diff --git a/LibOneM2M/OneM2M_Templates.ttcn b/LibOneM2M/OneM2M_Templates.ttcn index b9278af7ebbdfc4ee90ee8301cb294f53d4a262e..a2199ae1d73244d2ec2774584fed9d08c31c7133 100644 --- a/LibOneM2M/OneM2M_Templates.ttcn +++ b/LibOneM2M/OneM2M_Templates.ttcn @@ -7,7 +7,7 @@ * * @author ETSI * @version $URL: https://forge.etsi.org/svn/oneM2M/trunk/ttcn/LibOneM2M/OneM2M_Templates.ttcn $ - * $Id: OneM2M_Templates.ttcn 134 2016-10-11 09:33:13Z reinaortega $ + * $Id: OneM2M_Templates.ttcn 144 2016-10-24 10:28:51Z reinaortega $ * @desc Module containing templates for oneM2M * */ @@ -44,7 +44,7 @@ module OneM2M_Templates { */ template (value) MsgOut m_request(in template (value) RequestPrimitive p_requestPrimitive, in template (omit) AttributeList_1 p_nullFields := omit ) := { primitive := { requestPrimitive := p_requestPrimitive}, - host := PX_HOST_ADDRESS, + host := PX_SUT_ADDRESS, xmlNamespace := PX_XML_NAMESPACE, protocolBinding := PX_PROTOCOL_BINDING, serialization := PX_SERIALIZATION, @@ -57,7 +57,7 @@ module OneM2M_Templates { */ template (value) MsgOut m_response(in template (value) ResponsePrimitive p_responsePrimitive, in template (omit) AttributeList_1 p_nullFields := omit ) := { primitive := { responsePrimitive := p_responsePrimitive}, - host := PX_HOST_ADDRESS, + host := PX_SUT_ADDRESS, xmlNamespace := PX_XML_NAMESPACE, protocolBinding := PX_PROTOCOL_BINDING, serialization := PX_SERIALIZATION, @@ -512,7 +512,7 @@ module OneM2M_Templates { requestIdentifier := "m_createPollingChannel" & f_rnd(1, 1000000), resourceType := int15, primitiveContent := { - any_1 := {{PollingChannel_optional := m_contentCreatePollingChannel (omit)}} + any_1 := {{PollingChannel_optional := m_contentCreatePollingChannel (-)}} } }; @@ -550,8 +550,8 @@ module OneM2M_Templates { //Added by @Naum template (value) RequestPrimitive m_createServiceSubscribedAppRule (in ListOfM2MID p_applicableCredIDs, in ListOfM2MID p_allowedApp_IDs, in ListOfM2MID p_allowedAEs) modifies m_create := { from_ := PX_AE_ID_STEM, - requestIdentifier := "m_createCSE" & f_rnd(1, 1000000), - resourceType := int1,//FIXME Is this the correct value? + requestIdentifier := "m_createServiceSubscribedAppRule" & f_rnd(1, 1000000), + resourceType := int19,//FIXME Is this the correct value? primitiveContent := { any_1 := {{ServiceSubscribedAppRule_optional := m_contentCreateServiceSubscribedAppRule (p_applicableCredIDs, p_allowedApp_IDs, p_allowedAEs)}} } @@ -742,7 +742,7 @@ module OneM2M_Templates { } }; - template RequestPrimitive mw_notify_2(in template(value) Notification p_notification) modifies mw_notifyBase := { + template RequestPrimitive mw_notify_2(in template Notification p_notification) modifies mw_notifyBase := { primitiveContent := { any_1 := {{ Notification := p_notification}} } diff --git a/OneM2M_Testcases.ttcn b/OneM2M_Testcases.ttcn index dbdb749ef739799d33f1dee3887530867353a44c..3040e34661f135c84e4a2595af1d35b169f34d0f 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 135 2016-10-12 08:02:32Z reinaortega $ + * $Id: OneM2M_Testcases.ttcn 144 2016-10-24 10:28:51Z reinaortega $ * @desc Module containing test cases for oneM2M * */ @@ -1193,7 +1193,9 @@ module OneM2M_Testcases { // Test adapter configuration // Preamble - v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi); + v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi); + + // Test Body @@ -1357,14 +1359,14 @@ module OneM2M_Testcases { alt { [] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response { tc_ac.stop; - setverdict(pass, testcasename() & ": Container created successfuly"); + setverdict(pass, testcasename() & ": Resource type " & int2str(enum2int(p_resourceType)) & " created successfuly"); } [] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value v_response { tc_ac.stop; - setverdict(fail, testcasename() & ": Error while creating container"); + setverdict(fail, testcasename() & ": Error while creating resource type " & int2str(enum2int(p_resourceType))); } [] tc_ac.timeout { - setverdict(inconc, testcasename() & ": No answer while creating container"); + setverdict(inconc, testcasename() & ": No answer while creating resource type " & int2str(enum2int(p_resourceType))); } } @@ -3069,17 +3071,17 @@ module OneM2M_Testcases { var XSD.String v_groupName_2 := "VALUE_2"; var Labels v_labels_1 := {"VALUE_1"}; var Labels v_labels_2 := {"To be deleted"}; - var AcpType v_acp := {"ACP_ID"}; + var XSD.NonNegativeInteger v_maxNrOfMembers := 3; // 1 is the default value (set in the template m_createGroupBase) var AttributeList_1 v_nullFields; var template RequestPrimitive v_createRequest := m_createGroupBase; var template RequestPrimitive v_updateRequest := m_updateGroupBase; var ResponsePrimitive v_responsePrimitive; - + v_createRequest.primitiveContent.any_1[0].Group_optional.groupName:= v_groupName_1;//Attribute 1 v_createRequest.primitiveContent.any_1[0].Group_optional.labels := v_labels_1;//Attribute 3 v_updateRequest.primitiveContent.any_1[0].Group_optional.groupName:= v_groupName_2;//Attribute 1 - v_updateRequest.primitiveContent.any_1[0].Group_optional.accessControlPolicyIDs := v_acp;//Attribute 2 //TODO Check another attribute + v_updateRequest.primitiveContent.any_1[0].Group_optional.maxNrOfMembers := v_maxNrOfMembers;//Attribute 2 v_updateRequest.primitiveContent.any_1[0].Group_optional.labels := v_labels_2;//Attribute 3 v_nullFields := {"labels"}; @@ -3091,11 +3093,11 @@ module OneM2M_Testcases { if(ischosen(v_responsePrimitive.primitiveContent.any_1[0].Group_optional)) { //Check attribute 1 if(not match(v_responsePrimitive.primitiveContent.any_1[0].Group_optional.groupName, valueof(v_updateRequest.primitiveContent.any_1[0].Group_optional.groupName))){ - setverdict(fail, testcasename() & ": Error: Expiration Time attribute not updated correctly") + setverdict(fail, testcasename() & ": Error: groupName attribute not updated correctly") } //Check attribute 2 - if(not match(v_responsePrimitive.primitiveContent.any_1[0].Group_optional.accessControlPolicyIDs, valueof(v_updateRequest.primitiveContent.any_1[0].Group_optional.accessControlPolicyIDs))){ - setverdict(fail, testcasename() & ": Error: MaxNrOfInstances attribute not updated correctly") + if(not match(v_responsePrimitive.primitiveContent.any_1[0].Group_optional.maxNrOfMembers, valueof(v_updateRequest.primitiveContent.any_1[0].Group_optional.maxNrOfMembers))){ + setverdict(fail, testcasename() & ": Error: maxNrOfMembers attribute not updated correctly") } //Check attribute 3 if(ispresent(v_responsePrimitive.primitiveContent.any_1[0].Group_optional.labels)){ @@ -3420,7 +3422,7 @@ module OneM2M_Testcases { // Preamble v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi); - + // Test Body v_request := f_getUpdateRequestPrimitive(p_resourceType, v_aeIndex, p_updateRequestPrimitive); @@ -3429,7 +3431,7 @@ module OneM2M_Testcases { mcaPort.send(m_request(v_request)); tc_ac.start; alt { - [] mcaPort.receive(mw_response(mw_responsePrimitive(int4005))) -> value v_response { + [] mcaPort.receive(mw_response(mw_responsePrimitive(int4004))) -> value v_response { tc_ac.stop; setverdict(pass, testcasename() & ": Resource " & c_defaultResourceName & " of type " & int2str(enum2int(p_resourceType)) & " not found"); } @@ -3969,9 +3971,24 @@ module OneM2M_Testcases { // Local variables var MsgIn v_response; var RequestPrimitive v_request; - var integer v_aeIndex := -1; + var RequestPrimitive v_updateRequest := valueof(m_updateAcpBase); + var AccessControlRule v_accessControlRule_1 := { + accessControlOriginators := {PX_SUPER_USER}, + accessControlOperations := int63, + accessControlContexts_list := omit, + accessControlAuthenticationFlag := omit + }; + var AccessControlRule v_accessControlRule_2 := { + accessControlOriginators := {"wait"}, + accessControlOperations := int55, + accessControlContexts_list := omit, + accessControlAuthenticationFlag := omit + }; + + var integer v_aeIndex := -1; var integer v_resourceIndex := -1; + v_updateRequest.primitiveContent.any_1[0].AccessControlPolicy_optional.privileges.accessControlRule_list := {v_accessControlRule_1,v_accessControlRule_2}; // Test control // Test component configuration @@ -3980,7 +3997,26 @@ module OneM2M_Testcases { // Test adapter configuration // Preamble - v_aeIndex := f_cse_preamble_registerAe(int55);//c_CRUNDi); + v_aeIndex := f_cse_preamble_registerAe();//c_CRUNDi); + + v_updateRequest.primitiveContent.any_1[0].AccessControlPolicy_optional.privileges.accessControlRule_list[1].accessControlOriginators := {f_getResourceAddress(v_aeIndex)}; + v_updateRequest := f_getUpdateRequestPrimitive(int1, vc_acpAuxIndex, v_updateRequest); + + mcaPort.send(m_request(v_updateRequest)); + tc_ac.start; + alt { + [] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response { + tc_ac.stop; + setverdict(pass, testcasename() & ": Attribute of resource type " & int2str(enum2int(p_resourceType)) & " updated successfuly"); + } + [] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value v_response { + tc_ac.stop; + setverdict(fail, testcasename() & ": Error while updating resource type " & int2str(enum2int(p_resourceType))); + } + [] tc_ac.timeout { + setverdict(inconc, testcasename() & ": No answer while updating resource type " & int2str(enum2int(p_resourceType))); + } + } v_resourceIndex := f_cse_createResource(p_resourceType, p_createRequestPrimitive, v_aeIndex); @@ -4075,7 +4111,7 @@ module OneM2M_Testcases { testcase TC_CSE_DMR_DEL_BV_004_01() runs on CseTester system CseSystem { // Local variables - f_CSE_DMR_DEL_BV_004(int3, m_createContainerBase, int23, m_createSubscriptionBase);//Container + f_CSE_DMR_DEL_BV_004(int3, m_createContainerBase, int3, m_createContainerBase);//Container }; testcase TC_CSE_DMR_DEL_BV_004_02() runs on CseTester system CseSystem { @@ -6914,7 +6950,7 @@ module OneM2M_Testcases { [] tc_ac.timeout { setverdict(inconc, testcasename() & ": No answer while creating resource"); } - } + } //Postamble f_cse_postamble_deleteResources(); @@ -7065,7 +7101,7 @@ module OneM2M_Testcases { mcaPort.send(m_request(v_request)); alt { - [] mcaPort.receive(mw_request(mw_notify_2(valueof(v_notificationRequest)))) -> value v_response { + [] mcaPort.receive(mw_request(mw_notify_2(v_notificationRequest))) -> value v_response { tc_ac.stop; setverdict(pass, testcasename() & ": Notification received"); } @@ -7148,7 +7184,7 @@ module OneM2M_Testcases { mcaPort.send(m_request(v_request)); alt { - [] mcaPort.receive(mw_request(mw_notify_2(valueof(v_notificationRequest)))) -> value v_response { + [] mcaPort.receive(mw_request(mw_notify_2(v_notificationRequest))) -> value v_response { tc_ac.stop; setverdict(pass, testcasename() & ": Notification received"); } @@ -7589,7 +7625,7 @@ module OneM2M_Testcases { mcaPort.send(m_request(v_request)); alt { - [] mcaPort.receive(mw_request(mw_notify_2(valueof(v_notification)))) -> value v_response { + [] mcaPort.receive(mw_request(mw_notify_2(v_notification))) -> value v_response { tc_ac.stop; setverdict(pass, testcasename() & ": Notification received"); } @@ -8194,7 +8230,7 @@ module OneM2M_Testcases { v_boolResponse := true; if(not v_boolNotification){repeat;} } - [(not v_boolNotification)] mcaPort.receive(mw_request(mw_notify_2(valueof(v_notification)))) -> value v_response { + [(not v_boolNotification)] mcaPort.receive(mw_request(mw_notify_2(v_notification))) -> value v_response { tc_ac.stop; setverdict(pass, testcasename() & ": Notification received"); v_boolNotification := true;