From dc97fcc05083d92e623c8ba9b1198e2dc4a74a07 Mon Sep 17 00:00:00 2001 From: Elian Kraja Date: Thu, 26 Sep 2019 10:31:01 +0200 Subject: [PATCH] Added LCM Test cases --- ttcn/AtsMec/AtsMec_AppLCM_TestCases.ttcn | 1622 +++++++++++++++++ ttcn/LibMec/AppLCM/ttcn/AppLCM_Pics.ttcn | 8 + ttcn/LibMec/AppLCM/ttcn/AppLCM_Pixits.ttcn | 42 + ttcn/LibMec/AppLCM/ttcn/AppLCM_Templates.ttcn | 114 ++ .../AppLCM/ttcn/AppLCM_TypesAndValues.ttcn | 148 ++ ttcn/LibMec/ttcn/LibMec_Pics.ttcn | 2 + ttcn/LibMec/ttcn/LibMec_Pixits.ttcn | 3 +- .../LibItsHttp_JsonMessageBodyTypes.ttcn | 13 + .../LibItsHttp_JsonTemplates.ttcn | 80 + 9 files changed, 2031 insertions(+), 1 deletion(-) create mode 100644 ttcn/AtsMec/AtsMec_AppLCM_TestCases.ttcn create mode 100644 ttcn/LibMec/AppLCM/ttcn/AppLCM_Pics.ttcn create mode 100644 ttcn/LibMec/AppLCM/ttcn/AppLCM_Pixits.ttcn create mode 100644 ttcn/LibMec/AppLCM/ttcn/AppLCM_Templates.ttcn create mode 100644 ttcn/LibMec/AppLCM/ttcn/AppLCM_TypesAndValues.ttcn diff --git a/ttcn/AtsMec/AtsMec_AppLCM_TestCases.ttcn b/ttcn/AtsMec/AtsMec_AppLCM_TestCases.ttcn new file mode 100644 index 0000000..02b1cca --- /dev/null +++ b/ttcn/AtsMec/AtsMec_AppLCM_TestCases.ttcn @@ -0,0 +1,1622 @@ +/** +* @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_AppLCM_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; + + + import from AppLCM_Templates all; + import from AppLCM_Pics all; + import from AppLCM_Pixits all; + + // LibMec + import from LibMec_Functions all; + import from LibMec_Pics all; + import from LibMec_Pixits all; + + group App_lifecycle_management { + + /** + * @desc: Check that MEC API provider creates a new App Package when requested + * ETSI GS MEC 010-2 2.0.10, clause 7.5.1.3.1 + * ETSI GS MEC 010-2 2.0.10, Table 6.2.2.3.2-1 //CreateAppInstanceRequest + * ETSI GS MEC 010-2 2.0.10, Table 6.2.2.4.2-1 //AppInstanceInfo + */ + testcase TP_MEC_MEX_LCM_001_OK() runs on HttpComponent system HttpTestAdapter { + // Local variables + var HeaderLines v_headers; + var HttpMessage v_response; + + // Test control + if (not(PIC_APP_LCM_MANAGEMENT)){ + log("*** " & testcasename() & ": PIC_APP_LCM_MANAGEMENT required for executing the TC ***"); + setverdict(inconc); + stop; + } + + // Test component configuration + f_cf_01_http_up(); + + // Preamble + f_init_default_headers_list(-, -, v_headers); + httpPort.send( + m_http_request( + m_http_request_post( + "/" & PICS_ROOT_API & PX_MEX_LCM_URI, + v_headers, + m_http_message_body_json( + m_body_json_lifecycle_management( + m_lifecycle_management_create( + PX_APP_D_ID + ) + ) + ) + ) + )); + + 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_mex_lcm_instance_info( + mw_lcm_instance_info( + -, + PX_APP_D_ID, + PX_INSTANTIATION_STATE + ) + ))))) -> value v_response { + tc_ac.stop; + log("*** " & testcasename() & ": PASS: IUT successfully responds with the App LCM Instance info details ***"); + 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 + } // End of testcase TP_MEC_MEX_LCM_001_OK + + + + /** + * @desc: Check that MEC API provider sends an error when it receives + * a malformed request for the creation of a new App Instance + * ETSI GS MEC 010-2 2.0.10, clause 7.5.1.3.1 + * ETSI GS MEC 010-2 2.0.10, Table 6.2.2.3.2-1 //CreateAppInstanceRequest + */ + testcase TP_MEC_MEX_LCM_001_BR() runs on HttpComponent system HttpTestAdapter { + // Local variables + var HeaderLines v_headers; + var HttpMessage v_response; + + // Test control + if (not(PIC_APP_LCM_MANAGEMENT)){ + log("*** " & testcasename() & ": PIC_APP_LCM_MANAGEMENT required for executing the TC ***"); + setverdict(inconc); + stop; + } + + // Test component configuration + f_cf_01_http_up(); + + // Preamble + f_init_default_headers_list(-, -, v_headers); + httpPort.send( + m_http_request( + m_http_request_post( + "/" & PICS_ROOT_API & PX_MEX_LCM_URI, + v_headers, + m_http_message_body_json( + m_body_json_lifecycle_management_with_error( + m_lifecycle_management_create_with_error( + PX_APP_D_ID + ) + ) + ) + ))); + f_selfOrClientSyncAndVerdict(c_prDone, e_success); + + // Test Body + tc_ac.start; + alt { + [] httpPort.receive( + mw_http_response( + mw_http_response_400_bad_request( + ))) -> value v_response { + tc_ac.stop; + + log("*** " & testcasename() & ": PASS: IUT successfully responds with a Bad response ***"); + 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 + } // End of testcase TP_MEC_MEX_LCM_001_BR + + + + /** + * @desc: Check that MEC API provider retrieves the list of App instances when requested + * ETSI GS MEC 010-2 2.0.10, clause 7.5.1.3.2 + * ETSI GS MEC 010-2 2.0.10, Table 6.2.3.3.2-1 //AppInstanceInfo + */ + testcase TP_MEC_MEX_LCM_002_OK() runs on HttpComponent system HttpTestAdapter { + // Local variables + var HeaderLines v_headers; + var HttpMessage v_response; + + // Test control + if (not(PIC_APP_LCM_MANAGEMENT)){ + log("*** " & testcasename() & ": PIC_APP_LCM_MANAGEMENT required for executing the TC ***"); + setverdict(inconc); + stop; + } + // Test component configuration + f_cf_01_http_up(); + + // Preamble + f_init_default_headers_list(-, -, v_headers); + httpPort.send( + m_http_request( + m_http_request_get( + "/" & PICS_ROOT_API & PX_MEX_LCM_URI, + 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_mex_lcm_instance_info_list({ + *, + mw_lcm_instance_info( + PX_APP_INSTANCE_ID, + -, - + ), + * + } + ) + ) + ) + )) -> value v_response { + tc_ac.stop; + log("*** " & testcasename() & ": PASS: IUT successfully responds with an App LCM instance info and 200 status code ***"); + 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 + } // End of testcase TP_MEC_MEX_LCM_002_OK + + + /** + * @desc: Check that MEC API provider retrieves an App Package when requested + * @see: ETSI GS MEC 010-2 2.0.10, clause 7.5.2.3.2 + * ETSI GS MEC 010-2 2.0.10, Table 6.2.2.4.2-1 + */ + testcase TP_MEC_MEX_LCM_003_OK() runs on HttpComponent system HttpTestAdapter { + // Local variables + var HeaderLines v_headers; + var HttpMessage v_response; + + // Test control + if (not(PIC_APP_LCM_MANAGEMENT)){ + log("*** " & testcasename() & ": PIC_APP_LCM_MANAGEMENT required for executing the TC ***"); + setverdict(inconc); + stop; + } + + // Test component configuration + f_cf_01_http_up(); + + // Preamble + f_init_default_headers_list(-, -, v_headers); + httpPort.send( + m_http_request( + m_http_request_get( + "/" & PICS_ROOT_API & PX_MEX_LCM_URI & oct2char(unichar2oct(PX_APP_INSTANCE_ID, "UTF-8")), + 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_mex_lcm_instance_info( + mw_lcm_instance_info( + PX_APP_INSTANCE_ID, + -, + - + ) + ))))) -> value v_response { + tc_ac.stop; + log("*** " & testcasename() & ": PASS: IUT successfully responds with a App instance info ***"); + 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 + } // End of testcase TP_MEC_MEX_LCM_003_OK + + + + + + /** + * @desc: Check that MEC API provider fails on retrieving an App Instance when requested using wrong appInstanceId + * @see: ETSI GS MEC 010-2 2.0.10, clause 7.5.2.3.2 + */ + testcase TP_MEC_MEX_LCM_003_NF() runs on HttpComponent system HttpTestAdapter { + // Local variables + var HeaderLines v_headers; + var HttpMessage v_response; + + // Test control + if (not(PIC_APP_LCM_MANAGEMENT)){ + log("*** " & testcasename() & ": PIC_APP_LCM_MANAGEMENT required for executing the TC ***"); + setverdict(inconc); + stop; + } + + // Test component configuration + f_cf_01_http_up(); + + // Preamble + f_init_default_headers_list(-, -, v_headers); + httpPort.send( + m_http_request( + m_http_request_get( + "/" & PICS_ROOT_API & PX_MEX_LCM_URI & oct2char(unichar2oct(PX_NON_EXISTENT_APP_INSTANCE_ID, "UTF-8")) &"/app_descriptor", + 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( + ))) -> value v_response { + tc_ac.stop; + + log("*** " & testcasename() & ": PASS: IUT successfully responds with a 404 not found status code ***"); + 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 + } // End of testcase TP_MEC_MEX_LCM_003_NF + + + /** + * @desc: Check that MEC API provider service deletes an App Instance when requested + * ETSI GS MEC 010-2 2.0.10, clause 7.5.2.3.4 + */ + testcase TP_MEC_MEX_LCM_004_OK() runs on HttpComponent system HttpTestAdapter { + // Local variables + var HeaderLines v_headers; + var HttpMessage v_response; + + // Test control + if (not(PIC_APP_LCM_MANAGEMENT)){ + log("*** " & testcasename() & ": PIC_APP_LCM_MANAGEMENT required for executing the TC ***"); + setverdict(inconc); + stop; + } + + // Test component configuration + f_cf_01_http_up(); + + // Preamble + f_init_default_headers_list(-, -, v_headers); + httpPort.send( + m_http_request( + m_http_request_delete( + "/" & PICS_ROOT_API & PX_MEX_LCM_URI & oct2char(unichar2oct(PX_APP_INSTANCE_ID, "UTF-8")), + 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( + ))) -> value v_response { + tc_ac.stop; + log("*** " & testcasename() & ": PASS: IUT successfully responds with a 204 no content status code ***"); + 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 + } // End of testcase TP_MEC_MEX_LCM_004_OK + + /** + * @desc: Check that MEC API provider fails on deletion of an App Instance when requested using wrong appInstanceId + * @see: ETSI GS MEC 010-2 2.0.10, clause 7.5.2.3.2 + */ + testcase TP_MEC_MEX_LCM_004_NF() runs on HttpComponent system HttpTestAdapter { + // Local variables + var HeaderLines v_headers; + var HttpMessage v_response; + + // Test control + if (not(PIC_APP_LCM_MANAGEMENT)){ + log("*** " & testcasename() & ": PIC_APP_LCM_MANAGEMENT required for executing the TC ***"); + setverdict(inconc); + stop; + } + + // Test component configuration + f_cf_01_http_up(); + + // Preamble + f_init_default_headers_list(-, -, v_headers); + httpPort.send( + m_http_request( + m_http_request_delete( + "/" & PICS_ROOT_API & PX_MEX_LCM_URI & oct2char(unichar2oct(PX_NON_EXISTENT_APP_INSTANCE_ID, "UTF-8")), + 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( + ))) -> value v_response { + tc_ac.stop; + + log("*** " & testcasename() & ": PASS: IUT successfully responds with a 404 not found status code ***"); + 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 + } // End of testcase TP_MEC_MEX_LCM_004_NF + + + /** + * @desc: Check that MEC API provider service instantiates an App Instance when requested + * ETSI GS MEC 010-2 2.0.10, clause 7.5.6.3.1 + * ETSI GS MEC 010-2 2.0.10, table 6.2.2.7.2-1 //InstantiateAppRequest + */ + testcase TP_MEC_MEX_LCM_005_OK() runs on HttpComponent system HttpTestAdapter { + // Local variables + var HeaderLines v_headers; + var HttpMessage v_response; + + // Test control + if (not(PIC_APP_LCM_MANAGEMENT)){ + log("*** " & testcasename() & ": PIC_APP_LCM_MANAGEMENT required for executing the TC ***"); + setverdict(inconc); + stop; + } + + // Test component configuration + f_cf_01_http_up(); + + // Preamble + f_init_default_headers_list(-, -, v_headers); + httpPort.send( + m_http_request( + m_http_request_post( + "/" & PICS_ROOT_API & PX_MEX_LCM_URI & oct2char(unichar2oct(PX_APP_INSTANCE_ID, "UTF-8")) & "/instantiate", + v_headers, + m_http_message_body_json( + m_body_json_lifecycle_management_instantiate( + m_lifecycle_management_instantiate( + PX_APP_D_ID + ) + ) + ) + + ))); + f_selfOrClientSyncAndVerdict(c_prDone, e_success); + + // Test Body + tc_ac.start; + alt { + [] httpPort.receive( + mw_http_response( + mw_http_response_202_accepted( + ))) -> value v_response { + tc_ac.stop; + if (f_check_headers(v_response.response.header) == true) { + log("*** " & testcasename() & ": PASS: IUT successfully responds with a 202 accepted***"); + 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 + } // End of testcase TP_MEC_MEX_LCM_005_OK + + + /** + * @desc: Check that MEC API providerservice fails to instantiate an App Instance when + * it receives a request related to a not existing App Instance + * ETSI GS MEC 010-2 2.0.10, clause 7.5.6.3.1 + * ETSI GS MEC 010-2 2.0.10, table 6.2.2.7.2-1 //InstantiateAppRequest + */ + testcase TP_MEC_MEX_LCM_005_NF() runs on HttpComponent system HttpTestAdapter { + // Local variables + var HeaderLines v_headers; + var HttpMessage v_response; + + // Test control + if (not(PIC_APP_LCM_MANAGEMENT)){ + log("*** " & testcasename() & ": PIC_APP_LCM_MANAGEMENT required for executing the TC ***"); + setverdict(inconc); + stop; + } + + // Test component configuration + f_cf_01_http_up(); + + // Preamble + f_init_default_headers_list(-, -, v_headers); + httpPort.send( + m_http_request( + m_http_request_post( + "/" & PICS_ROOT_API & PX_MEX_LCM_URI & oct2char(unichar2oct(PX_NON_EXISTENT_APP_INSTANCE_ID, "UTF-8")) & "/instantiate", + v_headers, + m_http_message_body_json( + m_body_json_lifecycle_management_instantiate( + m_lifecycle_management_instantiate( + PX_APP_D_ID + ) + ) + ) + ))); + f_selfOrClientSyncAndVerdict(c_prDone, e_success); + + // Test Body + tc_ac.start; + alt { + [] httpPort.receive( + mw_http_response( + mw_http_response_404_not_found( + ))) -> value v_response { + tc_ac.stop; + + log("*** " & testcasename() & ": PASS: IUT successfully responds with a 404 not found status code ***"); + 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 + } // End of testcase TP_MEC_MEX_LCM_005_NF + + + /** + * @desc: Check that MEC API provider service fails to instantiate an App Instance when it receives a malformed request + * ETSI GS MEC 010-2 2.0.10, clause 7.5.6.3.1 + * ETSI GS MEC 010-2 2.0.10, table 6.2.2.7.2-1 //InstantiateAppRequest + */ + testcase TP_MEC_MEX_LCM_005_BR() runs on HttpComponent system HttpTestAdapter { + // Local variables + var HeaderLines v_headers; + var HttpMessage v_response; + + // Test control + if (not(PIC_APP_LCM_MANAGEMENT)){ + log("*** " & testcasename() & ": PIC_APP_LCM_MANAGEMENT required for executing the TC ***"); + setverdict(inconc); + stop; + } + + // Test component configuration + f_cf_01_http_up(); + + // Preamble + f_init_default_headers_list(-, -, v_headers); + httpPort.send( + m_http_request( + m_http_request_post( + "/" & PICS_ROOT_API & PX_MEX_LCM_URI & oct2char(unichar2oct(PX_APP_INSTANCE_ID, "UTF-8")) & "/instantiate", + v_headers, + m_http_message_body_json( + m_body_json_lifecycle_management_instantiate_with_error( + m_lifecycle_management_instantiate_with_error( + PX_APP_D_ID + ) + ) + ) + ))); + f_selfOrClientSyncAndVerdict(c_prDone, e_success); + + // Test Body + tc_ac.start; + alt { + [] httpPort.receive( + mw_http_response( + mw_http_response_400_bad_request( + ))) -> value v_response { + tc_ac.stop; + + log("*** " & testcasename() & ": PASS: IUT successfully responds with a 400 bad request status code ***"); + 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 + } // End of testcase TP_MEC_MEX_LCM_005_BR + + + /** + * @desc: Check that MEC API provider service terminates an App Instance when requested + * ETSI GS MEC 010-2 2.0.10, clause 7.5.7.3.1 + * ETSI GS MEC 010-2 2.0.10, table 6.2.2.9.2-1 //TerminateAppRequest + */ + testcase TP_MEC_MEX_LCM_006_OK() runs on HttpComponent system HttpTestAdapter { + // Local variables + var HeaderLines v_headers; + var HttpMessage v_response; + + // Test control + if (not(PIC_APP_LCM_MANAGEMENT)){ + log("*** " & testcasename() & ": PIC_APP_LCM_MANAGEMENT required for executing the TC ***"); + setverdict(inconc); + stop; + } + + // Test component configuration + f_cf_01_http_up(); + + // Preamble + f_init_default_headers_list(-, -, v_headers); + httpPort.send( + m_http_request( + m_http_request_post( + "/" & PICS_ROOT_API & PX_MEX_LCM_URI & oct2char(unichar2oct(PX_APP_INSTANCE_ID, "UTF-8")) & "/terminate", + v_headers, + m_http_message_body_json( + m_body_json_lifecycle_management_terminate( + m_lifecycle_management_terminate( + PX_APP_TERMINATION_TYPE + ) + ) + ) + + ))); + f_selfOrClientSyncAndVerdict(c_prDone, e_success); + + // Test Body + tc_ac.start; + alt { + [] httpPort.receive( + mw_http_response( + mw_http_response_202_accepted( + ))) -> value v_response { + tc_ac.stop; + if (f_check_headers(v_response.response.header) == true) { + log("*** " & testcasename() & ": PASS: IUT successfully responds with a 202 accepted***"); + 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 + } // End of testcase TP_MEC_MEX_LCM_006_OK + + + /** + * @desc: Check that MEC API providerservice fails to terminate an App Instance when + * it receives a request related to a not existing App Instance + * ETSI GS MEC 010-2 2.0.10, clause 7.5.7.3.1 + * ETSI GS MEC 010-2 2.0.10, table 6.2.2.9.2-1 //TerminateAppRequest + */ + testcase TP_MEC_MEX_LCM_006_NF() runs on HttpComponent system HttpTestAdapter { + // Local variables + var HeaderLines v_headers; + var HttpMessage v_response; + + // Test control + if (not(PIC_APP_LCM_MANAGEMENT)){ + log("*** " & testcasename() & ": PIC_APP_LCM_MANAGEMENT required for executing the TC ***"); + setverdict(inconc); + stop; + } + + // Test component configuration + f_cf_01_http_up(); + + // Preamble + f_init_default_headers_list(-, -, v_headers); + httpPort.send( + m_http_request( + m_http_request_post( + "/" & PICS_ROOT_API & PX_MEX_LCM_URI & oct2char(unichar2oct(PX_NON_EXISTENT_APP_INSTANCE_ID, "UTF-8")) & "/terminate", + v_headers, + m_http_message_body_json( + m_body_json_lifecycle_management_terminate( + m_lifecycle_management_terminate( + PX_APP_TERMINATION_TYPE + ) + ) + ) + ))); + f_selfOrClientSyncAndVerdict(c_prDone, e_success); + + // Test Body + tc_ac.start; + alt { + [] httpPort.receive( + mw_http_response( + mw_http_response_404_not_found( + ))) -> value v_response { + tc_ac.stop; + + log("*** " & testcasename() & ": PASS: IUT successfully responds with a 404 not found status code ***"); + 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 + } // End of testcase TP_MEC_MEX_LCM_006_NF + + + /** + * @desc: Check that MEC API providerservice fails to terminate an App Instance when it receives a malformed request + * ETSI GS MEC 010-2 2.0.10, clause 7.5.7.3.1 + * ETSI GS MEC 010-2 2.0.10, table 6.2.2.9.2-1 //TerminateAppRequest + */ + testcase TP_MEC_MEX_LCM_006_BR() runs on HttpComponent system HttpTestAdapter { + // Local variables + var HeaderLines v_headers; + var HttpMessage v_response; + + // Test control + if (not(PIC_APP_LCM_MANAGEMENT)){ + log("*** " & testcasename() & ": PIC_APP_LCM_MANAGEMENT required for executing the TC ***"); + setverdict(inconc); + stop; + } + + // Test component configuration + f_cf_01_http_up(); + + // Preamble + f_init_default_headers_list(-, -, v_headers); + httpPort.send( + m_http_request( + m_http_request_post( + "/" & PICS_ROOT_API & PX_MEX_LCM_URI & oct2char(unichar2oct(PX_APP_INSTANCE_ID, "UTF-8")) & "/terminate", + v_headers, + m_http_message_body_json( + m_body_json_lifecycle_management_terminate_with_error( + m_lifecycle_management_terminate_with_error( + PX_APP_TERMINATION_TYPE_WITH_ERROR + ) + ) + ) + ))); + f_selfOrClientSyncAndVerdict(c_prDone, e_success); + + // Test Body + tc_ac.start; + alt { + [] httpPort.receive( + mw_http_response( + mw_http_response_400_bad_request( + ))) -> value v_response { + tc_ac.stop; + + log("*** " & testcasename() & ": PASS: IUT successfully responds with a 400 Bad Request status code ***"); + 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 + } // End of testcase TP_MEC_MEX_LCM_006_BR + + + /** + * @desc: Check that MEC API provider service terminates an App Instance when requested + * ETSI GS MEC 010-2 2.0.10, clause 7.5.8.3.1 + * ETSI GS MEC 010-2 2.0.10, table 6.2.2.8.2-1 //OperateAppRequest + */ + testcase TP_MEC_MEX_LCM_007_OK() runs on HttpComponent system HttpTestAdapter { + // Local variables + var HeaderLines v_headers; + var HttpMessage v_response; + + // Test control + if (not(PIC_APP_LCM_MANAGEMENT)){ + log("*** " & testcasename() & ": PIC_APP_LCM_MANAGEMENT required for executing the TC ***"); + setverdict(inconc); + stop; + } + + // Test component configuration + f_cf_01_http_up(); + + // Preamble + f_init_default_headers_list(-, -, v_headers); + httpPort.send( + m_http_request( + m_http_request_post( + "/" & PICS_ROOT_API & PX_MEX_LCM_URI & oct2char(unichar2oct(PX_APP_INSTANCE_ID, "UTF-8")) & "/operate", + v_headers, + m_http_message_body_json( + m_body_json_lifecycle_management_operate( + m_lifecycle_management_operate( + PX_CHANGE_STATE_TO + ) + ) + ) + + ))); + f_selfOrClientSyncAndVerdict(c_prDone, e_success); + + // Test Body + tc_ac.start; + alt { + [] httpPort.receive( + mw_http_response( + mw_http_response_202_accepted( + ))) -> value v_response { + tc_ac.stop; + if (f_check_headers(v_response.response.header) == true) { + log("*** " & testcasename() & ": PASS: IUT successfully responds with a 202 accepted***"); + 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 + } // End of testcase TP_MEC_MEX_LCM_007_OK + + + /** + * @desc: Check that MEC API provider service fails to change the status of an App Instance + * when it receives a request related to a not existing App Instance + * ETSI GS MEC 010-2 2.0.10, clause 7.5.8.3.1 + * ETSI GS MEC 010-2 2.0.10, table 6.2.2.8.2-1 //OperateAppRequest + */ + testcase TP_MEC_MEX_LCM_007_NF() runs on HttpComponent system HttpTestAdapter { + // Local variables + var HeaderLines v_headers; + var HttpMessage v_response; + + // Test control + if (not(PIC_APP_LCM_MANAGEMENT)){ + log("*** " & testcasename() & ": PIC_APP_LCM_MANAGEMENT required for executing the TC ***"); + setverdict(inconc); + stop; + } + + // Test component configuration + f_cf_01_http_up(); + + // Preamble + f_init_default_headers_list(-, -, v_headers); + httpPort.send( + m_http_request( + m_http_request_post( + "/" & PICS_ROOT_API & PX_MEX_LCM_URI & oct2char(unichar2oct(PX_NON_EXISTENT_APP_INSTANCE_ID, "UTF-8")) & "/operate", + v_headers, + m_http_message_body_json( + m_body_json_lifecycle_management_operate( + m_lifecycle_management_operate( + PX_CHANGE_STATE_TO + ) + ) + ) + ))); + f_selfOrClientSyncAndVerdict(c_prDone, e_success); + + // Test Body + tc_ac.start; + alt { + [] httpPort.receive( + mw_http_response( + mw_http_response_404_not_found( + ))) -> value v_response { + tc_ac.stop; + + log("*** " & testcasename() & ": PASS: IUT successfully responds with a 404 not found status code ***"); + 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 + } // End of testcase TP_MEC_MEX_LCM_007_NF + + + /** + * @desc: Check that MEC API provider service fails to operate on an App Instance when it receives a malformed request + * ETSI GS MEC 010-2 2.0.10, clause 7.5.8.3.1 + * ETSI GS MEC 010-2 2.0.10, table 6.2.2.8.2-1 //OperateAppRequest + */ + testcase TP_MEC_MEX_LCM_007_BR() runs on HttpComponent system HttpTestAdapter { + // Local variables + var HeaderLines v_headers; + var HttpMessage v_response; + + // Test control + if (not(PIC_APP_LCM_MANAGEMENT)){ + log("*** " & testcasename() & ": PIC_APP_LCM_MANAGEMENT required for executing the TC ***"); + setverdict(inconc); + stop; + } + + // Test component configuration + f_cf_01_http_up(); + + // Preamble + f_init_default_headers_list(-, -, v_headers); + httpPort.send( + m_http_request( + m_http_request_post( + "/" & PICS_ROOT_API & PX_MEX_LCM_URI & oct2char(unichar2oct(PX_APP_INSTANCE_ID, "UTF-8")) & "/operate", + v_headers, + m_http_message_body_json( + m_body_json_lifecycle_management_operate_with_error( + m_lifecycle_management_operate_with_error( + PX_CHANGE_STATE_TO_WITH_ERROR + ) + ) + ) + ))); + f_selfOrClientSyncAndVerdict(c_prDone, e_success); + + // Test Body + tc_ac.start; + alt { + [] httpPort.receive( + mw_http_response( + mw_http_response_400_bad_request( + ))) -> value v_response { + tc_ac.stop; + + log("*** " & testcasename() & ": PASS: IUT successfully responds with a 400 Bad Request status code ***"); + 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 + } // End of testcase TP_MEC_MEX_LCM_007_BR + + + + /** + * @desc: Check that MEC API provider service retrieves info about LCM Operation Occurrency on App Instances when requested + * ETSI GS MEC 010-2 2.0.10, clause 7.5.9.3.2 + * ETSI GS MEC 010-2 2.0.10, table 6.2.2.14.2-1" //AppLcmOpOcc + */ + testcase TP_MEC_MEX_LCM_008_OK() runs on HttpComponent system HttpTestAdapter { + // Local variables + var HeaderLines v_headers; + var HttpMessage v_response; + + // Test control + if (not(PIC_APP_LCM_MANAGEMENT)){ + log("*** " & testcasename() & ": PIC_APP_LCM_MANAGEMENT required for executing the TC ***"); + setverdict(inconc); + stop; + } + // Test component configuration + f_cf_01_http_up(); + + // Preamble + f_init_default_headers_list(-, -, v_headers); + httpPort.send( + m_http_request( + m_http_request_get( + "/" & PICS_ROOT_API & PX_MEX_LCM_OP_OCC_URI, + 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_lifecycle_op_occ_list({ + *, + mw_lifecycle_management_op_occ( + PX_APP_LCM_OP_OCC_ID + ), + * + } + ) + ) + ) + )) -> value v_response { + tc_ac.stop; + log("*** " & testcasename() & ": PASS: IUT successfully responds with App LCM Operation Occurrencies info and 200 status code ***"); + 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 + } // End of testcase TP_MEC_MEX_LCM_008_OK + + /** + * @desc: Check that MEC API provider service retrieves info about LCM Operation Occurrency on an App Instance when requested + * ETSI GS MEC 010-2 2.0.10, clause 7.5.9.3.2 + * ETSI GS MEC 010-2 2.0.10, table 6.2.2.14.2-1" //AppLcmOpOcc + */ + testcase TP_MEC_MEX_LCM_009_OK() runs on HttpComponent system HttpTestAdapter { + // Local variables + var HeaderLines v_headers; + var HttpMessage v_response; + + // Test control + if (not(PIC_APP_LCM_MANAGEMENT)){ + log("*** " & testcasename() & ": PIC_APP_LCM_MANAGEMENT required for executing the TC ***"); + setverdict(inconc); + stop; + } + // Test component configuration + f_cf_01_http_up(); + + // Preamble + f_init_default_headers_list(-, -, v_headers); + httpPort.send( + m_http_request( + m_http_request_get( + "/" & PICS_ROOT_API & PX_MEX_LCM_OP_OCC_URI & oct2char(unichar2oct(PX_APP_LCM_OP_OCC_ID, "UTF-8")), + 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_lifecycle_op_occ( + mw_lifecycle_management_op_occ( + PX_APP_LCM_OP_OCC_ID + ) + ) + ) + ) + )) -> value v_response { + tc_ac.stop; + log("*** " & testcasename() & ": PASS: IUT successfully responds with the requested App LCM Operation Occurrency and 200 status code ***"); + 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 + } // End of testcase TP_MEC_MEX_LCM_009_OK + + /** + * @desc:Check that MEC API provider service sends an error when it receives a query for a not existing LCM Operation Occurrency + * ETSI GS MEC 010-2 2.0.10, clause 7.5.9.3.2 + * ETSI GS MEC 010-2 2.0.10, table 6.2.2.14.2-1" //AppLcmOpOcc + */ + testcase TP_MEC_MEX_LCM_009_NF() runs on HttpComponent system HttpTestAdapter { + // Local variables + var HeaderLines v_headers; + var HttpMessage v_response; + + // Test control + if (not(PIC_APP_LCM_MANAGEMENT)){ + log("*** " & testcasename() & ": PIC_APP_LCM_MANAGEMENT required for executing the TC ***"); + setverdict(inconc); + stop; + } + // Test component configuration + f_cf_01_http_up(); + + // Preamble + f_init_default_headers_list(-, -, v_headers); + httpPort.send( + m_http_request( + m_http_request_get( + "/" & PICS_ROOT_API & PX_MEX_LCM_OP_OCC_URI & oct2char(unichar2oct(PX_NON_EXISTENT_APP_LCM_OP_OCC_ID, "UTF-8")), + 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( + ) + )) -> value v_response { + tc_ac.stop; + log("*** " & testcasename() & ": PASS: IUT successfully responds with 404 not found status code ***"); + 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 + } // End of testcase TP_MEC_MEX_LCM_009_NF + + + +} // End of App_lifecycle_management + + + + +group app_lcm_subscriptions { + + /** + * @desc: Check that MEC API provider service creates a LCM Subscription when requested, + * where the subscription request can have SUBSCRIPTION_TYPE: + * - AppInstanceStateChangeSubscription + * - AppLcmOpOccStateChangeSubscription + * ETSI GS MEC 010-2 2.0.10, clause 7.5.3.3.1 + * ETSI GS MEC 010-2 2.0.10, table 6.2.2.13.2-1 //AppInstSubscriptionRequest + * ETSI GS MEC 010-2 2.0.10, table 6.2.2.10.2-1 //AppInstSubscriptionInfo + */ + testcase TP_MEC_MEX_LCM_010_OK() runs on HttpComponent system HttpTestAdapter { + // Local variables + var HeaderLines v_headers; + var HttpMessage v_response; + + // Test control + if (not(PIC_APP_LCM_MANAGEMENT)){ + log("*** " & testcasename() & ": PIC_APP_LCM_MANAGEMENT required for executing the TC ***"); + setverdict(inconc); + stop; + } + + // Test component configuration + f_cf_01_http_up(); + + // Preamble + f_init_default_headers_list(-, -, v_headers); + httpPort.send( + m_http_request( + m_http_request_post( + "/" & PICS_ROOT_API & PX_MEX_LCM_SUBS, + v_headers, + m_http_message_body_json( + m_body_json_lcm_subscribe( + m_app_lcm_subscribe_request( + PX_SUBSCRIPTION_TYPE, + PX_CALLBACK_URI + ) + ) + ) + ) + )); + + 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_lcm_subscription( + mw_app_lcm_subscription_info( + -, + PX_SUBSCRIPTION_TYPE, + PX_CALLBACK_URI) + + ))))) -> value v_response { + tc_ac.stop; + + log("*** " & testcasename() & ": PASS: IUT successfully responds with the new created subscription ***"); + 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 + } // End of testcase TP_MEC_MEX_LCM_010_OK + + + + /** + * @desc: Check that MEC API providerservice sends an error when it receives a + * malformed request to create a LCM Subscription + * ETSI GS MEC 010-2 2.0.10, clause 7.5.3.3.1 + * ETSI GS MEC 010-2 2.0.10, table 6.2.2.13.2-1 //AppInstSubscriptionRequest + */ + testcase TP_MEC_MEX_LCM_010_BR() runs on HttpComponent system HttpTestAdapter { + // Local variables + var HeaderLines v_headers; + var HttpMessage v_response; + + // Test control + if (not(PIC_APP_LCM_MANAGEMENT)){ + log("*** " & testcasename() & ": PIC_APP_LCM_MANAGEMENT required for executing the TC ***"); + setverdict(inconc); + stop; + } + + // Test component configuration + f_cf_01_http_up(); + + // Preamble + f_init_default_headers_list(-, -, v_headers); + httpPort.send( + m_http_request( + m_http_request_post( + "/" & PICS_ROOT_API & PX_MEX_LCM_SUBS, + v_headers, + m_http_message_body_json( + m_body_json_lcm_subscribe_with_error( + m_app_lcm_subscribe_request_with_error( + PX_SUBSCRIPTION_TYPE, + PX_CALLBACK_URI + ) + ) + ) + ) + )); + + f_selfOrClientSyncAndVerdict(c_prDone, e_success); + + // Test Body + tc_ac.start; + alt { + [] httpPort.receive( + mw_http_response( + mw_http_response_400_bad_request( + ))) -> value v_response { + tc_ac.stop; + + log("*** " & testcasename() & ": PASS: IUT successfully responds a 400 Bad request ***"); + 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 + } // End of testcase TP_MEC_MEX_LCM_010_BR + + + /** + * @desc: Check that MEC API provider service sends the list of LCM Subscriptions when requested + * ETSI GS MEC 010-2 2.0.10, clause 7.5.3.3.2 + * ETSI GS MEC 010-2 2.0.10, table 6.2.2.13.2-1 // AppInstSubscriptionRequest + * ETSI GS MEC 010-2 2.0.10, table 6.2.2.15.2-1 // AppLcmOpOccSubscriptionRequest + * ETSI GS MEC 010-2 2.0.10, table 6.2.2.10.2-1 // AppInstSubscriptionInfo + * ETSI GS MEC 010-2 2.0.10, table 6.2.2.16.2-1 // AppLcmOpOccSubscriptionInfo + */ + testcase TP_MEC_MEX_LCM_011_OK() runs on HttpComponent system HttpTestAdapter { + // Local variables + var HeaderLines v_headers; + var HttpMessage v_response; + + // Test control + if (not(PIC_APP_LCM_MANAGEMENT)){ + log("*** " & testcasename() & ": PIC_APP_LCM_MANAGEMENT required for executing the TC ***"); + setverdict(inconc); + stop; + } + + // Test component configuration + f_cf_01_http_up(); + + // Preamble + f_init_default_headers_list(-, -, v_headers); + httpPort.send( + m_http_request( + m_http_request_post( + "/" & PICS_ROOT_API & PX_MEX_LCM_SUBS, + 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_lcm_subscription_list({ + *, + mw_app_lcm_subscription_info( + -, + PX_SUBSCRIPTION_TYPE, + PX_CALLBACK_URI + ), + * + } + + ))))) -> value v_response { + tc_ac.stop; + + log("*** " & testcasename() & ": PASS: IUT successfully responds with the list of available subscriptions ***"); + 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 + } // End of testcase TP_MEC_MEX_LCM_011_OK + + + /** + * @desc: Check that MEC API provider service sends the information about an existing LCM subscription when requested + * ETSI GS MEC 010-2 2.0.10, clause 7.5.4.3.2 + * ETSI GS MEC 010-2 2.0.10, table 6.2.2.10.2-1 // AppInstSubscriptionInfo + * ETSI GS MEC 010-2 2.0.10, table 6.2.2.16.2-1 // AppLcmOpOccSubscriptionInfo + */ + testcase TP_MEC_MEX_LCM_012_OK() runs on HttpComponent system HttpTestAdapter { + // Local variables + var HeaderLines v_headers; + var HttpMessage v_response; + + // Test control + if (not(PIC_APP_LCM_MANAGEMENT)){ + log("*** " & testcasename() & ": PIC_APP_LCM_MANAGEMENT required for executing the TC ***"); + setverdict(inconc); + stop; + } + + // Test component configuration + f_cf_01_http_up(); + + // Preamble + f_init_default_headers_list(-, -, v_headers); + httpPort.send( + m_http_request( + m_http_request_get( + "/" & PICS_ROOT_API & PX_MEX_LCM_SUBS & oct2char(unichar2oct(PX_SUBSCRIPTION_ID, "UTF-8")), + 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_lcm_subscription( + mw_app_lcm_subscription_info( + PX_SUBSCRIPTION_ID, + PX_SUBSCRIPTION_TYPE, + PX_CALLBACK_URI + ) + ))))) -> value v_response { + tc_ac.stop; + + log("*** " & testcasename() & ": PASS: IUT successfully responds with the subscription requested ***"); + 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 + } // End of testcase TP_MEC_MEX_LCM_012_OK + + + /** + * @desc: Check that MEC API provider service sends an error when it receives a query for a not existing LCM Subscription + * ETSI GS MEC 010-2 2.0.10, clause 7.5.4.3.2 + */ + testcase TP_MEC_MEX_LCM_012_NF() runs on HttpComponent system HttpTestAdapter { + // Local variables + var HeaderLines v_headers; + var HttpMessage v_response; + + // Test control + if (not(PIC_APP_LCM_MANAGEMENT)){ + log("*** " & testcasename() & ": PIC_APP_LCM_MANAGEMENT required for executing the TC ***"); + setverdict(inconc); + stop; + } + + // Test component configuration + f_cf_01_http_up(); + + // Preamble + f_init_default_headers_list(-, -, v_headers); + httpPort.send( + m_http_request( + m_http_request_get( + "/" & PICS_ROOT_API & PX_MEX_LCM_SUBS & oct2char(unichar2oct(PX_NON_ESISTENT_SUBSCRIPTION_ID, "UTF-8")), + 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( + ) + )) -> value v_response { + tc_ac.stop; + + log("*** " & testcasename() & ": PASS: IUT successfully responds with 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 + } // End of testcase TP_MEC_MEX_LCM_012_NF + + /** + * @desc: Check that MEC API provider service delete an existing LCM Subscription when requested + * ETSI GS MEC 010-2 2.0.10, clause 7.3.4.3.4 + */ + testcase TP_MEC_MEX_LCM_013_OK() runs on HttpComponent system HttpTestAdapter { + // Local variables + var HeaderLines v_headers; + var HttpMessage v_response; + + // Test control + if (not(PIC_APP_LCM_MANAGEMENT)){ + log("*** " & testcasename() & ": PIC_APP_LCM_MANAGEMENT required for executing the TC ***"); + setverdict(inconc); + stop; + } + + // Test component configuration + f_cf_01_http_up(); + + // Preamble + f_init_default_headers_list(-, -, v_headers); + httpPort.send( + m_http_request( + m_http_request_delete( + "/" & PICS_ROOT_API & PX_MEX_LCM_SUBS & oct2char(unichar2oct(PX_SUBSCRIPTION_ID, "UTF-8")), + 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() + )) -> value v_response { + tc_ac.stop; + + log("*** " & testcasename() & ": PASS: IUT successfully responds 204 No Content ***"); + 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 + } // End of testcase TP_MEC_MEX_LCM_013_OK + + + /** + * @desc: Check that MEC API provider service delete an existing LCM Subscription when requested + * ETSI GS MEC 010-2 2.0.10, clause 7.3.4.3.4 + */ + testcase TP_MEC_MEX_LCM_013_NF() runs on HttpComponent system HttpTestAdapter { + // Local variables + var HeaderLines v_headers; + var HttpMessage v_response; + + // Test control + if (not(PIC_APP_LCM_MANAGEMENT)){ + log("*** " & testcasename() & ": PIC_APP_LCM_MANAGEMENT required for executing the TC ***"); + setverdict(inconc); + stop; + } + + // Test component configuration + f_cf_01_http_up(); + + // Preamble + f_init_default_headers_list(-, -, v_headers); + httpPort.send( + m_http_request( + m_http_request_delete( + "/" & PICS_ROOT_API & PX_MEX_LCM_SUBS & oct2char(unichar2oct(PX_NON_ESISTENT_SUBSCRIPTION_ID, "UTF-8")), + 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( + ) + )) -> value v_response { + tc_ac.stop; + + log("*** " & testcasename() & ": PASS: IUT successfully responds with 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 + } // End of testcase TP_MEC_MEX_LCM_013_NF + + +} // end of group app_lcm_subscriptions + +group app_lcm__notification { + + /** + * @desc Check that MEC API provider sends a notification to the subscriber + * when an application lcm change event occurs + * @see ETSI GS MEC 010-2 2.0.10, clause 7.5.5.3.1 + * ETSI GS MEC 010-2 2.0.10, table 6.2.2.18.2-1 // AppLcmOpOccNotification + * ETSI GS MEC 010-2 2.0.10, table 6.2.2.12.2-1 // AppInstNotification + */ + testcase TP_MEC_MEX_LCM_014_OK() runs on HttpComponent system HttpTestAdapter { + // Local variables + var HeaderLines v_headers; + + // Test control + if (not(PIC_APP_PACKAGE_NOTIFICATIONS)) { + log("*** " & testcasename() & ": PIC_APP_PACKAGE_NOTIFICATIONS required for executing the TC ***"); + setverdict(inconc); + stop; + } + + // Test component configuration + f_cf_01_http_notif_up(); + + // Test adapter configuration + + // Preamble + f_init_default_headers_list(-, -, v_headers); + action("Trigger a expire notification event"); + f_selfOrClientSyncAndVerdict(c_prDone, e_success); + + // Test Body + tc_wait.start; + alt { + [] httpPort_notif.receive( + mw_http_request( + mw_http_request_post( + unichar2char(PX_CALLBACK_URI), + -, + mw_http_message_body_json( + mw_body_json_lcm_notification( + mw_app_lcm_notification( + PX_NOTIFICATON_ID, + PX_NOTIFICATION_TYPE + ) + ) + ) + ) + ) + ) { + tc_wait.stop; + log("*** " & testcasename() & ": INFO: IUT successfully sends notification ***"); + + // Send 204 No Content + httpPort_notif.send(m_http_response(m_http_response_204_no_content(v_headers))); + + log("*** " & testcasename() & ": PASS: IUT successfully sends notification ***"); + f_selfOrClientSyncAndVerdict(c_tbDone, e_success); + } + [] tc_wait.timeout { + log("*** " & testcasename() & ": INCONC: Expected message not received ***"); + f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout); + } + } // End of 'alt' statement + + // Postamble + f_cf_01_http_notif_down(); + } + + +} // end of group app_lcm__notification + + +} // End of module AtsMec_PkgMgmt_mm1_TestCases + + + + + + + diff --git a/ttcn/LibMec/AppLCM/ttcn/AppLCM_Pics.ttcn b/ttcn/LibMec/AppLCM/ttcn/AppLCM_Pics.ttcn new file mode 100644 index 0000000..dc1c9e1 --- /dev/null +++ b/ttcn/LibMec/AppLCM/ttcn/AppLCM_Pics.ttcn @@ -0,0 +1,8 @@ +module AppLCM_Pics { + + /** + * @desc Does the IUT support LocationAPI? + */ + modulepar boolean PICS_LCM_API_SUPPORTED := true; + +} // End of module LocationAPI_Pics diff --git a/ttcn/LibMec/AppLCM/ttcn/AppLCM_Pixits.ttcn b/ttcn/LibMec/AppLCM/ttcn/AppLCM_Pixits.ttcn new file mode 100644 index 0000000..828e9cf --- /dev/null +++ b/ttcn/LibMec/AppLCM/ttcn/AppLCM_Pixits.ttcn @@ -0,0 +1,42 @@ +module AppLCM_Pixits { + + // JSON + import from JSON all; + + + import from AppLCM_TypesAndValues all; + + + modulepar JSON.String PX_APP_D_ID := "5lkj4782-2c70-4e47-9a4e-0ee3a1a0fd1f" + + modulepar InstantiationState PX_INSTANTIATION_STATE := NOT_INSTANTIATED + + modulepar JSON.String PX_APP_INSTANCE_ID := "5abe4782-2c70-4e47-9a4e-0ee3a1a0fd1f" + + modulepar JSON.String PX_NON_EXISTENT_APP_INSTANCE_ID := "PX_NON_EXISTENT_APP_INSTANCE_ID" + + modulepar TerminationType PX_APP_TERMINATION_TYPE := GRACEFUL + + modulepar TerminationTypeWithError PX_APP_TERMINATION_TYPE_WITH_ERROR := GRACE + + modulepar OperationType PX_CHANGE_STATE_TO := STARTED + + modulepar OperationTypeWithError PX_CHANGE_STATE_TO_WITH_ERROR := START + + modulepar JSON.String PX_APP_LCM_OP_OCC_ID := "5abe4782-2c70-4e47-9a4e-0ee3a1a0fd1f" + + modulepar JSON.String PX_NON_EXISTENT_APP_LCM_OP_OCC_ID := "PX_NON_EXISTENT_APP_LCM_OP_OCC_ID" + + modulepar JSON.AnyURI PX_CALLBACK_URI := "http://127.0.0.1/callback" + + modulepar SubscriptionType PX_SUBSCRIPTION_TYPE := AppInstanceStateChangeSubscription + + modulepar JSON.String PX_SUBSCRIPTION_ID := "e0deee2b-6e50-4f33-ab09-8bf0585025d3" + + modulepar JSON.String PX_NON_ESISTENT_SUBSCRIPTION_ID := "PX_NON_ESISTENT_SUBSCRIPTION_ID" + + modulepar JSON.String PX_NOTIFICATION_ID := "208c95ec-121f-4bc2-b896-be3fe000d3ea" + + modulepar NotificationType PX_NOTIFICATION_TYPE := AppInstNotification + +} // End of module \ No newline at end of file diff --git a/ttcn/LibMec/AppLCM/ttcn/AppLCM_Templates.ttcn b/ttcn/LibMec/AppLCM/ttcn/AppLCM_Templates.ttcn new file mode 100644 index 0000000..cac24e0 --- /dev/null +++ b/ttcn/LibMec/AppLCM/ttcn/AppLCM_Templates.ttcn @@ -0,0 +1,114 @@ +module AppLCM_Templates { + + // JSON + import from JSON all; + + // LibCommon + import from LibCommon_BasicTypesAndValues all; + + import from AppLCM_TypesAndValues all; + import from AppLCM_Pixits all; + + + template (present) CreateAppInstanceRequest m_lifecycle_management_create ( + in template (present) String p_appDId := ? + ) := { + appDId := p_appDId + } + + template (present) CreateAppInstanceRequestWithError m_lifecycle_management_create_with_error ( + in template (present) String p_appDIdWithError := ? + ) := { + appDIdWithError := p_appDIdWithError + } + + template (present) AppInstanceInfo mw_lcm_instance_info ( + in template (present) String p_app_instance_id := ?, + in template (present) String p_app_d_id := ?, + in template (present) InstantiationState p_instantiation_state := ? + ) := { + appInstanceId := p_app_instance_id, + appDId := p_app_d_id, + instantiationState := p_instantiation_state + } + + template (present) InstantiateAppRequest m_lifecycle_management_instantiate ( + in template (present) String p_app_instance_id + ) := { + appInstanceId := p_app_instance_id + } + + template (present) InstantiateAppRequestWithError m_lifecycle_management_instantiate_with_error ( + in template (present) String p_app_instance_id + ) := { + appId := p_app_instance_id + } + + template (present) TerminateAppRequest m_lifecycle_management_terminate ( + in template (present) TerminationType p_termination_type + ) := { + terminationType := p_termination_type + } + + template (present) TerminateAppRequestWithError m_lifecycle_management_terminate_with_error ( + in template (present) TerminationTypeWithError p_termination_type_with_error + ) := { + terminationTypeWithError := p_termination_type_with_error + } + + template (present) OperateAppRequest m_lifecycle_management_operate ( + in template (present) OperationType p_change_state_to_type + ) := { + changeStateTo := p_change_state_to_type + } + + template (present) OperateAppRequestWithError m_lifecycle_management_operate_with_error ( + in template (present) OperationTypeWithError p_change_state_to_type_with_error + ) := { + changeStateToWithError := p_change_state_to_type_with_error + } + + template (present) AppInstanceLcmOpOcc mw_lifecycle_management_op_occ ( + in template (present) JSON.String p_app_lcm_op_occ_id := ? + ) := { + appLcmOpOccId := p_app_lcm_op_occ_id + } + + + template (present) SubscriptionRequest m_app_lcm_subscribe_request ( + in template (present) SubscriptionType p_subscription_type, + in template (present) AnyURI p_callback_uri + ) := { + subscriptionType := p_subscription_type, + callbackUri := p_callback_uri + } + + + template (present) SubscriptionRequestWithError m_app_lcm_subscribe_request_with_error ( + in template (present) SubscriptionType p_subscription_type, + in template (present) AnyURI p_callback_uri_with_error + ) := { + subscriptionType := p_subscription_type, + callbackUriWithError := p_callback_uri_with_error + } + + template (present) SubscriptionInfo mw_app_lcm_subscription_info ( + in template (present) String p_subscription_id := ?, + in template (present) SubscriptionType p_subscription_type := ?, + in template (present) AnyURI p_callback_uri := ? + ) := { + subscriptionId := p_subscription_id, + subscriptionType := p_subscription_type, + callbackUri := p_callback_uri + } + + template (present) Notification mw_app_lcm_notification ( + in template (present) String p_notification_id := ?, + in template (present) NotificationType p_notification_type := ?, + in template (present) String p_subscription_id := ? + ) := { + notificationId := p_notification_id, + notificationType := p_notification_type + } + +} \ No newline at end of file diff --git a/ttcn/LibMec/AppLCM/ttcn/AppLCM_TypesAndValues.ttcn b/ttcn/LibMec/AppLCM/ttcn/AppLCM_TypesAndValues.ttcn new file mode 100644 index 0000000..5b0265c --- /dev/null +++ b/ttcn/LibMec/AppLCM/ttcn/AppLCM_TypesAndValues.ttcn @@ -0,0 +1,148 @@ +module AppLCM_TypesAndValues { + +// JSON +import from JSON all; + +// LibCommon +import from LibCommon_BasicTypesAndValues all; + + +type enumerated InstantiationState { + NOT_INSTANTIATED, + INSTANTIATED +} + + +type enumerated TerminationType { + FORCEFUL, + GRACEFUL +} + +type enumerated TerminationTypeWithError { + FORCE, + GRACE +} + + +type enumerated OperationType { + STARTED, + STOPPED +} + +type enumerated OperationTypeWithError { + START, + STOP +} + + +type enumerated SubscriptionType { + AppInstanceStateChangeSubscription, + AppLcmOpOccStateChangeSubscription +} + + +type enumerated NotificationType { + AppInstNotification, + AppLcmOpOccNotification +} + +type record CreateAppInstanceRequest { + String appDId +} + + +type record CreateAppInstanceRequestWithError { + String appDIdWithError +} + +type record of AppInstanceInfo AppInstanceInfoList; +type record AppInstanceInfo { + String appInstanceId, + String appDId, + InstantiationState instantiationState +} + +type record of SelectedMECHostInfo SelectedMECHostInfoList +type record SelectedMECHostInfo { + +} + +type record InstantiateAppRequest { + String appInstanceId, + SelectedMECHostInfoList selectedMECHostInfo +} + +type record InstantiateAppRequestWithError { + String appId, + SelectedMECHostInfoList selectedMECHostInfo +} + +type record TerminateAppRequest { + TerminationType terminationType +} + +type record TerminateAppRequestWithError { + TerminationTypeWithError terminationTypeWithError +} + +type record OperateAppRequest { + OperationType changeStateTo +} + +type record OperateAppRequestWithError { + OperationTypeWithError changeStateToWithError +} + +type record of AppInstanceLcmOpOcc AppInstanceLcmOpOccList; +type record AppInstanceLcmOpOcc { + String appLcmOpOccId +} + + +type record SubscriptionRequest { + AnyURI callbackUri, + SubscriptionType subscriptionType +} + +type record SubscriptionRequestWithError { + AnyURI callbackUriWithError, + SubscriptionType subscriptionType +} + +type record of SubscriptionInfo SubscriptionInfoList; +type record SubscriptionInfo { + String subscriptionId, + SubscriptionType subscriptionType, + AnyURI callbackUri +} + + +type record Notification { + String notificationId, + NotificationType notificationType, + String subscriptionId +} + +/** +* @desc Problem Details for HTTP APIs +* @member type_ A URI reference according to IETF RFC 3986 that identifies the problem type +* @member title A short, human-readable summary of the problem type +* @member status The HTTP status code for this occurrence of the problem +* @member detail A human-readable explanation specific to this occurrence of the problem +* @member instance A URI reference that identifies the specific occurrence of the problem +* @see IETF RFC 7807 Clause 3. The Problem Details JSON Object +*/ +type record ProblemDetails { + JSON.String type_, + JSON.String title, + UInt32 status, + JSON.String detail, + JSON.String instance +} with { + variant (type_) "name as 'type'"; +} + + +} with { +encode "JSON" +} diff --git a/ttcn/LibMec/ttcn/LibMec_Pics.ttcn b/ttcn/LibMec/ttcn/LibMec_Pics.ttcn index 0e654c5..8dcf66e 100644 --- a/ttcn/LibMec/ttcn/LibMec_Pics.ttcn +++ b/ttcn/LibMec/ttcn/LibMec_Pics.ttcn @@ -44,4 +44,6 @@ module LibMec_Pics { modulepar boolean PIC_APP_LCM_MANAGEMENT := true; + modulepar boolean PIC_APP_LCM_NOTIFICATIONS := false; + } // End of module LibMec_Pics diff --git a/ttcn/LibMec/ttcn/LibMec_Pixits.ttcn b/ttcn/LibMec/ttcn/LibMec_Pixits.ttcn index 288bf41..205f3ef 100644 --- a/ttcn/LibMec/ttcn/LibMec_Pixits.ttcn +++ b/ttcn/LibMec/ttcn/LibMec_Pixits.ttcn @@ -41,7 +41,8 @@ module LibMec_Pixits { modulepar charstring PX_MEX_LCM_URI := "/alcmi/v1/app_instances" modulepar charstring PX_MEX_LCM_SUBS := "/alcmi/v1/subscriptions" - + + modulepar charstring PX_MEX_LCM_OP_OCC_URI := "/alcmi/v1/app_lcm_op_occs" modulepar charstring PX_UE_APP_CTX_URI := "/mx2/v2/app_contexts"; diff --git a/ttcn/patch_lib_http/LibItsHttp_JsonMessageBodyTypes.ttcn b/ttcn/patch_lib_http/LibItsHttp_JsonMessageBodyTypes.ttcn index 645983f..97d971c 100644 --- a/ttcn/patch_lib_http/LibItsHttp_JsonMessageBodyTypes.ttcn +++ b/ttcn/patch_lib_http/LibItsHttp_JsonMessageBodyTypes.ttcn @@ -94,8 +94,21 @@ module LibItsHttp_JsonMessageBodyTypes { AppLCM_TypesAndValues.CreateAppInstanceRequestWithError createAppInstanceRequestWithError, AppLCM_TypesAndValues.AppInstanceInfoList appInstanceInfoList, AppLCM_TypesAndValues.InstantiateAppRequest appInstanceInstantiate, + AppLCM_TypesAndValues.InstantiateAppRequestWithError appInstanceInstantiateWithError, + AppLCM_TypesAndValues.TerminateAppRequest terminateType, + AppLCM_TypesAndValues.TerminateAppRequestWithError terminateTypeWithError, + AppLCM_TypesAndValues.OperateAppRequest changeStateTo, + AppLCM_TypesAndValues.OperateAppRequestWithError changeStateToWithError, + AppLCM_TypesAndValues.AppInstanceLcmOpOcc appInstanceLcmOpOcc, + AppLCM_TypesAndValues.AppInstanceLcmOpOccList appInstanceLcmOpOccList, + AppLCM_TypesAndValues.SubscriptionRequest subscriptionRequest, + AppLCM_TypesAndValues.SubscriptionRequestWithError subscriptionRequestWithError, + AppLCM_TypesAndValues.SubscriptionInfoList subscriptionInfoList, + AppLCM_TypesAndValues.SubscriptionInfo subscriptionInfo, + AppLCM_TypesAndValues.Notification lcmNotification, AppContext appContext, AppInfo appInfo, + UEAppInterfaceAPI_TypesAndValues.ProblemDetails problemDetails_ue_app_ctxt, universal charstring raw } with { diff --git a/ttcn/patch_lib_http/LibItsHttp_JsonTemplates.ttcn b/ttcn/patch_lib_http/LibItsHttp_JsonTemplates.ttcn index 4d21400..cd039b5 100644 --- a/ttcn/patch_lib_http/LibItsHttp_JsonTemplates.ttcn +++ b/ttcn/patch_lib_http/LibItsHttp_JsonTemplates.ttcn @@ -235,6 +235,86 @@ group lcm_api { ) := { appInstanceInstantiate := p_app_instance_instantiate } + + template (present) JsonBody m_body_json_lifecycle_management_instantiate_with_error ( + in template (present) InstantiateAppRequestWithError p_app_instance_instantiate_with_error + ) := { + appInstanceInstantiateWithError := p_app_instance_instantiate_with_error + } + + + + template (present) JsonBody m_body_json_lifecycle_management_terminate ( + in template (present) TerminateAppRequest p_app_instance_terminate + ) := { + terminateType := p_app_instance_terminate + } + + template (present) JsonBody m_body_json_lifecycle_management_terminate_with_error ( + in template (present) TerminateAppRequestWithError p_app_instance_terminate_with_error + ) := { + terminateTypeWithError := p_app_instance_terminate_with_error + } + + + + template (present) JsonBody m_body_json_lifecycle_management_operate ( + in template (present) OperateAppRequest p_app_instance_operate + ) := { + changeStateTo := p_app_instance_operate + } + + template (present) JsonBody m_body_json_lifecycle_management_operate_with_error ( + in template (present) OperateAppRequestWithError p_app_instance_operate_with_error + ) := { + changeStateToWithError := p_app_instance_operate_with_error + } + + + template (present) JsonBody mw_body_json_lifecycle_op_occ_list ( + in template (present) AppInstanceLcmOpOccList p_app_instance_op_occ_list + ) := { + appInstanceLcmOpOccList := p_app_instance_op_occ_list + } + + template (present) JsonBody mw_body_json_lifecycle_op_occ ( + in template (present) AppInstanceLcmOpOcc p_app_instance_op_occ + ) := { + appInstanceLcmOpOcc := p_app_instance_op_occ + } + + template (present) JsonBody m_body_json_lcm_subscribe( + in template (present) SubscriptionRequest p_app_lcm_request + ) := { + subscriptionRequest := p_app_lcm_request + } + + template (present) JsonBody m_body_json_lcm_subscribe_with_error( + in template (present) SubscriptionRequestWithError p_app_lcm_request_with_error + ) := { + subscriptionRequestWithError := p_app_lcm_request_with_error + } + + + template (present) JsonBody mw_body_json_lcm_subscription_list( + in template (present) SubscriptionInfoList p_app_lcm_subscription_list + ) := { + subscriptionInfoList := p_app_lcm_subscription_list + } + + template (present) JsonBody mw_body_json_lcm_subscription( + in template (present) SubscriptionInfo p_app_lcm_subscription + ) := { + subscriptionInfo := p_app_lcm_subscription + } + + + template (present) JsonBody mw_body_json_lcm_notification ( + in template (present) Notification p_lcm_notification + ) := { + lcmNotification := p_lcm_notification + } + } group ams_api { -- GitLab