diff --git a/LibOneM2M/OneM2M_Functions.ttcn b/LibOneM2M/OneM2M_Functions.ttcn index f0281ff18e09b3e23bd1b48b5ecc1a9453ae9205..8719805f381e922aa3fcf38070335af13e2a05d9 100644 --- a/LibOneM2M/OneM2M_Functions.ttcn +++ b/LibOneM2M/OneM2M_Functions.ttcn @@ -178,15 +178,23 @@ module OneM2M_Functions { function f_cf03Up() runs on CseSimu { // Variables + var PrimitiveContent v_cSEBaseResource; vc_config := e_cf03; vc_testSystemRole := e_cse; // Map map(self:mcaPortIn, system:mcaPortIn);//TODO To be consistent, we should use mcaPortIn for AE testing map(self:acPort, system:acPort); - map(self:utPort, system:utPort); + if(PX_UT_IMPLEMENTED) { + map(self:utPort, system:utPort); + } activate(a_default()); activate(a_ae_cf03()); + + //Creation of CSEBase + + v_cSEBaseResource := f_cse_generateLocalResource(-, -1, int5); + vc_cSEBaseIndex := f_setLocalResource(v_cSEBaseResource, int5, -1); // Connect @@ -274,7 +282,9 @@ module OneM2M_Functions { function f_cf03Down() runs on CseSimu { unmap(self:mcaPortIn, system:mcaPortIn); - unmap(self:utPort, system:utPort); + if(PX_UT_IMPLEMENTED){ + unmap(self:utPort, system:utPort); + } unmap(self:acPort, system:acPort); } @@ -667,7 +677,7 @@ module OneM2M_Functions { function f_cse_preamble_subscriptionVerification(inout integer p_ae2Index, inout template RequestPrimitive p_createRequestPrimitive,in ResourceType p_resourceType, in ResponseStatusCode p_responseStatusCode := int2000) runs on AeSimu { if(p_resourceType == int23){ - vc_ae2.start(f_cse_createResource(int2, m_createAe(PX_APP_ID, -, PX_AE2_ID_STEM, "MyAe2", {f_getAnnouncementTargetPoA("HTTP", PX_AE2_ADDRESS, "")}), -1)); // AE2 is registred + vc_ae2.start(f_cse_createResource(int2, m_createAe(PX_APP_ID, -, PX_AE2_ID_STEM, c_defaultAE2Name, {f_getAnnouncementTargetPoA("HTTP", PX_AE2_ADDRESS, "")}), -1)); // AE2 is registred f_checkComponentDoneAndGetVerdict(vc_ae2); @@ -1918,18 +1928,19 @@ module OneM2M_Functions { tc_ac.start; alt { - [] mcaPort.receive(mw_request(mw_createAe)) -> value v_request { + [] mcaPortIn.receive(mw_request(mw_createAe)) -> value v_request { tc_ac.stop; v_rp := v_request.primitive.requestPrimitive; v_parentIndex := f_getResourceIndex(v_rp.to_); - v_resourceIndex := f_ae_createResource(v_rp.primitiveContent, v_parentIndex, v_rp.resourceType, v_modifiedResource); + v_modifiedResource := f_ae_generateLocalResource(v_rp.primitiveContent, v_parentIndex, v_rp.resourceType); + v_resourceIndex := f_setLocalResource(v_modifiedResource, int2, v_parentIndex); if(v_resourceIndex != -1) { - mcaPort.send(m_response(m_responsePrimitive_content(int2001, v_rp.requestIdentifier, v_modifiedResource))); + mcaPortIn.send(m_response(m_responsePrimitive_content(int2001, v_rp.requestIdentifier, v_modifiedResource))); setverdict(pass, __SCOPE__&":INFO: Application registered successfuly"); } else { - mcaPort.send(m_response(m_responsePrimitive(int5000, v_request.primitive.requestPrimitive.requestIdentifier))); + mcaPortIn.send(m_response(m_responsePrimitive(int5000, v_request.primitive.requestPrimitive.requestIdentifier))); setverdict(inconc, __SCOPE__&":INFO: AE registration failed"); } } @@ -1973,7 +1984,8 @@ module OneM2M_Functions { v_rp := v_request.primitive.requestPrimitive; v_parentIndex := f_getResourceIndex(v_rp.to_); - v_resourceIndex := f_ae_createResource(v_rp.primitiveContent, v_parentIndex, v_rp.resourceType, v_modifiedResource); + v_modifiedResource := f_ae_generateLocalResource(v_rp.primitiveContent, v_parentIndex, v_rp.resourceType); + v_resourceIndex := f_setLocalResource(v_modifiedResource, int2, v_parentIndex); if(v_resourceIndex != -1) { mcaPort.send(m_response(m_responsePrimitive_content(int2001, v_rp.requestIdentifier, v_modifiedResource))); setverdict(pass, __SCOPE__&":INFO: Container created successfuly"); @@ -2007,36 +2019,46 @@ module OneM2M_Functions { * @param p_modifiedResource Assigned and/or modified fields * @return Internal resource index of the saved resource or -1 */ - function f_ae_createResource(in PrimitiveContent p_resource, in integer p_parentIndex, in ResourceType p_resourceType, out PrimitiveContent p_modifiedResource) runs on CseSimu return integer { + function f_ae_generateLocalResource(in PrimitiveContent p_resource, in integer p_parentIndex, in ResourceType p_resourceType) runs on CseSimu return PrimitiveContent { var integer v_resourceIndex; + var PrimitiveContent v_primitiveContent; // AE TODO To review the code (use of indexes, generation of value for certain attributes, etc..) if(p_resourceType == int2 and ispresent(p_resource)) { if(ischosen(p_resource.aE)){ - var AE_optional v_ae := p_resource.aE; - var AE_optional v_aeModified; - - v_resourceIndex := lengthof(vc_resourcesList) - 1; - v_ae.resourceType := p_resourceType; + var AE_optional v_content := p_resource.aE; + + v_resourceIndex := lengthof(vc_localResourcesList) - 1; + v_content.resourceType := p_resourceType; - v_ae.parentID := int2str(p_parentIndex); - v_ae.creationTime := fx_generateTimestamp(); - v_ae.lastModifiedTime := v_ae.creationTime; - v_ae.resourceID := "ae" & int2char(v_resourceIndex); - v_ae.aE_ID := "ae" & int2char(v_resourceIndex); - v_ae.resourceName := "ae" & int2char(v_resourceIndex); - - v_aeModified.parentID := v_ae.parentID; - v_aeModified.creationTime := v_ae.creationTime; - v_aeModified.lastModifiedTime := v_ae.lastModifiedTime; - v_aeModified.resourceID := v_ae.resourceID; - v_aeModified.aE_ID := v_ae.aE_ID; - v_aeModified.resourceName := v_ae.resourceName; + v_content.parentID := PX_CSE1_ID; + v_content.creationTime := fx_generateTimestamp(); + v_content.lastModifiedTime := v_content.creationTime; + v_content.resourceID := "ae" & int2str(v_resourceIndex); + v_content.aE_ID := "Cae" & int2str(v_resourceIndex); + v_content.resourceName := "ae" & int2str(v_resourceIndex); + v_primitiveContent := {aE := v_content}; + return v_primitiveContent; + + } + + } + + if(p_resourceType == int3 and ispresent(p_resource)) { + if(ischosen(p_resource.container)){ + var Container_optional v_content := p_resource.container; + + v_resourceIndex := lengthof(vc_localResourcesList) - 1; + v_content.resourceType := p_resourceType; - p_resource.aE := v_ae; - p_modifiedResource.aE := v_aeModified; - return f_setResource(p_resource, p_resourceType, p_parentIndex, false); + v_content.parentID := PX_CSE1_ID; + v_content.creationTime := fx_generateTimestamp(); + v_content.lastModifiedTime := v_content.creationTime; + v_content.resourceID := "cnt" & int2str(v_resourceIndex); + v_content.resourceName := "cnt" & int2str(v_resourceIndex); + v_primitiveContent := {container := v_content}; + return v_primitiveContent; } @@ -2045,7 +2067,7 @@ module OneM2M_Functions { // TODO: implement other resource types // Error - return -1; + return p_resource; } } // end helpingFunctions @@ -2086,7 +2108,8 @@ module OneM2M_Functions { [] mcaPort.receive(mw_request(mw_create)) -> value v_request { v_rp := v_request.primitive.requestPrimitive; v_parentIndex := f_getResourceIndex(v_rp.to_); - v_resourceIndex := f_ae_createResource(v_rp.primitiveContent, v_parentIndex, v_rp.resourceType, v_modifiedResource); + v_modifiedResource := f_ae_generateLocalResource(v_rp.primitiveContent, v_parentIndex, v_rp.resourceType); + v_resourceIndex := f_setLocalResource(v_modifiedResource, v_rp.resourceType, v_parentIndex); if(v_resourceIndex != -1) { mcaPort.send(m_response(m_responsePrimitive_content(int2001, v_rp.requestIdentifier, v_modifiedResource))); } @@ -2317,6 +2340,21 @@ module OneM2M_Functions { if(ischosen(p_contentResource.remoteCSE)) { return f_resourceIdCleaner(p_contentResource.remoteCSE.resourceID); } + if(ischosen(p_contentResource.cSEBase)) { + return f_resourceIdCleaner(p_contentResource.cSEBase.resourceID); + } + if(ischosen(p_contentResource.m2mServiceSubscriptionProfile)) { + return p_contentResource.m2mServiceSubscriptionProfile.resourceName; + } + if(ischosen(p_contentResource.node)) { + return p_contentResource.node.resourceName; + } + if(ischosen(p_contentResource.statsConfig)) { + return p_contentResource.statsConfig.resourceName; + } + if(ischosen(p_contentResource.statsCollect)) { + return p_contentResource.statsCollect.resourceName; + } log(__SCOPE__&":WARNING: Primitive Content Kind not implemented"); @@ -2362,6 +2400,22 @@ module OneM2M_Functions { if(ischosen(p_contentResource.remoteCSE)) { return p_contentResource.remoteCSE.resourceName; } + if(ischosen(p_contentResource.cSEBase)) { + return p_contentResource.cSEBase.resourceName; + } + if(ischosen(p_contentResource.m2mServiceSubscriptionProfile)) { + return p_contentResource.m2mServiceSubscriptionProfile.resourceName; + } + if(ischosen(p_contentResource.node)) { + return p_contentResource.node.resourceName; + } + if(ischosen(p_contentResource.statsConfig)) { + return p_contentResource.statsConfig.resourceName; + } + if(ischosen(p_contentResource.statsCollect)) { + return p_contentResource.statsCollect.resourceName; + } + log(__SCOPE__&":WARNING: Primitive Content Kind not implemented"); return "resourceNameNotFound"; @@ -2464,8 +2518,8 @@ module OneM2M_Functions { * @param p_address Resource URI (can be structured/unstructured cseRelative/spRelative/absolute) * @return Internal resource index of the given resource or -1 in case of error */ - function f_getResourceIndex(in XSD.AnyURI p_address) return integer { - return -1; //TODO + function f_getResourceIndex(in XSD.AnyURI p_address) runs on CseSimu return integer { + return vc_cSEBaseIndex; //TODO } /** @@ -2553,7 +2607,7 @@ module OneM2M_Functions { if(p_targetResourceIndex == -1) { return PX_CSE1_NAME; } else { - v_resourceAddress := f_getResourceAddress(vc_localResourcesList[p_targetResourceIndex].parentIndex, p_addressingMethod, p_primitiveScope) & "/" & f_getResourceName(vc_localResourcesList[p_targetResourceIndex].resource); + v_resourceAddress := f_getLocalResourceAddress(vc_localResourcesList[p_targetResourceIndex].parentIndex, p_addressingMethod, p_primitiveScope) & "/" & f_getResourceName(vc_localResourcesList[p_targetResourceIndex].resource); return v_resourceAddress; } } @@ -2570,7 +2624,7 @@ module OneM2M_Functions { if(p_targetResourceIndex == -1) { return PX_CSE1_ID & "/" & PX_CSE1_NAME; } else { - v_resourceAddress := f_getResourceAddress(vc_localResourcesList[p_targetResourceIndex].parentIndex, p_addressingMethod, p_primitiveScope) & "/" & f_getResourceName(vc_localResourcesList[p_targetResourceIndex].resource); + v_resourceAddress := f_getLocalResourceAddress(vc_localResourcesList[p_targetResourceIndex].parentIndex, p_addressingMethod, p_primitiveScope) & "/" & f_getResourceName(vc_localResourcesList[p_targetResourceIndex].resource); return v_resourceAddress; } } @@ -2579,14 +2633,14 @@ module OneM2M_Functions { if(p_targetResourceIndex == -1) { return PX_SP1_ID & PX_CSE1_ID; } else { - v_resourceAddress := f_getResourceAddress(-, p_addressingMethod, p_primitiveScope) & "/" & f_getResourceId(vc_localResourcesList[p_targetResourceIndex].resource); + v_resourceAddress := f_getLocalResourceAddress(-, p_addressingMethod, p_primitiveScope) & "/" & f_getResourceId(vc_localResourcesList[p_targetResourceIndex].resource); return v_resourceAddress; } } else { if(p_targetResourceIndex == -1) { return PX_SP1_ID & PX_CSE1_ID & "/" & PX_CSE1_NAME; } else { - v_resourceAddress := f_getResourceAddress(vc_localResourcesList[p_targetResourceIndex].parentIndex, p_addressingMethod, p_primitiveScope) & "/" & f_getResourceName(vc_localResourcesList[p_targetResourceIndex].resource); + v_resourceAddress := f_getLocalResourceAddress(vc_localResourcesList[p_targetResourceIndex].parentIndex, p_addressingMethod, p_primitiveScope) & "/" & f_getResourceName(vc_localResourcesList[p_targetResourceIndex].resource); return v_resourceAddress; } } diff --git a/LibOneM2M/OneM2M_Pixits.ttcn b/LibOneM2M/OneM2M_Pixits.ttcn index b083e1e781b9ad0aa9098cec53c0724e564fc3bd..7f07ab974e04507c3e03f73641f307dc5b5d1559 100644 --- a/LibOneM2M/OneM2M_Pixits.ttcn +++ b/LibOneM2M/OneM2M_Pixits.ttcn @@ -77,7 +77,7 @@ module OneM2M_Pixits { modulepar charstring PX_XML_NAMESPACE := "m2m=""http://www.onem2m.org/xml/protocols"""; - modulepar ListOfURIs PX_ACOR := {"*"}; + modulepar ListOfURIs PX_ACOR := {"all"}; } diff --git a/LibOneM2M/OneM2M_TestSystem.ttcn b/LibOneM2M/OneM2M_TestSystem.ttcn index 78448491b8d7237feb8517c251124e9dc03dc7bd..61be5d89b5832edfaac0d1812db204b5b18c17e6 100644 --- a/LibOneM2M/OneM2M_TestSystem.ttcn +++ b/LibOneM2M/OneM2M_TestSystem.ttcn @@ -80,6 +80,7 @@ module OneM2M_TestSystem { type component AeSystem { port OneM2MPort mcaPort; + port OneM2MPort mcaPortIn; port AdapterControlPort acPort; port UpperTesterPort utPort; } diff --git a/LibOneM2M/OneM2M_TypesAndValues.ttcn b/LibOneM2M/OneM2M_TypesAndValues.ttcn index 44fb2540f026b1249b6dbadbf111b0f993913b6a..8f8a33bbf8a4a4b4293526475898b65b817fb1e3 100644 --- a/LibOneM2M/OneM2M_TypesAndValues.ttcn +++ b/LibOneM2M/OneM2M_TypesAndValues.ttcn @@ -38,6 +38,7 @@ module OneM2M_TypesAndValues { const XSD.String c_defaultm2mServiceSubscriptionProfileResourceName := "Mym2mServiceSubscriptionProfileResource"; const XSD.String c_defaultServiceSubscribedAppRuleResourceName := "MyServiceSubscribedAppRuleResource"; const XSD.ID c_aeAuxName := "MyAe"; + const XSD.String c_defaultAE2Name := "MyAe2"; const XSD.String c_acpAuxName := "MyAcp"; const charstring c_invalid_location_update_period := "-PT30M10S" ;//duration set to invalid value (minus value) const XSD.ID c_resourceShortNameLatest := "la"; //<latest> diff --git a/OneM2M_Testcases_AE.ttcn b/OneM2M_Testcases_AE.ttcn index ea1216ec526dc64c4ef4625ff7e01fc06ea189e0..c2529e112f68148313f58dcd7813581838015ce0 100644 --- a/OneM2M_Testcases_AE.ttcn +++ b/OneM2M_Testcases_AE.ttcn @@ -73,6 +73,10 @@ module OneM2M_Testcases_AE { var ResponsePrimitive v_responsePrimitive; var template UtTriggerPrimitive v_utRequest := m_utCreateContainer; var UtTriggerAckPrimitive v_trigger_response; + var integer v_parentIndex := -1; + var integer v_resourceIndex := -1; + var MsgIn v_request; + var PrimitiveContent v_modifiedResource; var charstring v_action := __SCOPE__ & ": Please, send a valid CREATE Request for container containing To set to " & f_getResourceAddress(-1, e_nonHierarchical, p_primitiveScope); if(not(PICS_UNSTRUCTURED_CSE_RELATIVE_RESOURCE_ID_FORMAT)) { @@ -83,17 +87,19 @@ module OneM2M_Testcases_AE { f_cf03Up(); //Send Trigger Message - v_utRequest.to_ := f_getResourceAddress(-1, e_nonHierarchical, p_primitiveScope); + v_utRequest.to_ := f_getLocalResourceAddress(-1, e_nonHierarchical, p_primitiveScope); v_utRequest.from_ := "UNINITIALIZED"; f_sendUtPrimitive(v_utRequest, v_action); tc_ac.start; alt { - [] mcaPortIn.receive(mw_request(mw_createContainer(omit,v_utRequest.to_))) { + [] mcaPortIn.receive(mw_request(mw_createContainer(-,v_utRequest.to_))) -> value v_request { tc_ac.stop; setverdict(pass, __SCOPE__, " : Container creation request received successfuly"); - - v_responsePrimitive := valueof(m_responsePrimitive(int2001, "To_be_defined", omit)); + v_parentIndex := f_getResourceIndex(v_request.primitive.requestPrimitive.to_); + v_modifiedResource := f_ae_generateLocalResource(v_request.primitive.requestPrimitive.primitiveContent, v_parentIndex, v_request.primitive.requestPrimitive.resourceType); + v_resourceIndex := f_setLocalResource(v_modifiedResource, v_request.primitive.requestPrimitive.resourceType, v_parentIndex); + v_responsePrimitive := valueof(m_responsePrimitive(int2001, v_request.primitive.requestPrimitive.requestIdentifier, v_modifiedResource)); mcaPortIn.send(m_response(v_responsePrimitive)); } [] mcaPortIn.receive(mw_request(?)) { @@ -1306,112 +1312,146 @@ module OneM2M_Testcases_AE { testcase TC_AE_DMR_UPD_001_ET() runs on CseSimu system AeSystem { + var template RequestPrimitive v_expectedUpdateRequestAe; var charstring v_action := "Please, send a valid UPDATE Request for AE updating attribute expirationTime"; var template UtTriggerPrimitive v_utRequest := m_updateAeBase; v_utRequest.primitiveContent.aE.expirationTime := "20301231T012345"; - f_AE_DMR_UPD_001(v_utRequest, v_action); + v_expectedUpdateRequestAe.primitiveContent.aE := mw_contentAeUpdateRequest; + v_expectedUpdateRequestAe.primitiveContent.aE.expirationTime := ?; + + f_AE_DMR_UPD_001(v_utRequest, v_action, v_expectedUpdateRequestAe); } testcase TC_AE_DMR_UPD_001_LBL() runs on CseSimu system AeSystem { - + var template RequestPrimitive v_expectedUpdateRequestAe; var template UtTriggerPrimitive v_utRequest := m_updateAeBase; var charstring v_action := "Please, send a valid UPDATE Request for AE updating attribute labels"; v_utRequest.primitiveContent.aE.labels := {"UNINITIALIZED"}; - f_AE_DMR_UPD_001(v_utRequest,v_action); + v_expectedUpdateRequestAe.primitiveContent.aE := mw_contentAeUpdateRequest; + v_expectedUpdateRequestAe.primitiveContent.aE.labels := ?; + + + f_AE_DMR_UPD_001(v_utRequest,v_action, v_expectedUpdateRequestAe); } testcase TC_AE_DMR_UPD_001_APN() runs on CseSimu system AeSystem { + var template RequestPrimitive v_expectedUpdateRequestAe; var template UtTriggerPrimitive v_utRequest := m_updateAeBase; var charstring v_action := __SCOPE__ & ": Please, send a valid UPDATE Request for AE updating attribute appName"; v_utRequest.primitiveContent.aE.appName := "UNINITIALIZED"; + + v_expectedUpdateRequestAe.primitiveContent.aE := mw_contentAeUpdateRequest; + v_expectedUpdateRequestAe.primitiveContent.aE.appName := ?; - f_AE_DMR_UPD_001(v_utRequest,v_action); + f_AE_DMR_UPD_001(v_utRequest,v_action, v_expectedUpdateRequestAe); } testcase TC_AE_DMR_UPD_001_POA() runs on CseSimu system AeSystem { + var template RequestPrimitive v_expectedUpdateRequestAe; var template UtTriggerPrimitive v_utRequest := m_updateAeBase; var charstring v_action := __SCOPE__ & ": Please, send a valid UPDATE Request for AE updating attribute pointOfAccess"; v_utRequest.primitiveContent.aE.pointOfAccess := {"http://127.0.0.1:1400/monitor"}; + + v_expectedUpdateRequestAe.primitiveContent.aE := mw_contentAeUpdateRequest; + v_expectedUpdateRequestAe.primitiveContent.aE.pointOfAccess := ?; - f_AE_DMR_UPD_001(v_utRequest,v_action); + f_AE_DMR_UPD_001(v_utRequest,v_action, v_expectedUpdateRequestAe); } testcase TC_AE_DMR_UPD_001_OR() runs on CseSimu system AeSystem { + var template RequestPrimitive v_expectedUpdateRequestAe; var template UtTriggerPrimitive v_utRequest := m_updateAeBase; var charstring v_action := __SCOPE__ & ": Please, send a valid UPDATE Request for AE updating attribute ontologyRef"; v_utRequest.primitiveContent.aE.ontologyRef := "MyOntologyRef"; + + v_expectedUpdateRequestAe.primitiveContent.aE := mw_contentAeUpdateRequest; + v_expectedUpdateRequestAe.primitiveContent.aE.ontologyRef := ?; - f_AE_DMR_UPD_001(v_utRequest,v_action); + f_AE_DMR_UPD_001(v_utRequest,v_action, v_expectedUpdateRequestAe); } testcase TC_AE_DMR_UPD_001_NL() runs on CseSimu system AeSystem { + var template RequestPrimitive v_expectedUpdateRequestAe; var template UtTriggerPrimitive v_utRequest := m_updateAeBase; var charstring v_action := __SCOPE__ & ": Please, send a valid UPDATE Request for AE updating attribute nodeLink"; v_utRequest.primitiveContent.aE.nodeLink := "/CSE_ID/S-AE-ID-STEM"; + + v_expectedUpdateRequestAe.primitiveContent.aE := mw_contentAeUpdateRequest; + v_expectedUpdateRequestAe.primitiveContent.aE.nodeLink := ?; - f_AE_DMR_UPD_001(v_utRequest,v_action); + f_AE_DMR_UPD_001(v_utRequest,v_action, v_expectedUpdateRequestAe); } testcase TC_AE_DMR_UPD_001_RR() runs on CseSimu system AeSystem { + var template RequestPrimitive v_expectedUpdateRequestAe; var template UtTriggerPrimitive v_utRequest := m_updateAeBase; var charstring v_action := __SCOPE__ & ": Please, send a valid UPDATE Request for AE updating attribute requestReachability"; v_utRequest.primitiveContent.aE.requestReachability := true; + + v_expectedUpdateRequestAe.primitiveContent.aE := mw_contentAeUpdateRequest; + v_expectedUpdateRequestAe.primitiveContent.aE.requestReachability := ?; - f_AE_DMR_UPD_001(v_utRequest,v_action); + f_AE_DMR_UPD_001(v_utRequest,v_action, v_expectedUpdateRequestAe); } testcase TC_AE_DMR_UPD_001_CSZ() runs on CseSimu system AeSystem { + var template RequestPrimitive v_expectedUpdateRequestAe; var template UtTriggerPrimitive v_utRequestTestBody := m_updateAeBase; var charstring v_action := __SCOPE__ & ": Please, send a valid UPDATE Request for AE updating attribute contentSerialization"; v_utRequestTestBody.primitiveContent.aE.contentSerialization := {applicationxml}; + + v_expectedUpdateRequestAe.primitiveContent.aE := mw_contentAeUpdateRequest; + v_expectedUpdateRequestAe.primitiveContent.aE.contentSerialization := ?; - f_AE_DMR_UPD_001(v_utRequestTestBody,v_action); + f_AE_DMR_UPD_001(v_utRequestTestBody,v_action, v_expectedUpdateRequestAe); } - function f_AE_DMR_UPD_001(template UtTriggerPrimitive p_utRequestTestBody, in charstring p_action) runs on CseSimu { + function f_AE_DMR_UPD_001(template UtTriggerPrimitive p_utRequestTestBody, in charstring p_action, template RequestPrimitive p_expectedUpdateRequest) runs on CseSimu { //primitives for mcaPortIn var MsgIn v_request; var ResponsePrimitive v_responsePrimitive; var integer v_aeIndex := -1; - var template RequestPrimitive v_expectedUpdateRequestAe := mw_updateAe(); + var integer v_resourceIndex := -1; + var integer v_parentIndex := -1; + var PrimitiveContent v_modifiedResource; - f_cf03Up(); //Preamble v_aeIndex := f_ae_preamble_registerAe(); //Send Trigger Message - p_utRequestTestBody.to_ := f_getResourceAddress(v_aeIndex); + p_utRequestTestBody.to_ := f_getLocalResourceAddress(v_aeIndex); f_sendUtPrimitive(p_utRequestTestBody,p_action); //Test behavior - v_expectedUpdateRequestAe.primitiveContent.aE := mw_contentAeUpdateRequest; - v_expectedUpdateRequestAe.primitiveContent := f_getTemplateFromPrimitiveContent(p_utRequestTestBody.primitiveContent); - tc_ac.start; alt{ - [] mcaPortIn.receive(mw_request(v_expectedUpdateRequestAe)) -> value v_request { + [] mcaPortIn.receive(mw_request(p_expectedUpdateRequest)) -> value v_request { tc_ac.stop; setverdict(pass, __SCOPE__, " : AE registration update request is accepted!"); - v_responsePrimitive := valueof(m_responsePrimitive(int2001, "To_be_defined", omit)); - + v_parentIndex := f_getResourceIndex(v_request.primitive.requestPrimitive.to_); + v_modifiedResource := f_ae_generateLocalResource(v_request.primitive.requestPrimitive.primitiveContent, v_parentIndex, v_request.primitive.requestPrimitive.resourceType); + v_resourceIndex := f_setLocalResource(v_modifiedResource, v_request.primitive.requestPrimitive.resourceType, v_parentIndex); + if(v_resourceIndex != -1) { + mcaPort.send(m_response(m_responsePrimitive_content(int2004, v_request.primitive.requestPrimitive.requestIdentifier, v_modifiedResource))); + } //send back responsePrimitive mcaPortIn.send(m_response(v_responsePrimitive)); } @@ -1517,7 +1557,7 @@ module OneM2M_Testcases_AE { setverdict(pass, __SCOPE__, " : Container update request is accepted!!"); //set responseStatusCode back to SUT - v_responsePrimitive := valueof(m_responsePrimitive(int2001, "To_be_defined", omit)); + v_responsePrimitive := valueof(m_responsePrimitive(int2004, "To_be_defined", omit)); //send back responsePrimitive mcaPortIn.send(m_response(v_responsePrimitive)); diff --git a/OneM2M_Testcases_CSE.ttcn b/OneM2M_Testcases_CSE.ttcn index cf3b55b116aa83bb80c4e46cbcb93c856d9c1f60..064aa3501f4e7dad6b9ee70a6fbf0e63942ed355 100644 --- a/OneM2M_Testcases_CSE.ttcn +++ b/OneM2M_Testcases_CSE.ttcn @@ -4220,14 +4220,14 @@ module OneM2M_Testcases_CSE { var ResponsePrimitive v_responsePrimitive; var AeSimu v_ae1 := AeSimu.create("AE1") alive; - v_createRequest.primitiveContent.mgmtResource.resourceName := omit; + v_createRequest.primitiveContent.mgmtCmd.resourceName := omit; v_ae1.start(f_CSE_DMR_CRE_001(int12, v_createRequest, -));//Management Command v_ae1.done; if(getverdict == pass){ v_responsePrimitive := f_getResponsePrimitive(v_ae1); - if(not ispresent(v_responsePrimitive.primitiveContent.mgmtResource.resourceName)){ + if(not ispresent(v_responsePrimitive.primitiveContent.mgmtCmd.resourceName)){ setverdict(fail, __SCOPE__, ": Error, resourceName attribute not provided"); } } @@ -4376,7 +4376,7 @@ module OneM2M_Testcases_CSE { if(ispresent(p_parentRequestPrimitive)) { if(match(int23, p_parentRequestPrimitive.resourceType)){ - vc_ae2.start(f_cse_createResource(int2, m_createAe(PX_APP_ID, -, PX_AE2_ID_STEM, "MyAe2", v_poaList), -1)); // AE2 is registred + vc_ae2.start(f_cse_createResource(int2, m_createAe(PX_APP_ID, -, PX_AE2_ID_STEM, c_defaultAE2Name, v_poaList), -1)); // AE2 is registred vc_ae2.done; v_ae2Index := f_getResource(vc_ae2); p_parentRequestPrimitive.primitiveContent.subscription.notificationURI := {f_getResourceAddress(v_ae2Index)}; @@ -4411,7 +4411,7 @@ module OneM2M_Testcases_CSE { // Test Body if(match(int23, p_requestPrimitive.resourceType)){ - vc_ae2.start(f_cse_createResource(int2, m_createAe(PX_APP_ID, -, PX_AE2_ID_STEM, "MyAe2", v_poaList), -1)); // AE2 is registred + vc_ae2.start(f_cse_createResource(int2, m_createAe(PX_APP_ID, -, PX_AE2_ID_STEM, c_defaultAE2Name, v_poaList), -1)); // AE2 is registred vc_ae2.done; v_ae2Index := f_getResource(vc_ae2); p_requestPrimitive.primitiveContent.subscription.notificationURI := {f_getResourceAddress(v_ae2Index)}; @@ -5664,11 +5664,11 @@ module OneM2M_Testcases_CSE { // Local variables var AeSimu v_ae1 := AeSimu.create("AE1") alive; var template RequestPrimitive v_createRequest := m_createContainerBase; - const AttributeList c_optionalAttribute := {"creator"}; + var AttributeList v_optionalAttribute := {"creator"}; - v_createRequest.primitiveContent.container.creator := ""; + v_createRequest.primitiveContent.container.creator := "NullValue"; - v_ae1.start(f_CSE_DMR_CRE_012(int3, v_createRequest, c_optionalAttribute)); + v_ae1.start(f_CSE_DMR_CRE_012(int3, v_createRequest, v_optionalAttribute)); v_ae1.done; } @@ -5702,11 +5702,11 @@ module OneM2M_Testcases_CSE { // Local variables var AeSimu v_ae1 := AeSimu.create("AE1") alive; var template RequestPrimitive v_createRequest := m_createContentInstanceBase; - const AttributeList c_optionalAttribute := {"creator"}; + var AttributeList v_optionalAttribute := {"creator"}; - v_createRequest.primitiveContent.contentInstance.creator := "NotInitialized"; + v_createRequest.primitiveContent.contentInstance.creator := "NullValue"; - v_ae1.start(f_CSE_DMR_CRE_012(int4, v_createRequest, c_optionalAttribute)); + v_ae1.start(f_CSE_DMR_CRE_012(int4, v_createRequest, v_optionalAttribute)); v_ae1.done; } @@ -5959,11 +5959,11 @@ module OneM2M_Testcases_CSE { // Local variables var AeSimu v_ae1 := AeSimu.create("AE1") alive; var template RequestPrimitive v_createRequest := m_createSubscriptionBase; - const AttributeList c_optionalAttribute := {"creator"}; + var AttributeList v_optionalAttribute := {"creator"}; - v_createRequest.primitiveContent.subscription.creator := "MyCreator"; + v_createRequest.primitiveContent.subscription.creator := "NullValue"; - v_ae1.start(f_CSE_DMR_CRE_012(int23, v_createRequest, c_optionalAttribute)); + v_ae1.start(f_CSE_DMR_CRE_012(int23, v_createRequest, v_optionalAttribute)); v_ae1.done; } @@ -5992,9 +5992,10 @@ module OneM2M_Testcases_CSE { var integer v_ae2Index := -1; const XSD.NCName c_accessControlPolicyIDs := "accessControlPolicyIDs"; var integer v_resourceIndex := -1; + var XSD.NCName v_myOptionalAttribute := p_optionalAttribute[0]; // Test control - if(p_optionalAttribute[0] == c_accessControlPolicyIDs) { + if(v_myOptionalAttribute == c_accessControlPolicyIDs) { if(not(PICS_ACP_SUPPORT)) { setverdict(inconc, __SCOPE__ & ": AccessControlPolicy support is required to run this test case"); stop; @@ -6007,7 +6008,7 @@ module OneM2M_Testcases_CSE { // Test adapter configuration // Preamble - if (p_optionalAttribute[0] == c_accessControlPolicyIDs) { + if (v_myOptionalAttribute == c_accessControlPolicyIDs) { v_acpAuxIndex := f_cse_preamble_createAcpAux();//c_CRUDNDi) } @@ -6022,17 +6023,18 @@ module OneM2M_Testcases_CSE { } // Test Body -// if(p_optionalAttribute[0] == "creator") { -// p_requestPrimitive.primitiveContent.container.creator := vc_resourcesList[v_parentIndex].resource.aE.aE_ID; -// } v_request := f_getCreateRequestPrimitive(p_resourceType, p_requestPrimitive, v_parentIndex); - mcaPort.send(m_request(v_request)); + if(v_myOptionalAttribute == "creator") { + mcaPort.send(m_request(v_request, {{v_myOptionalAttribute, omit}})); + } else { + mcaPort.send(m_request(v_request)); + } tc_ac.start; alt { [] mcaPort.receive(mw_response(mw_responsePrimitive(int2001, f_getTemplateFromPrimitiveContent(v_request.primitiveContent)))) -> value v_response { tc_ac.stop; - setverdict(pass, __SCOPE__ & ": Accepted creation for resource type " & int2str(enum2int(p_resourceType)) & " containing attribute " & p_optionalAttribute[0]); + setverdict(pass, __SCOPE__ & ": Accepted creation for resource type " & int2str(enum2int(p_resourceType)) & " containing attribute " & v_myOptionalAttribute); f_checkAttributesToBeSaved(p_resourceType, v_request, v_response.primitive.responsePrimitive); v_resourceIndex := f_setResource(v_response.primitive.responsePrimitive.primitiveContent, p_resourceType, v_parentIndex); } @@ -14998,7 +15000,7 @@ module OneM2M_Testcases_CSE { testcase TC_CSE_DMR_UPD_016_ACP_ET() runs on Tester system CseSystem { var AeSimu v_ae1 := AeSimu.create("AE1") alive; - var Timestamp v_expirationTime := "20001231T012345"; + var Timestamp v_expirationTime := "21001231T012345"; var template RequestPrimitive v_updateRequest := m_updateAcpBase; var ResponsePrimitive v_responsePrimitive; var PrimitiveContent v_primitiveContentRetrieveResource; @@ -16012,6 +16014,7 @@ module OneM2M_Testcases_CSE { var integer v_contentInstanceIndex_1 := -1; var integer v_contentInstanceIndex_2 := -1; const ResourceType c_containerResourceType := int3; + timer t_contentInstanceCreationGap; // Test control @@ -16026,6 +16029,10 @@ module OneM2M_Testcases_CSE { v_containerIndex := f_cse_createResource(int3, m_createContainerBase, v_aeIndex); v_contentInstanceIndex_1 := f_cse_createResource(int4, m_createContentInstance_noResourceName, v_containerIndex); + + t_contentInstanceCreationGap.start(1.0); + t_contentInstanceCreationGap.timeout; + v_contentInstanceIndex_2 := f_cse_createResource(int4, m_createContentInstance_noResourceName, v_containerIndex); // Test Body @@ -16152,6 +16159,7 @@ module OneM2M_Testcases_CSE { var integer v_contentInstanceIndex_1 := -1; var integer v_contentInstanceIndex_2 := -1; const ResourceType c_containerResourceType := int3; + timer t_contentInstanceCreationGap; // Test control @@ -16166,6 +16174,10 @@ module OneM2M_Testcases_CSE { v_containerIndex := f_cse_createResource(int3, m_createContainerBase, v_aeIndex); v_contentInstanceIndex_1 := f_cse_createResource(int4, m_createContentInstance_noResourceName, v_containerIndex); + + t_contentInstanceCreationGap.start(1.0); + t_contentInstanceCreationGap.timeout; + v_contentInstanceIndex_2 := f_cse_createResource(int4, m_createContentInstance_noResourceName, v_containerIndex); // Test Body @@ -19167,7 +19179,7 @@ module OneM2M_Testcases_CSE { // Preamble v_aeIndex_1 := f_cse_preamble_registerAe(-, -); //c_CRUDNDi - v_aeIndex_2 := f_cse_createResource(int2, m_createAe(PX_APP_ID, -, PX_AE2_ID_STEM, "MyAe2", omit), -1); // AE2 is registred + v_aeIndex_2 := f_cse_createResource(int2, m_createAe(PX_APP_ID, -, PX_AE2_ID_STEM, c_defaultAE2Name, omit), -1); // AE2 is registred v_acpIndex := f_cse_createResource(int1, v_createAcp, -1); // AE child resource v_containerIndex_1 := f_cse_createResource(int3, m_createContainerBase, v_aeIndex_1); // AE1 child resource v_containerIndex_2 := f_cse_createResource(int3, m_createContainerBase, v_aeIndex_2); // AE2 child resource @@ -21700,7 +21712,7 @@ module OneM2M_Testcases_CSE { } //Postamble - v_accessControlRule_1 := valueof(m_createAcr({"*"}, int63)); + v_accessControlRule_1 := valueof(m_createAcr({"all"}, int63)); v_setOfArcs.accessControlRule_list := {v_accessControlRule_1}; v_updateRequest := valueof(m_updateAcpPrivileges(v_setOfArcs, v_setOfArcs)); v_updateRequest := f_getUpdateRequestPrimitive(int1, v_acpIndex, v_updateRequest);