From 42c5f2b3cb6fa5676bf8c43839eae9d675f8f2d1 Mon Sep 17 00:00:00 2001 From: reinaortega <miguelangel.reinaortega@etsi.org> Date: Fri, 10 May 2019 10:47:51 +0200 Subject: [PATCH] Implementation of FlexContainer test cases TC_CSE_FLXC_CRE_002, TC_CSE_FLXC_UPD_001, TC_CSE_FLXC_UPD_002, TC_CSE_FLXC_UPD_003 Signed-off-by: reinaortega <miguelangel.reinaortega@etsi.org> --- LibOneM2M/OneM2M_Functions.ttcn | 7 +- LibOneM2M/OneM2M_Templates.ttcn | 83 +++++++- LibOneM2M/OneM2M_Types.ttcn | 4 +- OneM2M_Testcases_CSE_Release_2.ttcn | 316 +++++++++++++++------------- 4 files changed, 253 insertions(+), 157 deletions(-) diff --git a/LibOneM2M/OneM2M_Functions.ttcn b/LibOneM2M/OneM2M_Functions.ttcn index 90cfd19..6a23c61 100644 --- a/LibOneM2M/OneM2M_Functions.ttcn +++ b/LibOneM2M/OneM2M_Functions.ttcn @@ -4302,7 +4302,12 @@ module OneM2M_Functions { if(ischosen(p_contentResource.statsCollect)) { return p_contentResource.statsCollect.resourceName; } - + if(ischosen(p_contentResource.genericInterworkingService)) { + return p_contentResource.genericInterworkingService.resourceName; + } + if(ischosen(p_contentResource.genericInterworkingService_invalid)) { + return p_contentResource.genericInterworkingService_invalid.resourceName; + } log(__SCOPE__&":WARNING: Primitive Content Kind not implemented"); return "resourceNameNotFound"; diff --git a/LibOneM2M/OneM2M_Templates.ttcn b/LibOneM2M/OneM2M_Templates.ttcn index 27027c2..0e2046d 100644 --- a/LibOneM2M/OneM2M_Templates.ttcn +++ b/LibOneM2M/OneM2M_Templates.ttcn @@ -558,7 +558,23 @@ module OneM2M_Templates { requestIdentifier := "m_updateAcp", primitiveContent:= {accessControlPolicy := m_contentUpdateAcpPrivileges(p_privileges, p_selfPrivileges)} }; - + + /** + * @desc Base UPDATE request primitive for GenericInterworkingService resource + */ + template (value) RequestPrimitive m_updateGenericInterworkingServiceBase modifies m_update:= { + requestIdentifier := "m_updateGenericInterworkingService", + primitiveContent:= {genericInterworkingService := m_contentUpdateGenericInterworkingService} + }; + + /** + * @desc Base UPDATE request primitive for GenericInterworkingService_invalid resource + */ + template (value) RequestPrimitive m_updateGenericInterworkingServiceBase_invalid modifies m_update:= { + requestIdentifier := "m_updateGenericInterworkingServiceInvalid", + primitiveContent:= {genericInterworkingService_invalid := m_contentUpdateGenericInterworkingService_invalid} + }; + /** * @desc Base UPDATE request primitive for Group resource */ @@ -1936,8 +1952,9 @@ module OneM2M_Templates { announcedAttribute := omit,//O stateTag := omit,//NP creator := omit,//O - containerDefinition := "org.onem2m.genericInterworkingService",//M + containerDefinition := "urn:m2m:CDT-gis-v2_17_0.xsd",//M ontologyRef := omit,//O + contentSize := omit,//NP serviceName := "MyService",//M?? inputDataPointLinks := omit,//O outputDataPointLinks := omit,//O @@ -3264,7 +3281,62 @@ module OneM2M_Templates { privileges := p_privileges,//O selfPrivileges := p_selfPrivileges//O }; - + + /** + * @desc Base primitiveContent for UPDATE operation for GenericInterworkingService resource + */ + template (value) GenericInterworkingService_optional m_contentUpdateGenericInterworkingService := { + resourceName := omit,//NP + resourceType := omit,//NP + resourceID := omit,//NP + parentID := omit,//NP + creationTime := omit,//NP + lastModifiedTime := omit,//NP + labels := omit,//O + accessControlPolicyIDs := omit,//O + expirationTime := omit,//O + dynamicAuthorizationConsultationIDs := omit, //O + announceTo := omit,//O + announcedAttribute := omit,//O + stateTag := omit,//NP + creator := omit,//NP + containerDefinition := omit,//NP + ontologyRef := omit,//O + contentSize := omit,//NP + serviceName := omit,//NP + inputDataPointLinks := omit,//O + outputDataPointLinks := omit,//O + choice := omit//NP + }; + + /** + * @desc Base primitiveContent for UPDATE operation for GenericInterworkingService_invalid resource + */ + template (value) GenericInterworkingService_invalid m_contentUpdateGenericInterworkingService_invalid := { + resourceName := omit,//NP + resourceType := omit,//NP + resourceID := omit,//NP + parentID := omit,//NP + creationTime := omit,//NP + lastModifiedTime := omit,//NP + labels := omit,//O + accessControlPolicyIDs := omit,//O + expirationTime := omit,//O + dynamicAuthorizationConsultationIDs := omit, //O + announceTo := omit,//O + announcedAttribute := omit,//O + stateTag := omit,//NP + creator := omit,//NP + containerDefinition := omit,//NP + ontologyRef := omit,//O + contentSize := omit,//NP + serviceName := omit,//NP + expirationCounter:= omit,//Invalid attribute + inputDataPointLinks := omit,//O + outputDataPointLinks := omit,//O + choice := omit//NP + }; + /** * @desc Base primitiveContent for UPDATE operation for Group resource */ @@ -5026,7 +5098,6 @@ module OneM2M_Templates { parentID := omit,//NP creationTime := omit,//NP lastModifiedTime := omit,//NP - expirationCounter := 1,//Invalid attribute labels := omit,//O accessControlPolicyIDs := p_accessControlPolicyIds,//O expirationTime := omit,//O @@ -5035,9 +5106,11 @@ module OneM2M_Templates { announcedAttribute := omit,//O stateTag := omit,//NP creator := omit,//O - containerDefinition := "org.onem2m.genericInterworkingService",//M + containerDefinition := "urn:m2m:CDT-gis-v2_17_0.xsd",//M ontologyRef := omit,//O + contentSize := omit, //NP serviceName := "MyService",//M?? + expirationCounter := 1,//Invalid attribute inputDataPointLinks := omit,//O outputDataPointLinks := omit,//O choice := omit//NP diff --git a/LibOneM2M/OneM2M_Types.ttcn b/LibOneM2M/OneM2M_Types.ttcn index 1dc0b5d..275bd1a 100644 --- a/LibOneM2M/OneM2M_Types.ttcn +++ b/LibOneM2M/OneM2M_Types.ttcn @@ -7290,6 +7290,7 @@ group OptionalResourceTypes { XSD.ID creator optional, XSD.AnyURI containerDefinition optional, XSD.AnyURI ontologyRef optional, + XSD.NonNegativeInteger contentSize optional, XSD.String serviceName optional, ListOfDataLinks inputDataPointLinks optional, ListOfDataLinks outputDataPointLinks optional, @@ -8455,7 +8456,6 @@ group InvalidTypes { NhURI parentID optional, Timestamp creationTime optional, Timestamp lastModifiedTime optional, - XSD.PositiveInteger expirationCounter optional,//Invalid field, non existing for Container Labels labels optional, AcpType accessControlPolicyIDs optional, Timestamp expirationTime optional, @@ -8466,7 +8466,9 @@ group InvalidTypes { XSD.ID creator optional, XSD.AnyURI containerDefinition optional, XSD.AnyURI ontologyRef optional, + XSD.NonNegativeInteger contentSize optional, XSD.String serviceName optional, + XSD.PositiveInteger expirationCounter optional,//Invalid field, non existing for Container ListOfDataLinks inputDataPointLinks optional, ListOfDataLinks outputDataPointLinks optional, union { diff --git a/OneM2M_Testcases_CSE_Release_2.ttcn b/OneM2M_Testcases_CSE_Release_2.ttcn index a561c35..0eac251 100644 --- a/OneM2M_Testcases_CSE_Release_2.ttcn +++ b/OneM2M_Testcases_CSE_Release_2.ttcn @@ -5047,7 +5047,7 @@ module OneM2M_Testcases_CSE_Release_2 { v_aeIndex := f_cse_preamble_registerAe(-, -);//AE1 is registred; v_request := m_createGenericInterworkingServiceBase; - v_request.primitiveContent.genericInterworkingService.containerDefinition := "org.onem2m.nonExistingDefinition"; + v_request.primitiveContent.genericInterworkingService.containerDefinition := "urn:m2m:nonExistingSchemaDefinition.xsd"; v_request := f_getCreateRequestPrimitive(int28, v_request, v_aeIndex); f_send(e_mca_port, m_request(v_request)); @@ -5084,207 +5084,223 @@ module OneM2M_Testcases_CSE_Release_2 { f_cf01Down(); } // end TC_CSE_FLXC_CRE_002 + }//end of group Create + + group Update { + /** - * @desc Check that the IUT increments the field value of attribute stateTag in the parent <flexContainer> resource when a resource is created as the direct child of the parent <flexContainer> + * @desc Check that the IUT increments the field value of attribute stateTag in the <flexContainer> resource when a custom attribute of the resource is modified * */ - testcase TC_CSE_FLXC_CRE_003() runs on Tester system CseSystem { + testcase TC_CSE_FLXC_UPD_001() runs on Tester system CseSystem { var AeSimu v_ae1 := AeSimu.create("AE1") alive; - v_ae1.start(f_CSE_FLXC_CRE_003()); + v_ae1.start(f_CSE_FLXC_UPD_001()); v_ae1.done; } - function f_CSE_FLXC_CRE_003() runs on AeSimu { + function f_CSE_FLXC_UPD_001() runs on AeSimu { //Local variables - var integer v_aeIndex, v_acpAuxIndex := -1; + var integer v_aeIndex := -1; var integer v_resourceIndex := -1; - var RequestPrimitive v_req1; - var RequestPrimitive v_req2; - var RequestPrimitive v_req3; - var MsgIn v_resp1, v_resp3; - var ResponsePrimitive v_resp2;//Response to a Notify Request - + var RequestPrimitive v_request := m_create; + var RequestPrimitive v_updateRequest := valueof(m_updateGenericInterworkingServiceBase); + v_updateRequest.primitiveContent.genericInterworkingService.inputDataPointLinks := { + dataLinkEntry_list := { + { + name:="MyDataLink", + dataContainerID :="MyDataContainerId", + attributeName := omit + } + } + }; + // Test control - // Test component configuration - f_cf02Up(); + f_cf01Up(); // Test adapter configuration - + // Preamble - vc_cse1.start(f_cse_registerRemoteCse(m_createRemoteCSEBase)); - vc_cse1.done; - - v_acpAuxIndex := f_cse_preamble_createAcpAux(); + v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi); - v_aeIndex := f_cse_preamble_registerAe({f_getResourceId(vc_resourcesList[v_acpAuxIndex].resource)}, -);//AE1 is registred; + v_resourceIndex := f_cse_createResource(int28, m_createGenericInterworkingServiceBase, v_aeIndex); - v_resourceIndex := f_cse_createResource(int15, m_createPollingChannelBase, v_aeIndex); - - v_req1 := valueof(m_retrievePollingRequest(f_getResourceAddress(v_resourceIndex), f_getOriginator(v_resourceIndex))); - f_send(e_mca_port, m_request(v_req1)); - //v_req2 := valueof(m_notifyNotification(f_getResourceAddress(v_aeIndex), m_contentNotification_subscriptionVerification)); - v_req2 := valueof(m_notify(f_getResourceAddress(v_aeIndex))); - v_req2.requestExpirationTimestamp := {alt_1 := 15000}; + // Test Body + if(ispresent(vc_resourcesList[v_resourceIndex].resource.genericInterworkingService.stateTag)) { + + f_cse_updateResource(int28, v_resourceIndex, v_updateRequest); - vc_cse1.start(f_cse_notifyProcedure_notify(v_req2)); + f_send(e_mca_port, m_request(m_retrieve(f_getResourceAddress(v_resourceIndex), f_getOriginator(v_resourceIndex)))); - tc_ac.start; - alt { - [] mcaPort.receive(mw_response(mw_responsePollingResponse(v_req2))) -> value v_resp1 { - tc_ac.stop; - setverdict(pass, __SCOPE__ & ": Polling response received"); - } - [] mcaPort.receive(mw_response(mw_responsePollingResponse)) { - tc_ac.stop; - setverdict(fail, __SCOPE__ & ": Content not carrying request targeting AE1"); - } - [] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) { - tc_ac.stop; - setverdict(fail, __SCOPE__ & ": Wrong status code"); - } - [] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) { - tc_ac.stop; - setverdict(fail, __SCOPE__ & ": Error while retrieving resource"); - } - [] tc_ac.timeout { - setverdict(fail, __SCOPE__ & ": No answer while retrieving resource"); - } - } - - f_checkAeSimuStatus(); - - //Send response in any case - v_resp2 := valueof(m_responseNotification(int2000, omit)); - v_resp2.requestIdentifier := v_resp1.primitive.responsePrimitive.primitiveContent.requestPrimitive.requestIdentifier; - v_req3 := valueof(m_notifyResponsePrimitive(f_getResourceAddress(v_resourceIndex) & "/" & c_resourceShortNamePollingChannelUri, v_resp2)); - v_req3.from_ := f_getOriginator(v_aeIndex); - f_send(e_mca_port, m_request(v_req3)); - - tc_ac.start; - alt { - [] mcaPort.receive(mw_response(mw_responseNotify(int2000))) -> value v_resp3 { - tc_ac.stop; - setverdict(pass, __SCOPE__ & ": Polling response received"); - } - [] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) { - tc_ac.stop; - setverdict(fail, __SCOPE__&":INFO: Error while performing notification"); - } - [] mcaPort.receive { - tc_ac.stop; - setverdict(fail, __SCOPE__&":INFO: Unexpected message received"); - } - [] tc_ac.timeout { - setverdict(fail, __SCOPE__&":INFO: No answer while performing notification"); - } + tc_ac.start; + alt { + [] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value vc_response { + tc_ac.stop; + if(vc_response.primitive.responsePrimitive.primitiveContent.genericInterworkingService.stateTag == 1) { + setverdict(pass, __SCOPE__ & ": The stateTag attribute is incremented"); + } + else{ + setverdict(fail, __SCOPE__ & ": Error the stateTag attribute is not incremented"); + } + } + [] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) { + tc_ac.stop; + setverdict(fail, __SCOPE__ & ": Error while retrieving resource attributes"); + } + [] tc_ac.timeout { + setverdict(fail, __SCOPE__ & ": No answer while retrieving resource attributes"); + } + } + + }//end if + else{ + setverdict(fail, __SCOPE__ & ": Error the stateTag attribute is empty"); } - - f_aeSimu_checkComponentDoneAndGetVerdict(vc_cse1); - + //Postamble f_cse_postamble_deleteResources(); // Tear down - f_cf02Down(); + f_cf01Down(); } - - }//end of group Create - - group Update { /** - * @desc Check that the IUT rejects the update of the <flexContainer> resource when the resource representation does not comply with the schema definition. + * @desc Check that the IUT does not increment the field value of attribute stateTag in the <flexContainer> resource when a common attribute of the resource is modified * */ - testcase TC_CSE_FLXC_UPD_001() runs on Tester system CseSystem { + testcase TC_CSE_FLXC_UPD_002() runs on Tester system CseSystem { - var CseSimu v_cse1 := CseSimu.create("CSE1") alive; + var AeSimu v_ae1 := AeSimu.create("AE1") alive; - v_cse1.start(f_CSE_FLXC_UPD_001()); - v_cse1.done; + v_ae1.start(f_CSE_FLXC_UPD_002()); + v_ae1.done; } - function f_CSE_FLXC_UPD_001() runs on CseSimu { + function f_CSE_FLXC_UPD_002() runs on AeSimu { //Local variables - var integer v_localResourceIndex := -1; - var MsgIn v_request_req1, v_request_req3; - var RequestPrimitive v_request_req2; - var ResponsePrimitive v_response_rsp1; - var template UtTriggerPrimitive v_utRequest1 := m_utCreatePollingChannel; - var template UtTriggerPrimitive v_utRequest2; - var charstring v_action1 := "Please, send a Polling Channel CREATE request"; - var charstring v_action2 := "Please, send a Polling request (Retrieve PollingChannelURI request)"; - var RequestPrimitive v_requestNotify; - - //Test control + var integer v_aeIndex := -1; + var integer v_resourceIndex := -1; + var RequestPrimitive v_request := m_create; + var RequestPrimitive v_updateRequest := valueof(m_updateGenericInterworkingServiceBase); + var Labels v_labels_1:= {"VALUE_1"}; + v_updateRequest.primitiveContent.genericInterworkingService.labels := v_labels_1; + + // Test control - // Test component configuration - f_cf02UpCseSimuMaster(); + // Test component configuration + f_cf01Up(); - // Test adapter configuration + // Test adapter configuration + + // Preamble + v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi); + + v_resourceIndex := f_cse_createResource(int28, m_createGenericInterworkingServiceBase, v_aeIndex); + + // Test Body + if(ispresent(vc_resourcesList[v_resourceIndex].resource.genericInterworkingService.stateTag)) { - // Preamble - vc_remoteCseIndex := f_cse_registerRemoteCse(m_createRemoteCSEBase); - - //send triggering primitive to SUT - v_localResourceIndex := f_cse_createLocalResource(v_utRequest1,v_action1); - - //Check that the created resource is a PollingChannel - if(not(vc_localResourcesList[v_localResourceIndex].resourceType == int15)) { - setverdict(inconc, __SCOPE__&":INFO: Polling Channel resource not creaded"); - f_checkCseSimuStatus(); - } - - //Trigger IUT for sending a polling request (req1) - v_utRequest2 := valueof(m_utRetrievePollingChannelUri(f_getLocalResourceAddress(v_localResourceIndex) & "/" & c_resourceShortNamePollingChannelUri)); - f_sendUtPrimitive(v_utRequest2,v_action2); + f_cse_updateResource(int28, v_resourceIndex, v_updateRequest); - tc_ac.start; - alt { - [] mccPortIn.receive(mw_request(mw_retrieve(f_getResourceAddress(v_localResourceIndex) & "/" & c_resourceShortNamePollingChannelUri))) -> value v_request_req1 { - tc_ac.stop; - setverdict(pass, __SCOPE__&":INFO: Polling request received successfuly"); - v_response_rsp1 := valueof(m_responsePrimitive(int2000,v_request_req1.primitive.requestPrimitive.requestIdentifier)); - v_response_rsp1.from_ := PX_CSE1_ID; - v_response_rsp1.to_ := v_request_req1.primitive.requestPrimitive.from_; - //Put in the primitiveContent a Notify request (req2) (simulated) from another node CSE - v_request_req2 := valueof(m_notify(f_getResourceAddress(vc_remoteCseIndex))); - v_response_rsp1.primitiveContent := { requestPrimitive := v_request_req2 }; - f_send(e_mcc_in_port, m_response(v_response_rsp1)); - } - [] tc_ac.timeout { - setverdict(inconc, __SCOPE__&":INFO: No request received for creating resource type Polling Channel"); - } + f_send(e_mca_port, m_request(m_retrieve(f_getResourceAddress(v_resourceIndex), f_getOriginator(v_resourceIndex)))); + + tc_ac.start; + alt { + [] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) -> value vc_response { + tc_ac.stop; + if(vc_response.primitive.responsePrimitive.primitiveContent.genericInterworkingService.stateTag == 0) { + setverdict(pass, __SCOPE__ & ": The stateTag attribute has not been incremented"); + } + else{ + setverdict(fail, __SCOPE__ & ": Error the stateTag attribute is incremented"); + } + } + [] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) { + tc_ac.stop; + setverdict(fail, __SCOPE__ & ": Error while retrieving resource attributes"); + } + [] tc_ac.timeout { + setverdict(fail, __SCOPE__ & ": No answer while retrieving resource attributes"); + } + } + + }//end if + else{ + setverdict(fail, __SCOPE__ & ": Error the stateTag attribute is empty"); } + + //Postamble + f_cse_postamble_deleteResources(); + + // Tear down + f_cf01Down(); + } + + + /** + * @desc Check that the IUT rejects the update of the <flexContainer> resource when the resource representation does not comply with the schema definition + * + */ + testcase TC_CSE_FLXC_UPD_003() runs on Tester system CseSystem { + + var AeSimu v_ae1 := AeSimu.create("AE1") alive; + + v_ae1.start(f_CSE_FLXC_UPD_003()); + v_ae1.done; + } + + function f_CSE_FLXC_UPD_003() runs on AeSimu { + //Local variables + var integer v_aeIndex := -1; + var integer v_resourceIndex := -1; + var RequestPrimitive v_request := m_create; + var RequestPrimitive v_updateRequest := valueof(m_updateGenericInterworkingServiceBase_invalid); + v_updateRequest.primitiveContent.genericInterworkingService_invalid.expirationCounter := 1; + + // Test control + + // Test component configuration + f_cf01Up(); + + // Test adapter configuration + + // Preamble + v_aeIndex := f_cse_preamble_registerAe();//c_CRUDNDi); + + v_resourceIndex := f_cse_createResource(int28, m_createGenericInterworkingServiceBase, v_aeIndex); + + // Test Body + v_updateRequest := f_getUpdateRequestPrimitive(int28, v_resourceIndex, v_updateRequest); + + f_send(e_mca_port, m_request(v_updateRequest)); tc_ac.start; alt { - [] mccPortIn.receive(mw_request(mw_notifyResponsePrimitive(?))) -> value v_request_req3 { + [] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) -> value vc_response { tc_ac.stop; - //Check that primitiveContent carries the response to req2 (resp2) - if(v_request_req3.primitive.requestPrimitive.primitiveContent.responsePrimitive.requestIdentifier == v_request_req2.requestIdentifier) { - setverdict(pass, __SCOPE__ & ": NOTIFY request received carrying response (rsp2) to the Notify request (req2)"); - } else { - setverdict(fail, __SCOPE__ & ": NOTIFY request received not carryng the expected response (rsp2) to the Notify request (req2)"); - } + setverdict(pass, __SCOPE__ & ": GenericInterworkingService resource correctly not updated"); + } + [] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) { + tc_ac.stop; + setverdict(fail, __SCOPE__ & ": GenericInterworkingService resource updated with wrong attribute"); } [] tc_ac.timeout { - setverdict(fail, __SCOPE__ & ": No message while expecting NOTIFY request"); + setverdict(fail, __SCOPE__ & ": No answer while retrieving resource attributes"); } - } - + } + //Postamble - f_cse_postamble_deleteResourcesCSE(); - - // Tear down - f_cf02DownCseSimuMaster(); + f_cse_postamble_deleteResources(); + + // Tear down + f_cf01Down(); } + }//end of group Update }//end group FlexContainer -- GitLab