From eb11c30a4be61cf8390575a54fb92aa66099a69d Mon Sep 17 00:00:00 2001 From: YannGarcia Date: Mon, 11 Nov 2019 11:37:45 +0100 Subject: [PATCH] Update BWA test cases --- ttcn/AtsMec/AtsMec_Ams_TestCases.ttcn | 3 +- .../AtsMec_AppEnablementAPI_TestCases.ttcn | 2 +- ttcn/AtsMec/AtsMec_AppLCM_TestCases.ttcn | 6 +- .../AtsMec_BwManagementAPI_TestCases.ttcn | 935 +++++++++++++++++- ttcn/AtsMec/AtsMec_TestControl.ttcn | 16 +- ttcn/LibIts | 2 +- .../ttcn/BwManagementAPI_Pixits.ttcn | 10 + .../ttcn/BwManagementAPI_Templates.ttcn | 2 +- .../ttcn/BwManagementAPI_TypesAndValues.ttcn | 3 +- 9 files changed, 964 insertions(+), 15 deletions(-) diff --git a/ttcn/AtsMec/AtsMec_Ams_TestCases.ttcn b/ttcn/AtsMec/AtsMec_Ams_TestCases.ttcn index 2e0005e..8b44ec1 100644 --- a/ttcn/AtsMec/AtsMec_Ams_TestCases.ttcn +++ b/ttcn/AtsMec/AtsMec_Ams_TestCases.ttcn @@ -1246,8 +1246,7 @@ alt { [] httpPort.receive( mw_http_response( - mw_http_response_204_no_content( - ) + mw_http_response_204_no_content ) ) { diff --git a/ttcn/AtsMec/AtsMec_AppEnablementAPI_TestCases.ttcn b/ttcn/AtsMec/AtsMec_AppEnablementAPI_TestCases.ttcn index b458822..7ac9f4c 100644 --- a/ttcn/AtsMec/AtsMec_AppEnablementAPI_TestCases.ttcn +++ b/ttcn/AtsMec/AtsMec_AppEnablementAPI_TestCases.ttcn @@ -1626,7 +1626,7 @@ module AtsMec_AppEnablementAPI_TestCases { alt { [] httpPort.receive( mw_http_response( - mw_http_response_412_precondition_failed() + mw_http_response_412_precondition_failed )) { tc_ac.stop; diff --git a/ttcn/AtsMec/AtsMec_AppLCM_TestCases.ttcn b/ttcn/AtsMec/AtsMec_AppLCM_TestCases.ttcn index 177d336..0e1b21f 100644 --- a/ttcn/AtsMec/AtsMec_AppLCM_TestCases.ttcn +++ b/ttcn/AtsMec/AtsMec_AppLCM_TestCases.ttcn @@ -361,8 +361,8 @@ module AtsMec_AppLCM_TestCases { alt { [] httpPort.receive( mw_http_response( - mw_http_response_204_no_content( - ))) -> value v_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); @@ -1471,7 +1471,7 @@ group app_lcm_subscriptions { alt { [] httpPort.receive( mw_http_response( - mw_http_response_204_no_content() + mw_http_response_204_no_content )) -> value v_response { tc_ac.stop; diff --git a/ttcn/AtsMec/AtsMec_BwManagementAPI_TestCases.ttcn b/ttcn/AtsMec/AtsMec_BwManagementAPI_TestCases.ttcn index 44e3c4c..c08d918 100644 --- a/ttcn/AtsMec/AtsMec_BwManagementAPI_TestCases.ttcn +++ b/ttcn/AtsMec/AtsMec_BwManagementAPI_TestCases.ttcn @@ -41,10 +41,67 @@ module AtsMec_BwManagementAPI_TestCases { * @see https://forge.etsi.org/gitlab/mec/MEC-tests/blob/master/Test%20Purposes/Plat/Mp1/Bandwidth/PlatBandwidthManager.tplan2 * @see hhttps://forge.etsi.org/swagger/ui/?url=https://forge.etsi.org/gitlab/mec/gs015-bandwith-mgmt-api/raw/master/BwManagementApi.yaml */ - testcase TC_MEC_PLAT_MP1_BWA_BV_001() runs on HttpComponent system HttpTestAdapter { + testcase TC_MEC_SRV_BWA_001_OK() runs on HttpComponent system HttpTestAdapter { + // Local variables + var HeaderLines v_headers; + + // Test control + if (not(PICS_MEC_PLAT) or not(PICS_BWMANAGEMENT_API_SUPPORTED)) { + log("*** " & testcasename() & ": PICS_MEC_PLAT and PICS_BWMANAGEMENT_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( + "/" & PICS_ROOT_API & PX_ME_BWM_URI & "?app_instance_id=" & 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_bw_info( + mw_bw_info + ))))) { + tc_ac.stop; + + log("*** " & testcasename() & ": PASS: IUT successfully responds with BW information ***"); + 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_SRV_BWA_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/gitlab/mec/MEC-tests/blob/master/Test%20Purposes/Plat/Mp1/Bandwidth/PlatBandwidthManager.tplan2 + * @see hhttps://forge.etsi.org/swagger/ui/?url=https://forge.etsi.org/gitlab/mec/gs015-bandwith-mgmt-api/raw/master/BwManagementApi.yaml + */ + testcase TC_MEC_SRV_BWA_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_BWMANAGEMENT_API_SUPPORTED)) { @@ -63,13 +120,83 @@ module AtsMec_BwManagementAPI_TestCases { httpPort.send( m_http_request( m_http_request_get( - PX_ME_BWM_URI & "?app_instance_id=" & oct2char(unichar2oct(PX_APP_INSTANCE_ID, "UTF-8")), + "/" & PICS_ROOT_API & PX_ME_BWM_URI & "?app_id=" & oct2char(unichar2oct(PX_APP_INSTANCE_ID, "UTF-8")), // Wrong parameter name should trigger an error response 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( + mw_http_message_body_json( + mw_body_json_ue_identity_problem_details( + mw_problem_details( + -, -, 400 + )))))) { + tc_ac.stop; + + log("*** " & testcasename() & ": PASS: IUT successfully responds with an HTTP 400 error status ***"); + 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_SRV_BWA_001_BR + + /** + * @desc Check that the IUT responds with a registration and initialisation approval for the requested bandwidth requirements sent by a MEC Application + * @see https://forge.etsi.org/gitlab/mec/MEC-tests/blob/master/Test%20Purposes/Plat/Mp1/Bandwidth/PlatBandwidthManager.tplan2 + * @see hhttps://forge.etsi.org/swagger/ui/?url=https://forge.etsi.org/gitlab/mec/gs015-bandwith-mgmt-api/raw/master/BwManagementApi.yaml + */ + testcase TC_MEC_SRV_BWA_002_OK() runs on HttpComponent system HttpTestAdapter { + // Local variables + var HeaderLines v_headers; + var HttpMessage v_response; + + // Test control + if (not(PICS_MEC_PLAT) or not(PICS_BWMANAGEMENT_API_SUPPORTED)) { + log("*** " & testcasename() & ": PICS_MEC_PLAT and PICS_BWMANAGEMENT_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_post( + "/" & PICS_ROOT_API & PX_ME_BWM_URI & "?app_instance_id=" & oct2char(unichar2oct(PX_APP_INSTANCE_ID, "UTF-8")), + v_headers, + m_http_message_body_json( + m_body_json_bw_info( + m_bw_info( + PX_APP_INSTANCE_ID, + APPLICATION_SPECIFIC_BW_ALLOCATION, + not_defined_in_the_present_document, + PX_FIXED_ALLOCATION + ) + ) + ) + ) + ) + ); + f_selfOrClientSyncAndVerdict(c_prDone, e_success); + // Test Body tc_ac.start; alt { @@ -82,7 +209,805 @@ module AtsMec_BwManagementAPI_TestCases { ))))) -> value v_response { tc_ac.stop; - log("*** " & testcasename() & ": PASS: IUT successfully responds with a ZoneId ***"); + if (f_check_headers(valueof(v_response.response.header)) == true) { + log("*** " & testcasename() & ": PASS: IUT successfully responds with a location ***"); + 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_SRV_BWA_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/gitlab/mec/MEC-tests/blob/master/Test%20Purposes/Plat/Mp1/Bandwidth/PlatBandwidthManager.tplan2 + * @see hhttps://forge.etsi.org/swagger/ui/?url=https://forge.etsi.org/gitlab/mec/gs015-bandwith-mgmt-api/raw/master/BwManagementApi.yaml + */ + testcase TC_MEC_SRV_BWA_002_BR() runs on HttpComponent system HttpTestAdapter { + // Local variables + var HeaderLines v_headers; + + // Test control + if (not(PICS_MEC_PLAT) or not(PICS_BWMANAGEMENT_API_SUPPORTED)) { + log("*** " & testcasename() & ": PICS_MEC_PLAT and PICS_BWMANAGEMENT_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_post( + "/" & PICS_ROOT_API & PX_ME_BWM_URI & "?app_instance_id=" & oct2char(unichar2oct(PX_APP_INSTANCE_ID, "UTF-8")), + v_headers, + m_http_message_body_json( + m_body_json_bw_info( + m_bw_info( + PX_APP_INSTANCE_ID, + INVALID_BW_ALLOCATION, + not_defined_in_the_present_document, + PX_FIXED_ALLOCATION + ) + ) + ) + ) + ) + ); + f_selfOrClientSyncAndVerdict(c_prDone, e_success); + + // Test Body + tc_ac.start; + alt { + [] httpPort.receive( + mw_http_response( + mw_http_response_400_bad_request( + mw_http_message_body_json( + mw_body_json_ue_identity_problem_details( + mw_problem_details( + -, -, 400 + )))))) { + tc_ac.stop; + + log("*** " & testcasename() & ": PASS: IUT successfully responds with an HTTP 400 error status ***"); + 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_SRV_BWA_002_BR + + /** + * @desc Check that the IUT responds with the configured bandwidth allocation when queried by a MEC Application + * @see https://forge.etsi.org/gitlab/mec/MEC-tests/blob/master/Test%20Purposes/Plat/Mp1/Bandwidth/PlatBandwidthManager.tplan2 + * @see hhttps://forge.etsi.org/swagger/ui/?url=https://forge.etsi.org/gitlab/mec/gs015-bandwith-mgmt-api/raw/master/BwManagementApi.yaml + */ + testcase TC_MEC_SRV_BWA_003_OK() runs on HttpComponent system HttpTestAdapter { + // Local variables + var HeaderLines v_headers; + + // Test control + if (not(PICS_MEC_PLAT) or not(PICS_BWMANAGEMENT_API_SUPPORTED)) { + log("*** " & testcasename() & ": PICS_MEC_PLAT and PICS_BWMANAGEMENT_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( + "/" & PICS_ROOT_API & PX_ME_BWM_URI & "?allocation_id=" & oct2char(unichar2oct(PX_ALLOCATION_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_bw_info( + mw_bw_info + ))))) { + tc_ac.stop; + + log("*** " & testcasename() & ": PASS: IUT successfully responds with an application instance identifier ***"); + 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_SRV_BWA_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/gitlab/mec/MEC-tests/blob/master/Test%20Purposes/Plat/Mp1/Bandwidth/PlatBandwidthManager.tplan2 + * @see hhttps://forge.etsi.org/swagger/ui/?url=https://forge.etsi.org/gitlab/mec/gs015-bandwith-mgmt-api/raw/master/BwManagementApi.yaml + */ + testcase TC_MEC_SRV_BWA_003_NF() runs on HttpComponent system HttpTestAdapter { + // Local variables + var HeaderLines v_headers; + + // Test control + if (not(PICS_MEC_PLAT) or not(PICS_BWMANAGEMENT_API_SUPPORTED)) { + log("*** " & testcasename() & ": PICS_MEC_PLAT and PICS_BWMANAGEMENT_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( + "/" & PICS_ROOT_API & PX_ME_BWM_URI & "?allocation_id=" & oct2char(unichar2oct(PX_NON_EXISTENT_ALLOCATION_ID, "UTF-8")), // Wrong parameter name should trigger an error response + 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( + mw_http_message_body_json( + mw_body_json_ue_identity_problem_details( + mw_problem_details( + -, -, 404 + )))))) { + tc_ac.stop; + + log("*** " & testcasename() & ": PASS: IUT successfully responds with an HTTP 404 error status ***"); + 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_SRV_BWA_003_NF + + /** + * @desc Check that the IUT updates the requested bandwidth requirements when commanded by a MEC Application + * @see https://forge.etsi.org/gitlab/mec/MEC-tests/blob/master/Test%20Purposes/Plat/Mp1/Bandwidth/PlatBandwidthManager.tplan2 + * @see hhttps://forge.etsi.org/swagger/ui/?url=https://forge.etsi.org/gitlab/mec/gs015-bandwith-mgmt-api/raw/master/BwManagementApi.yaml + */ + testcase TC_MEC_SRV_BWA_004_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_BWMANAGEMENT_API_SUPPORTED)) { + log("*** " & testcasename() & ": PICS_MEC_PLAT and PICS_BWMANAGEMENT_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_post( + "/" & PICS_ROOT_API & PX_ME_BWM_URI & "?allocation_id=" & oct2char(unichar2oct(PX_ALLOCATION_ID, "UTF-8")), + v_headers, + m_http_message_body_json( + m_body_json_bw_info( + m_bw_info( + PX_APP_INSTANCE_ID, + APPLICATION_SPECIFIC_BW_ALLOCATION, + not_defined_in_the_present_document, + PX_FIXED_ALLOCATION + ) + ) + ) + ) + ) + ); + 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_bw_info( + mw_bw_info + ))))) -> value v_response { + tc_ac.stop; + + if (f_check_headers(valueof(v_response.response.header)) == true) { + log("*** " & testcasename() & ": PASS: IUT successfully responds to update request ***"); + 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_SRV_BWA_004_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/gitlab/mec/MEC-tests/blob/master/Test%20Purposes/Plat/Mp1/Bandwidth/PlatBandwidthManager.tplan2 + * @see hhttps://forge.etsi.org/swagger/ui/?url=https://forge.etsi.org/gitlab/mec/gs015-bandwith-mgmt-api/raw/master/BwManagementApi.yaml + */ + testcase TC_MEC_SRV_BWA_004_BR() runs on HttpComponent system HttpTestAdapter { + // Local variables + var HeaderLines v_headers; + + // Test control + if (not(PICS_MEC_PLAT) or not(PICS_BWMANAGEMENT_API_SUPPORTED)) { + log("*** " & testcasename() & ": PICS_MEC_PLAT and PICS_BWMANAGEMENT_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_post( + "/" & PICS_ROOT_API & PX_ME_BWM_URI & "?alloc_id=" & oct2char(unichar2oct(PX_ALLOCATION_ID, "UTF-8")), + v_headers, + m_http_message_body_json( + m_body_json_bw_info( + m_bw_info( + PX_APP_INSTANCE_ID, + APPLICATION_SPECIFIC_BW_ALLOCATION, + not_defined_in_the_present_document, + PX_FIXED_ALLOCATION + ) + ) + ) + ) + ) + ); + f_selfOrClientSyncAndVerdict(c_prDone, e_success); + + // Test Body + tc_ac.start; + alt { + [] httpPort.receive( + mw_http_response( + mw_http_response_400_bad_request( + mw_http_message_body_json( + mw_body_json_ue_identity_problem_details( + mw_problem_details( + -, -, 400 + )))))) { + tc_ac.stop; + + log("*** " & testcasename() & ": PASS: IUT successfully responds with an HTTP 400 error status ***"); + 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_SRV_BWA_004_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/gitlab/mec/MEC-tests/blob/master/Test%20Purposes/Plat/Mp1/Bandwidth/PlatBandwidthManager.tplan2 + * @see hhttps://forge.etsi.org/swagger/ui/?url=https://forge.etsi.org/gitlab/mec/gs015-bandwith-mgmt-api/raw/master/BwManagementApi.yaml + */ + testcase TC_MEC_SRV_BWA_004_NF() runs on HttpComponent system HttpTestAdapter { + // Local variables + var HeaderLines v_headers; + + // Test control + if (not(PICS_MEC_PLAT) or not(PICS_BWMANAGEMENT_API_SUPPORTED)) { + log("*** " & testcasename() & ": PICS_MEC_PLAT and PICS_BWMANAGEMENT_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_post( + "/" & PICS_ROOT_API & PX_ME_BWM_URI & "?allocation_id=" & oct2char(unichar2oct(PX_NON_EXISTENT_ALLOCATION_ID, "UTF-8")), + v_headers, + m_http_message_body_json( + m_body_json_bw_info( + m_bw_info( + PX_APP_INSTANCE_ID, + APPLICATION_SPECIFIC_BW_ALLOCATION, + not_defined_in_the_present_document, + PX_FIXED_ALLOCATION + ) + ) + ) + ) + ) + ); + f_selfOrClientSyncAndVerdict(c_prDone, e_success); + + // Test Body + tc_ac.start; + alt { + [] httpPort.receive( + mw_http_response( + mw_http_response_404_not_found( + mw_http_message_body_json( + mw_body_json_ue_identity_problem_details( + mw_problem_details( + -, -, 404 + )))))) { + tc_ac.stop; + + log("*** " & testcasename() & ": PASS: IUT successfully responds with an HTTP 404 error status ***"); + 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_SRV_BWA_004_NF + + /** + * @desc Check that the IUT when provided with just the changes (deltas) updates the requested bandwidth requirements when commanded by a MEC Application + * @see https://forge.etsi.org/gitlab/mec/MEC-tests/blob/master/Test%20Purposes/Plat/Mp1/Bandwidth/PlatBandwidthManager.tplan2 + * @see hhttps://forge.etsi.org/swagger/ui/?url=https://forge.etsi.org/gitlab/mec/gs015-bandwith-mgmt-api/raw/master/BwManagementApi.yaml + */ + testcase TC_MEC_SRV_BWA_005_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_BWMANAGEMENT_API_SUPPORTED)) { + log("*** " & testcasename() & ": PICS_MEC_PLAT and PICS_BWMANAGEMENT_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_patch( + "/" & PICS_ROOT_API & PX_ME_BWM_URI & "?allocation_id=" & oct2char(unichar2oct(PX_ALLOCATION_ID, "UTF-8")), + v_headers, + m_http_message_body_json( + m_body_json_bw_info( + m_bw_info( + PX_APP_INSTANCE_ID, + APPLICATION_SPECIFIC_BW_ALLOCATION, + not_defined_in_the_present_document, + PX_FIXED_PATCHED_ALLOCATION + ) + ) + ) + ) + ) + ); + 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_bw_info( + mw_bw_info + ))))) -> value v_response { + tc_ac.stop; + + if (f_check_headers(valueof(v_response.response.header)) == true) { + log("*** " & testcasename() & ": PASS: IUT successfully responds with a location ***"); + 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_SRV_BWA_005_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/gitlab/mec/MEC-tests/blob/master/Test%20Purposes/Plat/Mp1/Bandwidth/PlatBandwidthManager.tplan2 + * @see hhttps://forge.etsi.org/swagger/ui/?url=https://forge.etsi.org/gitlab/mec/gs015-bandwith-mgmt-api/raw/master/BwManagementApi.yaml + */ + testcase TC_MEC_SRV_BWA_005_BR() runs on HttpComponent system HttpTestAdapter { + // Local variables + var HeaderLines v_headers; + + // Test control + if (not(PICS_MEC_PLAT) or not(PICS_BWMANAGEMENT_API_SUPPORTED)) { + log("*** " & testcasename() & ": PICS_MEC_PLAT and PICS_BWMANAGEMENT_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_patch( + "/" & PICS_ROOT_API & PX_ME_BWM_URI & "?alloc_id=" & oct2char(unichar2oct(PX_ALLOCATION_ID, "UTF-8")), + v_headers, + m_http_message_body_json( + m_body_json_bw_info( + m_bw_info( + PX_APP_INSTANCE_ID, + APPLICATION_SPECIFIC_BW_ALLOCATION, + not_defined_in_the_present_document, + PX_FIXED_PATCHED_ALLOCATION + ) + ) + ) + ) + ) + ); + f_selfOrClientSyncAndVerdict(c_prDone, e_success); + + // Test Body + tc_ac.start; + alt { + [] httpPort.receive( + mw_http_response( + mw_http_response_400_bad_request( + mw_http_message_body_json( + mw_body_json_ue_identity_problem_details( + mw_problem_details( + -, -, 400 + )))))) { + tc_ac.stop; + + log("*** " & testcasename() & ": PASS: IUT successfully responds with an HTTP 400 error status ***"); + 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_SRV_BWA_005_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/gitlab/mec/MEC-tests/blob/master/Test%20Purposes/Plat/Mp1/Bandwidth/PlatBandwidthManager.tplan2 + * @see hhttps://forge.etsi.org/swagger/ui/?url=https://forge.etsi.org/gitlab/mec/gs015-bandwith-mgmt-api/raw/master/BwManagementApi.yaml + */ + testcase TC_MEC_SRV_BWA_005_NF() runs on HttpComponent system HttpTestAdapter { + // Local variables + var HeaderLines v_headers; + + // Test control + if (not(PICS_MEC_PLAT) or not(PICS_BWMANAGEMENT_API_SUPPORTED)) { + log("*** " & testcasename() & ": PICS_MEC_PLAT and PICS_BWMANAGEMENT_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_patch( + "/" & PICS_ROOT_API & PX_ME_BWM_URI & "?allocation_id=" & oct2char(unichar2oct(PX_NON_EXISTENT_ALLOCATION_ID, "UTF-8")), + v_headers, + m_http_message_body_json( + m_body_json_bw_info( + m_bw_info( + PX_APP_INSTANCE_ID, + APPLICATION_SPECIFIC_BW_ALLOCATION, + not_defined_in_the_present_document, + PX_FIXED_PATCHED_ALLOCATION + ) + ) + ) + ) + ) + ); + f_selfOrClientSyncAndVerdict(c_prDone, e_success); + + // Test Body + tc_ac.start; + alt { + [] httpPort.receive( + mw_http_response( + mw_http_response_404_not_found( + mw_http_message_body_json( + mw_body_json_ue_identity_problem_details( + mw_problem_details( + -, -, 404 + )))))) { + tc_ac.stop; + + log("*** " & testcasename() & ": PASS: IUT successfully responds with an HTTP 404 error status ***"); + 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_SRV_BWA_005_NF + + /** + * @desc Check that the IUT responds with an error when a request sent by a MEC Application doesn't comply with a required condition + * @see https://forge.etsi.org/gitlab/mec/MEC-tests/blob/master/Test%20Purposes/Plat/Mp1/Bandwidth/PlatBandwidthManager.tplan2 + * @see hhttps://forge.etsi.org/swagger/ui/?url=https://forge.etsi.org/gitlab/mec/gs015-bandwith-mgmt-api/raw/master/BwManagementApi.yaml + */ + testcase TC_MEC_SRV_BWA_005_PF() runs on HttpComponent system HttpTestAdapter { + // Local variables + var HeaderLines v_headers; + + // Test control + if (not(PICS_MEC_PLAT) or not(PICS_BWMANAGEMENT_API_SUPPORTED)) { + log("*** " & testcasename() & ": PICS_MEC_PLAT and PICS_BWMANAGEMENT_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_patch( + "/" & PICS_ROOT_API & PX_ME_BWM_URI & "?allocation_id=" & oct2char(unichar2oct(PX_NON_EXISTENT_ALLOCATION_ID, "UTF-8")), + v_headers, + m_http_message_body_json( + m_body_json_bw_info( + m_bw_info( + PX_APP_INSTANCE_ID, + APPLICATION_SPECIFIC_BW_ALLOCATION, + not_defined_in_the_present_document, + PX_FIXED_PATCHED_ALLOCATION + ) + ) + ) + ) + ) + ); + f_selfOrClientSyncAndVerdict(c_prDone, e_success); + + // Test Body + tc_ac.start; + alt { + [] httpPort.receive( + mw_http_response( + mw_http_response_412_precondition_failed( + mw_http_message_body_json( + mw_body_json_ue_identity_problem_details( + mw_problem_details( + -, -, 412 + )))))) { + tc_ac.stop; + + log("*** " & testcasename() & ": PASS: IUT successfully responds with an HTTP 412 error status ***"); + 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_SRV_BWA_005_PF + + /** + * @desc Check that the IUT unregisters from the Bandwidth Management Service when commanded by a MEC Application + * @see https://forge.etsi.org/gitlab/mec/MEC-tests/blob/master/Test%20Purposes/Plat/Mp1/Bandwidth/PlatBandwidthManager.tplan2 + * @see hhttps://forge.etsi.org/swagger/ui/?url=https://forge.etsi.org/gitlab/mec/gs015-bandwith-mgmt-api/raw/master/BwManagementApi.yaml + */ + testcase TC_MEC_SRV_BWA_006_OK() runs on HttpComponent system HttpTestAdapter { + // Local variables + var HeaderLines v_headers; + + // Test control + if (not(PICS_MEC_PLAT) or not(PICS_BWMANAGEMENT_API_SUPPORTED)) { + log("*** " & testcasename() & ": PICS_MEC_PLAT and PICS_BWMANAGEMENT_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_delete( + "/" & PICS_ROOT_API & PX_ME_BWM_URI & "?alloction_id=" & oct2char(unichar2oct(PX_ALLOCATION_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 + )) { + tc_ac.stop; + + log("*** " & testcasename() & ": PASS: IUT successfully responds with HTTP 204 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 + + // Postamble + f_cf_01_http_down(); + } // End of testcase TC_MEC_SRV_BWA_006_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/gitlab/mec/MEC-tests/blob/master/Test%20Purposes/Plat/Mp1/Bandwidth/PlatBandwidthManager.tplan2 + * @see hhttps://forge.etsi.org/swagger/ui/?url=https://forge.etsi.org/gitlab/mec/gs015-bandwith-mgmt-api/raw/master/BwManagementApi.yaml + */ + testcase TC_MEC_SRV_BWA_006_NF() runs on HttpComponent system HttpTestAdapter { + // Local variables + var HeaderLines v_headers; + + // Test control + if (not(PICS_MEC_PLAT) or not(PICS_BWMANAGEMENT_API_SUPPORTED)) { + log("*** " & testcasename() & ": PICS_MEC_PLAT and PICS_BWMANAGEMENT_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_delete( + "/" & PICS_ROOT_API & PX_ME_BWM_URI & "?allocation_id=" & oct2char(unichar2oct(PX_NON_EXISTENT_ALLOCATION_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( + mw_http_message_body_json( + mw_body_json_ue_identity_problem_details( + mw_problem_details( + -, -, 404 + )))))) { + tc_ac.stop; + + log("*** " & testcasename() & ": PASS: IUT successfully responds with HTTP error 404 ***"); f_selfOrClientSyncAndVerdict(c_tbDone, e_success); } [] tc_ac.timeout { @@ -93,7 +1018,7 @@ module AtsMec_BwManagementAPI_TestCases { // Postamble f_cf_01_http_down(); - } // End of testcase TC_MEC_PLAT_MP1_BWA_BV_001 + } // End of testcase TC_MEC_SRV_BWA_006_NF } // End of group me_app_role diff --git a/ttcn/AtsMec/AtsMec_TestControl.ttcn b/ttcn/AtsMec/AtsMec_TestControl.ttcn index 8a27e89..3288086 100644 --- a/ttcn/AtsMec/AtsMec_TestControl.ttcn +++ b/ttcn/AtsMec/AtsMec_TestControl.ttcn @@ -116,7 +116,21 @@ module AtsMec_TestControl { } if (PICS_BWMANAGEMENT_API_SUPPORTED) { - execute(TC_MEC_PLAT_MP1_BWA_BV_001()); + execute(TC_MEC_SRV_BWA_001_OK()); + execute(TC_MEC_SRV_BWA_001_BR()); + execute(TC_MEC_SRV_BWA_002_OK()); + execute(TC_MEC_SRV_BWA_002_BR()); + execute(TC_MEC_SRV_BWA_003_OK()); + execute(TC_MEC_SRV_BWA_003_NF()); + execute(TC_MEC_SRV_BWA_004_OK()); + execute(TC_MEC_SRV_BWA_004_BR()); + execute(TC_MEC_SRV_BWA_004_NF()); + execute(TC_MEC_SRV_BWA_005_OK()); + execute(TC_MEC_SRV_BWA_005_BR()); + execute(TC_MEC_SRV_BWA_005_NF()); + execute(TC_MEC_SRV_BWA_005_PF()); + execute(TC_MEC_SRV_BWA_006_OK()); + execute(TC_MEC_SRV_BWA_006_NF()); } } // End of 'control' statement diff --git a/ttcn/LibIts b/ttcn/LibIts index 3c0c0de..b45c6e8 160000 --- a/ttcn/LibIts +++ b/ttcn/LibIts @@ -1 +1 @@ -Subproject commit 3c0c0de3330be31a4a670518770d7ef20dacf245 +Subproject commit b45c6e85ab69bb72637c9e0396ed0a48944d85ae diff --git a/ttcn/LibMec/BwManagementAPI/ttcn/BwManagementAPI_Pixits.ttcn b/ttcn/LibMec/BwManagementAPI/ttcn/BwManagementAPI_Pixits.ttcn index ff8445d..085ea68 100644 --- a/ttcn/LibMec/BwManagementAPI/ttcn/BwManagementAPI_Pixits.ttcn +++ b/ttcn/LibMec/BwManagementAPI/ttcn/BwManagementAPI_Pixits.ttcn @@ -3,11 +3,21 @@ module BwManagementAPI_Pixits { // LibCommon import from LibCommon_BasicTypesAndValues all; + // LibMec/BwManagementAPI + import from BwManagementAPI_TypesAndValues all; // LibMec/LocationAPI import from LocationAPI_TypesAndValues all; modulepar Address PX_APP_INSTANCE_ID := "appInst01"; + modulepar FixedAllocation PX_FIXED_ALLOCATION := ""; + + modulepar FixedAllocation PX_ALLOCATION_ID := ""; + + modulepar FixedAllocation PX_FIXED_PATCHED_ALLOCATION := ""; + + modulepar FixedAllocation PX_NON_EXISTENT_ALLOCATION_ID := ""; + modulepar ResourceURL PX_RESOURCE_URL := "http://example.com/exampleAPI/location/v2/users?address:acr:192.0.0.1"; } // End of module BwManagementAPI_Pixits diff --git a/ttcn/LibMec/BwManagementAPI/ttcn/BwManagementAPI_Templates.ttcn b/ttcn/LibMec/BwManagementAPI/ttcn/BwManagementAPI_Templates.ttcn index bf5fa3b..d750e75 100644 --- a/ttcn/LibMec/BwManagementAPI/ttcn/BwManagementAPI_Templates.ttcn +++ b/ttcn/LibMec/BwManagementAPI/ttcn/BwManagementAPI_Templates.ttcn @@ -43,7 +43,7 @@ module BwManagementAPI_Templates { in RequestType p_requestType, in FixedBWPriority p_fixedBWPriority, in FixedAllocation p_fixedAllocation, - in AllocationDirection p_allocationDirection + in AllocationDirection p_allocationDirection := Downlink ) := { timeStamp := omit, appInsId := p_appInsId, diff --git a/ttcn/LibMec/BwManagementAPI/ttcn/BwManagementAPI_TypesAndValues.ttcn b/ttcn/LibMec/BwManagementAPI/ttcn/BwManagementAPI_TypesAndValues.ttcn index 63da82e..74e5b7b 100644 --- a/ttcn/LibMec/BwManagementAPI/ttcn/BwManagementAPI_TypesAndValues.ttcn +++ b/ttcn/LibMec/BwManagementAPI/ttcn/BwManagementAPI_TypesAndValues.ttcn @@ -72,7 +72,8 @@ module BwManagementAPI_TypesAndValues { */ type enumerated RequestType { APPLICATION_SPECIFIC_BW_ALLOCATION, - SESSION_SPECIFIC_BW_ALLOCATION + SESSION_SPECIFIC_BW_ALLOCATION, + INVALID_BW_ALLOCATION } /** -- GitLab