From 651d6feba49b9d6f579f362a43f93936be230fa9 Mon Sep 17 00:00:00 2001 From: YannGarcia Date: Wed, 19 Jun 2019 01:45:49 -0700 Subject: [PATCH] Review UEidentityAPI tests --- ttcn/AtsMec/AtsMec_TestControl.ttcn | 14 +- .../AtsMec_UEidentityAPI_TestCases.ttcn | 141 +++++++++++++----- .../ttcn/UEidentityAPI_Pixits.ttcn | 4 +- .../ttcn/UEidentityAPI_TypesAndValues.ttcn | 3 +- 4 files changed, 116 insertions(+), 46 deletions(-) diff --git a/ttcn/AtsMec/AtsMec_TestControl.ttcn b/ttcn/AtsMec/AtsMec_TestControl.ttcn index 5cdfe3a..1ca40a7 100644 --- a/ttcn/AtsMec/AtsMec_TestControl.ttcn +++ b/ttcn/AtsMec/AtsMec_TestControl.ttcn @@ -27,13 +27,13 @@ module AtsMec_TestControl { execute(TC_MEC_PLAT_MP1_LOC_BV_001()); } if (PICS_UE_IDENTITY_API_SUPPORTED) { - execute(TC_MEC_PLAT_MP1_UETAG_BV_001()); - execute(TC_MEC_PLAT_MP1_UETAG_BV_002()); - execute(TC_MEC_PLAT_MP1_UETAG_BV_003()); - execute(TC_MEC_PLAT_MP1_UETAG_BI_001()); - execute(TC_MEC_PLAT_MP1_UETAG_BI_002()); - execute(TC_MEC_PLAT_MP1_UETAG_BI_003()); - execute(TC_MEC_PLAT_MP1_UETAG_BI_004()); + execute(TC_MEC_PLAT_UETAG_001_OK()); + execute(TC_MEC_PLAT_UETAG_002_OK()); + 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(TP_MEC_PLAT_UETAG_004_BI()); } if (PICS_LOCATION_API_SUPPORTED) { execute(TC_MEC_PLAT_MP1_INF_BV_001()); diff --git a/ttcn/AtsMec/AtsMec_UEidentityAPI_TestCases.ttcn b/ttcn/AtsMec/AtsMec_UEidentityAPI_TestCases.ttcn index 016dca1..3b4554d 100644 --- a/ttcn/AtsMec/AtsMec_UEidentityAPI_TestCases.ttcn +++ b/ttcn/AtsMec/AtsMec_UEidentityAPI_TestCases.ttcn @@ -40,7 +40,7 @@ module AtsMec_UEidentityAPI_TestCases { * @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 */ - testcase TC_MEC_PLAT_MP1_UETAG_BV_001() runs on HttpComponent system HttpTestAdapter { + testcase TC_MEC_PLAT_UETAG_001_OK() runs on HttpComponent system HttpTestAdapter { // Local variables var HeaderLines v_headers; var HttpMessage v_response; @@ -92,13 +92,13 @@ module AtsMec_UEidentityAPI_TestCases { // Postamble f_cf_01_http_down(); - } // End of testcase TC_MEC_PLAT_MP1_UETAG_BV_001 + } // End of testcase TC_MEC_PLAT_UETAG_001_OK /** * @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 */ - testcase TC_MEC_PLAT_MP1_UETAG_BV_002() runs on HttpComponent system HttpTestAdapter { + testcase TC_MEC_PLAT_UETAG_002_OK() runs on HttpComponent system HttpTestAdapter { // Local variables var HeaderLines v_headers; var HttpMessage v_response; @@ -161,13 +161,13 @@ module AtsMec_UEidentityAPI_TestCases { // Postamble f_cf_01_http_down(); - } // End of testcase TC_MEC_PLAT_MP1_UETAG_BV_002 + } // End of testcase TC_MEC_PLAT_UETAG_002_OK /** * @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 */ - testcase TC_MEC_PLAT_MP1_UETAG_BV_003() runs on HttpComponent system HttpTestAdapter { + testcase TC_MEC_PLAT_UETAG_003_OK() runs on HttpComponent system HttpTestAdapter { // Local variables var HeaderLines v_headers; var HttpMessage v_response; @@ -230,13 +230,13 @@ module AtsMec_UEidentityAPI_TestCases { // Postamble f_cf_01_http_down(); - } // End of testcase TC_MEC_PLAT_MP1_UETAG_BV_003 + } // End of testcase TC_MEC_PLAT_UETAG_003_OK /** - * @desc Check that the IUT responds with ProblemDetails on information on an unknown UE Identity tag when queried by a MEC Application + * @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 */ - testcase TC_MEC_PLAT_MP1_UETAG_BI_001() runs on HttpComponent system HttpTestAdapter { + testcase TC_MEC_PLAT_UETAG_001_BI() runs on HttpComponent system HttpTestAdapter { // Local variables var HeaderLines v_headers; var HttpMessage v_response; @@ -270,13 +270,70 @@ module AtsMec_UEidentityAPI_TestCases { alt { [] httpPort.receive( mw_http_response( - mw_http_response_404_not_found( + mw_http_response_400_bad_request( + mw_http_message_body_json( + 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); + } + [] tc_ac.timeout { + log("*** " & testcasename() & ": INCONC: Expected message not received ***"); + f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout); + } + } // End of 'alt' statement + + // Postamble + f_cf_01_http_down(); + } // End of testcase TC_MEC_PLAT_UETAG_001_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 + */ + 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 ***"); + setverdict(inconc); + stop; + } + + // Test component configuration + f_cf_01_http_up(); + + // Test adapter configuration + + // Preamble + f_init_default_headers_list(-, -, v_headers); + httpPort.send( + m_http_request( + m_http_request_get( + PX_ME_APP_Q_UE_IDENTITY_ID_URI & oct2char(unichar2oct(PX_APP_INSTANCE_ID_UNAUTHORIZED, "UTF-8")) & "/ue_identity_tag_info?ueIdentityTag=" & oct2char(unichar2oct(PX_UE_IDENTITY_TAG, "UTF-8")), + v_headers + ) + ) + ); + f_selfOrClientSyncAndVerdict(c_prDone, e_success); + + // Test Body + tc_ac.start; + alt { + [] httpPort.receive( + mw_http_response( + mw_http_response_403_forbidden( mw_http_message_body_json( mw_body_json_ue_identity_problem_details( mw_problem_details( - -, -, 404 + -, -, 403 )))))) -> value v_response { - log("*** " & testcasename() & ": PASS: IUT successfully responds with a ProblemDetails set to 404 Not Found ***"); + log("*** " & testcasename() & ": PASS: IUT successfully responds with a ProblemDetails set to 403 Forbidden ***"); f_selfOrClientSyncAndVerdict(c_tbDone, e_success); } [] tc_ac.timeout { @@ -287,13 +344,13 @@ module AtsMec_UEidentityAPI_TestCases { // Postamble f_cf_01_http_down(); - } // End of testcase TC_MEC_PLAT_MP1_UETAG_BI_001 + } // End of testcase TC_MEC_PLAT_UETAG_002_BI /** - * @desc Check that the IUT responds with ProblemDetails on information an unknown Application Instance Identifier when queried by a MEC Application + * @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 */ - testcase TC_MEC_PLAT_MP1_UETAG_BI_002() runs on HttpComponent system HttpTestAdapter { + testcase TC_MEC_PLAT_UETAG_003_BI() runs on HttpComponent system HttpTestAdapter { // Local variables var HeaderLines v_headers; var HttpMessage v_response; @@ -315,7 +372,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_APP_INSTANCE_ID_UNKNOWN, "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_NON_EXISTENT_APP_INSTANCE_ID, "UTF-8")) & "/ue_identity_tag_info?ueIdentityTag=" & oct2char(unichar2oct(PX_UE_IDENTITY_TAG, "UTF-8")), v_headers ) ) @@ -344,13 +401,13 @@ module AtsMec_UEidentityAPI_TestCases { // Postamble f_cf_01_http_down(); - } // End of testcase TC_MEC_PLAT_MP1_UETAG_BI_002 + } // End of testcase TC_MEC_PLAT_UETAG_003_BI /** * @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 */ - testcase TC_MEC_PLAT_MP1_UETAG_BI_003() runs on HttpComponent system HttpTestAdapter { + testcase TP_MEC_PLAT_UETAG_003_BI() runs on HttpComponent system HttpTestAdapter { // Local variables var HeaderLines v_headers; var HttpMessage v_response; @@ -401,37 +458,49 @@ module AtsMec_UEidentityAPI_TestCases { // Postamble f_cf_01_http_down(); - } // End of testcase TC_MEC_PLAT_MP1_UETAG_BI_003 + } // End of testcase TP_MEC_PLAT_UETAG_003_BI /** - * @desc Check that the IUT responds with ProblemDetails on information on not allowed request + * @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 */ - testcase TC_MEC_PLAT_MP1_UETAG_BI_004() 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 ***"); setverdict(inconc); stop; } - + // Test component configuration f_cf_01_http_up(); - + // Test adapter configuration - + // Preamble f_init_default_headers_list(-, -, v_headers); httpPort.send( m_http_request( - m_http_request_get( - PX_ME_APP_Q_UE_IDENTITY_ID_URI & oct2char(unichar2oct(APP_INSTANCE_ID_WITH_RESTRICTED_ACCESS, "UTF-8")) & "/ue_identity_tag_info?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, + INVALID_STATE + ) + } + ) + ) + ) + ) ) ); f_selfOrClientSyncAndVerdict(c_prDone, e_success); @@ -441,13 +510,13 @@ module AtsMec_UEidentityAPI_TestCases { alt { [] httpPort.receive( mw_http_response( - mw_http_response_403_forbidden( - mw_http_message_body_json( - 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 404 Not Found ***"); + mw_http_response_400_bad_request( + mw_http_message_body_json( + 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); } [] tc_ac.timeout { @@ -458,7 +527,7 @@ module AtsMec_UEidentityAPI_TestCases { // Postamble f_cf_01_http_down(); - } // End of testcase TC_MEC_PLAT_MP1_UETAG_BI_004 + } // End of testcase TP_MEC_PLAT_UETAG_004_BI } // End of group me_app_role diff --git a/ttcn/LibMec/UEidentityAPI/ttcn/UEidentityAPI_Pixits.ttcn b/ttcn/LibMec/UEidentityAPI/ttcn/UEidentityAPI_Pixits.ttcn index f513896..947bc9a 100644 --- a/ttcn/LibMec/UEidentityAPI/ttcn/UEidentityAPI_Pixits.ttcn +++ b/ttcn/LibMec/UEidentityAPI/ttcn/UEidentityAPI_Pixits.ttcn @@ -8,9 +8,9 @@ module UEidentityAPI_Pixits { modulepar universal charstring PX_APP_INSTANCE_ID := "appInst01"; - modulepar universal charstring PX_APP_INSTANCE_ID_UNKNOWN := "appInst99"; + modulepar universal charstring PX_NON_EXISTENT_APP_INSTANCE_ID := "appInst99"; - modulepar universal charstring APP_INSTANCE_ID_WITH_RESTRICTED_ACCESS := "appInst98"; + modulepar universal charstring PX_APP_INSTANCE_ID_UNAUTHORIZED := "appInst98"; modulepar universal charstring PX_UE_IDENTITY_TAG := "UeTagA"; diff --git a/ttcn/LibMec/UEidentityAPI/ttcn/UEidentityAPI_TypesAndValues.ttcn b/ttcn/LibMec/UEidentityAPI/ttcn/UEidentityAPI_TypesAndValues.ttcn index 77007fb..03a2aab 100644 --- a/ttcn/LibMec/UEidentityAPI/ttcn/UEidentityAPI_TypesAndValues.ttcn +++ b/ttcn/LibMec/UEidentityAPI/ttcn/UEidentityAPI_TypesAndValues.ttcn @@ -56,7 +56,8 @@ module UEidentityAPI_TypesAndValues { */ type enumerated State { UNREGISTERED, - REGISTERED + REGISTERED, + INVALID_STATE // Used for BI tests } /** -- GitLab