diff --git a/LibOneM2M/OneM2M_Functions.ttcn b/LibOneM2M/OneM2M_Functions.ttcn index 3bec814de3de3e8f433e05e552583a236eca2687..a40657df9f4dbfc87d462992b02b53c9de607667 100644 --- a/LibOneM2M/OneM2M_Functions.ttcn +++ b/LibOneM2M/OneM2M_Functions.ttcn @@ -2177,6 +2177,7 @@ module OneM2M_Functions { f_send(e_mcc_in_port, m_response(v_responsePrimitive)); } [] mccPortIn.receive(mw_request(?)) -> value v_request { + tc_ac.stop; setverdict(fail, __SCOPE__ & ":ERROR: Request received with unexpected parameters"); v_responsePrimitive := valueof(m_responsePrimitive(int4000,v_request.primitive.requestPrimitive.requestIdentifier)); f_send(e_mcc_in_port, m_response(v_responsePrimitive)); @@ -3220,6 +3221,46 @@ module OneM2M_Functions { if(ispresent(p_resource.aE.supportedReleaseVersions)) { vc_localResourcesList[p_localResourceIndex].resource.aE.supportedReleaseVersions := p_resource.aE.supportedReleaseVersions; } + } else if(ischosen(vc_localResourcesList[p_localResourceIndex].resource.aEAnnc) and (ischosen(p_resource.aEAnnc))) {//AEAnnc + if(ispresent(p_resource.aEAnnc.accessControlPolicyIDs)) { + vc_localResourcesList[p_localResourceIndex].resource.aEAnnc.accessControlPolicyIDs := p_resource.aEAnnc.accessControlPolicyIDs; + } + if(ispresent(p_resource.aEAnnc.expirationTime)) { + vc_localResourcesList[p_localResourceIndex].resource.aEAnnc.expirationTime := p_resource.aEAnnc.expirationTime; + } + if(ispresent(p_resource.aEAnnc.labels)) { + vc_localResourcesList[p_localResourceIndex].resource.aEAnnc.labels := p_resource.aEAnnc.labels; + } + if(ispresent(p_resource.aEAnnc.link)) { + vc_localResourcesList[p_localResourceIndex].resource.aEAnnc.link := p_resource.aEAnnc.link; + } + if(ispresent(p_resource.aEAnnc.dynamicAuthorizationConsultationIDs)) { + vc_localResourcesList[p_localResourceIndex].resource.aEAnnc.dynamicAuthorizationConsultationIDs := p_resource.aEAnnc.dynamicAuthorizationConsultationIDs; + } + if(ispresent(p_resource.aEAnnc.appName)) { + vc_localResourcesList[p_localResourceIndex].resource.aEAnnc.appName := p_resource.aEAnnc.appName; + } + if(ispresent(p_resource.aEAnnc.pointOfAccess)) { + vc_localResourcesList[p_localResourceIndex].resource.aEAnnc.pointOfAccess := p_resource.aEAnnc.pointOfAccess; + } + if(ispresent(p_resource.aEAnnc.ontologyRef)) { + vc_localResourcesList[p_localResourceIndex].resource.aEAnnc.ontologyRef := p_resource.aEAnnc.ontologyRef; + } + if(ispresent(p_resource.aEAnnc.nodeLink)) { + vc_localResourcesList[p_localResourceIndex].resource.aEAnnc.nodeLink := p_resource.aEAnnc.nodeLink; + } + if(ispresent(p_resource.aEAnnc.requestReachability)) { + vc_localResourcesList[p_localResourceIndex].resource.aEAnnc.requestReachability := p_resource.aEAnnc.requestReachability; + } + if(ispresent(p_resource.aEAnnc.contentSerialization)) { + vc_localResourcesList[p_localResourceIndex].resource.aEAnnc.contentSerialization := p_resource.aEAnnc.contentSerialization; + } + if(ispresent(p_resource.aEAnnc.e2eSecInfo)) { + vc_localResourcesList[p_localResourceIndex].resource.aEAnnc.e2eSecInfo := p_resource.aEAnnc.e2eSecInfo; + } + if(ispresent(p_resource.aEAnnc.supportedReleaseVersions)) { + vc_localResourcesList[p_localResourceIndex].resource.aEAnnc.supportedReleaseVersions := p_resource.aEAnnc.supportedReleaseVersions; + } } else if(ischosen(vc_localResourcesList[p_localResourceIndex].resource.accessControlPolicy) and (ischosen(p_resource.accessControlPolicy))) { //AccessControlPolicy if(ispresent(p_resource.accessControlPolicy.expirationTime)) { vc_localResourcesList[p_localResourceIndex].resource.accessControlPolicy.expirationTime := p_resource.accessControlPolicy.expirationTime; @@ -3372,16 +3413,13 @@ module OneM2M_Functions { [] mccPortIn.receive(mw_request(mw_create())) -> value v_request { log(__SCOPE__&": WARNING: Unexpected CREATE message received"); - tc_ac.stop; v_localResourceIndex := f_processCreateRequestPrimitive(v_request.primitive.requestPrimitive); f_send(e_mcc_in_port, m_response(vc_response.primitive.responsePrimitive)); - tc_ac.start(10.0); repeat; } [] mccPortIn.receive(mw_request(mw_retrieve(?))) -> value v_request { - tc_ac.stop; log(__SCOPE__&": WARNING: Unexpected RETRIEVE message received"); f_processRetrieveRequestPrimitive(v_request.primitive.requestPrimitive); @@ -3390,36 +3428,29 @@ module OneM2M_Functions { } else { f_send(e_mcc_in_port, m_response(vc_response.primitive.responsePrimitive)); } - tc_ac.start(10.0); repeat; } [] mccPortIn.receive(mw_request(mw_update())) -> value v_request { - tc_ac.stop; log(__SCOPE__&": WARNING: Unexpected UPDATE message received"); f_processUpdateRequestPrimitive(v_request.primitive.requestPrimitive); f_send(e_mcc_in_port, m_response(vc_response.primitive.responsePrimitive)); - tc_ac.start(10.0); repeat; } [] mccPortIn.receive(mw_request(mw_delete())) -> value v_request { - tc_ac.stop; log(__SCOPE__&": WARNING: Unexpected DELETE message received"); f_processDeleteRequestPrimitive(v_request.primitive.requestPrimitive); f_send(e_mcc_in_port, m_response(vc_response.primitive.responsePrimitive)); - tc_ac.start(10.0); repeat; } [] mccPortIn.receive(mw_request(mw_notify)) -> value v_request { - tc_ac.stop; log(__SCOPE__&": WARNING: Unexpected NOTIFY message received"); //Send response in any case v_response := valueof(m_responseNotification(int2000, omit)); v_response.requestIdentifier := vc_request.primitive.requestPrimitive.requestIdentifier; f_send(e_mcc_in_port, m_response(v_response)); - tc_ac.start(10.0); repeat; } [] mccPortIn.receive (mw_request(?)){ @@ -3440,14 +3471,12 @@ module OneM2M_Functions { var ResponsePrimitive v_response; [] mcaPortIn.receive(mw_request(mw_notify)) -> value v_request { - tc_ac.stop; log(__SCOPE__&": WARNING: Unexpected NOTIFY message received"); //Send response in any case v_response := valueof(m_responseNotification(int2000, omit)); v_response.requestIdentifier := vc_request.primitive.requestPrimitive.requestIdentifier; f_send(e_mca_in_port, m_response(v_response)); - tc_ac.start(10.0); repeat; } [] mcaPortIn.receive { @@ -3464,33 +3493,40 @@ module OneM2M_Functions { * @desc Activation of the corresponding default altstep depending on config for CseSimu */ function f_cse_activateDefaults_cse1() runs on CseSimu { - if(not(self == mtc)) { + deactivate; activate(a_default()); if(vc_config == e_cf02) { activate(a_cse_cf02_cse1()); log(__SCOPE__&": INFO: Default cf02_cse1 activated"); + } else if(vc_config == e_cf02CseSimuMaster) { + activate(a_cse_cf02_cse1()); + log(__SCOPE__&": INFO: Default cf02_cse1 activated"); + } else if(vc_config == e_cf03) { + activate(a_cse_cf03()); + log(__SCOPE__&": INFO: Default cf03 activated"); } else if(vc_config == e_cf04) { activate(a_cse_cf04()); log(__SCOPE__&": INFO: Default cf04 activated"); } } - } /** * @desc Activation of the corresponding default altstep depending on config for AeSimu */ function f_cse_activateDefaults_ae() runs on AeSimu { - if(not(self == mtc)) { + deactivate; activate(a_default()); if(vc_config == e_cf01) { activate(a_cse_cf01()); - log(__SCOPE__&": INFO: Default cf01 and cf01_ae2 activated"); + log(__SCOPE__&": INFO: Default cf01 activated"); + } else if(vc_config == e_cf02) { + activate(a_cse_cf02_ae1()); + log(__SCOPE__&": INFO: Default cf02_ae1 activated"); } else if(vc_config == e_cf02CseSimuMaster) { activate(a_cse_cf02_ae1()); log(__SCOPE__&": INFO: Default cf02_ae1 activated"); } } - } }//end group CseAltstepFunctions }//end cseFunctions @@ -4980,12 +5016,12 @@ module OneM2M_Functions { var verdicttype v_verdict := none; - tc_ac.start(15.0); + tc_done.start(15.0); alt { [] p_component.done -> value v_verdict { - tc_ac.stop; + tc_done.stop; } - [] tc_ac.timeout { + [] tc_done.timeout { setverdict(inconc, __SCOPE__ & "INFO: Component did not finish"); } } @@ -5009,12 +5045,12 @@ module OneM2M_Functions { var verdicttype v_verdict := none; - tc_ac.start(15.0); + tc_done.start(15.0); alt { [] p_component.done -> value v_verdict { - tc_ac.stop; + tc_done.stop; } - [] tc_ac.timeout { + [] tc_done.timeout { setverdict(inconc, __SCOPE__ & "INFO: Component did not finish"); } } diff --git a/LibOneM2M/OneM2M_Templates.ttcn b/LibOneM2M/OneM2M_Templates.ttcn index dbf76024289c01cd669f7630f90d0e04a1381989..835858ad1cb65c1444de951d973cace4da3dbceb 100644 --- a/LibOneM2M/OneM2M_Templates.ttcn +++ b/LibOneM2M/OneM2M_Templates.ttcn @@ -3753,6 +3753,31 @@ module OneM2M_Templates { choice := *//O }; + template AEAnnc_optional mw_contentAeAnnc_base := { + resourceName := ?,//M + resourceType := ?,//M + resourceID := ?,//M + parentID := ?,//M + creationTime := ?,//M + lastModifiedTime := ?,//M + labels := *,//O + accessControlPolicyIDs := *,//O + expirationTime := ?,//M + link := ?,//M, + dynamicAuthorizationConsultationIDs := *, //O + appName := *,//O + app_ID := ?,//M + aE_ID := ?,//M + pointOfAccess := *,//O + ontologyRef := *,//O + nodeLink := *,//O + requestReachability := ?,//M + contentSerialization := *,//O + e2eSecInfo:= *, //O + supportedReleaseVersions := ?,//M + choice := *//O + }; + template AEAnnc_optional mw_contentAeAnnc_any := { resourceName := *,//M resourceType := *,//M diff --git a/LibOneM2M/OneM2M_TestSystem.ttcn b/LibOneM2M/OneM2M_TestSystem.ttcn index 53545f35756d659bf9714ea63f9136c9e031ae31..bf43b6463998b80b2012094af7d053c9309d5b86 100644 --- a/LibOneM2M/OneM2M_TestSystem.ttcn +++ b/LibOneM2M/OneM2M_TestSystem.ttcn @@ -46,6 +46,7 @@ module OneM2M_TestSystem { //timers timer tc_ac := PX_TAC; timer tc_wait := PX_TWAIT; + timer tc_done := PX_TDONE; //global variables var Configurations vc_config; var TestSystemRole vc_testSystemRole; diff --git a/OneM2M_Testcases_CSE_Release_1.ttcn b/OneM2M_Testcases_CSE_Release_1.ttcn index d50ccb8cbedc3146eb319fe1e04f39eb34c72052..94e7d7c31571645926399958bfc81a5008cc8d63 100644 --- a/OneM2M_Testcases_CSE_Release_1.ttcn +++ b/OneM2M_Testcases_CSE_Release_1.ttcn @@ -467,18 +467,23 @@ module OneM2M_Testcases_CSE_Release_1 { //Test Body vc_ae1.start(f_cse_createResource(int2, m_createAe(PX_APP_ID, -, PX_ALLOWED_S_AE_IDS[0]))); - v_requestPrimitive := mw_createAEAnnc_s_ae_id(PX_CSE_ID & PX_ALLOWED_S_AE_IDS[0], -, -, PX_CSE_ID & PX_ALLOWED_S_AE_IDS[0]); + v_requestPrimitive := mw_createAEAnnc_s_ae_id(PX_CSE_ID & "/" & PX_ALLOWED_S_AE_IDS[0], -, -, PX_CSE_ID & "/" & PX_ALLOWED_S_AE_IDS[0]); tc_ac.start; alt{ [] mccPortIn.receive(mw_request(v_requestPrimitive)) -> value v_request { tc_ac.stop; - setverdict(pass, __SCOPE__ & ": AE creation redirected."); + setverdict(pass, __SCOPE__ & ": AEAnnc creation received."); f_cse_sendResponse_cseSimu(v_request); } [] mccPortIn.receive(mw_request(mw_createAEAnnc())) -> value v_request { tc_ac.stop; - setverdict(fail, __SCOPE__ & ": AE creation redirected but wrong parameters"); + setverdict(fail, __SCOPE__ & ": AEAnnc creation received but wrong parameters"); + f_cse_sendResponse_cseSimu(v_request); + } + [] mccPortIn.receive(mw_request(?)) -> value v_request { + tc_ac.stop; + setverdict(fail, __SCOPE__ & ": Other operation received"); f_cse_sendResponse_cseSimu(v_request); } [] tc_ac.timeout { @@ -930,7 +935,6 @@ module OneM2M_Testcases_CSE_Release_1 { } - /** * @desc Check that the IUT accepts an AE re-registration (allowed M2M-SP-assigned AE-ID, S-AE-ID-STEM provided by AE), transfer response to the AE * @@ -940,7 +944,6 @@ module OneM2M_Testcases_CSE_Release_1 { var AeSimu v_ae1 := AeSimu.create("AE1") alive; v_ae1.start(f_CSE_REG_CRE_010()); - v_ae1.done; } @@ -950,6 +953,7 @@ module OneM2M_Testcases_CSE_Release_1 { var MsgIn v_response; var RequestPrimitive v_request; var integer v_aeIndex := -1; + var template RequestPrimitive v_updateAeAnnc := mw_updateAEAnnc; //Test control if(not(PICS_MN_CSE)) { @@ -964,47 +968,53 @@ module OneM2M_Testcases_CSE_Release_1 { vc_cse1.start(f_cse_registrationRemoteCse(mw_createRemoteCSE)); vc_cse1.done; + vc_cse1.start(f_cse_announcementProcedure_createHandler()); + v_aeIndex := f_cse_createResource(int2, m_createAe(PX_APP_ID, omit, PX_ALLOWED_S_AE_IDS[0])); - vc_cse1.start(f_cse_announcementProcedure_createHandler()); - vc_cse1.done; + f_aeSimu_checkComponentDoneAndGetVerdict(vc_cse1); - //TODO Deregister - //f_cse_deleteResource(v_aeIndex); - v_request := valueof(m_delete(f_getResourceAddress(v_aeIndex), f_getOriginator(v_aeIndex))); - f_send(e_mca_port, m_request(v_request)); + //AE Deregistration + vc_cse1.start(f_cse_announcementProcedure_updateHandler()); + f_cse_deleteResource(v_aeIndex); + + f_aeSimu_checkComponentDoneAndGetVerdict(vc_cse1); //Test Body - f_cse_createResource(int2, m_createAe(PX_APP_ID, omit, f_getResourceId(vc_resourcesList[v_aeIndex].resource))); + v_updateAeAnnc.primitiveContent.aEAnnc.link := PX_CSE_ID & "/" & f_getResourceId(vc_resourcesList[v_aeIndex].resource); + v_updateAeAnnc.primitiveContent.aEAnnc.labels := {"Credential-ID:None"}; - vc_cse1.start(f_cse_announcementProcedure_createHandler(mw_createAEAnnc_s_ae_id(PX_CSE_ID, -, -, -))); - vc_cse1.done; + vc_cse1.start(f_cse_announcementProcedure_updateHandler(v_updateAeAnnc)); + v_request := valueof(m_createAe(PX_APP_ID, omit, f_getResourceId(vc_resourcesList[v_aeIndex].resource))); + mcaPort.send(f_getMsgOutPrimitive(m_request(v_request))); + tc_ac.start; - alt { - [] mcaPortIn.receive(mw_response(mw_responsePrimitive(int2001))) -> value v_response { + [] mcaPort.receive(mw_response(mw_responsePrimitive(int2001))) -> value v_response { tc_ac.stop; //continue to test the content if (ischosen(v_response.primitive.responsePrimitive.primitiveContent.aE)){ - if (v_response.primitive.responsePrimitive.primitiveContent.aE.app_ID == PX_APP_ID){ + if (v_response.primitive.responsePrimitive.primitiveContent.aE.aE_ID == f_getResourceId(vc_resourcesList[v_aeIndex].resource)){ setverdict(pass, __SCOPE__ & ": AE creation success."); }else{ - setverdict(fail, __SCOPE__ & ": Error in AE content."); + setverdict(fail, __SCOPE__ & ": Wrong AE-ID assigned during re registration"); } }else{ - setverdict(fail, __SCOPE__ & ": primitiveContent doesn't exist"); + setverdict(fail, __SCOPE__ & ": Ae representation not present"); } } - [] mcaPortIn.receive { + [] mcaPort.receive (mw_response(mw_responsePrimitive(?))) { tc_ac.stop; - setverdict(fail, __SCOPE__ & ": Error while creating AE"); + setverdict(fail, __SCOPE__ & ": Error while AE re registration "); } [] tc_ac.timeout { setverdict(fail, __SCOPE__ & ": No answer while creating AE"); } } + f_aeSimu_checkComponentDoneAndGetVerdict(vc_cse1); + // Postamble f_cse_postamble_deleteResources(); @@ -1394,6 +1404,83 @@ module OneM2M_Testcases_CSE_Release_1 { }//end TC_CSE_REG_CRE_019 + /** + * @desc Check that the IUT accepts a create request of <AE> resource with attributes multiplicity equals to 1 and asking AE_ID_Stem by indicating AE_ID_Stem starting with character ‘S’. + * + */ + testcase TC_CSE_REG_CRE_020() runs on Tester system CseSystem { + + var AeSimu v_ae1 := AeSimu.create("AE1") alive; + v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1)); + v_ae1.done; + + v_ae1.start(f_CSE_REG_CRE_020()); + + v_ae1.done; + + } + + function f_CSE_REG_CRE_020() runs on AeSimu { + + //Local variables + var RequestPrimitive v_request; + var ResourceType v_resourceType := int2; + + //Test control + if(not(PICS_IN_CSE)) { + setverdict(inconc, __SCOPE__ & ": IUT shall be IN-CSE to run this test case"); + stop; + } + + // Test component configuration + f_cf01Up(); + + //Preamble + + //Test Body + v_request := valueof(m_createAe(PX_APP_ID, omit, "S")); + + v_request := f_getCreateRequestPrimitive(v_resourceType, v_request, -1); + + mcaPort.send(f_getMsgOutPrimitive(m_request(v_request))); + + tc_ac.start; + alt { + [] mcaPort.receive(mw_response(mw_responsePrimitive(int2001))) -> value vc_response { + tc_ac.stop; + f_checkAttributesToBeSaved(int2, v_request, vc_response.primitive.responsePrimitive); + vc_aeAuxIndex := f_setResource(vc_response.primitive.responsePrimitive.primitiveContent, int2); + + setverdict(pass, __SCOPE__ & ": AE successfully created."); + if(ischosen(vc_response.primitive.responsePrimitive.primitiveContent.aE)) { + if(ispresent(vc_response.primitive.responsePrimitive.primitiveContent.aE.resourceID)) { + if(f_resourceIdCleaner(vc_response.primitive.responsePrimitive.primitiveContent.aE.resourceID[0]) != "S") { + setverdict(fail, __SCOPE__ & ": ResourceID not starting with 'S'"); + } + } else { + setverdict(fail, __SCOPE__ & ": ResourceID attribute not present"); + } + } else { + setverdict(fail, __SCOPE__ & ": AE resource representation not present"); + } + } + [] mcaPort.receive(mw_response(mw_responsePrimitiveInverse(int2001))) -> value vc_response{ + tc_ac.stop; + setverdict(fail, __SCOPE__ & ": Error while creating AE with status code " & int2str(enum2int(vc_response.primitive.responsePrimitive.responseStatusCode))); + } + [] tc_ac.timeout { + setverdict(fail, __SCOPE__ & ": No answer while creating AE"); + } + } + + // Postamble + f_cse_postamble_deleteResources(); + + // Tear down + f_cf01Down(); + + } + /** * @desc Check that the IUT rejects the create request of <CSEBase> resource. * @@ -1920,6 +2007,238 @@ module OneM2M_Testcases_CSE_Release_1 { }//end g_CSE_REG_CRE_028 + /** + * @desc Check that the IUT accepts an AE registration (preprovisioned S-AE-ID-STEM provided by AE), communication between MN-CSE and IN-CSE + * + */ + testcase TC_CSE_REG_CRE_029() runs on Tester system CseSystem { + + var CseSimu v_cse1 := CseSimu.create("CSE1") alive; + v_cse1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_CSE1)); + v_cse1.done; + + v_cse1.start(f_CSE_REG_CRE_029()); + + v_cse1.done; + + } + + function f_CSE_REG_CRE_029() runs on CseSimu { + + var MsgIn v_response; + var RequestPrimitive v_request; + var integer v_aeAnncIndex := -1; + var template PrimitiveContent v_primitiveContent; + + //Test control + if(not(PICS_IN_CSE)) { + setverdict(inconc, __SCOPE__ & ": IUT shall be IN-CSE to run this test case"); + stop; + } + + // Test component configuration + f_cf04Up(); + + //Preamble + + vc_remoteCseIndex := f_cse_registerRemoteCse(m_createRemoteCSEBase); + + //Test Body + v_request := valueof(m_createAEAnnc(-, f_getResourceAddress(vc_remoteCseIndex), PX_CSE1_ID & "/" & PX_ALLOWED_S_AE_IDS[0], PX_APP_ID, PX_CSE1_ID & "/" & PX_ALLOWED_S_AE_IDS[0])); + + v_request := f_getCreateRequestPrimitive(int10002, v_request, vc_remoteCseIndex); + v_primitiveContent.aEAnnc := mw_contentAeAnnc_base; + + mccPort.send(f_getMsgOutPrimitive(m_request(v_request))); + + tc_ac.start; + alt { + [] mccPort.receive(mw_response(mw_responsePrimitive(int2001, v_primitiveContent))) -> value v_response { + tc_ac.stop; + f_checkAttributesToBeSaved(int10002, v_request, v_response.primitive.responsePrimitive); + v_aeAnncIndex := f_setResource(v_response.primitive.responsePrimitive.primitiveContent, int10002); + + setverdict(pass, __SCOPE__ & ": AEAnnc successfully created."); + if(v_response.primitive.responsePrimitive.primitiveContent.aEAnnc.link != PX_CSE1_ID & "/" & PX_ALLOWED_S_AE_IDS[0]) { + setverdict(fail, __SCOPE__ & ": Link attribute not correct"); + } + if(v_response.primitive.responsePrimitive.primitiveContent.aEAnnc.labels != {"Credential-ID:None"}) { + setverdict(fail, __SCOPE__ & ": Labels attribute not correct"); + } + } + [] mccPort.receive(mw_response(mw_responsePrimitiveInverse(int2001))) -> value v_response{ + tc_ac.stop; + setverdict(fail, __SCOPE__ & ": Error while creating AEAnnc with status code " & int2str(enum2int(v_response.primitive.responsePrimitive.responseStatusCode))); + } + [] tc_ac.timeout { + setverdict(fail, __SCOPE__ & ": No answer while creating AEAnnc"); + } + } + + // Postamble + f_cse_postamble_deleteResourcesCSE(); + + // Tear down + f_cf04Down(); + + } + + /** + * @desc Check that the IUT accepts an AE re-registration (allowed M2M-SP-assigned AE-ID, S-AE-ID-STEM provided by AE), transfer response to the AE + * + */ + testcase TC_CSE_REG_CRE_030() runs on Tester system CseSystem { + + var AeSimu v_ae1 := AeSimu.create("AE1") alive; + v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1)); + v_ae1.done; + + v_ae1.start(f_CSE_REG_CRE_030()); + + v_ae1.done; + + } + + function f_CSE_REG_CRE_030() runs on AeSimu { + + var MsgIn v_response; + var RequestPrimitive v_request; + var integer v_aeIndex := -1; + + //Test control + if(not(PICS_MN_CSE)) { + setverdict(inconc, __SCOPE__ & ": IUT shall be MN-CSE to run this test case"); + stop; + } + + // Test component configuration + f_cf02Up(); + + //Preamble + vc_cse1.start(f_cse_registrationRemoteCse(mw_createRemoteCSE)); + vc_cse1.done; + + vc_cse1.start(f_cse_announcementProcedure_createHandler(mw_createAEAnnc_s_ae_id(PX_CSE_ID & "/" & PX_ALLOWED_S_AE_IDS[0], -, -, -))); + + v_request := valueof(m_createAe(PX_APP_ID, omit, PX_ALLOWED_S_AE_IDS[0])); + v_request := f_getCreateRequestPrimitive(int2, v_request, -1); + mcaPort.send(f_getMsgOutPrimitive(m_request(v_request))); + + f_aeSimu_checkComponentDoneAndGetVerdict(vc_cse1); + + //Test Body + tc_ac.start; + + alt { + [] mcaPort.receive(mw_response(mw_responsePrimitive(int2001))) -> value v_response { + tc_ac.stop; + //continue to test the content + if (ischosen(v_response.primitive.responsePrimitive.primitiveContent.aE)){ + if (v_response.primitive.responsePrimitive.primitiveContent.aE.aE_ID == PX_ALLOWED_S_AE_IDS[0]){ + setverdict(pass, __SCOPE__ & ": AE creation success."); + }else{ + setverdict(fail, __SCOPE__ & ": AE-ID is not correct"); + } + }else{ + setverdict(fail, __SCOPE__ & ": AE representation not present"); + } + } + [] tc_ac.timeout { + setverdict(fail, __SCOPE__ & ": No answer while creating AE"); + } + } + + // Postamble + f_cse_postamble_deleteResources(); + + // Tear down + f_cf02Down(); + + }; //end f_CSE_REG_CRE_030 + + /** + * @desc Check that the IUT accepts an AE registration (S-AE-ID-STEM not provided by AE), communication between MN-CSE and IN-CSE + * + */ + testcase TC_CSE_REG_CRE_031() runs on Tester system CseSystem { + + var CseSimu v_cse1 := CseSimu.create("CSE1") alive; + v_cse1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_CSE1)); + v_cse1.done; + + v_cse1.start(f_CSE_REG_CRE_031()); + + v_cse1.done; + + } + + function f_CSE_REG_CRE_031() runs on CseSimu { + + var MsgIn v_response; + var RequestPrimitive v_request; + var integer v_aeAnncIndex := -1; + var template PrimitiveContent v_primitiveContent; + const charstring v_cseId := PX_CSE_ID; + template XSD.AnyURI v_link := pattern "{v_cseId}/S*"; + template XSD.ID v_resourceID := pattern "S*"; + + //Test control + if(not(PICS_IN_CSE)) { + setverdict(inconc, __SCOPE__ & ": IUT shall be IN-CSE to run this test case"); + stop; + } + + // Test component configuration + f_cf04Up(); + + //Preamble + + vc_remoteCseIndex := f_cse_registerRemoteCse(m_createRemoteCSEBase); + + //Test Body + v_request := valueof(m_createAEAnnc(-, f_getResourceAddress(vc_remoteCseIndex), PX_CSE1_ID & "/" & "S", PX_APP_ID, PX_CSE1_ID & "/" & "S")); + + v_request := f_getCreateRequestPrimitive(int10002, v_request, vc_remoteCseIndex); + v_primitiveContent.aEAnnc := mw_contentAeAnnc_base; + + mccPort.send(f_getMsgOutPrimitive(m_request(v_request))); + + tc_ac.start; + alt { + [] mccPort.receive(mw_response(mw_responsePrimitive(int2001, v_primitiveContent))) -> value v_response { + tc_ac.stop; + f_checkAttributesToBeSaved(int10002, v_request, v_response.primitive.responsePrimitive); + v_aeAnncIndex := f_setResource(v_response.primitive.responsePrimitive.primitiveContent, int10002); + + setverdict(pass, __SCOPE__ & ": AEAnnc successfully created."); + if(match(v_response.primitive.responsePrimitive.primitiveContent.aEAnnc.link, v_link)) { + setverdict(fail, __SCOPE__ & ": Link attribute not correct"); + } + if(v_response.primitive.responsePrimitive.primitiveContent.aEAnnc.labels != {"Credential-ID:None"}) { + setverdict(fail, __SCOPE__ & ": Labels attribute not correct"); + } + } + [] mccPort.receive(mw_response(mw_responsePrimitive(int2001))) -> value v_response { + tc_ac.stop; + setverdict(fail, __SCOPE__ & ": AEAnnc successfully created with wrong attributes"); + } + [] mccPort.receive(mw_response(mw_responsePrimitiveInverse(int2001))) -> value v_response { + tc_ac.stop; + setverdict(fail, __SCOPE__ & ": Error while creating AEAnnc with status code " & int2str(enum2int(v_response.primitive.responsePrimitive.responseStatusCode))); + } + [] tc_ac.timeout { + setverdict(fail, __SCOPE__ & ": No answer while creating AEAnnc"); + } + } + + // Postamble + f_cse_postamble_deleteResourcesCSE(); + + // Tear down + f_cf04Down(); + + } //end of testcase TC_CSE_REG_CRE_031 + } //end group Create group Retrieve{ @@ -3040,6 +3359,231 @@ module OneM2M_Testcases_CSE_Release_1 { }//end TC_CSE_REG_DEL_004 + /** + * @desc Check that the IUT accepts an AE de-registration when AE-ID is starting with “S†+ * + */ + testcase TC_CSE_REG_DEL_005() runs on Tester system CseSystem { + + var AeSimu v_ae1 := AeSimu.create("AE1") alive; + v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1)); + v_ae1.done; + + v_ae1.start(f_CSE_REG_DEL_005()); + + v_ae1.done; + + } + + function f_CSE_REG_DEL_005() runs on AeSimu { + //Local variables + var RequestPrimitive v_request; + var integer v_aeIndex := -1; + + //Test control + if(not(PICS_IN_CSE)) { + setverdict(inconc, __SCOPE__ & ": IUT shall be IN-CSE to run this test case"); + stop; + } + + // Test component configuration + f_cf01Up(); + + // Test adapter configuration + + // Preamble + v_aeIndex := f_cse_createResource(int2, m_createAe(PX_APP_ID, omit, "S"));//c_CRUDNDi); + + // Test Body + v_request := valueof(m_delete(f_getResourceAddress(v_aeIndex), f_getOriginator(v_aeIndex))); + + mcaPort.send(f_getMsgOutPrimitive(m_request(v_request))); + tc_ac.start; + alt { + [] mcaPort.receive(mw_response(mw_responsePrimitive(int2002))) { + tc_ac.stop; + setverdict(pass, __SCOPE__ & ": AE has been de-registered successfully"); + f_removeElementFromList(vc_resourcesIndexToBeDeleted, v_aeIndex); + } + [] mcaPort.receive(mw_response(mw_responsePrimitiveOK)) { + tc_ac.stop; + setverdict(fail, __SCOPE__ & ": Wrong response status code in the response"); + } + [] mcaPort.receive(mw_response(mw_responsePrimitiveKO)) { + tc_ac.stop; + setverdict(fail, __SCOPE__ & ": Error while de-registering AE"); + } + [] tc_ac.timeout { + setverdict(fail, __SCOPE__ & ": No answer while de-registering AE"); + } + } + + // Postamble + f_cse_postamble_deleteResources(); + + // Tear down + f_cf01Down(); + + }//end TC_CSE_REG_DEL_005 + + /** + * @desc Check that the IUT accepts an AE de-registration when AE-ID is starting with “S†+ * + */ + testcase TC_CSE_REG_DEL_006() runs on Tester system CseSystem { + + var CseSimu v_cse1 := CseSimu.create("CSE1") alive; + v_cse1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_CSE1)); + v_cse1.done; + + v_cse1.start(f_CSE_REG_DEL_006()); + + v_cse1.done; + + } + + function f_CSE_REG_DEL_006() runs on CseSimu { + + var RequestPrimitive v_request; + var template RequestPrimitive v_updateAeAnnc := mw_updateAEAnnc; + var integer v_cseBaseIndex := -1; + var integer v_aeIndex := -1; + var integer v_aeIndex_ae1 := -1; + var integer v_aeAnncIndex := -1; + var ResourceType v_resourceType := int2; + + //Test control + if(not(PICS_MN_CSE)) { + setverdict(inconc, __SCOPE__ & ": IUT shall be MN-CSE to run this test case"); + stop; + } + + // Test component configuration + f_cf02UpCseSimuMaster(int1); + + //Preamble + vc_remoteCseIndex := f_cse_registrationRemoteCse(mw_createRemoteCSE); + + vc_ae1.start(f_cse_createResource(int2, m_createAe(PX_APP_ID, omit, "S"))); + + v_aeAnncIndex := f_cse_announcementProcedure_createHandler(-, -, -); + + f_cseSimu_checkComponentDoneAndGetVerdict(vc_ae1); + + v_aeIndex_ae1 := f_getLatestResourceIndex(vc_ae1); + + v_aeIndex := f_getLatestResource(vc_ae1); + + //Test Body + vc_ae1.start(f_cse_deleteResource(v_aeIndex_ae1)); + v_updateAeAnnc.primitiveContent.aEAnnc.link := "INACTIVE"; + + tc_ac.start; + alt { + [] mccPortIn.receive(mw_request(v_updateAeAnnc)) -> value vc_request { + tc_ac.stop; + setverdict(pass, __SCOPE__ & ": AE Announced UPDATE received"); + f_processUpdateRequestPrimitive(vc_request.primitive.requestPrimitive); + mccPortIn.send(f_getMsgOutPrimitive(m_response(vc_response.primitive.responsePrimitive))); + } + [] mccPortIn.receive(mw_request(mw_update)) { + tc_ac.stop; + setverdict(fail, __SCOPE__ & ": Wrong UPDATE request received "); + } + [] tc_ac.timeout { + setverdict(fail, __SCOPE__ & ": No answer while creating AE"); + } + } + + f_cseSimu_checkComponentDoneAndGetVerdict(vc_ae1); + + // Postamble + f_cse_postamble_deleteResourcesCSE(); + + // Tear down + f_cf02DownCseSimuMaster(); + + } + + /** + * @desc Check that the IUT accepts the response from IN-CSE for the AE de-registration when AE-ID is starting with “S†+ * + */ + testcase TC_CSE_REG_DEL_007() runs on Tester system CseSystem { + + var AeSimu v_ae1 := AeSimu.create("AE1") alive; + v_ae1.start(f_setProtocolBinding(PX_PROTOCOL_BINDING_AE1)); + v_ae1.done; + + v_ae1.start(f_CSE_REG_DEL_007()); + v_ae1.done; + + } + + function f_CSE_REG_DEL_007() runs on AeSimu { + + var MsgIn v_response; + var RequestPrimitive v_request; + var integer v_aeIndex := -1; + var template RequestPrimitive v_updateAeAnnc := mw_updateAEAnnc; + + //Test control + if(not(PICS_MN_CSE)) { + setverdict(inconc, __SCOPE__ & ": IUT shall be MN-CSE to run this test case"); + stop; + } + + // Test component configuration + f_cf02Up(); + + //Preamble + vc_cse1.start(f_cse_registrationRemoteCse(mw_createRemoteCSE)); + vc_cse1.done; + + v_aeIndex := f_cse_createResource(int2, m_createAe(PX_APP_ID, omit, "S")); + + vc_cse1.start(f_cse_announcementProcedure_createHandler()); + f_aeSimu_checkComponentDoneAndGetVerdict(vc_cse1); + + v_updateAeAnnc.primitiveContent.aEAnnc.link := "INACTIVE"; + vc_cse1.start(f_cse_announcementProcedure_updateHandler(v_updateAeAnnc)); + + v_request := valueof(m_delete(f_getResourceAddress(v_aeIndex), f_getOriginator(v_aeIndex))); + mcaPort.send(f_getMsgOutPrimitive(m_request(v_request))); + + //Test Body + f_aeSimu_checkComponentDoneAndGetVerdict(vc_cse1); + + tc_ac.start; + alt { + [] mcaPort.receive(mw_response(mw_responsePrimitive(int2004))) -> value v_response { + tc_ac.stop; + setverdict(pass, __SCOPE__ & ": AE resource deleted successfully."); + } + [] mcaPortIn.receive(mw_response(mw_responsePrimitive(?))) -> value v_response { + tc_ac.stop; + setverdict(fail, __SCOPE__ & ": Error while deleting AE resource"); + } + [] tc_ac.timeout { + setverdict(fail, __SCOPE__ & ": No answer while deleting AE resource"); + } + } + + //Check to see if the resource is present or not + if (not(f_cse_isResourcePresent(v_aeIndex))) { + setverdict(pass, __SCOPE__ & ":INFO: Resource deleted"); + } else { + setverdict(fail, __SCOPE__ & ":ERROR: Resource not deleted"); + } + + // Postamble + f_cse_postamble_deleteResources(); + + // Tear down + f_cf02Down(); + + }; //end TC_CSE_REG_DEL_007 + }// end group Delete }//end Registration