diff --git a/TODO.md b/TODO.md index 708142ecedbed3763e446a2955054a9dbd0b1cac..0331d0976b28af8e038a24c59d3a188e0c0f5168 100644 --- a/TODO.md +++ b/TODO.md @@ -60,4 +60,21 @@ https://forge.etsi.org/gitlab/mec/MEC-tests/blob/master/Test%20Purposes/SRV/UELO ### UeIdentity +ETSI GS MEC 014 V1.1.1 (2018-02) + +https://forge.etsi.org/gitlab/mec/MEC-tests/blob/master/Test%20Purposes/SRV/UeIdentity/PlatUeIdentity.tplan2 + +- TC_MEC_PLAT_UETAG_001_OK To be tested + +- TC_MEC_PLAT_UETAG_002_OK To be tested + +- TC_MEC_PLAT_UETAG_003_OK To be tested + +- TC_MEC_PLAT_UETAG_001_BI To be tested + +- TC_MEC_PLAT_UETAG_002_BI To be tested + +- TP_MEC_PLAT_UETAG_003_BI Done + +- TP_MEC_PLAT_UETAG_004_BI Done diff --git a/ttcn/AtsMec/AtsMec_LocationAPI_TestCases.ttcn b/ttcn/AtsMec/AtsMec_LocationAPI_TestCases.ttcn index fdc7d24a2199b2feaba62cb0289e13871a539c17..85bc8c5d6f9e4a3585125e9ecc999735de15a882 100644 --- a/ttcn/AtsMec/AtsMec_LocationAPI_TestCases.ttcn +++ b/ttcn/AtsMec/AtsMec_LocationAPI_TestCases.ttcn @@ -12,8 +12,6 @@ module AtsMec_LocationAPI_TestCases { // Libcommon - import from LibCommon_Time all; - import from LibCommon_VerdictControl all; import from LibCommon_Sync all; // LibHttp @@ -24,7 +22,6 @@ module AtsMec_LocationAPI_TestCases { import from LibItsHttp_TestSystem all; // LibMec_LocationAPI - import from LocationAPI_TypesAndValues all; import from LocationAPI_Templates all; import from LocationAPI_Pics all; import from LocationAPI_Pixits all; @@ -44,11 +41,10 @@ module AtsMec_LocationAPI_TestCases { testcase TC_MEC_SRV_UELOC_001_OK() runs on HttpComponent system HttpTestAdapter { // Local variables var HeaderLines v_headers; - var HttpMessage v_response; // Test control - if (not(PICS_MEC_PLAT) or not(PICS_LOCATION_API_SUPPORTED)) { - log("*** " & testcasename() & ": PICS_MEC_PLAT and PICS_LOCATION_API_SUPPORTED required for executing the TC ***"); + if (not(PICS_MEC_PLAT) or not(PICS_SERVICES) or not(PICS_LOCATION_API_SUPPORTED)) { + log("*** " & testcasename() & ": PICS_MEC_PLAT and PICS_SERVICES and PICS_LOCATION_API_SUPPORTED required for executing the TC ***"); setverdict(inconc); stop; } @@ -84,7 +80,7 @@ module AtsMec_LocationAPI_TestCases { mw_user_info(PX_USER, PX_ACCESS_POINT_ID, PX_ZONE_ID, PX_RESOURCE_URL), * } - )))))) -> value v_response { + )))))) { log("*** " & testcasename() & ": PASS: IUT successfully responds with a ZoneId ***"); f_selfOrClientSyncAndVerdict(c_tbDone, e_success); } @@ -106,11 +102,10 @@ module AtsMec_LocationAPI_TestCases { testcase TC_MEC_SRV_UELOC_001_BR() runs on HttpComponent system HttpTestAdapter { // Local variables var HeaderLines v_headers; - var HttpMessage v_response; // Test control - if (not(PICS_MEC_PLAT) or not(PICS_LOCATION_API_SUPPORTED)) { - log("*** " & testcasename() & ": PICS_MEC_PLAT and PICS_LOCATION_API_SUPPORTED required for executing the TC ***"); + if (not(PICS_MEC_PLAT) or not(PICS_SERVICES) or not(PICS_LOCATION_API_SUPPORTED)) { + log("*** " & testcasename() & ": PICS_MEC_PLAT and PICS_SERVICES and PICS_LOCATION_API_SUPPORTED required for executing the TC ***"); setverdict(inconc); stop; } @@ -138,7 +133,7 @@ module AtsMec_LocationAPI_TestCases { [] httpPort.receive( mw_http_response( mw_http_response_400_bad_request - )) -> value v_response { + )) { log("*** " & testcasename() & ": PASS: IUT successfully responds with 400 Bad Request ***"); f_selfOrClientSyncAndVerdict(c_tbDone, e_success); } @@ -160,11 +155,10 @@ module AtsMec_LocationAPI_TestCases { testcase TC_MEC_SRV_UELOC_001_NF() runs on HttpComponent system HttpTestAdapter { // Local variables var HeaderLines v_headers; - var HttpMessage v_response; // Test control - if (not(PICS_MEC_PLAT) or not(PICS_LOCATION_API_SUPPORTED)) { - log("*** " & testcasename() & ": PICS_MEC_PLAT and PICS_LOCATION_API_SUPPORTED required for executing the TC ***"); + if (not(PICS_MEC_PLAT) or not(PICS_SERVICES) or not(PICS_LOCATION_API_SUPPORTED)) { + log("*** " & testcasename() & ": PICS_MEC_PLAT and PICS_SERVICES and PICS_LOCATION_API_SUPPORTED required for executing the TC ***"); setverdict(inconc); stop; } @@ -192,7 +186,7 @@ module AtsMec_LocationAPI_TestCases { [] httpPort.receive( mw_http_response( mw_http_response_404_not_found - )) -> value v_response { + )) { log("*** " & testcasename() & ": PASS: IUT successfully responds with a 404 Not Found ***"); f_selfOrClientSyncAndVerdict(c_tbDone, e_success); } @@ -218,11 +212,10 @@ module AtsMec_LocationAPI_TestCases { testcase TC_MEC_PLAT_LOCSUB_001_OK() runs on HttpComponent system HttpTestAdapter { // Local variables var HeaderLines v_headers; - var HttpMessage v_response; // Test control - if (not(PICS_MEC_PLAT) or not(PICS_LOCATION_API_SUPPORTED)) { - log("*** " & testcasename() & ": PICS_MEC_PLAT and PICS_LOCATION_API_SUPPORTED required for executing the TC ***"); + if (not(PICS_MEC_PLAT) or not(PICS_SERVICES) or not(PICS_LOCATION_API_SUPPORTED)) { + log("*** " & testcasename() & ": PICS_MEC_PLAT and PICS_SERVICES and PICS_LOCATION_API_SUPPORTED required for executing the TC ***"); setverdict(inconc); stop; } @@ -265,7 +258,7 @@ module AtsMec_LocationAPI_TestCases { PX_CLIENT_ID, PX_CALLBACK_REF_URL, PX_USER - )))))) -> value v_response { + )))))) { log("*** " & testcasename() & ": PASS: IUT successfully responds with a ressourceURL ***"); f_selfOrClientSyncAndVerdict(c_tbDone, e_success); } @@ -286,11 +279,10 @@ module AtsMec_LocationAPI_TestCases { testcase TC_MEC_PLAT_LOCSUB_002_OK() runs on HttpComponent system HttpTestAdapter { // Local variables var HeaderLines v_headers; - var HttpMessage v_response; // Test control - if (not(PICS_MEC_PLAT) or not(PICS_LOCATION_API_SUPPORTED)) { - log("*** " & testcasename() & ": PICS_MEC_PLAT and PICS_LOCATION_API_SUPPORTED required for executing the TC ***"); + if (not(PICS_MEC_PLAT) or not(PICS_SERVICES) or not(PICS_LOCATION_API_SUPPORTED)) { + log("*** " & testcasename() & ": PICS_MEC_PLAT and PICS_SERVICES and PICS_LOCATION_API_SUPPORTED required for executing the TC ***"); setverdict(inconc); stop; } @@ -318,7 +310,7 @@ module AtsMec_LocationAPI_TestCases { [] httpPort.receive( mw_http_response( mw_http_response_ok - )) -> value v_response { + )) { log("*** " & testcasename() & ": PASS: IUT successfully cancel subscription ***"); f_selfOrClientSyncAndVerdict(c_tbDone, e_success); } diff --git a/ttcn/AtsMec/AtsMec_TestControl.ttcn b/ttcn/AtsMec/AtsMec_TestControl.ttcn index cf55fd45273e711bf989cf39af9d7c6f4d7471bd..1004ac9eb9408bdac83c38e7c83c2d380126c4a1 100644 --- a/ttcn/AtsMec/AtsMec_TestControl.ttcn +++ b/ttcn/AtsMec/AtsMec_TestControl.ttcn @@ -22,7 +22,7 @@ module AtsMec_TestControl { control { - if (PICS_MEC_PLAT) { + if (PICS_MEC_PLAT and PICS_SERVICES) { if (PICS_LOCATION_API_SUPPORTED) { execute(TC_MEC_SRV_UELOC_001_OK()); execute(TC_MEC_SRV_UELOC_001_BR()); @@ -38,8 +38,9 @@ module AtsMec_TestControl { execute(TC_MEC_PLAT_UETAG_003_OK()); execute(TC_MEC_PLAT_UETAG_001_BI()); execute(TC_MEC_PLAT_UETAG_002_BI()); - execute(TP_MEC_PLAT_UETAG_003_BI()); + execute(TC_MEC_PLAT_UETAG_003_BI()); execute(TP_MEC_PLAT_UETAG_004_BI()); + execute(TP_MEC_PLAT_UETAG_005_BI()); } } diff --git a/ttcn/AtsMec/AtsMec_UEidentityAPI_TestCases.ttcn b/ttcn/AtsMec/AtsMec_UEidentityAPI_TestCases.ttcn index 15ff8bd8e57f456bbc7191d3998528560ae9c6ac..0c488622c409924aaa35c22c16a1c9950ae1fd6c 100644 --- a/ttcn/AtsMec/AtsMec_UEidentityAPI_TestCases.ttcn +++ b/ttcn/AtsMec/AtsMec_UEidentityAPI_TestCases.ttcn @@ -12,8 +12,6 @@ module AtsMec_UEidentityAPI_TestCases { // Libcommon - import from LibCommon_Time all; - import from LibCommon_VerdictControl all; import from LibCommon_Sync all; // LibHttp @@ -24,7 +22,6 @@ module AtsMec_UEidentityAPI_TestCases { import from LibItsHttp_TestSystem all; // LibMec_UEidentityAPI - import from UEidentityAPI_TypesAndValues all; import from UEidentityAPI_Templates all; import from UEidentityAPI_Pics all; import from UEidentityAPI_Pixits all; @@ -34,20 +31,19 @@ module AtsMec_UEidentityAPI_TestCases { import from LibMec_Pics all; import from LibMec_Pixits all; - group me_app_role { + group ueIdentity { /** - * @desc Check that the IUT responds with a list for the location of User Equipments when queried by a MEC Application - * @see https://forge.etsi.org/gitlab/mec/MEC-tests/blob/master/Test%20Purposes/Plat/Mp1/UeIdentity/PlatUeIdentity.tplan2 + * @desc Check that the IUT responds with the information on a UE Identity tag when queried by a MEC Application + * @see https://forge.etsi.org/gitlab/mec/MEC-tests/blob/master/Test%20Purposes/SRV/UeIdentity/PlatUeIdentity.tplan2 */ testcase TC_MEC_PLAT_UETAG_001_OK() runs on HttpComponent system HttpTestAdapter { // Local variables var HeaderLines v_headers; - var HttpMessage v_response; // Test control - if (not(PICS_MEC_PLAT) or not(PICS_UE_IDENTITY_API_SUPPORTED)) { - log("*** " & testcasename() & ": PICS_MEC_PLAT and PICS_LOCATION_API_SUPPORTED required for executing the TC ***"); + if (not(PICS_MEC_PLAT) or not(PICS_SERVICES) or not(PICS_UE_IDENTITY_API_SUPPORTED)) { + log("*** " & testcasename() & ": PICS_MEC_PLAT and PICS_SERVICES and PICS_LOCATION_API_SUPPORTED required for executing the TC ***"); setverdict(inconc); stop; } @@ -80,7 +76,7 @@ module AtsMec_UEidentityAPI_TestCases { mw_ue_identity_tag_info( { *, mw_ue_identity_tag_item(PX_UE_IDENTITY_TAG), * } - )))))) -> value v_response { + )))))) { log("*** " & testcasename() & ": PASS: IUT successfully responds with a UeIdentityTag ***"); f_selfOrClientSyncAndVerdict(c_tbDone, e_success); } @@ -96,12 +92,11 @@ module AtsMec_UEidentityAPI_TestCases { /** * @desc Check that the IUT registers a tag (representing a UE) or a list of tags when commanded by a MEC Application - * @see https://forge.etsi.org/gitlab/mec/MEC-tests/blob/master/Test%20Purposes/Plat/Mp1/UeIdentity/PlatUeIdentity.tplan2 + * @see https://forge.etsi.org/gitlab/mec/MEC-tests/blob/master/Test%20Purposes/SRV/UeIdentity/PlatUeIdentity.tplan2 */ testcase TC_MEC_PLAT_UETAG_002_OK() runs on HttpComponent system HttpTestAdapter { // Local variables var HeaderLines v_headers; - var HttpMessage v_response; // Test control if (not(PICS_MEC_PLAT) or not(PICS_UE_IDENTITY_API_SUPPORTED)) { @@ -117,6 +112,11 @@ module AtsMec_UEidentityAPI_TestCases { // Preamble f_init_default_headers_list(-, -, v_headers); + // Verify that the user is not register yet + if (f_check_user_register_state(-, v_headers) != 0) { + log("*** " & testcasename() & ": INCONC: Wrong initial conditions ***"); + f_selfOrClientSyncAndVerdict(c_prDone, e_timeout); + } httpPort.send( m_http_request( m_http_request_post( @@ -149,9 +149,14 @@ module AtsMec_UEidentityAPI_TestCases { mw_body_json_ue_identity_tag_info( mw_ue_identity_tag_info( { *, mw_ue_identity_tag_item(PX_UE_IDENTITY_TAG, REGISTERED), * } - )))))) -> value v_response { - log("*** " & testcasename() & ": PASS: IUT successfully responds with a UeIdentityTag ***"); - f_selfOrClientSyncAndVerdict(c_tbDone, e_success); + )))))) { + if (f_check_user_register_state(-, v_headers) == 1) { + log("*** " & testcasename() & ": PASS: IUT successfully registered the tag ***"); + f_selfOrClientSyncAndVerdict(c_tbDone, e_success); + } else { + log("*** " & testcasename() & ": FAIL: The tag was not registered ***"); + f_selfOrClientSyncAndVerdict(c_tbDone, e_error); + } } [] tc_ac.timeout { log("*** " & testcasename() & ": INCONC: Expected message not received ***"); @@ -165,12 +170,11 @@ module AtsMec_UEidentityAPI_TestCases { /** * @desc Check that the IUT deregisters a tag (representing a UE) or a list of tags when commanded by a MEC Application - * @see https://forge.etsi.org/gitlab/mec/MEC-tests/blob/master/Test%20Purposes/Plat/Mp1/UeIdentity/PlatUeIdentity.tplan2 + * @see https://forge.etsi.org/gitlab/mec/MEC-tests/blob/master/Test%20Purposes/SRV/UeIdentity/PlatUeIdentity.tplan2 */ testcase TC_MEC_PLAT_UETAG_003_OK() runs on HttpComponent system HttpTestAdapter { // Local variables var HeaderLines v_headers; - var HttpMessage v_response; // Test control if (not(PICS_MEC_PLAT) or not(PICS_UE_IDENTITY_API_SUPPORTED)) { @@ -186,6 +190,11 @@ module AtsMec_UEidentityAPI_TestCases { // Preamble f_init_default_headers_list(-, -, v_headers); + // Verify that the user is not register yet + if (f_check_user_register_state(-, v_headers) != 1) { + log("*** " & testcasename() & ": INCONC: Wrong initial conditions ***"); + f_selfOrClientSyncAndVerdict(c_prDone, e_timeout); + } httpPort.send( m_http_request( m_http_request_post( @@ -218,9 +227,14 @@ module AtsMec_UEidentityAPI_TestCases { mw_body_json_ue_identity_tag_info( mw_ue_identity_tag_info( { *, mw_ue_identity_tag_item(PX_UE_IDENTITY_TAG, UNREGISTERED), * } - )))))) -> value v_response { - log("*** " & testcasename() & ": PASS: IUT successfully responds with a UeIdentityTag ***"); - f_selfOrClientSyncAndVerdict(c_tbDone, e_success); + )))))) { + if (f_check_user_register_state(-, v_headers) == 0) { + log("*** " & testcasename() & ": PASS: IUT successfully unregistered the tag ***"); + f_selfOrClientSyncAndVerdict(c_tbDone, e_success); + } else { + log("*** " & testcasename() & ": FAIL: The tag was not unregistered ***"); + f_selfOrClientSyncAndVerdict(c_tbDone, e_error); + } } [] tc_ac.timeout { log("*** " & testcasename() & ": INCONC: Expected message not received ***"); @@ -234,16 +248,15 @@ module AtsMec_UEidentityAPI_TestCases { /** * @desc Check that the IUT responds with an error when a request with incorrect parameters is sent by a MEC Application - * @see https://forge.etsi.org/gitlab/mec/MEC-tests/blob/master/Test%20Purposes/Plat/Mp1/UeIdentity/PlatUeIdentity.tplan2 + * @see https://forge.etsi.org/gitlab/mec/MEC-tests/blob/master/Test%20Purposes/SRV/UeIdentity/PlatUeIdentity.tplan2 */ testcase TC_MEC_PLAT_UETAG_001_BI() runs on HttpComponent system HttpTestAdapter { // Local variables var HeaderLines v_headers; - var HttpMessage v_response; // Test control - if (not(PICS_MEC_PLAT) or not(PICS_UE_IDENTITY_API_SUPPORTED)) { - log("*** " & testcasename() & ": PICS_MEC_PLAT and PICS_LOCATION_API_SUPPORTED required for executing the TC ***"); + if (not(PICS_MEC_PLAT) or not (PICS_SERVICES) or not(PICS_UE_IDENTITY_API_SUPPORTED)) { + log("*** " & testcasename() & ": PICS_MEC_PLAT and PICS_SERVICES and PICS_LOCATION_API_SUPPORTED required for executing the TC ***"); setverdict(inconc); stop; } @@ -275,7 +288,7 @@ module AtsMec_UEidentityAPI_TestCases { mw_body_json_ue_identity_problem_details( mw_problem_details( -, -, 400 - )))))) -> value v_response { + )))))) { log("*** " & testcasename() & ": PASS: IUT successfully responds with a ProblemDetails set to 400 Bad Request ***"); f_selfOrClientSyncAndVerdict(c_tbDone, e_success); } @@ -291,16 +304,15 @@ module AtsMec_UEidentityAPI_TestCases { /** * @desc Check that the IUT responds with an error when an unauthorised request is sent by a MEC Application - * @see https://forge.etsi.org/gitlab/mec/MEC-tests/blob/master/Test%20Purposes/Plat/Mp1/UeIdentity/PlatUeIdentity.tplan2 + * @see https://forge.etsi.org/gitlab/mec/MEC-tests/blob/master/Test%20Purposes/SRV/UeIdentity/PlatUeIdentity.tplan2 */ testcase TC_MEC_PLAT_UETAG_002_BI() runs on HttpComponent system HttpTestAdapter { // Local variables var HeaderLines v_headers; - var HttpMessage v_response; // Test control - if (not(PICS_MEC_PLAT) or not(PICS_UE_IDENTITY_API_SUPPORTED)) { - log("*** " & testcasename() & ": PICS_MEC_PLAT and PICS_LOCATION_API_SUPPORTED required for executing the TC ***"); + if (not(PICS_MEC_PLAT) or not(PICS_SERVICES) or not(PICS_UE_IDENTITY_API_SUPPORTED)) { + log("*** " & testcasename() & ": PICS_MEC_PLAT and PICS_SERVICES and PICS_LOCATION_API_SUPPORTED required for executing the TC ***"); setverdict(inconc); stop; } @@ -332,7 +344,7 @@ module AtsMec_UEidentityAPI_TestCases { mw_body_json_ue_identity_problem_details( mw_problem_details( -, -, 403 - )))))) -> value v_response { + )))))) { log("*** " & testcasename() & ": PASS: IUT successfully responds with a ProblemDetails set to 403 Forbidden ***"); f_selfOrClientSyncAndVerdict(c_tbDone, e_success); } @@ -348,16 +360,15 @@ module AtsMec_UEidentityAPI_TestCases { /** * @desc Check that the IUT responds with an error when a request for an URI that cannot be mapped to a valid resource URI is sent by a MEC Application - * @see https://forge.etsi.org/gitlab/mec/MEC-tests/blob/master/Test%20Purposes/Plat/Mp1/UeIdentity/PlatUeIdentity.tplan2 + * @see https://forge.etsi.org/gitlab/mec/MEC-tests/blob/master/Test%20Purposes/SRV/UeIdentity/PlatUeIdentity.tplan2 */ testcase TC_MEC_PLAT_UETAG_003_BI() runs on HttpComponent system HttpTestAdapter { // Local variables var HeaderLines v_headers; - var HttpMessage v_response; // Test control - if (not(PICS_MEC_PLAT) or not(PICS_UE_IDENTITY_API_SUPPORTED)) { - log("*** " & testcasename() & ": PICS_MEC_PLAT and PICS_LOCATION_API_SUPPORTED required for executing the TC ***"); + if (not(PICS_MEC_PLAT) or not(PICS_SERVICES) or not(PICS_UE_IDENTITY_API_SUPPORTED)) { + log("*** " & testcasename() & ": PICS_MEC_PLAT and PICS_SERVICES and PICS_LOCATION_API_SUPPORTED required for executing the TC ***"); setverdict(inconc); stop; } @@ -372,7 +383,7 @@ module AtsMec_UEidentityAPI_TestCases { httpPort.send( m_http_request( m_http_request_get( - PX_ME_APP_Q_UE_IDENTITY_ID_URI & oct2char(unichar2oct(PX_NON_EXISTENT_APP_INSTANCE_ID, "UTF-8")) & "/ue_identity_tag_info?ueIdentityTag=" & oct2char(unichar2oct(PX_UE_IDENTITY_TAG, "UTF-8")), + PX_ME_APP_Q_UE_IDENTITY_ID_URI & oct2char(unichar2oct(PX_APP_INSTANCE_ID, "UTF-8")) & "/ue_identity_tag_info?ueIdentityTag=" & oct2char(unichar2oct(PX_UE_IDENTITY_TAG_UNKNOWN, "UTF-8")), v_headers ) ) @@ -389,7 +400,7 @@ module AtsMec_UEidentityAPI_TestCases { mw_body_json_ue_identity_problem_details( mw_problem_details( -, -, 404 - )))))) -> value v_response { + )))))) { log("*** " & testcasename() & ": PASS: IUT successfully responds with a ProblemDetails set to 404 Not Found ***"); f_selfOrClientSyncAndVerdict(c_tbDone, e_success); } @@ -405,16 +416,15 @@ module AtsMec_UEidentityAPI_TestCases { /** * @desc Check that the IUT responds with ProblemDetails on information an invalid URI - * @see https://forge.etsi.org/gitlab/mec/MEC-tests/blob/master/Test%20Purposes/Plat/Mp1/UeIdentity/PlatUeIdentity.tplan2 + * @see https://forge.etsi.org/gitlab/mec/MEC-tests/blob/master/Test%20Purposes/SRV/UeIdentity/PlatUeIdentity.tplan2 */ - testcase TP_MEC_PLAT_UETAG_003_BI() runs on HttpComponent system HttpTestAdapter { + testcase TP_MEC_PLAT_UETAG_004_BI() runs on HttpComponent system HttpTestAdapter { // Local variables var HeaderLines v_headers; - var HttpMessage v_response; // Test control - if (not(PICS_MEC_PLAT) or not(PICS_UE_IDENTITY_API_SUPPORTED)) { - log("*** " & testcasename() & ": PICS_MEC_PLAT and PICS_LOCATION_API_SUPPORTED required for executing the TC ***"); + if (not(PICS_MEC_PLAT) or not(PICS_SERVICES) or not(PICS_UE_IDENTITY_API_SUPPORTED)) { + log("*** " & testcasename() & ": PICS_MEC_PLAT and PICS_SERVICES and PICS_LOCATION_API_SUPPORTED required for executing the TC ***"); setverdict(inconc); stop; } @@ -426,12 +436,29 @@ module AtsMec_UEidentityAPI_TestCases { // Preamble f_init_default_headers_list(-, -, v_headers); + // Verify that the user is not register yet + if (f_check_user_register_state(-, v_headers) != 0) { + log("*** " & testcasename() & ": INCONC: Wrong initial conditions ***"); + f_selfOrClientSyncAndVerdict(c_prDone, e_timeout); + } httpPort.send( m_http_request( - m_http_request_get( - PX_ME_APP_Q_UE_IDENTITY_ID_URI & oct2char(unichar2oct(PX_APP_INSTANCE_ID, "UTF-8")) & "/ue_identity_tag_information?ueIdentityTag=" & oct2char(unichar2oct(PX_UE_IDENTITY_TAG, "UTF-8")), - v_headers - ) + m_http_request_post( + PX_ME_APP_Q_UE_IDENTITY_ID_URI & oct2char(unichar2oct(PX_APP_INSTANCE_ID, "UTF-8")) & "/ue_identity_tag_info", + v_headers, + m_http_message_body_json( + m_body_json_ue_identity_tag_info( + m_ue_identity_tag_info( + { + m_ue_identity_tag_item( + PX_UE_IDENTITY_TAG, + UNREGISTERED + ) + } + ) + ) + ) + ) ) ); f_selfOrClientSyncAndVerdict(c_prDone, e_success); @@ -446,7 +473,7 @@ module AtsMec_UEidentityAPI_TestCases { mw_body_json_ue_identity_problem_details( mw_problem_details( -, -, 400 - )))))) -> value v_response { + )))))) { log("*** " & testcasename() & ": PASS: IUT successfully responds with a ProblemDetails set to 404 Not Found ***"); f_selfOrClientSyncAndVerdict(c_tbDone, e_success); } @@ -458,20 +485,19 @@ module AtsMec_UEidentityAPI_TestCases { // Postamble f_cf_01_http_down(); - } // End of testcase TP_MEC_PLAT_UETAG_003_BI + } // End of testcase TP_MEC_PLAT_UETAG_004_BI /** * @desc Check that the IUT responds with an error when an unauthorised request is sent by a MEC Application - * @see https://forge.etsi.org/gitlab/mec/MEC-tests/blob/master/Test%20Purposes/Plat/Mp1/UeIdentity/PlatUeIdentity.tplan2 + * @see https://forge.etsi.org/gitlab/mec/MEC-tests/blob/master/Test%20Purposes/SRV/UeIdentity/PlatUeIdentity.tplan2 */ - testcase TP_MEC_PLAT_UETAG_004_BI() runs on HttpComponent system HttpTestAdapter { + testcase TP_MEC_PLAT_UETAG_005_BI() runs on HttpComponent system HttpTestAdapter { // Local variables var HeaderLines v_headers; - var HttpMessage v_response; // Test control - if (not(PICS_MEC_PLAT) or not(PICS_UE_IDENTITY_API_SUPPORTED)) { - log("*** " & testcasename() & ": PICS_MEC_PLAT and PICS_LOCATION_API_SUPPORTED required for executing the TC ***"); + if (not(PICS_MEC_PLAT) or not(PICS_SERVICES) or not(PICS_UE_IDENTITY_API_SUPPORTED)) { + log("*** " & testcasename() & ": PICS_MEC_PLAT and PICS_SERVICES and PICS_LOCATION_API_SUPPORTED required for executing the TC ***"); setverdict(inconc); stop; } @@ -483,6 +509,11 @@ module AtsMec_UEidentityAPI_TestCases { // Preamble f_init_default_headers_list(-, -, v_headers); + // Verify that the user is not register yet + if (f_check_user_register_state(-, v_headers) != 1) { + log("*** " & testcasename() & ": INCONC: Wrong initial conditions ***"); + f_selfOrClientSyncAndVerdict(c_prDone, e_timeout); + } httpPort.send( m_http_request( m_http_request_post( @@ -494,7 +525,7 @@ module AtsMec_UEidentityAPI_TestCases { { m_ue_identity_tag_item( PX_UE_IDENTITY_TAG, - INVALID_STATE + REGISTERED ) } ) @@ -515,7 +546,7 @@ module AtsMec_UEidentityAPI_TestCases { mw_body_json_ue_identity_problem_details( mw_problem_details( -, -, 400 - )))))) -> value v_response { + )))))) { log("*** " & testcasename() & ": PASS: IUT successfully responds with a ProblemDetails set to 400 Bad Request ***"); f_selfOrClientSyncAndVerdict(c_tbDone, e_success); } @@ -527,8 +558,8 @@ module AtsMec_UEidentityAPI_TestCases { // Postamble f_cf_01_http_down(); - } // End of testcase TP_MEC_PLAT_UETAG_004_BI + } // End of testcase TP_MEC_PLAT_UETAG_005_BI - } // End of group me_app_role + } // End of group ueIdentity } // End of module AtsMec_TestCases diff --git a/ttcn/LibMec/ttcn/LibMec_Functions.ttcn b/ttcn/LibMec/ttcn/LibMec_Functions.ttcn index d9f9276d78cbcf06d463ac81b78b80f857adfbf7..b9e4801795c635e0532af1b413b936b320413eec 100644 --- a/ttcn/LibMec/ttcn/LibMec_Functions.ttcn +++ b/ttcn/LibMec/ttcn/LibMec_Functions.ttcn @@ -1,14 +1,22 @@ module LibMec_Functions { // Libcommon - import from LibCommon_Time all; - import from LibCommon_VerdictControl all; import from LibCommon_Sync all; + // LibMec + import from LibMec_Pixits all; + + // LibMec_UEidentityAPI + import from UEidentityAPI_TypesAndValues all; + import from UEidentityAPI_Templates all; + import from UEidentityAPI_Pixits all; + // LibHttp import from LibItsHttp_TypesAndValues all; import from LibItsHttp_Templates all; import from LibItsHttp_TestSystem all; + import from LibItsHttp_Templates all; + import from LibItsHttp_JsonTemplates all; group preambles { @@ -60,6 +68,60 @@ module LibMec_Functions { } // End of group postambles + group helpers { + + /** + * @desc Check if the user is registered or not + * @param + * @return 0 if unregistered, 1 if registered, -1 otherwise + */ + function f_check_user_register_state( + in UeIdentityTag p_ue_identity_tag := PX_UE_IDENTITY_TAG, + in HeaderLines p_headers + ) runs on HttpComponent return integer { + var HttpMessage v_response; + var integer v_result := -1; + + httpPort.send( + m_http_request( + m_http_request_get( + PX_ME_APP_Q_UE_IDENTITY_ID_URI & oct2char(unichar2oct(PX_APP_INSTANCE_ID, "UTF-8")) & "/ue_identity_tag_info?ueIdentityTag=" & oct2char(unichar2oct(p_ue_identity_tag, "UTF-8")), + p_headers + ) + ) + ); + + // Test Body + tc_ac.start; + alt { + [] httpPort.receive( + mw_http_response( + mw_http_response_ok( + mw_http_message_body_json( + mw_body_json_ue_identity_tag_info( + mw_ue_identity_tag_info( + { *, mw_ue_identity_tag_item(PX_UE_IDENTITY_TAG), * } + )))))) -> value v_response { + for (var integer v_i := 0; v_i < lengthof(v_response.response.body.json_body.ueIdentityTagInfo.ueIdentityTags); v_i := v_i + 1) { + if (v_response.response.body.json_body.ueIdentityTagInfo.ueIdentityTags[v_i].ueIdentityTag == p_ue_identity_tag) { + if (v_response.response.body.json_body.ueIdentityTagInfo.ueIdentityTags[v_i].state == UNREGISTERED) { + v_result := 0; + } else { + v_result := 1; + } + break; + } + } + } + [] tc_ac.timeout { + } + } // End of 'alt' statement + + return v_result; + } // End of function f_check_user_register_state + + } // End of group helpers + group altsteps { altstep a_default_requests() runs on HttpComponent {