/** * @author ETSI / STF569 * @version $URL:$ * $ID:$ * @desc This module provides the MEC test cases. * @copyright ETSI Copyright Notification * No part may be reproduced except as authorized by written permission. * The copyright and the foregoing restriction extend to reproduction in all media. * All rights reserved. * @see ETSI GS MEC 003, Draft ETSI GS MEC 013 V2.0.3 (2018-10) */ module AtsMec_UEAppInterfaceAPI_TestCases { // Libcommon import from LibCommon_Sync all; // LibHttp import from LibItsHttp_TypesAndValues all; import from LibItsHttp_Functions all; import from LibItsHttp_Templates all; import from LibItsHttp_JsonTemplates all; import from LibItsHttp_TestSystem all; // LibMec/UEAppInterfaceAPI import from UEAppInterfaceAPI_Templates all; import from UEAppInterfaceAPI_Functions all; import from UEAppInterfaceAPI_Pics all; import from UEAppInterfaceAPI_Pixits all; // LibMec import from LibMec_Functions all; import from LibMec_Pics all; import from LibMec_Pixits all; group ue_app_ctx { /** * @desc Check that the IUT acknowledges the creation of the application context when requested by an UE Application * @see https://forge.etsi.org/rep/mec/gs032p2-test-purposes/blob/master/Test%20Purposes/MEO/UEAPPCTX/SysUeAppsContext.tplan2 */ testcase TC_MEC_MEO_UEAPPCTX_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_SERVICES) or not(PICS_ENABLE_UE_APP_CTX)) { log("*** " & testcasename() & ": PICS_MEC_PLAT and PICS_SERVICES and PICS_ENABLE_UE_APP_CTX 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_post( "/" & PICS_ROOT_API & PX_UE_APP_CTX_URI, v_headers, m_http_message_body_json( m_body_json_app_context( m_app_context( PX_CONTEXT_ID, PX_ASSOCIATE_UE_APP_ID, m_required_app_info( PX_APP_NAME, PX_APP_PROVIDER, PX_REFERENCE_URL ))))))); f_selfOrClientSyncAndVerdict(c_prDone, e_success); // Test Body tc_ac.start; alt { [] httpPort.receive( mw_http_response( mw_http_response_201_created( mw_http_message_body_json( mw_body_json_app_context( mw_app_context( -, -, mw_required_app_info( PX_APP_NAME ))))))) -> value v_response { tc_ac.stop; if (f_check_headers(v_response.response.header) == true) { log("*** " & testcasename() & ": PASS: IUT successfully responds with a AppContext ***"); f_selfOrClientSyncAndVerdict(c_tbDone, e_success); } else { log("*** " & testcasename() & ": FAIL: Header 'Location' was not present in the response headers ***"); f_selfOrClientSyncAndVerdict(c_tbDone, e_error); } } [] 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_MEO_UEAPPCTX_001_OK /** * @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/rep/mec/gs032p2-test-purposes/blob/master/Test%20Purposes/MEO/UEAPPCTX/SysUeAppsContext.tplan2 */ testcase TC_MEC_MEO_UEAPPCTX_001_BR() runs on HttpComponent system HttpTestAdapter { // Local variables var HeaderLines v_headers; // Test control if (not(PICS_MEC_PLAT) or not(PICS_SERVICES) or not(PICS_ENABLE_UE_APP_CTX)) { log("*** " & testcasename() & ": PICS_MEC_PLAT and PICS_SERVICES and PICS_ENABLE_UE_APP_CTX 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_post( "/" & PICS_ROOT_API & PX_UE_APP_CTX_URI, v_headers, m_http_message_body_json( m_body_json_app_context( m_app_context( PX_CONTEXT_ID, PX_ASSOCIATE_UE_APP_ID, m_required_app_info( PX_APP_NAME, PX_APP_PROVIDER, PX_REFERENCE_URL ))))))); f_selfOrClientSyncAndVerdict(c_prDone, e_success); // Test Body tc_ac.start; alt { [] httpPort.receive( mw_http_response( mw_http_response_400_bad_request )) { tc_ac.stop; log("*** " & testcasename() & ": PASS: IUT successfully responds with a AppTerminationNotificationSubscription ***"); 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_MEO_UEAPPCTX_001_BR /** * @desc Check that the IUT updates the application callback reference when commanded by an UE Application * @see https://forge.etsi.org/rep/mec/gs032p2-test-purposes/blob/master/Test%20Purposes/MEO/UEAPPCTX/SysUeAppsContext.tplan2 */ testcase TC_MEC_MEO_UEAPPCTX_002_OK() runs on HttpComponent system HttpTestAdapter { // Local variables var HeaderLines v_headers; // Test control if (not(PICS_MEC_PLAT) or not(PICS_SERVICES) or not(PICS_ENABLE_UE_APP_CTX)) { log("*** " & testcasename() & ": PICS_MEC_PLAT and PICS_SERVICES and PICS_ENABLE_UE_APP_CTX required for executing the TC ***"); setverdict(inconc); stop; } // Test component configuration f_cf_01_http_up(); // Test adapter configuration // Preamble f_create_ue_app_ctx(); f_init_default_headers_list(-, -, v_headers); httpPort.send( m_http_request( m_http_request_post( "/" & PICS_ROOT_API & PX_UE_APP_CTX_URI & "/" & oct2char(unichar2oct(PX_CONTEXT_ID)), v_headers, m_http_message_body_json( m_body_json_app_context( m_app_context( PX_CONTEXT_ID, PX_ASSOCIATE_UE_APP_ID, m_required_app_info( PX_APP_NAME, PX_APP_PROVIDER, PX_REFERENCE_URL ), PX_CALLBACK_REF )))))); f_selfOrClientSyncAndVerdict(c_prDone, e_success); // Test Body tc_ac.start; alt { [] httpPort.receive( mw_http_response( mw_http_response_204_no_content )) { tc_ac.stop; log("*** " & testcasename() & ": PASS: IUT successfully responds with a AppContext ***"); 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_delete_ue_app_ctx(); f_cf_01_http_down(); } // End of testcase TC_MEC_MEO_UEAPPCTX_002_OK /** * @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/rep/mec/gs032p2-test-purposes/blob/master/Test%20Purposes/MEO/UEAPPCTX/SysUeAppsContext.tplan2 */ testcase TC_MEC_MEO_UEAPPCTX_002_BR() runs on HttpComponent system HttpTestAdapter { // Local variables var HeaderLines v_headers; // Test control if (not(PICS_MEC_PLAT) or not(PICS_SERVICES) or not(PICS_ENABLE_UE_APP_CTX)) { log("*** " & testcasename() & ": PICS_MEC_PLAT and PICS_SERVICES and PICS_ENABLE_UE_APP_CTX 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_post( "/" & PICS_ROOT_API & PX_UE_APP_CTX_URI & "/" & oct2char(unichar2oct(PX_CONTEXT_ID)), v_headers, m_http_message_body_json( m_body_json_app_context( m_app_context( PX_CONTEXT_ID, PX_ASSOCIATE_UE_APP_ID, m_required_app_info( PX_APP_NAME, PX_APP_PROVIDER, PX_REFERENCE_URL ), PX_CALLBACK_REF )))))); f_selfOrClientSyncAndVerdict(c_prDone, e_success); // Test Body tc_ac.start; alt { [] httpPort.receive( mw_http_response( mw_http_response_400_bad_request )) { tc_ac.stop; log("*** " & testcasename() & ": PASS: IUT successfully responds with a AppContext ***"); 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_MEO_UEAPPCTX_002_BR /** * @desc Check that the IUT responds with an error when a request for an unknown URI is sent by a MEC Application * @see https://forge.etsi.org/rep/mec/gs032p2-test-purposes/blob/master/Test%20Purposes/MEO/UEAPPCTX/SysUeAppsContext.tplan2 */ testcase TC_MEC_MEO_UEAPPCTX_002_NF() runs on HttpComponent system HttpTestAdapter { // Local variables var HeaderLines v_headers; // Test control if (not(PICS_MEC_PLAT) or not(PICS_SERVICES) or not(PICS_ENABLE_UE_APP_CTX)) { log("*** " & testcasename() & ": PICS_MEC_PLAT and PICS_SERVICES and PICS_ENABLE_UE_APP_CTX 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_post( "/" & PICS_ROOT_API & PX_UE_APP_CTX_URI & "/" & oct2char(unichar2oct(PX_CONTEXT_ID)), v_headers, m_http_message_body_json( m_body_json_app_context( m_app_context( PX_NON_EXISTENT_CONTEXT_ID, PX_ASSOCIATE_UE_APP_ID, m_required_app_info( PX_APP_NAME, PX_APP_PROVIDER, PX_REFERENCE_URL ), PX_CALLBACK_REF )))))); f_selfOrClientSyncAndVerdict(c_prDone, e_success); // Test Body tc_ac.start; alt { [] httpPort.receive( mw_http_response( mw_http_response_404_not_found )) { tc_ac.stop; log("*** " & testcasename() & ": PASS: IUT successfully responds with a AppContext ***"); 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_MEO_UEAPPCTX_002_NF /** * @desc Check that the IUT deletes the application context when commanded by an UE Application * @see https://forge.etsi.org/rep/mec/gs032p2-test-purposes/blob/master/Test%20Purposes/MEO/UEAPPCTX/SysUeAppsContext.tplan2 */ testcase TC_MEC_MEO_UEAPPCTX_003_OK() runs on HttpComponent system HttpTestAdapter { // Local variables var HeaderLines v_headers; // Test control if (not(PICS_MEC_PLAT) or not(PICS_SERVICES) or not(PICS_ENABLE_UE_APP_CTX)) { log("*** " & testcasename() & ": PICS_MEC_PLAT and PICS_SERVICES and PICS_ENABLE_UE_APP_CTX required for executing the TC ***"); setverdict(inconc); stop; } // Test component configuration f_cf_01_http_up(); // Test adapter configuration // Preamble f_create_ue_app_ctx(); f_init_default_headers_list(-, -, v_headers); httpPort.send( m_http_request( m_http_request_delete( "/" & PICS_ROOT_API & PX_UE_APP_CTX_URI & "/" & oct2char(unichar2oct(PX_CONTEXT_ID)), v_headers ))); f_selfOrClientSyncAndVerdict(c_prDone, e_success); // Test Body tc_ac.start; alt { [] httpPort.receive( mw_http_response( mw_http_response_204_no_content )) { tc_ac.stop; log("*** " & testcasename() & ": PASS: IUT successfully delete AppContext ***"); 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_MEO_UEAPPCTX_003_OK /** * @desc Check that the IUT responds with an error when a request for an unknown URI is sent by a MEC Application * @see https://forge.etsi.org/rep/mec/gs032p2-test-purposes/blob/master/Test%20Purposes/MEO/UEAPPCTX/SysUeAppsContext.tplan2 */ testcase TC_MEC_MEO_UEAPPCTX_003_NF() runs on HttpComponent system HttpTestAdapter { // Local variables var HeaderLines v_headers; // Test control if (not(PICS_MEC_PLAT) or not(PICS_SERVICES) or not(PICS_ENABLE_UE_APP_CTX)) { log("*** " & testcasename() & ": PICS_MEC_PLAT and PICS_SERVICES and PICS_ENABLE_UE_APP_CTX required for executing the TC ***"); setverdict(inconc); stop; } // Test component configuration f_cf_01_http_up(); // Test adapter configuration // Preamble f_create_ue_app_ctx(); f_init_default_headers_list(-, -, v_headers); httpPort.send( m_http_request( m_http_request_delete( "/" & PICS_ROOT_API & PX_UE_APP_CTX_URI & "/" & oct2char(unichar2oct(PX_NON_EXISTENT_CONTEXT_ID)), v_headers ))); f_selfOrClientSyncAndVerdict(c_prDone, e_success); // Test Body tc_ac.start; alt { [] httpPort.receive( mw_http_response( mw_http_response_404_not_found )) { tc_ac.stop; log("*** " & testcasename() & ": PASS: IUT successfully delete AppContext ***"); 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_MEO_UEAPPCTX_003_NF } // End of group ue_app_ctx group ue_apps { /** * @desc Check that the IUT responds with the list of user applications available when requested by an UE Application * @see https://forge.etsi.org/rep/mec/gs032p2-test-purposes/blob/master/Test%20Purposes/MEO/UEAPPS/SysUeApplications.tplan2 */ testcase TC_MEC_MEO_UEAPPS_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_SERVICES) or not(PICS_ENABLE_UE_APP_CTX)) { log("*** " & testcasename() & ": PICS_MEC_PLAT and PICS_SERVICES and PICS_ENABLE_UE_APP_CTX required for executing the TC ***"); setverdict(inconc); stop; } // Test component configuration f_cf_01_http_up(); // Test adapter configuration // Preamble f_create_ue_app_ctx(); f_init_default_headers_list(-, -, v_headers); httpPort.send( m_http_request( m_http_request_get( "/" & PICS_ROOT_API & PX_UE_APPS_URI & "&appName=" & oct2char(unichar2oct(PX_APP_NAME)), v_headers ))); f_selfOrClientSyncAndVerdict(c_prDone, e_success); // Test Body tc_ac.start; alt { [] httpPort.receive( mw_http_response( mw_http_response_ok( mw_http_message_body_json( mw_body_json_app_info( { *, mw_appInfo_list(PX_APP_NAME), *} ))))) { tc_ac.stop; log("*** " & testcasename() & ": PASS: IUT successfully responds with a AppInfo ***"); 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_create_ue_app_ctx(); f_cf_01_http_down(); } // End of testcase TC_MEC_MEO_UEAPPS_001_OK /** * @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/rep/mec/gs032p2-test-purposes/blob/master/Test%20Purposes/MEO/UEAPPS/SysUeApplications.tplan2 */ testcase TC_MEC_MEO_UEAPPS_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_SERVICES) or not(PICS_ENABLE_UE_APP_CTX)) { log("*** " & testcasename() & ": PICS_MEC_PLAT and PICS_SERVICES and PICS_ENABLE_UE_APP_CTX required for executing the TC ***"); setverdict(inconc); stop; } // Test component configuration f_cf_01_http_up(); // Test adapter configuration // Preamble f_create_ue_app_ctx(); f_init_default_headers_list(-, -, v_headers); httpPort.send( m_http_request( m_http_request_get( "/" & PICS_ROOT_API & PX_UE_APPS_URI & "&appName=" & oct2char(unichar2oct(PX_APP_NAME)) & "&serviceCont=unknown", // Wrong URI v_headers ))); f_selfOrClientSyncAndVerdict(c_prDone, e_success); // Test Body tc_ac.start; alt { [] httpPort.receive( mw_http_response( mw_http_response_400_bad_request )) { tc_ac.stop; log("*** " & testcasename() & ": PASS: IUT successfully responds with a AppInfo ***"); 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_create_ue_app_ctx(); f_cf_01_http_down(); } // End of testcase TC_MEC_MEO_UEAPPS_001_BR /** * @desc Check that the IUT responds with an error when a request for an unknown URI is sent by a MEC Application * @see https://forge.etsi.org/rep/mec/gs032p2-test-purposes/blob/master/Test%20Purposes/MEO/UEAPPS/SysUeApplications.tplan2 */ testcase TC_MEC_MEO_UEAPPS_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_SERVICES) or not(PICS_ENABLE_UE_APP_CTX)) { log("*** " & testcasename() & ": PICS_MEC_PLAT and PICS_SERVICES and PICS_ENABLE_UE_APP_CTX 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( "/" & PICS_ROOT_API & PX_UE_APPS_URI & "&appName=" & oct2char(unichar2oct(PX_NON_EXISTENT_APP_NAME)), v_headers ))); f_selfOrClientSyncAndVerdict(c_prDone, e_success); // Test Body tc_ac.start; alt { [] httpPort.receive( mw_http_response( mw_http_response_404_not_found )) { tc_ac.stop; log("*** " & testcasename() & ": PASS: IUT successfully responds with a AppInfo ***"); 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_MEO_UEAPPS_001_NF } // End of group ue_apps } // End of module AtsMec_UEAppInterfaceAPI_TestCases