diff --git a/LibOneM2M/OneM2M_Functions.ttcn b/LibOneM2M/OneM2M_Functions.ttcn index 7b766a38f394f7ad0eb1d553ef727fe837d83b67..61344610e15c3be17236676f0efac3620d9a4427 100644 --- a/LibOneM2M/OneM2M_Functions.ttcn +++ b/LibOneM2M/OneM2M_Functions.ttcn @@ -208,14 +208,13 @@ module OneM2M_Functions { tc_ac.stop; setverdict(pass,__SCOPE__&":INFO: Application registered successfuly"); if(ischosen(v_response.primitive.responsePrimitive.primitiveContent.aE)) { - vc_aeAux := v_response.primitive.responsePrimitive.primitiveContent.aE; f_checkAttributesToBeSaved(int2, v_request, v_response.primitive.responsePrimitive); - v_aeAuxIndex := f_setResource(v_response.primitive.responsePrimitive.primitiveContent, int2); + vc_aeAuxIndex := f_setResource(v_response.primitive.responsePrimitive.primitiveContent, int2); - if(ispresent(vc_aeAux.aE_ID)){ - f_sendAcPrimitive("AE-ID_changed", oct2char(unichar2oct(vc_aeAux.aE_ID))); + if(ispresent(v_response.primitive.responsePrimitive.primitiveContent.aE.aE_ID)){ + f_sendAcPrimitive("AE-ID_changed", oct2char(unichar2oct(v_response.primitive.responsePrimitive.primitiveContent.aE.aE_ID))); } else { f_sendAcPrimitive("AE-ID_changed", "0"); } @@ -238,7 +237,7 @@ module OneM2M_Functions { } f_checkCseTesterStatus(); - return v_aeAuxIndex; + return vc_aeAuxIndex; } @@ -278,12 +277,11 @@ module OneM2M_Functions { tc_ac.stop; setverdict(pass, __SCOPE__&": INFO: Application registered successfuly"); if(ischosen(v_response.primitive.responsePrimitive.primitiveContent.aE)) { - vc_aeAux := v_response.primitive.responsePrimitive.primitiveContent.aE; - v_aeAuxIndex := f_setResource(v_response.primitive.responsePrimitive.primitiveContent, int2); + vc_aeAuxIndex := f_setResource(v_response.primitive.responsePrimitive.primitiveContent, int2); - if(ispresent(vc_aeAux.aE_ID)){ - f_sendAcPrimitive("AE-ID_changed", oct2char(unichar2oct(vc_aeAux.aE_ID))); + if(ispresent(v_response.primitive.responsePrimitive.primitiveContent.aE.aE_ID)){ + f_sendAcPrimitive("AE-ID_changed", oct2char(unichar2oct(v_response.primitive.responsePrimitive.primitiveContent.aE.aE_ID))); } else { f_sendAcPrimitive("AE-ID_changed", "0"); } @@ -307,7 +305,7 @@ module OneM2M_Functions { } f_checkCseTesterStatus(); - return v_aeAuxIndex; + return vc_aeAuxIndex; } @@ -880,7 +878,7 @@ module OneM2M_Functions { tc_ac.start; alt { - [] mcaPort.receive(mw_request(mw_notify(valueof(v_notificationRequest)))) -> value v_request { + [] mcaPort.receive(mw_request(mw_notify(v_notificationRequest))) -> value v_request { tc_ac.stop; setverdict(pass, __SCOPE__ & ":INFO: Notification received"); v_responsePrimitive.requestIdentifier := v_request.primitive.requestPrimitive.requestIdentifier; @@ -1453,7 +1451,11 @@ module OneM2M_Functions { if (p_resourceType == int9) {//group if(match(valueof(p_request.primitiveContent.group_.memberIDs), v_defaultListOfURIs )){ - p_request.primitiveContent.group_.memberIDs := {f_getResourceId(vc_resourcesList[p_parentIndex].resource)}; + if (p_parentIndex == -1){ + p_request.primitiveContent.group_.memberIDs := {f_getResourceId(vc_resourcesList[vc_aeAuxIndex].resource)}; + }else{ + p_request.primitiveContent.group_.memberIDs := {f_getResourceId(vc_resourcesList[p_parentIndex].resource)}; + } } } @@ -1994,19 +1996,25 @@ module OneM2M_Functions { }//end group altstepFunctions + /** + * @desc Get the Resource Identifier with Unstructured-CSE-relative -Resource-ID format + */ function f_resourceIdCleaner(in XSD.ID p_resourceID) return XSD.ID { var integer v_length := lengthof(p_resourceID); var integer i; var XSD.ID result := ""; + //log("p_resourceID: " & p_resourceID); for (i := v_length - 1; i>=0; i := i-1){ if(p_resourceID[i]=="/"){ + //log("result: " & result); return result; } else{ result := p_resourceID[i] & result; } } + //log("result: " & result); return result; } diff --git a/LibOneM2M/OneM2M_Templates.ttcn b/LibOneM2M/OneM2M_Templates.ttcn index 780d6cbdfc15a885d204afa402ae34038296edf6..c65b712fdd1f82fd9b6093713ead7f6de1815eed 100644 --- a/LibOneM2M/OneM2M_Templates.ttcn +++ b/LibOneM2M/OneM2M_Templates.ttcn @@ -2773,11 +2773,11 @@ module OneM2M_Templates { } template Subscription_optional mw_contentSubscription_rc4 modifies mw_contentSubscriptionBase := { - choice := {schedule := ?} //O + choice := {choice_list := ?} //O } template Subscription_optional mw_contentSubscription_rc5 modifies mw_contentSubscriptionBase := { - choice := {childResource := ?} //O + choice := {childResource_list := ?} //O } template Subscription_optional mw_contentSubscription_rc6 modifies mw_contentSubscriptionBase := { @@ -2805,7 +2805,7 @@ module OneM2M_Templates { notificationEventCat := omit,//O creator := omit,//O subscriberURI := omit,//O - choice := {childResource := ?}//O + choice := {childResource_list := ?}//O } template Subscription_optional mw_contentSubscription_rc7 modifies mw_contentSubscriptionBase := { @@ -2813,7 +2813,7 @@ module OneM2M_Templates { } template Subscription_optional mw_contentSubscription_rc8 modifies m_contentSubscription_allOmit := { - choice := {childResource := ?} //O + choice := {childResource_list := ?} //O } template ContentInstance_optional mw_contentContentInstanceBase := { @@ -3013,7 +3013,8 @@ module OneM2M_Templates { template Notification mw_contentNotificationVerification modifies mw_contentNotificationBase := { verificationRequest := true, - creator := ? + //creator := ? //Temporal change, do not commit! + creator := * } diff --git a/LibOneM2M/OneM2M_TestSystem.ttcn b/LibOneM2M/OneM2M_TestSystem.ttcn index 6c2d7d5edc5935584dccf1673575314527030cb8..b9af2a79e822635cd8d088d14a9706680e71ebf1 100644 --- a/LibOneM2M/OneM2M_TestSystem.ttcn +++ b/LibOneM2M/OneM2M_TestSystem.ttcn @@ -40,7 +40,7 @@ module OneM2M_TestSystem { port OneM2MPort mccPort; //global variables - var AE_optional vc_aeAux;//TODO To be removed + var integer vc_aeAuxIndex;//TODO To be removed var RemoteCSE_optional vc_remoteCSEAux;//TODO To be removed var AccessControlPolicy_optional vc_acpAux; var integer vc_acpAuxIndex := -1; diff --git a/LibOneM2M/OneM2M_Types.ttcn b/LibOneM2M/OneM2M_Types.ttcn index f6d9208addab417d39aef9116c9c559b6ccc8785..c1d781c0ae9d5ff1ae901a3127d222a27d239c4d 100644 --- a/LibOneM2M/OneM2M_Types.ttcn +++ b/LibOneM2M/OneM2M_Types.ttcn @@ -3243,7 +3243,10 @@ module OneM2M_Types { type union Representation { Resource_2 resource, ResponsePrimitive responsePrimitive - }; + } + with { + variant "name as 'representation'"; + } type record Notification_1 { @@ -5215,9 +5218,11 @@ group optionalResourceTypes { XSD.ID creator optional, XSD.AnyURI subscriberURI optional, union { - ChildResourceRef childResource, - Schedule schedule - } choice optional + record length(1 .. infinity) of ChildResourceRef childResource_list, + record length(1 .. infinity) of union { + Schedule schedule + } choice_list + } choice optional //TODO Replace type of choice union elements as other choice union elements (record length(1..infinity) of) } with { variant "name as uncapitalized"; @@ -5226,6 +5231,10 @@ group optionalResourceTypes { //variant (latestNotify) "text 'true' as '1'"; //variant (latestNotify) "text 'false' as '0'"; variant (choice) "untagged"; + variant (choice.childResource_list) "untagged"; + variant (choice.childResource_list[-]) "name as 'childResource'"; + variant (choice.choice_list) "untagged"; + variant (choice.choice_list[-]) "untagged"; }; diff --git a/OneM2M_Testcases.ttcn b/OneM2M_Testcases.ttcn index e5afdbf0fbb5d6afea75e3da744045daa2a24770..fe4a10fe0a128da11e175bf083e60f11ab147ce0 100644 --- a/OneM2M_Testcases.ttcn +++ b/OneM2M_Testcases.ttcn @@ -2219,6 +2219,13 @@ module OneM2M_Testcases { p_notifyHandler.start(f_cse_notifyProcedure_subscriptionVerificationHandler(v_parentIndex)); } v_parentIndex := f_cse_createResource(valueof(p_parentRequestPrimitive.resourceType), p_parentRequestPrimitive, v_parentIndex); + + if(ischosen(p_parentRequestPrimitive.primitiveContent.group_)){ + + f_cse_preamble_registerAe(); + + } + } else {//Resource under CSEBase if(p_resourceType != int1) { @@ -2227,6 +2234,12 @@ module OneM2M_Testcases { p_requestPrimitive := f_setAcpId(p_requestPrimitive, {vc_resourcesList[v_acpAuxIndex].resource.accessControlPolicy.resourceID}); } + + if(ischosen(p_requestPrimitive.primitiveContent.group_)){ + + f_cse_preamble_registerAe(); + + } } @@ -16074,7 +16087,7 @@ module OneM2M_Testcases { } [] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response { tc_ac.stop; - setverdict(fail, __SCOPE__ & ": Subsciption successful whereas <Subscription> resource is not subscribable"); + setverdict(fail, __SCOPE__ & ": Subscription successful whereas <Subscription> resource is not subscribable"); } [] tc_ac.timeout { setverdict(fail, __SCOPE__ & ": No answer while creating resource"); @@ -16138,7 +16151,7 @@ module OneM2M_Testcases { } [] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response { tc_ac.stop; - setverdict(fail, __SCOPE__ & ": Subsciption successful whereas <Subscription> resource is not subscribable"); + setverdict(fail, __SCOPE__ & ": Subscription successful whereas <Subscription> resource is not subscribable"); } [] tc_ac.timeout { setverdict(fail, __SCOPE__ & ": No answer while creating resource"); @@ -16206,7 +16219,7 @@ module OneM2M_Testcases { } [] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response { tc_ac.stop; - setverdict(fail, __SCOPE__ & ": Subsciption successful whereas it doesn't have privilege"); + setverdict(fail, __SCOPE__ & ": Subscription successful whereas it doesn't have privilege"); } [] tc_ac.timeout { setverdict(fail, __SCOPE__ & ": No answer while creating resource"); @@ -16268,7 +16281,7 @@ module OneM2M_Testcases { } [] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response { tc_ac.stop; - setverdict(fail, __SCOPE__ & ": Subsciption successful whereas subsciption verification failed"); + setverdict(fail, __SCOPE__ & ": Subscription successful whereas Subscription verification failed"); } [] tc_ac.timeout { setverdict(fail, __SCOPE__ & ": No answer while creating resource"); @@ -16317,6 +16330,7 @@ module OneM2M_Testcases { // Test Body v_request := f_getCreateRequestPrimitive(int23, m_createSubscriptionBase, v_aeIndex); + v_request.primitiveContent.subscription.notificationURI := {f_getResourceAddress(v_ae2Index)}; mcaPort.send(m_request(valueof(v_request))); @@ -16446,7 +16460,7 @@ module OneM2M_Testcases { } [] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response { tc_ac.stop; - setverdict(fail, __SCOPE__ & ": Subsciption successful whereas subsciption creator has no privilege"); + setverdict(fail, __SCOPE__ & ": Subscription successful whereas Subscription creator has no privilege"); } [] tc_ac.timeout { setverdict(fail, __SCOPE__ & ": No answer while creating resource"); @@ -16512,7 +16526,7 @@ module OneM2M_Testcases { } [] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response { tc_ac.stop; - setverdict(fail, __SCOPE__ & ": Subsciption successful whereas subsciption creator has no privilege"); + setverdict(fail, __SCOPE__ & ": Subscription successful whereas Subscription creator has no privilege"); } [] tc_ac.timeout { setverdict(fail, __SCOPE__ & ": No answer while creating resource"); @@ -16542,7 +16556,7 @@ module OneM2M_Testcases { */ testcase TC_CSE_SUB_NTF_003() runs on CseTester system CseSystem { // Local variables - const integer numberOfAggregatedNotification := 3; + const integer numberOfAggregatedNotification := 2; var Labels v_labels_1:= {"VALUE_1"}; var Labels v_labels_2:= {"VALUE_2"}; var integer v_aeIndex := -1; @@ -16583,6 +16597,7 @@ module OneM2M_Testcases { v_request:= f_getUpdateRequestPrimitive(int2, v_aeIndex, v_updateRequest); // Update request 1 f_cse_updateResource(v_request); + v_updateRequest := m_updateAeBase; v_updateRequest.primitiveContent.aE.labels := v_labels_2; v_request:= f_getUpdateRequestPrimitive(int2, v_aeIndex, v_updateRequest); // Update request 2 f_cse_updateResource(v_request); @@ -16642,7 +16657,7 @@ module OneM2M_Testcases { v_notifyHandler.start(f_cse_notifyProcedure_representationHandler(v_contentResponse)); // check if the notification is well received and if its content matchs v_request:= f_getUpdateRequestPrimitive(int2, v_aeIndex, v_updateRequest); // Update request - v_updateRequest.primitiveContent.aE.labels := v_labels_1; + v_request.primitiveContent.aE.labels := v_labels_1; mcaPort.send(m_request(v_request)); tc_ac.start; @@ -17309,7 +17324,7 @@ module OneM2M_Testcases { v_createRequest := m_createSubscriptionAdvanced(f_getResourceAddress(v_aeIndex), -, {f_getResourceAddress(v_ae2Index)}, omit, omit, omit, omit,f_getResourceAddress(v_ae2Index)); // SubscriberURI ="ResourceID" - v_resourceIndex := f_cse_createResource(int23, v_createRequest, v_aeIndex); // Subsciption + v_resourceIndex := f_cse_createResource(int23, v_createRequest, v_aeIndex); // Subscription v_request := valueof(m_delete(f_getResourceAddress(v_resourceIndex), f_getOriginator(v_resourceIndex))); // Subscription resource deletion request @@ -17321,6 +17336,7 @@ module OneM2M_Testcases { v_notifyHandler.start(f_CSE_SUB_DEL_001(f_getResourceAddress(v_resourceIndex))); // check that no notification is received mcaPort.send(m_request(v_request)); + tc_ac.start; alt { [] mcaPort.receive(mw_response(mw_responsePrimitive(int2002))) -> value v_response { tc_ac.stop; @@ -17576,7 +17592,7 @@ module OneM2M_Testcases { [] mcaPort.receive(mw_response(mw_responsePrimitive(int2001))) -> value v_response { tc_ac.stop; setverdict(pass, __SCOPE__ & ": Resource type " & int2str(enum2int(c_accessControlPolicyType)) & " created successfully"); - v_acpIndex := f_setResource(v_response.primitive.responsePrimitive.primitiveContent, int1); + v_acpIndex := f_setResource(v_response.primitive.responsePrimitive.primitiveContent, int1, v_aeIndex); } [] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response { tc_ac.stop; @@ -17648,7 +17664,7 @@ module OneM2M_Testcases { [] mcaPort.receive(mw_response(mw_responsePrimitive(int2001))) -> value v_response { tc_ac.stop; setverdict(pass, __SCOPE__ & ": Resource type " & int2str(enum2int(c_accessControlPolicyType)) & " created successfully"); - v_acpIndex := f_setResource(v_response.primitive.responsePrimitive.primitiveContent, c_accessControlPolicyType); + v_acpIndex := f_setResource(v_response.primitive.responsePrimitive.primitiveContent, c_accessControlPolicyType, v_aeIndex); } [] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response { tc_ac.stop; @@ -17751,8 +17767,8 @@ module OneM2M_Testcases { v_primitiveContentRetrievedResource := f_cse_retrieveResource(v_aeIndex); if(getverdict == pass){ if(ischosen(v_primitiveContentRetrievedResource.aE)) { - if(not match (v_primitiveContentRetrievedResource.aE.accessControlPolicyIDs, valueof(v_updateRequest.primitiveContent.aE.accessControlPolicyIDs))){ - setverdict(fail, __SCOPE__ & ": Error: Access Control policy ID attribute not updated correctly") + if(not match (f_resourceIdCleaner(v_primitiveContentRetrievedResource.aE.accessControlPolicyIDs[0]), v_updateRequest.primitiveContent.aE.accessControlPolicyIDs[0])){ + setverdict(fail, __SCOPE__ & ": Error: Access Control policy ID attribute not updated correctly"); } } } @@ -18306,15 +18322,15 @@ module OneM2M_Testcases { var template RequestPrimitive v_updateRequest := m_updateContainerBase; var Labels v_labels_1:= {"VALUE_1"}; v_updateRequest.primitiveContent.container.labels := v_labels_1; - f_CSE_SEC_ACP_012(v_updateRequest, int62); //TODO Fix p_acor + f_CSE_SEC_ACP_012(v_updateRequest, int59); }//end TC_CSE_SEC_ACP_012_UPD testcase TC_CSE_SEC_ACP_012_RET() runs on CseTester system CseSystem { //Retrieve - f_CSE_SEC_ACP_012(m_retrieveResource("Temporary", "Temporary"), int62); //TODO Fix p_acor + f_CSE_SEC_ACP_012(m_retrieveResource("Temporary", "Temporary"), int61); }//end TC_CSE_SEC_ACP_012_RET testcase TC_CSE_SEC_ACP_012_DEL() runs on CseTester system CseSystem { //Delete - f_CSE_SEC_ACP_012(m_delete("Temporary", "Temporary"), int62); //TODO Fix p_acor + f_CSE_SEC_ACP_012(m_delete("Temporary", "Temporary"), int55); }//end TC_CSE_SEC_ACP_012_DEL function f_CSE_SEC_ACP_012(template RequestPrimitive p_requestPrimitive, in AccessControlOperations p_acor) runs on CseTester {