From e189f298b2a9afc4eff679284e6a05e5b99f0ae4 Mon Sep 17 00:00:00 2001 From: ishaqm Date: Tue, 27 May 2025 12:08:19 +0500 Subject: [PATCH 1/3] Implement TPs, add templates and typing for MEC048 --- ...ec_SelfServiceEnablementAPI_TestCases.ttcn | 1064 +++++++++++++++++ ..._SelfServiceEnablementAPI_TestControl.ttcn | 56 + .../AtsMec_SelfServiceEnablementAPI/module.mk | 39 + .../LibMec/SelfServiceEnablementAPI/module.mk | 6 + .../SelfServiceEnablementAPI_Functions.ttcn | 190 +++ .../ttcn/SelfServiceEnablementAPI_Pics.ttcn | 8 + .../ttcn/SelfServiceEnablementAPI_Pixits.ttcn | 52 + .../SelfServiceEnablementAPI_Templates.ttcn | 457 +++++++ ...lfServiceEnablementAPI_TypesAndValues.ttcn | 332 +++++ ttcn/LibMec/ttcn/LibMec_Pixits.ttcn | 4 + .../ttcn/LibHttp_JsonMessageBodyTypes.ttcn | 10 + .../ttcn/LibHttp_JsonTemplates.ttcn | 101 ++ 12 files changed, 2319 insertions(+) create mode 100644 ttcn/AtsMec_SelfServiceEnablementAPI/AtsMec_SelfServiceEnablementAPI_TestCases.ttcn create mode 100644 ttcn/AtsMec_SelfServiceEnablementAPI/AtsMec_SelfServiceEnablementAPI_TestControl.ttcn create mode 100644 ttcn/AtsMec_SelfServiceEnablementAPI/module.mk create mode 100644 ttcn/LibMec/SelfServiceEnablementAPI/module.mk create mode 100644 ttcn/LibMec/SelfServiceEnablementAPI/ttcn/SelfServiceEnablementAPI_Functions.ttcn create mode 100644 ttcn/LibMec/SelfServiceEnablementAPI/ttcn/SelfServiceEnablementAPI_Pics.ttcn create mode 100644 ttcn/LibMec/SelfServiceEnablementAPI/ttcn/SelfServiceEnablementAPI_Pixits.ttcn create mode 100644 ttcn/LibMec/SelfServiceEnablementAPI/ttcn/SelfServiceEnablementAPI_Templates.ttcn create mode 100644 ttcn/LibMec/SelfServiceEnablementAPI/ttcn/SelfServiceEnablementAPI_TypesAndValues.ttcn diff --git a/ttcn/AtsMec_SelfServiceEnablementAPI/AtsMec_SelfServiceEnablementAPI_TestCases.ttcn b/ttcn/AtsMec_SelfServiceEnablementAPI/AtsMec_SelfServiceEnablementAPI_TestCases.ttcn new file mode 100644 index 0000000..a83b927 --- /dev/null +++ b/ttcn/AtsMec_SelfServiceEnablementAPI/AtsMec_SelfServiceEnablementAPI_TestCases.ttcn @@ -0,0 +1,1064 @@ + +module AtsMec_SelfServiceEnablementAPI_TestCases { + + // Libcommon + import from LibCommon_Sync all; + + // LibHttp + import from LibHttp_TypesAndValues all; + import from LibHttp_Functions all; + import from LibHttp_Templates all; + import from LibHttp_JsonTemplates all; + import from LibHttp_TestSystem all; + + // LibMec/SelfServiceEnablementAPI + import from SelfServiceEnablementAPI_TypesAndValues all; + import from SelfServiceEnablementAPI_Templates all; + import from SelfServiceEnablementAPI_Functions all; + import from SelfServiceEnablementAPI_Pics all; + import from SelfServiceEnablementAPI_Pixits all; + + // LibMec + import from LibMec_Functions all; + import from LibMec_Pics all; + import from LibMec_Pixits all; + + group tenant { + + /** + * @Desc Check that the IUT responds with a list of all available tenantInfo when requested to a CSE - No query parameters + */ + testcase TC_MEC_MEC048_MEO_CSE_001_OK_01() runs on HttpComponent system HttpTestAdapter { + // Local variables + var Headers v_headers; + var TenantInfoList v_tenant_info_list := { + valueof(m_tenant_info(PX_CSE_CUSTOMER_ID_1, PX_CSE_CUSTOMER_NAME_1, "Retail", omit, PX_CSE_TENANT_NAME_1)), + valueof(m_tenant_info(PX_CSE_CUSTOMER_ID_2, PX_CSE_CUSTOMER_NAME_2, "Education", omit, PX_CSE_TENANT_NAME_2)), + valueof(m_tenant_info(PX_CSE_CUSTOMER_ID_3, PX_CSE_CUSTOMER_NAME_3, "Automotive", omit, PX_CSE_TENANT_NAME_3)) + }; + + // Test control + if (not(PICS_SERVICES) or not(PICS_CSE_API_SUPPORTED)) { + log("*** " & testcasename() & ": PICS_SERVICES and PICS_CSE_API_SUPPORTED required for executing the TC ***"); + setverdict(inconc); + stop; + } + + var charstring_list v_tenant_id_list; + // Test component configuration + f_cf_01_http_up(); + + // Test adapter configuration + + // Preamble + f_create_tenant_info_list(v_tenant_info_list, v_tenant_id_list); + f_init_default_headers_list(-, -, v_headers); + httpPort.send( + m_http_request( + m_http_request_get( + PICS_ROOT_API & PX_CSE_TENANTS_INFO, + 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_cse_tenant_info_list( + { + mw_tenant_info( + PX_CSE_CUSTOMER_ID_1, + PX_CSE_CUSTOMER_NAME_1, + PX_CSE_TENANT_NAME_1 + ), + mw_tenant_info( + PX_CSE_CUSTOMER_ID_2, + PX_CSE_CUSTOMER_NAME_1, + PX_CSE_TENANT_NAME_2 + ), + mw_tenant_info( + PX_CSE_CUSTOMER_ID_3, + PX_CSE_CUSTOMER_NAME_2, + PX_CSE_TENANT_NAME_1 + ) + } + ))))) { + tc_ac.stop; + + log("*** " & testcasename() & ": PASS: IUT successfully responds with a TenantInfoList ***"); + f_selfOrClientSyncAndVerdict(c_tbDone, e_success); + } + [] tc_ac.timeout { + log("*** " & testcasename() & ": INCONC: Expected message not received ***"); + f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout); + } + } // End of 'alt' statement + + // Postamble + f_delete_tenant_info_list(v_tenant_info_list); + + f_cf_01_http_down(); + + } // End of testcase TC_MEC_MEC048_MEO_CSE_001_OK_01 + + /** + * @desc Check that the IUT responds with a list of all available tenantInfo when requested to a CSE - customerId attribute as query parameter + */ + testcase TC_MEC_MEC048_MEO_CSE_001_OK_02() runs on HttpComponent system HttpTestAdapter { + // Local variables + var Headers v_headers; + var TenantInfoList v_tenant_info_list := { + valueof(m_tenant_info(PX_CSE_CUSTOMER_ID_1, PX_CSE_CUSTOMER_NAME_1, "Retail", omit, PX_CSE_TENANT_NAME_1)), + valueof(m_tenant_info(PX_CSE_CUSTOMER_ID_2, PX_CSE_CUSTOMER_NAME_2, "Education", omit, PX_CSE_TENANT_NAME_2)), + valueof(m_tenant_info(PX_CSE_CUSTOMER_ID_3, PX_CSE_CUSTOMER_NAME_3, "Automotive", omit, PX_CSE_TENANT_NAME_3)) + }; + + // Test control + if (not(PICS_SERVICES) or not(PICS_CSE_API_SUPPORTED)) { + log("*** " & testcasename() & ": PICS_SERVICES and PICS_CSE_API_SUPPORTED required for executing the TC ***"); + setverdict(inconc); + stop; + } + + // Test component configuration + f_cf_01_http_up(); + + // Test adapter configuration + + // Preamble + f_create_tenant_info_list(v_tenant_info_list); + f_init_default_headers_list(-, -, v_headers); + httpPort.send( + m_http_request( + m_http_request_get( + PICS_ROOT_API & PX_CSE_TENANTS_INFO & "?customerId=" & oct2char(unichar2oct(PX_CSE_CUSTOMER_ID_1, "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_cse_tenant_info_list( + { + mw_tenant_info( + PX_CSE_CUSTOMER_ID_1, + PX_CSE_CUSTOMER_NAME_1, + PX_CSE_TENANT_NAME_1 + ) + } + ))))) { + tc_ac.stop; + + log("*** " & testcasename() & ": PASS: IUT successfully responds with a TenantInfoList ***"); + f_selfOrClientSyncAndVerdict(c_tbDone, e_success); + } + [] tc_ac.timeout { + log("*** " & testcasename() & ": INCONC: Expected message not received ***"); + f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout); + } + } // End of 'alt' statement + + // Postamble + f_delete_tenant_info_list(v_tenant_info_list); + + f_cf_01_http_down(); + + } // End of testcase TC_MEC_MEC048_MEO_CSE_001_OK_02 + + /** + * @desc Check that the IUT responds with a list of all available tenantInfo when requested to a CSE - customerName as query parameter + */ + testcase TC_MEC_MEC048_MEO_CSE_001_OK_03() runs on HttpComponent system HttpTestAdapter { + // Local variables + var Headers v_headers; + var TenantInfoList v_tenant_info_list := { + valueof(m_tenant_info(PX_CSE_CUSTOMER_ID_1, PX_CSE_CUSTOMER_NAME_1, "Retail", omit, PX_CSE_TENANT_NAME_1)), + valueof(m_tenant_info(PX_CSE_CUSTOMER_ID_2, PX_CSE_CUSTOMER_NAME_2, "Education", omit, PX_CSE_TENANT_NAME_2)), + valueof(m_tenant_info(PX_CSE_CUSTOMER_ID_3, PX_CSE_CUSTOMER_NAME_3, "Automotive", omit, PX_CSE_TENANT_NAME_3)) + }; + + // Test control + if (not(PICS_SERVICES) or not(PICS_CSE_API_SUPPORTED)) { + log("*** " & testcasename() & ": PICS_SERVICES and PICS_CSE_API_SUPPORTED required for executing the TC ***"); + setverdict(inconc); + stop; + } + + // Test component configuration + f_cf_01_http_up(); + + // Test adapter configuration + + // Preamble + f_create_tenant_info_list(v_tenant_info_list); + f_init_default_headers_list(-, -, v_headers); + httpPort.send( + m_http_request( + m_http_request_get( + PICS_ROOT_API & PX_CSE_TENANTS_INFO & "?customerName=" & oct2char(unichar2oct(PX_CSE_CUSTOMER_NAME_1, "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_cse_tenant_info_list( + { + mw_tenant_info( + PX_CSE_CUSTOMER_ID_1, + PX_CSE_CUSTOMER_NAME_1, + PX_CSE_TENANT_NAME_1, PX_CSE_TENANT_NAME_1 + ), + mw_tenant_info( + PX_CSE_CUSTOMER_ID_2, + PX_CSE_CUSTOMER_NAME_2, + PX_CSE_TENANT_NAME_2 + ) + } + ))))) { + tc_ac.stop; + + log("*** " & testcasename() & ": PASS: IUT successfully responds with a TenantInfoList ***"); + f_selfOrClientSyncAndVerdict(c_tbDone, e_success); + } + [] tc_ac.timeout { + log("*** " & testcasename() & ": INCONC: Expected message not received ***"); + f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout); + } + } // End of 'alt' statement + + // Postamble + f_delete_tenant_info_list(v_tenant_info_list); + + f_cf_01_http_down(); + + } // End of testcase TC_MEC_MEC048_MEO_CSE_001_OK_03 + + /** + * @Desc Check that the IUT creates a new tenantInfo when requested to a CSE + */ + testcase TC_MEC_MEC048_MEO_CSE_002_OK() runs on HttpComponent system HttpTestAdapter { + // Local variables + var Headers v_headers; + var HttpMessage v_response; + + // Test control + if (not(PICS_SERVICES) or not(PICS_CSE_API_SUPPORTED)) { + log("*** " & testcasename() & ": PICS_SERVICES and PICS_CSE_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_CSE_TENANTS_INFO, + v_headers, + m_http_message_body_json( + m_body_json_cse_tenant_info( + m_tenant_info( + PX_CSE_CUSTOMER_ID_2, + PX_CSE_CUSTOMER_NAME_1, + omit, + omit, + PX_CSE_TENANT_NAME_1 + )))))); + 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_cse_tenant_info( + mw_tenant_info( + PX_CSE_CUSTOMER_ID_2, + PX_CSE_CUSTOMER_NAME_1, + PX_CSE_TENANT_NAME_1 + )))))) -> value v_response { + tc_ac.stop; + + log("*** " & testcasename() & ": PASS: IUT successfully responds with a TenantInfo ***"); + f_selfOrClientSyncAndVerdict(c_tbDone, e_success); + } + [] tc_ac.timeout { + log("*** " & testcasename() & ": INCONC: Expected message not received ***"); + f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout); + } + } // End of 'alt' statement + + // Postamble + f_delete_tenant_info(v_response.response.body.json_body.tenantInfo); + + f_cf_01_http_down(); + + } // End of testcase TC_MEC_MEC048_MEO_CSE_002_OK + + /** + * @desc Check that the IUT responds with an error on creating a tenantInfo with resourceUseInfo and siteList + */ + testcase TC_MEC_MEC048_MEO_CSE_002_BR() runs on HttpComponent system HttpTestAdapter { + // Local variables + var Headers v_headers; + + // Test control + if (not(PICS_SERVICES) or not(PICS_CSE_API_SUPPORTED)) { + log("*** " & testcasename() & ": PICS_SERVICES and PICS_CSE_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_CSE_TENANTS_INFO, + v_headers, + m_http_message_body_json( + m_body_json_cse_tenant_info( + m_tenant_info( + PX_CSE_CUSTOMER_ID_1, + PX_CSE_CUSTOMER_NAME_1, + omit, + omit, + PX_CSE_TENANT_NAME_1, + m_resource_info(100, 50, 50, 1024, 512, 512, 2048, 1024, 1024), + m_site_info("site-001", omit) + )))))); + f_selfOrClientSyncAndVerdict(c_prDone, e_success); + + // Test Body + tc_ac.start; + alt { + [] httpPort.receive( + mw_http_response( + mw_http_response_400_bad_request + )) { + tc_ac.stop; + + log("*** " & testcasename() & ": PASS: IUT successfully responds with the correct error 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_MEC048_MEO_CSE_002_BR + + /** + * @Desc Check that the IUT responds with a specific tenantInfo when requested to a MEC Consumer + */ + testcase TC_MEC_MEC048_MEO_CSE_003_OK() runs on HttpComponent system HttpTestAdapter { + // Local variables + var Headers v_headers; + var TenantInfo v_tenant_info := valueof(m_tenant_info(PX_CSE_CUSTOMER_ID_1, PX_CSE_CUSTOMER_NAME_1, "Retail", omit, PX_CSE_TENANT_NAME_1)); + + var charstring v_tenant_id; + + // Test control + if (not(PICS_SERVICES) or not(PICS_CSE_API_SUPPORTED)) { + log("*** " & testcasename() & ": PICS_SERVICES and PICS_CSE_API_SUPPORTED required for executing the TC ***"); + setverdict(inconc); + stop; + } + + // Test component configuration + f_cf_01_http_up(); + + // Test adapter configuration + + // Preamble + f_create_tenant_info(v_tenant_info, v_tenant_id); + f_init_default_headers_list(-, -, v_headers); + httpPort.send( + m_http_request( + m_http_request_get( + PICS_ROOT_API & PX_CSE_TENANTS_INFO & "/" & v_tenant_id, + 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_cse_tenant_info( + mw_tenant_info( + PX_CSE_CUSTOMER_ID_1, + PX_CSE_CUSTOMER_NAME_1, + PX_CSE_TENANT_NAME_1 + ) + + ))))) { + tc_ac.stop; + + log("*** " & testcasename() & ": PASS: IUT successfully responds with specific TenantInfo ***"); + f_selfOrClientSyncAndVerdict(c_tbDone, e_success); + } + [] tc_ac.timeout { + log("*** " & testcasename() & ": INCONC: Expected message not received ***"); + f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout); + } + } // End of 'alt' statement + + // Postamble + + f_delete_tenant_info(v_tenant_info); + + f_cf_01_http_down(); + + } // End of testcase TC_MEC_MEC048_MEO_CSE_003_OK + + /** + * @Desc Check that the IUT returns an error when requesting a not existing tenantInfo to a MEC Consumer + */ + testcase TC_MEC_MEC048_MEO_CSE_003_NF() runs on HttpComponent system HttpTestAdapter { + // Local variables + var Headers v_headers; + + // Test control + if (not(PICS_SERVICES) or not(PICS_CSE_API_SUPPORTED)) { + log("*** " & testcasename() & ": PICS_SERVICES and PICS_CSE_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_CSE_TENANTS_INFO & "/" & oct2char(unichar2oct(PX_CSE_TENANT_ID_1, "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 + )) { + tc_ac.stop; + + log("*** " & testcasename() & ": PASS: IUT successfully responds with a correct error 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_MEC048_MEO_CSE_003_NF + + /** + * @desc Check that the IUT updates an existing tenantInfo when requested to a CSE + */ + testcase TC_MEC_MEC048_MEO_CSE_004_OK() runs on HttpComponent system HttpTestAdapter { + // Local variables + var Headers v_headers; + var TenantInfo v_tenant_info := valueof(m_tenant_info(PX_CSE_CUSTOMER_ID_1, PX_CSE_CUSTOMER_NAME_1, "Retail", omit, PX_CSE_TENANT_NAME_1)); + var charstring v_tenant_id; + + // Test control + if (not(PICS_SERVICES) or not(PICS_CSE_API_SUPPORTED)) { + log("*** " & testcasename() & ": PICS_SERVICES and PICS_CSE_API_SUPPORTED required for executing the TC ***"); + setverdict(inconc); + stop; + } + + // Test component configuration + f_cf_01_http_up(); + + // Test adapter configuration + + // Preamble + f_create_tenant_info(v_tenant_info, v_tenant_id); + f_init_default_headers_list(-, -, v_headers); + + httpPort.send( + m_http_request( + m_http_request_put( + PICS_ROOT_API & PX_CSE_TENANTS_INFO & "/" & v_tenant_id, + v_headers, + m_http_message_body_json( + m_body_json_cse_tenant_info( + m_tenant_info( + PX_NEW_CUSTOMER_ID, + PX_NEW_CUSTOMER_NAME, + omit, + omit, + PX_NEW_TENANT_NAME + ) + ))))); + 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_cse_tenant_info( + mw_tenant_info( + PX_NEW_CUSTOMER_ID, + PX_NEW_CUSTOMER_NAME, + PX_NEW_TENANT_NAME + )))))) { + tc_ac.stop; + + log("*** " & testcasename() & ": PASS: IUT successfully responds with an updated TenantInfo entry ***"); + f_selfOrClientSyncAndVerdict(c_tbDone, e_success); + } + [] tc_ac.timeout { + log("*** " & testcasename() & ": INCONC: Expected message not received ***"); + f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout); + } + } // End of 'alt' statement + + // Postamble + f_delete_tenant_info(v_tenant_info); + f_cf_01_http_down(); + } // End of testcase TC_MEC_MEC048_MEO_CSE_004_OK + + /** + * @desc Check that the IUT returns an error on updating a not existing tenantInfo requested to a CSE + */ + testcase TC_MEC_MEC048_MEO_CSE_004_NF() runs on HttpComponent system HttpTestAdapter { + // Local variables + var Headers v_headers; + + // Test control + if (not(PICS_SERVICES) or not(PICS_CSE_API_SUPPORTED)) { + log("*** " & testcasename() & ": PICS_SERVICES and PICS_CSE_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_put( + PICS_ROOT_API & PX_CSE_TENANTS_INFO & "/" & oct2char(unichar2oct(PX_NON_EXISTENT_TENANT_ID, "UTF-8")), + v_headers, + m_http_message_body_json( + m_body_json_cse_tenant_info( + m_tenant_info( + PX_NEW_CUSTOMER_ID, + PX_NEW_CUSTOMER_NAME, + omit, + omit, + PX_NEW_TENANT_NAME + ) + ))))); + f_selfOrClientSyncAndVerdict(c_prDone, e_success); + + // Test Body + tc_ac.start; + alt { + [] httpPort.receive( + mw_http_response( + mw_http_response_404_not_found + )) { + tc_ac.stop; + + log("*** " & testcasename() & ": PASS: IUT successfully responds with the correct error 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_MEC048_MEO_CSE_004_NF + + /** + * @desc Check that the IUT returns an error on updating with invalid values tenantInfo requested to a CSE + */ + testcase TC_MEC_MEC048_MEO_CSE_004_BR() runs on HttpComponent system HttpTestAdapter { + // Local variables + var Headers v_headers; + + // Test control + if (not(PICS_SERVICES) or not(PICS_CSE_API_SUPPORTED)) { + log("*** " & testcasename() & ": PICS_SERVICES and PICS_CSE_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_put( + PICS_ROOT_API & PX_CSE_TENANTS_INFO & "/" & oct2char(unichar2oct(PX_NON_EXISTENT_TENANT_ID, "UTF-8")), + v_headers, + m_http_message_body_json( + m_body_json_cse_tenant_info( + m_tenant_info( + PX_NEW_CUSTOMER_ID, + PX_NEW_CUSTOMER_NAME, + omit, + omit, + PX_NEW_TENANT_NAME, + m_resource_info(100, 50, 50, 1024, 512, 512, 2048, 1024, 1024), + m_site_info("site-001", omit) + ) + ))))); + f_selfOrClientSyncAndVerdict(c_prDone, e_success); + + // Test Body + tc_ac.start; + alt { + [] httpPort.receive( + mw_http_response( + mw_http_response_400_bad_request + )) { + tc_ac.stop; + + log("*** " & testcasename() & ": PASS: IUT successfully responds with the correct error 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_MEC048_MEO_CSE_004_BR + + /** + * @Desc Check that the IUT removes a tenantInfo when requested to a CSE + */ + testcase TC_MEC_MEC048_MEO_CSE_005_OK() runs on HttpComponent system HttpTestAdapter { + // Local variables + var Headers v_headers; + var TenantInfo v_tenant_info := valueof(m_tenant_info(PX_CSE_CUSTOMER_ID_1, PX_CSE_CUSTOMER_NAME_1, "Retail", omit, PX_CSE_TENANT_NAME_1)); + var charstring v_tenant_id; + + // Test control + if (not(PICS_SERVICES) or not(PICS_CSE_API_SUPPORTED)) { + log("*** " & testcasename() & ": PICS_SERVICES and PICS_CSE_API_SUPPORTED required for executing the TC ***"); + setverdict(inconc); + stop; + } + + // Test component configuration + f_cf_01_http_up(); + + // Test adapter configuration + + // Preamble + f_create_tenant_info(v_tenant_info, v_tenant_id); + + f_init_default_headers_list(-, -, v_headers); + httpPort.send( + m_http_request( + m_http_request_delete( + PICS_ROOT_API & PX_CSE_TENANTS_INFO & "/" & v_tenant_id, + v_headers + ))); + f_selfOrClientSyncAndVerdict(c_prDone, e_success); + + // Test Body + tc_ac.start; + alt { + [] httpPort.receive( + mw_http_response( + mw_http_response_204_no_content + )) { + tc_ac.stop; + + log("*** " & testcasename() & ": PASS: IUT successfully deletes the tenantInfo ***"); + 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_MEC048_MEO_CSE_005_OK + + /** + * @Desc Check that the IUT returns an error on deleting a not existing tenantInfo when requested to a CSE + */ + testcase TC_MEC_MEC048_MEO_CSE_005_NF() runs on HttpComponent system HttpTestAdapter { + // Local variables + var Headers v_headers; + + // Test control + if (not(PICS_SERVICES) or not(PICS_CSE_API_SUPPORTED)) { + log("*** " & testcasename() & ": PICS_SERVICES and PICS_CSE_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_CSE_TENANTS_INFO & "/" & oct2char(unichar2oct(PX_NON_EXISTENT_TENANT_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 + )) { + tc_ac.stop; + + log("*** " & testcasename() & ": PASS: IUT successfully responds with the correct error 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_MEC048_MEO_CSE_005_NF + + /** + * @Desc Check that the IUT returns a resourceQuotaInfo for a specific tenant when requested to a CSE + */ + testcase TC_MEC_MEC048_MEO_CSE_006_OK() runs on HttpComponent system HttpTestAdapter { + + // Local variables + var Headers v_headers; + var TenantInfo v_tenant_info := valueof(m_tenant_info(PX_CSE_CUSTOMER_ID_1, PX_CSE_CUSTOMER_NAME_1, "Retail", omit, PX_CSE_TENANT_NAME_1)); + var ResourceQuotaInfo v_resource_quota_info := valueof(m_resource_quota_info(PX_CPU_QUOTA, PX_MEMORY_QUOTA, PX_DISK_QUOTA)); + var charstring v_tenant_id; + // Test control + if (not(PICS_SERVICES) or not(PICS_CSE_API_SUPPORTED)) { + log("*** " & testcasename() & ": PICS_SERVICES and PICS_CSE_API_SUPPORTED required for executing the TC ***"); + setverdict(inconc); + stop; + } + + // Test component configuration + f_cf_01_http_up(); + + // Test adapter configuration + + // Preamble + f_create_tenant_info(v_tenant_info, v_tenant_id); + f_create_resource_quota_info(v_resource_quota_info, v_tenant_id); + f_init_default_headers_list(-, -, v_headers); + httpPort.send( + m_http_request( + m_http_request_get( + PICS_ROOT_API & PX_CSE_TENANTS_INFO & "/" & v_tenant_id & "/resources/quota_in_system", + 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_cse_resource_quota_info( + mw_resource_quota_info( + PX_CPU_QUOTA, + PX_MEMORY_QUOTA, + PX_DISK_QUOTA + ) + ))))) { + tc_ac.stop; + + log("*** " & testcasename() & ": PASS: IUT successfully responds with specific ResourceQuotaInfo ***"); + f_selfOrClientSyncAndVerdict(c_tbDone, e_success); + } + [] tc_ac.timeout { + log("*** " & testcasename() & ": INCONC: Expected message not received ***"); + f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout); + } + } // End of 'alt' statement + + // Postamble + f_delete_tenant_info(v_tenant_info); + f_cf_01_http_down(); + + } // End of testcase TC_MEC_MEC048_MEO_CSE_006_OK + + /** + * @Desc Check that the IUT returns an error on retrieving resourceQuotaInfo for a not existing tenant when requested to a CSE + */ + testcase TC_MEC_MEC048_MEO_CSE_006_NF() runs on HttpComponent system HttpTestAdapter { + + // Local variables + var Headers v_headers; + + // Test control + if (not(PICS_SERVICES) or not(PICS_CSE_API_SUPPORTED)) { + log("*** " & testcasename() & ": PICS_SERVICES and PICS_CSE_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_CSE_TENANTS_INFO & "/" & oct2char(unichar2oct(PX_NON_EXISTENT_TENANT_ID , "UTF-8")) & "/resources/quota_in_system", + v_headers + ))); + f_selfOrClientSyncAndVerdict(c_prDone, e_success); + + // Test Body + tc_ac.start; + alt { + [] httpPort.receive( + mw_http_response( + mw_http_response_404_not_found + )) { + tc_ac.stop; + + log("*** " & testcasename() & ": PASS: IUT successfully responds with correct error 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_MEC048_MEO_CSE_006_NF + + /** + * @desc Check that the IUT updates the resourceQuotaInfo for an existing tenant when requested to a CSE + */ + testcase TC_MEC_MEC048_MEO_CSE_007_OK() runs on HttpComponent system HttpTestAdapter { + // Local variables + var Headers v_headers; + var TenantInfo v_tenant_info := valueof(m_tenant_info(PX_CSE_CUSTOMER_ID_1, PX_CSE_CUSTOMER_NAME_1, "Retail", omit, PX_CSE_TENANT_NAME_1)); + var ResourceQuotaInfo v_resource_quota_info := valueof(m_resource_quota_info(PX_CPU_QUOTA, PX_MEMORY_QUOTA, PX_DISK_QUOTA)); + var charstring v_tenant_id; + + // Test control + if (not(PICS_SERVICES) or not(PICS_CSE_API_SUPPORTED)) { + log("*** " & testcasename() & ": PICS_SERVICES and PICS_CSE_API_SUPPORTED required for executing the TC ***"); + setverdict(inconc); + stop; + } + + // Test component configuration + f_cf_01_http_up(); + + // Test adapter configuration + + // Preamble + f_create_tenant_info(v_tenant_info, v_tenant_id); + f_create_resource_quota_info(v_resource_quota_info, v_tenant_id); + f_init_default_headers_list(-, -, v_headers); + + httpPort.send( + m_http_request( + m_http_request_put( + PICS_ROOT_API & PX_CSE_TENANTS_INFO & "/" & v_tenant_id & "/resources/quota_in_system", + v_headers, + m_http_message_body_json( + m_body_json_cse_resource_quota_info( + m_resource_quota_info( + 5, + 3072, + 50 + ) + ))))); + 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_cse_resource_quota_info( + mw_resource_quota_info( + 5, + 3072, + 50 + )))))) { + tc_ac.stop; + + log("*** " & testcasename() & ": PASS: IUT successfully responds with an updated ResourceQuotaInfo ***"); + f_selfOrClientSyncAndVerdict(c_tbDone, e_success); + } + [] tc_ac.timeout { + log("*** " & testcasename() & ": INCONC: Expected message not received ***"); + f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout); + } + } // End of 'alt' statement + + // Postamble + f_delete_tenant_info(v_tenant_info); + f_cf_01_http_down(); + + } // End of testcase TC_MEC_MEC048_MEO_CSE_007_OK + + /** + * @desc Check that the IUT returns an error on updating the resourceQuotaInfo for a not existing tenant when requested to a CSE + */ + testcase TC_MEC_MEC048_MEO_CSE_007_NF() runs on HttpComponent system HttpTestAdapter { + // Local variables + var Headers v_headers; + + // Test control + if (not(PICS_SERVICES) or not(PICS_CSE_API_SUPPORTED)) { + log("*** " & testcasename() & ": PICS_SERVICES and PICS_CSE_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_put( + PICS_ROOT_API & PX_CSE_TENANTS_INFO & "/" & oct2char(unichar2oct(PX_NON_EXISTENT_TENANT_ID , "UTF-8")) & "/resources/quota_in_system", + v_headers, + m_http_message_body_json( + m_body_json_cse_resource_quota_info( + m_resource_quota_info( + 5, + 2048, + 75 + ) + ))))); + f_selfOrClientSyncAndVerdict(c_prDone, e_success); + + // Test Body + tc_ac.start; + alt { + [] httpPort.receive( + mw_http_response( + mw_http_response_404_not_found + )) { + tc_ac.stop; + + log("*** " & testcasename() & ": PASS: IUT successfully responds with the correct error 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_MEC048_MEO_CSE_007_NF + + } // End of group tenant + +} // End of module AtsMec_SelfServiceEnablementAPI_TestCases diff --git a/ttcn/AtsMec_SelfServiceEnablementAPI/AtsMec_SelfServiceEnablementAPI_TestControl.ttcn b/ttcn/AtsMec_SelfServiceEnablementAPI/AtsMec_SelfServiceEnablementAPI_TestControl.ttcn new file mode 100644 index 0000000..01e66d0 --- /dev/null +++ b/ttcn/AtsMec_SelfServiceEnablementAPI/AtsMec_SelfServiceEnablementAPI_TestControl.ttcn @@ -0,0 +1,56 @@ +module AtsMec_SelfServiceEnablementAPI_TestControl { + + // LibMec/SelfServiceEnablementAPI + import from SelfServiceEnablementAPI_Pics all; + + // LibMec + import from LibMec_Pics all; + + // AtsMec_SelfServiceEnablementAPI + import from AtsMec_SelfServiceEnablementAPI_TestCases all; + + control { + + if (PICS_CSE_API_SUPPORTED) { + + if (PICS_SERVICES) { + execute(TC_MEC_MEC048_MEO_CSE_001_OK_01()); + execute(TC_MEC_MEC048_MEO_CSE_001_OK_02()); + execute(TC_MEC_MEC048_MEO_CSE_001_OK_03()); + execute(TC_MEC_MEC048_MEO_CSE_002_OK()); + execute(TC_MEC_MEC048_MEO_CSE_002_BR()); + execute(TC_MEC_MEC048_MEO_CSE_003_OK()); + execute(TC_MEC_MEC048_MEO_CSE_003_NF()); + execute(TC_MEC_MEC048_MEO_CSE_004_OK()); + execute(TC_MEC_MEC048_MEO_CSE_004_NF()); + execute(TC_MEC_MEC048_MEO_CSE_004_BR()); + execute(TC_MEC_MEC048_MEO_CSE_005_OK()); + execute(TC_MEC_MEC048_MEO_CSE_005_NF()); + execute(TC_MEC_MEC048_MEO_CSE_006_OK()); + execute(TC_MEC_MEC048_MEO_CSE_006_NF()); + execute(TC_MEC_MEC048_MEO_CSE_007_OK()); + execute(TC_MEC_MEC048_MEO_CSE_007_NF()); + + execute(TC_MEC_MEC048_MEO_CSE_013_OK()); + execute(TC_MEC_MEC048_MEO_CSE_013_OK_02()); + execute(TC_MEC_MEC048_MEO_CSE_014_OK()); + execute(TC_MEC_MEC048_MEO_CSE_014_OK_02()); + execute(TC_MEC_MEC048_MEO_CSE_014_BR()); + execute(TC_MEC_MEC048_MEO_CSE_015_OK()); + execute(TC_MEC_MEC048_MEO_CSE_015_NF()); + execute(TC_MEC_MEC048_MEO_CSE_016_OK()); + execute(TC_MEC_MEC048_MEO_CSE_016_NF()); + execute(TC_MEC_MEC048_MEO_CSE_016_BR()); + execute(TC_MEC_MEC048_MEO_CSE_017_OK()); + execute(TC_MEC_MEC048_MEO_CSE_017_NF()); + + execute(TC_MEC_MEC048_MEO_CSE_018_OK()); + execute(TC_MEC_MEC048_MEO_CSE_019_OK()); + execute(TC_MEC_MEC048_MEO_CSE_020_OK()); + } + + } + + } // End of 'control' statement + +} // End of module AtsMec_SelfServiceEnablementAPI_TestControl diff --git a/ttcn/AtsMec_SelfServiceEnablementAPI/module.mk b/ttcn/AtsMec_SelfServiceEnablementAPI/module.mk new file mode 100644 index 0000000..24667ca --- /dev/null +++ b/ttcn/AtsMec_SelfServiceEnablementAPI/module.mk @@ -0,0 +1,39 @@ +suite := AtsMec_SelfServiceEnablementAPI + +sources := \ + AtsMec_SelfServiceEnablementAPI_TestCases.ttcn \ + AtsMec_SelfServiceEnablementAPI_TestControl.ttcn + +modules := ../LibCommon \ + ../../titan-test-system-framework/ttcn/LibHelpers \ + ../../titan-test-system-framework/ttcn/LibHttp \ + ../../titan-test-system-framework/ttcn/LibXsd \ + ../../titan-test-system-framework/ttcn/LibJson \ + ../patch_lib_http \ + ../LibMec \ + ../LibMec/LocationAPI \ + ../LibMec/EdgePlatformApplicationEnablementAPI \ + ../LibMec/ApplicationPackageLifecycleAndOperationGrantingAPI \ + ../LibMec/TrafficManagementAPI \ + ../LibMec/UEAppInterfaceAPI \ + ../LibMec/UEidentityAPI \ + ../LibMec/V2XInformationServiceAPI \ + ../LibMec/DeviceApplicationInterfaceAPI \ + ../LibMec/WlanInformationAPI \ + ../LibMec/FixedAccessInformationServiceAPI \ + ../LibMec/ApplicationMobilityServiceAPI \ + ../LibMec/IoTAPI \ + ../LibMec/FederationEnablementAPI \ + ../LibMec/SelfServiceEnablementAPI \ + ../../titan-test-system-framework/ccsrc/Framework \ + ../../titan-test-system-framework/ccsrc/loggers \ + ../../titan-test-system-framework/ccsrc/Protocols/Http \ + ../../titan-test-system-framework/ccsrc/Protocols/Tcp \ + ../../titan-test-system-framework/ccsrc/Protocols/Xml \ + ../../titan-test-system-framework/ccsrc/Helpers \ + ../../ccsrc/Ports/LibHttp \ + ../../ccsrc/EncDec/LibMec \ + ../../ccsrc/externals \ + ../../ccsrc/Protocols/Http \ + ../../ccsrc/Protocols/Json \ + ../modules/titan.TestPorts.Common_Components.Abstract_Socket \ diff --git a/ttcn/LibMec/SelfServiceEnablementAPI/module.mk b/ttcn/LibMec/SelfServiceEnablementAPI/module.mk new file mode 100644 index 0000000..586b4c0 --- /dev/null +++ b/ttcn/LibMec/SelfServiceEnablementAPI/module.mk @@ -0,0 +1,6 @@ +sources := \ + ttcn/SelfServiceEnablementAPI_Pics.ttcn \ + ttcn/SelfServiceEnablementAPI_Pixits.ttcn \ + ttcn/SelfServiceEnablementAPI_Templates.ttcn \ + ttcn/SelfServiceEnablementAPI_Functions.ttcn \ + ttcn/SelfServiceEnablementAPI_TypesAndValues.ttcn diff --git a/ttcn/LibMec/SelfServiceEnablementAPI/ttcn/SelfServiceEnablementAPI_Functions.ttcn b/ttcn/LibMec/SelfServiceEnablementAPI/ttcn/SelfServiceEnablementAPI_Functions.ttcn new file mode 100644 index 0000000..a16934c --- /dev/null +++ b/ttcn/LibMec/SelfServiceEnablementAPI/ttcn/SelfServiceEnablementAPI_Functions.ttcn @@ -0,0 +1,190 @@ +module SelfServiceEnablementAPI_Functions { + + // JSON + import from Json all; + + // LibCommon + import from LibCommon_BasicTypesAndValues all; + import from LibCommon_Time all; + import from LibCommon_VerdictControl all; + import from LibCommon_Sync all; + + // LibHttp + import from LibHttp_TypesAndValues all; + import from LibHttp_Functions all; + import from LibHttp_Templates all; + import from LibHttp_JsonTemplates all; + import from LibHttp_TestSystem all; + + // LibMec/SelfServiceEnablementAPI + import from SelfServiceEnablementAPI_TypesAndValues all; + import from SelfServiceEnablementAPI_Templates all; + import from SelfServiceEnablementAPI_Pixits all; + + // LibMec + import from LibMec_Templates all; + import from LibMec_Functions all; + import from LibMec_Pics all; + import from LibMec_Pixits all; + + function f_create_tenant_info_list( + inout TenantInfoList p_tenant_info_list, + out charstring_list p_tenant_id_list + ) runs on HttpComponent { + log(">>> f_create_tenant_info_list: ", p_tenant_info_list); + var charstring v_tenant_id; + for (var integer i := 0; i < lengthof(p_tenant_info_list); i := i + 1) { + f_create_tenant_info(p_tenant_info_list[i], v_tenant_id); + p_tenant_id_list := p_tenant_id_list & { v_tenant_id }; + } + } // End of function f_create_tenant_info_list + + function f_create_tenant_info( + inout TenantInfo p_tenant_info, + out charstring p_tenant_id + ) runs on HttpComponent { + var Headers v_headers; + var HttpMessage v_response; + + log(">>> f_create_tenant_info: ", p_tenant_info); + + f_init_default_headers_list(-, -, v_headers); + httpPort.send( + m_http_request( + m_http_request_post( + PICS_ROOT_API & PX_CSE_TENANTS_INFO, + v_headers, + m_http_message_body_json( + m_body_json_cse_tenant_info(p_tenant_info) + )))); + tc_ac.start; + alt { + [] httpPort.receive( + mw_http_response( + mw_http_response_201_created( + mw_http_message_body_json( + mw_body_json_cse_tenant_info( + mw_tenant_info( + ?, + ?, + ?, + ?, + ? + ) + ))))) -> value v_response { + tc_ac.stop; + + // Extract HTTP Location header + var charstring_list v_tenant_id; + f_get_header(v_response.response.header, "Location", v_tenant_id); + // Extract HTTP tenant id + p_tenant_id := regexp( + v_tenant_id[0], + "?+" & PX_CSE_TENANTS_INFO & "/(?*)", + 0 + ); + + p_tenant_info := v_response.response.body.json_body.tenantInfo; + log("f_create_tenant_info: INFO: IUT successfully creates the Tenants: ", p_tenant_info); + } + [] tc_ac.timeout { + log("f_create_tenant_info: INCONC: Expected message not received"); + } + } // End of 'alt' statement + + } // End of function f_create_tenant_info + + function f_delete_tenant_info_list( + in TenantInfoList p_tenant_info_list + ) runs on HttpComponent { + for (var integer i := 0; i < lengthof(p_tenant_info_list); i := i + 1) { + if (ispresent(p_tenant_info_list[i].tenantId)) { + f_delete_tenant_info(p_tenant_info_list[i]); + } + } + } // End of function f_delete_tenant_info_list + + function f_delete_tenant_info( + in TenantInfo p_tenant_info + ) runs on HttpComponent { + var Headers v_headers; + var HttpMessage v_response; + + // Check if tenantId is present + if (not ispresent(p_tenant_info.tenantId)) { + log("f_delete_tenant_info: INCONC: tenantId not present, cannot delete."); + return; + } + + f_init_default_headers_list(-, -, v_headers); + + httpPort.send( + m_http_request( + m_http_request_delete( + PICS_ROOT_API & PX_CSE_TENANTS_INFO & "/" & oct2char(unichar2oct(p_tenant_info.tenantId, "UTF-8")), + v_headers + ))); + tc_ac.start; + alt { + [] httpPort.receive( + mw_http_response( + mw_http_response_204_no_content + )) { + tc_ac.stop; + } + [] tc_ac.timeout { + log("f_delete_tenant_info: INCONC: Expected message not received"); + } + } // End of 'alt' statement + + } // End of function f_delete_tenant_info + + function f_create_resource_quota_info( + inout ResourceQuotaInfo p_resource_quota_info, + in charstring p_tenant_id + ) runs on HttpComponent { + var Headers v_headers; + var HttpMessage v_response; + + log(">>> f_create_resource_quota_info: ", p_resource_quota_info); + + f_init_default_headers_list(-, -, v_headers); + httpPort.send( + m_http_request( + m_http_request_post( + PICS_ROOT_API & PX_CSE_TENANTS_INFO & "/" & p_tenant_id & "/resources/quota_in_system", + v_headers, + m_http_message_body_json( + m_body_json_cse_resource_quota_info( + m_resource_quota_info( + PX_CPU_QUOTA, + PX_MEMORY_QUOTA, + PX_DISK_QUOTA + ) + ))))); + tc_ac.start; + alt { + [] httpPort.receive( + mw_http_response( + mw_http_response_201_created( + mw_http_message_body_json( + mw_body_json_cse_resource_quota_info( + mw_resource_quota_info( + PX_CPU_QUOTA, + PX_MEMORY_QUOTA, + PX_DISK_QUOTA + ) + ))))) -> value v_response { + tc_ac.stop; + + p_resource_quota_info := v_response.response.body.json_body.resourceQuotaInfo; + log("f_create_resource_quota_info: INFO: IUT successfully creates the resources: ", p_resource_quota_info); + } + [] tc_ac.timeout { + log("f_create_resource_quota_info: INCONC: Expected message not received"); + } + } // End of 'alt' statement + + } // End of function f_create_resource_quota_info + + } // End of module SelfServiceEnablementAPI_Functions diff --git a/ttcn/LibMec/SelfServiceEnablementAPI/ttcn/SelfServiceEnablementAPI_Pics.ttcn b/ttcn/LibMec/SelfServiceEnablementAPI/ttcn/SelfServiceEnablementAPI_Pics.ttcn new file mode 100644 index 0000000..e663e98 --- /dev/null +++ b/ttcn/LibMec/SelfServiceEnablementAPI/ttcn/SelfServiceEnablementAPI_Pics.ttcn @@ -0,0 +1,8 @@ +module SelfServiceEnablementAPI_Pics { + + /** + * @desc Does the IUT support CSE API? + */ + modulepar boolean PICS_CSE_API_SUPPORTED := true; + +} // End of module SelfServiceEnablementAPI_Pics diff --git a/ttcn/LibMec/SelfServiceEnablementAPI/ttcn/SelfServiceEnablementAPI_Pixits.ttcn b/ttcn/LibMec/SelfServiceEnablementAPI/ttcn/SelfServiceEnablementAPI_Pixits.ttcn new file mode 100644 index 0000000..c0532ba --- /dev/null +++ b/ttcn/LibMec/SelfServiceEnablementAPI/ttcn/SelfServiceEnablementAPI_Pixits.ttcn @@ -0,0 +1,52 @@ +module SelfServiceEnablementAPI_Pixits { + + // JSON + import from Json all; + + // LibCommon + import from LibCommon_BasicTypesAndValues all; + + // LibMec/SelfServiceEnablementAPI + import from SelfServiceEnablementAPI_TypesAndValues all; + + modulepar Json.String PX_CSE_CUSTOMER_ID_1 := "" + + modulepar Json.String PX_CSE_CUSTOMER_NAME_1 := "customerName"; + + modulepar Json.String PX_CSE_TENANT_ID_1 := ""; + + modulepar Json.String PX_CSE_TENANT_NAME_1 := "tenantX"; + + modulepar Json.String PX_CSE_CUSTOMER_ID_2 := "" + + modulepar Json.String PX_CSE_CUSTOMER_NAME_2 := "customerName02"; + + modulepar Json.String PX_CSE_TENANT_NAME_2 := "tenantY"; + + modulepar Json.String PX_CSE_CUSTOMER_ID_3 := "" + + modulepar Json.String PX_CSE_CUSTOMER_NAME_3 := "customerName03"; + + modulepar Json.String PX_CSE_TENANT_NAME_3 := "tenantName03"; + + modulepar Json.String PX_NON_EXISTENT_TENANT_ID := "9344"; + + modulepar Json.String PX_NEW_CUSTOMER_ID := ""; + + modulepar Json.String PX_NEW_CUSTOMER_NAME := "newCustomer"; + + modulepar Json.String PX_NEW_TENANT_NAME := "newTenat"; + + modulepar Json.Integer PX_CPU_QUOTA := 4; + + modulepar Json.Integer PX_MEMORY_QUOTA := 2048; + + modulepar Json.Integer PX_DISK_QUOTA := 50; + + modulepar Json.AnyURI PX_CSE_SUB_CALLBACK_URI := "http://127.0.0.1/callback"; + + modulepar Json.String PX_UNKNOWN_SUBSCRIPTION_ID := "0787"; + + modulepar Json.String PX_NON_EXISTENT_SUBSCRIPTION_ID := "NON_EXISTENT_SUBSCRIPTION_ID"; + +} // End of module SelfServiceEnablementAPI_Pixits diff --git a/ttcn/LibMec/SelfServiceEnablementAPI/ttcn/SelfServiceEnablementAPI_Templates.ttcn b/ttcn/LibMec/SelfServiceEnablementAPI/ttcn/SelfServiceEnablementAPI_Templates.ttcn new file mode 100644 index 0000000..2c9bb1e --- /dev/null +++ b/ttcn/LibMec/SelfServiceEnablementAPI/ttcn/SelfServiceEnablementAPI_Templates.ttcn @@ -0,0 +1,457 @@ +module SelfServiceEnablementAPI_Templates { + + // JSON + import from Json all; + + // LibCommon + import from LibCommon_BasicTypesAndValues all; + + // LibMec + import from LibMec_TypesAndValues all; + + // Lib/SelfServiceEnablementAPI + import from SelfServiceEnablementAPI_TypesAndValues all; + + template (omit) TenantInfo m_tenant_info( + in Json.String p_customerId, + in Json.String p_customerName, + in template (omit) Json.String p_customerCategory, + in template (omit) Json.String p_tenantId, + in Json.String p_tenantName, + in template (omit) ResourceInfo p_resourceUseInfo := omit, + in template (omit) SiteInfo p_siteList := omit + ) := { + customerId := p_customerId, + customerName := p_customerName, + customerCategory := p_customerCategory, + tenantId := p_tenantId, + tenantName := p_tenantName, + resourceUseInfo := p_resourceUseInfo, + siteList := p_siteList + } // End of template m_tenant_info + + template (present) TenantInfo mw_tenant_info( + template (present) Json.String p_customerId := ?, + template (present) Json.String p_customerName := ?, + template Json.String p_customerCategory := *, + template Json.String p_tenantId := *, + template (present) Json.String p_tenantName := ?, + template ResourceInfo p_resourceUseInfo := *, + template SiteInfo p_siteList := * + ) := { + customerId := p_customerId, + customerName := p_customerName, + customerCategory := p_customerCategory, + tenantId := p_tenantId, + tenantName := p_tenantName, + resourceUseInfo := p_resourceUseInfo, + siteList := p_siteList + } // End of template mw_tenant_info + + template (omit) ResourceQuotaInfo m_resource_quota_info( + in template (omit) Json.Integer p_cpuQuota, + in template (omit) Json.Integer p_memoryQuota, + in template (omit) Json.Integer p_diskQuota + ) := { + cpuQuota := p_cpuQuota, + memoryQuota := p_memoryQuota, + diskQuota := p_diskQuota + } // End of template m_resource_quota_info + + template (present) ResourceQuotaInfo mw_resource_quota_info( + template Json.Integer p_cpuQuota := *, + template Json.Integer p_memoryQuota := *, + template Json.Integer p_diskQuota := * + ) := { + cpuQuota := p_cpuQuota, + memoryQuota := p_memoryQuota, + diskQuota := p_diskQuota + } // End of template mw_resource_quota_info + + template (omit) SiteResourceQuotaInfo m_site_resource_quota_info( + in Json.String p_siteId, + in template (omit) Json.Integer p_cpuQuota, + in template (omit) Json.Integer p_memoryQuota, + in template (omit) Json.Integer p_diskQuota + ) := { + siteId := p_siteId, + cpuQuota := p_cpuQuota, + memoryQuota := p_memoryQuota, + diskQuota := p_diskQuota + } // End of template m_site_resource_quota_info + + template (present) SiteResourceQuotaInfo mw_site_resource_quota_info( + template (present) Json.String p_siteId := ?, + template Json.Integer p_cpuQuota := *, + template Json.Integer p_memoryQuota := *, + template Json.Integer p_diskQuota := * + ) := { + siteId := p_siteId, + cpuQuota := p_cpuQuota, + memoryQuota := p_memoryQuota, + diskQuota := p_diskQuota + } // End of template mw_site_resource_quota_info + + template (omit) ResourceUsageSubscription m_resource_usage_subscription( + in template (omit) Json.AnyURI p_callbackReference, + in template (omit) Json.Bool p_requestTestNotification, + in template (omit) WebsockNotifConfig p_websockNotifConfig := omit, + in template (omit) Links p_links := omit, + in Json.String p_customerId, + in Json.String p_tenantId, + in template (value) NotificationTrigger p_notificationTrigger, + in template (omit) TimeStamp p_expiryDeadline := omit + ) := { + subscriptionType := "ResourceUsageSubscription", + callbackReference := p_callbackReference, + requestTestNotification := p_requestTestNotification, + websockNotifConfig := p_websockNotifConfig, + links := p_links, + customerId := p_customerId, + tenantId := p_tenantId, + notificationTrigger := p_notificationTrigger, + expiryDeadline := p_expiryDeadline + } // End of template m_resource_usage_subscription + + template (present) ResourceUsageSubscription mw_resource_usage_subscription( + template Json.AnyURI p_callbackReference := *, + template Json.Bool p_requestTestNotification := *, + template WebsockNotifConfig p_websockNotifConfig := *, + template Links p_links := *, + template (present) Json.String p_customerId := ?, + template (present) Json.String p_tenantId := ?, + template (present) NotificationTrigger p_notificationTrigger := ?, + template TimeStamp p_expiryDeadline := * + ) := { + subscriptionType := "ResourceUsageSubscription", + callbackReference := p_callbackReference, + requestTestNotification := p_requestTestNotification, + websockNotifConfig := p_websockNotifConfig, + links := p_links, + customerId := p_customerId, + tenantId := p_tenantId, + notificationTrigger := p_notificationTrigger, + expiryDeadline := p_expiryDeadline + } // End of template mw_resource_usage_subscription + + template (value) NotificationTrigger m_notification_trigger( + in template (value) TriggerType p_triggerType, + in Json.UInt8 p_threshold, + in Json.Bool p_greaterOrLess + ) := { + triggerType := p_triggerType, + threshold := p_threshold, + greaterOrLess := p_greaterOrLess + } // End of template m_notification_trigger + + template (present) NotificationTrigger mw_notification_trigger( + template (present) TriggerType p_triggerType := ?, + template (present) Json.UInt8 p_threshold := ?, + template (present) Json.Bool p_greaterOrLess := ? + ) := { + triggerType := p_triggerType, + threshold := p_threshold, + greaterOrLess := p_greaterOrLess + } // End of template mw_notification_trigger + + template (omit) SiteResourceUsageSubscription m_site_resource_usage_subscription( + in template (omit) Json.AnyURI p_callbackReference, + in template (omit) Json.Bool p_requestTestNotification, + in template (omit) WebsockNotifConfig p_websockNotifConfig := omit, + in template (omit) Links p_links := omit, + in Json.String p_customerId, + in Json.String p_tenantId, + in template (value) SiteId p_siteList, + in template (value) NotificationTrigger p_notificationTrigger, + in template (omit) TimeStamp p_expiryDeadline := omit + ) := { + subscriptionType := "SiteResourceUsageSubscription", + callbackReference := p_callbackReference, + requestTestNotification := p_requestTestNotification, + websockNotifConfig := p_websockNotifConfig, + links := p_links, + customerId := p_customerId, + tenantId := p_tenantId, + siteList := p_siteList, + notificationTrigger := p_notificationTrigger, + expiryDeadline := p_expiryDeadline + } // End of template m_site_resource_usage_subscription + + template (present) SiteResourceUsageSubscription mw_site_resource_usage_subscription( + template Json.AnyURI p_callbackReference := *, + template Json.Bool p_requestTestNotification := *, + template WebsockNotifConfig p_websockNotifConfig := *, + template Links p_links := *, + template (present) Json.String p_customerId := ?, + template (present) Json.String p_tenantId := ?, + template (present) SiteId p_siteList := ?, + template (present) NotificationTrigger p_notificationTrigger := ?, + template TimeStamp p_expiryDeadline := * + ) := { + subscriptionType := "SiteResourceUsageSubscription", + callbackReference := p_callbackReference, + requestTestNotification := p_requestTestNotification, + websockNotifConfig := p_websockNotifConfig, + links := p_links, + customerId := p_customerId, + tenantId := p_tenantId, + siteList := p_siteList, + notificationTrigger := p_notificationTrigger, + expiryDeadline := p_expiryDeadline + } // End of template mw_site_resource_usage_subscription + + template (value) SubscriptionLinkList m_subscription_link_list( + in template (value) Links p_links + ) := { + links := p_links + } // End of template m_subscription_link_list + + template (present) SubscriptionLinkList mw_subscription_link_list( + template (present) Links p_links := ? + ) := { + links := p_links + } // End of template mw_subscription_link_list + + template (omit) ResourceUsageNotification m_resource_usage_notification( + in template (omit) TimeStamp p_timeStamp := omit, + in Json.String p_customerId, + in Json.String p_tenantId, + in template (value) ResourceUseInfo p_resourceUseInfo + ) := { + notificationType := "ResourceUsageNotification", + timeStamp := p_timeStamp, + customerId := p_customerId, + tenantId := p_tenantId, + resourceUseInfo := p_resourceUseInfo + } // End of template m_resource_usage_notification + + template (present) ResourceUsageNotification mw_resource_usage_notification( + template TimeStamp p_timeStamp := *, + template (present) Json.String p_customerId := ?, + template (present) Json.String p_tenantId := ?, + template (present) ResourceUseInfo p_resourceUseInfo := ? + ) := { + notificationType := "ResourceUsageNotification", + timeStamp := p_timeStamp, + customerId := p_customerId, + tenantId := p_tenantId, + resourceUseInfo := p_resourceUseInfo + } // End of template mw_resource_usage_notification + + template (omit) ResourceUseInfo m_resource_use_info( + in template (omit) Json.Integer p_cpuUsed, + in template (omit) Json.Integer p_cpuRemain, + in template (omit) Json.Integer p_memoryUsed, + in template (omit) Json.Integer p_memoryRemain, + in template (omit) Json.Integer p_diskUsed, + in template (omit) Json.Integer p_diskRemain + ) := { + cpuUsed := p_cpuUsed, + cpuRemain := p_cpuRemain, + memoryUsed := p_memoryUsed, + memoryRemain := p_memoryRemain, + diskUsed := p_diskUsed, + diskRemain := p_diskRemain + } // End of template m_resource_use_info + + template ResourceUseInfo mw_resource_use_info( + template Json.Integer p_cpuUsed := *, + template Json.Integer p_cpuRemain := *, + template Json.Integer p_memoryUsed := *, + template Json.Integer p_memoryRemain := *, + template Json.Integer p_diskUsed := *, + template Json.Integer p_diskRemain := * + ) := { + cpuUsed := p_cpuUsed, + cpuRemain := p_cpuRemain, + memoryUsed := p_memoryUsed, + memoryRemain := p_memoryRemain, + diskUsed := p_diskUsed, + diskRemain := p_diskRemain + } // End of template mw_resource_use_info + + template (omit) SiteResourceUsageNotification m_site_resource_usage_notification( + in template (omit) TimeStamp p_timeStamp := omit, + in Json.String p_customerId, + in Json.String p_tenantId, + in template (value) SiteResourceUseInfo p_siteResourceUseInfo + ) := { + notificationType := "SiteResourceUsageNotification", + timeStamp := p_timeStamp, + customerId := p_customerId, + tenantId := p_tenantId, + siteResourceUseInfo := p_siteResourceUseInfo + } // End of template m_site_resource_usage_notification + + template (present) SiteResourceUsageNotification mw_site_resource_usage_notification( + template TimeStamp p_timeStamp := *, + template (present) Json.String p_customerId := ?, + template (present) Json.String p_tenantId := ?, + template (present) SiteResourceUseInfo p_siteResourceUseInfo := ? + ) := { + notificationType := "SiteResourceUsageNotification", + timeStamp := p_timeStamp, + customerId := p_customerId, + tenantId := p_tenantId, + siteResourceUseInfo := p_siteResourceUseInfo + } // End of template mw_site_resource_usage_notification + + template (omit) SiteResourceUseInfo m_site_resource_use_info( + in Json.String p_siteId, + in template (omit) Json.Integer p_cpuUsed, + in template (omit) Json.Integer p_cpuRemain, + in template (omit) Json.Integer p_memoryUsed, + in template (omit) Json.Integer p_memoryRemain, + in template (omit) Json.Integer p_diskUsed, + in template (omit) Json.Integer p_diskRemain + ) := { + siteId := p_siteId, + cpuUsed := p_cpuUsed, + cpuRemain := p_cpuRemain, + memoryUsed := p_memoryUsed, + memoryRemain := p_memoryRemain, + diskUsed := p_diskUsed, + diskRemain := p_diskRemain + } // End of template m_site_resource_use_info + + template (present) SiteResourceUseInfo mw_site_resource_use_info( + template (present) Json.String p_siteId := ?, + template Json.Integer p_cpuUsed := *, + template Json.Integer p_cpuRemain := *, + template Json.Integer p_memoryUsed := *, + template Json.Integer p_memoryRemain := *, + template Json.Integer p_diskUsed := *, + template Json.Integer p_diskRemain := * + ) := { + siteId := p_siteId, + cpuUsed := p_cpuUsed, + cpuRemain := p_cpuRemain, + memoryUsed := p_memoryUsed, + memoryRemain := p_memoryRemain, + diskUsed := p_diskUsed, + diskRemain := p_diskRemain + } // End of template mw_site_resource_use_info + + template (value) ExpiryNotification m_expiry_notification( + in template (value) Links p_links, + in template (value) TimeStamp p_expiryDeadline + ) := { + notificationType := "ExpiryNotification", + expiryDeadline := p_expiryDeadline, + links := p_links + } // End of template m_expiry_notification + + template (present) ExpiryNotification mw_expiry_notification( + template (present) Links p_links := ?, + template (present) TimeStamp p_expiryDeadline := ? + ) := { + notificationType := "ExpiryNotification", + expiryDeadline := p_expiryDeadline, + links := p_links + } // End of template mw_expiry_notification + + template (value) Links m_links( + in LinkType p_self_, + in template (omit) Subscriptions p_subscription := omit + ) :={ + self_ := p_self_, + subscription := p_subscription + } // End of template m_links + + template (present) Links mw_links( + template (present) LinkType p_self_ := ?, + template Subscriptions p_subscription := * + ) :={ + self_ := p_self_, + subscription := p_subscription + } // End of template mw_links + + template (value) Subscription m_subscription( + in Json.AnyURI p_href, + in Json.String p_subscriptionType + ) := { + href := p_href, + subscriptionType := p_subscriptionType + } // End of template m_subscription + + template (present) Subscription mw_subscription( + template (present) Json.AnyURI p_href := ?, + template (present) Json.String p_subscriptionType := ? + ) := { + href := p_href, + subscriptionType := p_subscriptionType + } // End of template mw_subscription + + template SiteInfo m_site_info( + in template Json.String p_siteId, + in template (omit) ResourceInfo p_resourceInfo := omit + ) := { + siteId := p_siteId, + resourceInfo := p_resourceInfo + } // End of template m_site_info + + template (present) SiteInfo mw_site_info( + template (present) Json.String p_siteId := ?, + template ResourceInfo p_resourceInfo := * + ) := { + siteId := p_siteId, + resourceInfo := p_resourceInfo + } // End of template mw_site_info + + template SiteId m_site_id( + in template Json.String p_siteId + ) := { + siteId := p_siteId + } // End of template m_site_id + + template (present) SiteId mw_site_id( + template (present) Json.String p_siteId := ? + ) := { + siteId := p_siteId + } // End of template mw_site_id + + template (omit) ResourceInfo m_resource_info( + in template (omit) Json.Integer p_cpuQuota, + in template (omit) Json.Integer p_cpuUsed, + in template (omit) Json.Integer p_cpuRemain, + in template (omit) Json.Integer p_memoryQuota, + in template (omit) Json.Integer p_memoryUsed, + in template (omit) Json.Integer p_memoryRemain, + in template (omit) Json.Integer p_diskQuota, + in template (omit) Json.Integer p_diskUsed, + in template (omit) Json.Integer p_diskRemain + ) := { + cpuQuota := p_cpuQuota, + cpuUsed := p_cpuUsed, + cpuRemain := p_cpuRemain, + memoryQuota := p_memoryQuota, + memoryUsed := p_memoryUsed, + memoryRemain := p_memoryRemain, + diskQuota := p_diskQuota, + diskUsed := p_diskUsed, + diskRemain := p_diskRemain + } // End of template m_resource_info + + template (present) ResourceInfo mw_resource_info( + template Json.Integer p_cpuQuota := *, + template Json.Integer p_cpuUsed := *, + template Json.Integer p_cpuRemain := *, + template Json.Integer p_memoryQuota := *, + template Json.Integer p_memoryUsed := *, + template Json.Integer p_memoryRemain := *, + template Json.Integer p_diskQuota := *, + template Json.Integer p_diskUsed := *, + template Json.Integer p_diskRemain := * + ) := { + cpuQuota := p_cpuQuota, + cpuUsed := p_cpuUsed, + cpuRemain := p_cpuRemain, + memoryQuota := p_memoryQuota, + memoryUsed := p_memoryUsed, + memoryRemain := p_memoryRemain, + diskQuota := p_diskQuota, + diskUsed := p_diskUsed, + diskRemain := p_diskRemain +} // End of template mw_resource_info + +} // End of module SelfServiceEnablementAPI_Templates diff --git a/ttcn/LibMec/SelfServiceEnablementAPI/ttcn/SelfServiceEnablementAPI_TypesAndValues.ttcn b/ttcn/LibMec/SelfServiceEnablementAPI/ttcn/SelfServiceEnablementAPI_TypesAndValues.ttcn new file mode 100644 index 0000000..9de9a4b --- /dev/null +++ b/ttcn/LibMec/SelfServiceEnablementAPI/ttcn/SelfServiceEnablementAPI_TypesAndValues.ttcn @@ -0,0 +1,332 @@ +module SelfServiceEnablementAPI_TypesAndValues { + + // JSON + import from Json all; + + // LibMec + import from LibMec_TypesAndValues all; + + /** + * @desc This type represents the information on a tenant + * @param customerId Identifier of the customer + * @param customerName Name of the customer + * @param customerCategory Category of the customer + * @param tenantId Identifier of the tenant + * @param tenantName Name of the tenant + * @param resourceUseInfo Resource in the MEC system that can be used by the tenant + * @param siteList A list of edge sites that can be used by the tenant + * @see ETSI GS MEC 048 V3.1.1 (2024-04) Table 6.2.2-1: Definition of type TenantInfo + */ + type record TenantInfo { + Json.String customerId, + Json.String customerName, + Json.String customerCategory optional, + Json.String tenantId optional, + Json.String tenantName, + ResourceInfo resourceUseInfo optional, + SiteInfo siteList optional + } + type set of TenantInfo TenantInfoList; + + /** + * @desc This type represents the information on the computing resource quota for a tenant in a MEC system + * @param cpuQuota Allowed number of CPUs in the MEC system that can be used by the tenant + * @param memoryQuota Allowed amount of memory (MB) in the MEC system that can be used by the tenant + * @param diskQuota Allowed amount of disk (GB) in the MEC system that can be used by the tenant + * @see ETSI GS MEC 048 V3.1.1 (2024-04) Table 6.2.3-1: Definition of type ResourceQuotaInfo + */ + type record ResourceQuotaInfo { + Json.Integer cpuQuota optional, + Json.Integer memoryQuota optional, + Json.Integer diskQuota optional + } + + /** + * @desc This type represents the information on the computing resource quota for a tenant in an edge site + * @param siteId Identifier of an edge site + * @param cpuQuota Allowed number of CPUs in the MEC system that can be used by the tenant + * @param memoryQuota Allowed amount of memory (MB) in the MEC system that can be used by the tenant + * @param diskQuota Allowed amount of disk (GB) in the MEC system that can be used by the tenant + * @see ETSI GS MEC 048 V3.1.1 (2024-04) Table 6.2.4-1: Definition of type SiteResourceQuotaInfo + */ + type record SiteResourceQuotaInfo { + Json.String siteId, + Json.Integer cpuQuota optional, + Json.Integer memoryQuota optional, + Json.Integer diskQuota optional + } + type set of SiteResourceQuotaInfo SiteResourceQuotaInfoList; + + /** + * @desc This type represents a subscription to get updates on the computing resource usage of a tenant in a MEC system + * @param subscriptionType Shall be set to "ResourceUsageSubscription" + * @param callbackReference URI exposed by the client on which to receive notifications via HTTP + * @param requestTestNotification Set to TRUE by the service consumer to request a test notification via HTTP on the callbackReference URI + * @param websockNotifConfig Provides details to negotiate and signal the use of a Websocket connection between the WAIS and the service consumer for notifications + * @param _links Hyperlink related to the resource. This shall be only included in the HTTP responses and in HTTP PUT requests + * @param customerId Identifier to uniquely specify the customer for the subscription + * @param tenantId Identifier of the tenant + * @param notificationTrigger Set for trigger-based event notification reporting + * @param expiryDeadline The expiration time of the subscription determined by the CSE + * @see ETSI GS MEC 048 V3.1.1 (2024-04) Table 6.3.2-1: Definition of type ResourceUsageSubscription + */ + type record ResourceUsageSubscription { + Json.String subscriptionType, + Json.AnyURI callbackReference optional, + Json.Bool requestTestNotification optional, + WebsockNotifConfig websockNotifConfig optional, + Links links optional, + Json.String customerId, + Json.String tenantId, + NotificationTrigger notificationTrigger, + TimeStamp expiryDeadline optional + } with { + variant (links) "name as '_links'"; + } + + /** + * @desc This type represents a subscription to get updates on the computing resource usage of a tenant in one or multiple edge sites + * @param subscriptionType Shall be set to "SiteResourceUsageSubscription" + * @param callbackReference URI exposed by the client on which to receive notifications via HTTP + * @param requestTestNotification Set to TRUE by the service consumer to request a test notification via HTTP on the callbackReference URI + * @param websockNotifConfig Provides details to negotiate and signal the use of a Websocket connection between the WAIS and the service consumer for notifications + * @param _links Hyperlink related to the resource. This shall be only included in the HTTP responses and in HTTP PUT requests + * @param customerId Identifier to uniquely specify the customer for the subscription + * @param tenantId Identifier of the tenant + * @param notificationTrigger Set for trigger-based event notification reporting + * @param expiryDeadline The expiration time of the subscription determined by the CSE + * @see ETSI GS MEC 048 V3.1.1 (2024-04) Table 6.3.3-1: Definition of type SiteResourceUsageSubscription + */ + type record SiteResourceUsageSubscription { + Json.String subscriptionType, + Json.AnyURI callbackReference optional, + Json.Bool requestTestNotification optional, + WebsockNotifConfig websockNotifConfig optional, + Links links optional, + Json.String customerId, + Json.String tenantId, + SiteId siteList, + NotificationTrigger notificationTrigger, + TimeStamp expiryDeadline optional + } with { + variant (links) "name as '_links'"; + } + + /** + * @desc This type represents a list of links related to currently existing subscriptions for the service consumer + * @param _links List of hyperlinks related to the resource + * @see ETSI GS MEC 048 V3.1.1 (2024-04) Table 6.3.4-1: Attributes of type SubscriptionLinkList + */ + type record SubscriptionLinkList { + Links links + } with { + variant (links) "name as '_links'"; + } + + /** + * @desc This type represents a notification from CSE with regards to the computing resource usage of a tenant in a MEC system + * @param notificationType Shall be set to "ResourceUsageNotification" + * @param timeStamp Time stamp + * @param customerId Identifier to uniquely specify the customer for the subscription + * @param tenantId Identifier of the tenant + * @param resourceUseInfo Resource usage in the MEC system by the tenant + * @see ETSI GS MEC 048 V3.1.1 (2024-04) Table 6.4.2-1: Attributes of type ResourceUsageNotification + */ + type record ResourceUsageNotification { + Json.String notificationType, + TimeStamp timeStamp optional, + Json.String customerId, + Json.String tenantId, + ResourceUseInfo resourceUseInfo + } + + /** + * @desc This type represents resource usage in the MEC system by the tenant + * @param cpuUsed Used number of CPUs by the tenant + * @param cpuRemain Remaining number of CPUs that can be used by the tenant + * @param memoryUsed Used amount of memory (MB) by the tenant + * @param memoryRemain Remaining amount of memory (MB) that can be used by the tenant + * @param diskUsed Used amount of disk (GB) by the tenant + * @param diskRemain Remaining amount of disk (GB) that can be used by the tenant + * @see ETSI GS MEC 048 V3.1.1 (2024-04) Table 6.4.2-1: Attributes of type ResourceUseInfo + */ + type record ResourceUseInfo { + Json.Integer cpuUsed optional, + Json.Integer cpuRemain optional, + Json.Integer memoryUsed optional, + Json.Integer memoryRemain optional, + Json.Integer diskUsed optional, + Json.Integer diskRemain optional + } + + /** + * @desc This type represents a notification from CSE with regards to the computing resource usage of a tenant in one or multiple edge sites + * @param notificationType Shall be set to "SiteResourceUsageNotification" + * @param timeStamp Time stamp + * @param customerId Identifier to uniquely specify the customer for the subscriptionc + * @param tenantId Identifier of the tenant + * @param resourceUseInfo Resource usage in the MEC system by the tenant + * @see ETSI GS MEC 048 V3.1.1 (2024-04) Table 6.4.3-1: Attributes of type SiteResourceUsageNotification + */ + type record SiteResourceUsageNotification { + Json.String notificationType, + TimeStamp timeStamp optional, + Json.String customerId, + Json.String tenantId, + SiteResourceUseInfo siteResourceUseInfo + } + + /** + * @desc This type represents resource usage in the edge sites by the tenant + * @param siteId Identifier of an edge site + * @param cpuUsed Used number of CPUs by the tenant + * @param cpuRemain Remaining number of CPUs that can be used by the tenant + * @param memoryUsed Used amount of memory (MB) by the tenant + * @param memoryRemain Remaining amount of memory (MB) that can be used by the tenant + * @param diskUsed Used amount of disk (GB) by the tenant + * @param diskRemain Remaining amount of disk (GB) that can be used by the tenant + * @see ETSI GS MEC 048 V3.1.1 (2024-04) Table 6.4.3-1: Attributes of type SiteResourceUseInfo + */ + type record SiteResourceUseInfo { + Json.String siteId, + Json.Integer cpuUsed optional, + Json.Integer cpuRemain optional, + Json.Integer memoryUsed optional, + Json.Integer memoryRemain optional, + Json.Integer diskUsed optional, + Json.Integer diskRemain optional + } + + /** + * @desc This type represents a notification from CSE with regards to expiry of an existing subscription + * @param notificationType Shall be set to "ExpiryNotification" + * @param _links Object containing hyperlinks related to the resource + * @param expiryDeadline Time stamp + * @see ETSI GS MEC 048 V3.1.1 (2024-04) Table 6.4.4-1: Attributes of type ExpiryNotification + */ + type record ExpiryNotification { + Json.String notificationType, + TimeStamp expiryDeadline, + Links links + } with { + variant (links) "name as '_links'"; + } + + /** + * @desc This type represents the information on an edge site + * @param siteId Identifier of an edge site + * @param resourceInfo Resource information in the edge site that is associated with a specific tenant + * @see ETSI GS MEC 048 V3.1.1 (2024-04) Table 6.5.2-1: Attributes of type SiteInfo + */ + type record SiteInfo { + Json.String siteId, + ResourceInfo resourceInfo + } + + /** + * @desc This type represents the resource information in an edge site or a MEC system that is associated with a tenant + * @param cpuQuota Allowed number of CPUs that can be used by the tenant + * @param cpuUsed Used number of CPUs by the tenant + * @param cpuRemain Remaining number of CPUs that can be used by the tenant + * @param memoryQuota Allowed amount of memory (MB) that can be used by the tenant + * @param memoryUsed Used amount of memory (MB) by the tenant + * @param memoryRemain Remaining amount of memory (MB) that can be used by the tenant + * @param diskQuota Allowed amount of disk (GB) that can be used by the tenant + * @param diskUsed Used amount of disk (GB) by the tenant + * @param diskRemain Remaining amount of disk (GB) that can be used by the tenant + * @see ETSI GS MEC 048 V3.1.1 (2024-04) Table 6.4.3-1: Attributes of type ResourceInfo + */ + type record ResourceInfo { + Json.Integer cpuQuota optional, + Json.Integer cpuUsed optional, + Json.Integer cpuRemain optional, + Json.Integer memoryQuota optional, + Json.Integer memoryUsed optional, + Json.Integer memoryRemain optional, + Json.Integer diskQuota optional, + Json.Integer diskUsed optional, + Json.Integer diskRemain optional + } + + /** + * @desc This type represents the information on an edge site + * @param siteId Identifier of an edge site + * @param resourceInfo Resource information in the edge site that is associated with a specific tenant + * @see ETSI GS MEC 048 V3.1.1 (2024-04) Table 6.5.2-1: Attributes of type SiteInfo + */ + type record NotificationTrigger { + TriggerType triggerType, + Json.UInt8 threshold, + Json.Bool greaterOrLess + } + + /** + * @desc Trigger for the notification + * @see ETSI GS MEC 048 V3.1.1 (2024-04) Table 6.3.2-1: Enumeration TriggerType + */ + type enumerated TriggerType { + e_tt_ten (10), // 10 = Notification trigged based on the number of used CPUs + e_tt_eleven (11), // 11 = Notification trigged based on the number of remaining CPUs + e_tt_twenty (20), // 20 = Notification trigged based on the amount of used memory + e_tt_twentyone (21), // 21 = Notification trigged based on the amount of remaining memory + e_tt_thirty (30), // 30 = Notification trigged based on the amount of used disk + e_tt_thirtyone (31) // 31 = Notification trigged based on the amount of remaining disk + } with { + variant "JSON: as number" + } + + /** + * @desc Hyperlink related to the resource + * @member subscription URI identifying the subscription for the test notification + * @see ETSI GS MEC 048 V3.1.1 (2024-04) : Definition of type Links + */ + type record Links { + LinkType self_, + Subscriptions subscription optional + } with { + variant (self_) "name as 'self'"; + } + + /** + * @desc The service consumer's subscriptions + * @member href The URI referring to the subscription + * @member subscriptionType Type of the subscription + * @see ETSI GS MEC 048 V3.1.1 (2024-04) Table 6.3.4-11: Type Subscription + */ + type record Subscription { + Json.AnyURI href, + Json.String subscriptionType + } + type set of Subscription Subscriptions; + + /** + * @desc This type represents a type of link + * @member href URI referring to a resource + * @see ETSI GS MEC 048 V3.1.1 (2024-04) : Definition of type LinkType + */ + type record LinkType { + Json.AnyURI href + } + + /** + * @desc This type represents the identifier of an edge site. + * @param siteId Identifier of an edge site + * @see ETSI GS MEC 048 V3.1.1 (2024-04) Table 6.5.5-1: Attributes of type SiteInfo + */ + type record SiteId { + Json.String siteId + } + + /** + * @desc This type represents configuration for the delivery of subscription notifications over Websockets + * @member websocketUri Set by location server to indicate to the service consumer the Websocket URI to be used for delivering notifications + * @member requestWebsocketUri Set to true by the service consumer to indicate that Websocket delivery is requested + * @see ETSI GS MEC 048 V3.1.1 (2024-04) Type: WebsockNotifConfig + */ + type record WebsockNotifConfig { + Json.AnyURI websocketUri optional, + Json.Bool requestWebsocketUri optional +} with { + encode "JSON" +} +} // End of module SelfServiceEnablementAPI_TypesAndValues \ No newline at end of file diff --git a/ttcn/LibMec/ttcn/LibMec_Pixits.ttcn b/ttcn/LibMec/ttcn/LibMec_Pixits.ttcn index d476bdb..fa071c8 100644 --- a/ttcn/LibMec/ttcn/LibMec_Pixits.ttcn +++ b/ttcn/LibMec/ttcn/LibMec_Pixits.ttcn @@ -128,4 +128,8 @@ module LibMec_Pixits { // FIXME FSCOM Split this file according to the different modulepar charstring PX_SENS_MGMT := "sens/v1/sensor_management"; + modulepar charstring PX_CSE_TENANTS_INFO := "cse/v1/tenants"; + + modulepar charstring PX_CSE_LIST_SUBS := "/cse/v1/subscriptions"; + } // End of module LibMec_Pixits diff --git a/ttcn/patch_lib_http/ttcn/LibHttp_JsonMessageBodyTypes.ttcn b/ttcn/patch_lib_http/ttcn/LibHttp_JsonMessageBodyTypes.ttcn index 0a6cc8d..5576ee7 100644 --- a/ttcn/patch_lib_http/ttcn/LibHttp_JsonMessageBodyTypes.ttcn +++ b/ttcn/patch_lib_http/ttcn/LibHttp_JsonMessageBodyTypes.ttcn @@ -34,6 +34,8 @@ module LibHttp_JsonMessageBodyTypes { import from QoSMeasurementAPI_TypesAndValues all; // LibMec/SensorsSharingService import from SensorsSharingService_TypesAndValues all; + // LibMec/SelfServiceEnablementAPI + import from SelfServiceEnablementAPI_TypesAndValues all; /** * This file volontary contains a trivial declaration of the type JsonBody. @@ -204,6 +206,14 @@ module LibHttp_JsonMessageBodyTypes { SensorCharacteristics sensor_characteristics, // ETSI GS MEC 046 V3.1.1 (2024-04) Clause 6.5.4 Type: SensorCharacteristic SensorCharacteristicInfos sensor_characteristic_infos, // ETSI GS MEC 046 V3.1.1 (2024-04) Clause 6.5.4 Type: SensorCharacteristic SensorsSharingService_TypesAndValues.TestNotification sens_test_notification, + TenantInfo tenantInfo, + TenantInfoList tenantInfoList, + ResourceQuotaInfo resourceQuotaInfo, + ResourceUsageSubscription resourceUsageSubscription, + SiteResourceUsageSubscription siteResourceUsageSubscription, + SiteResourceUsageNotification siteResourceUsageNotification, + ResourceUsageNotification resourceUsageNotification, + // TODO Add here your custom variants universal charstring raw } with { diff --git a/ttcn/patch_lib_http/ttcn/LibHttp_JsonTemplates.ttcn b/ttcn/patch_lib_http/ttcn/LibHttp_JsonTemplates.ttcn index dd41e8f..97d704a 100644 --- a/ttcn/patch_lib_http/ttcn/LibHttp_JsonTemplates.ttcn +++ b/ttcn/patch_lib_http/ttcn/LibHttp_JsonTemplates.ttcn @@ -61,6 +61,9 @@ module LibHttp_JsonTemplates { // LibMec/SensorsSharingService import from SensorsSharingService_TypesAndValues all; + // LibMec/SelfServiceEnablementAPI + import from SelfServiceEnablementAPI_TypesAndValues all; + template (value) JsonBody m_json_body_raw( in template (value) charstring p_raw ) := { @@ -1990,4 +1993,102 @@ module LibHttp_JsonTemplates { } // End of group sens + group cse { + + template (value) JsonBody m_body_json_cse_tenant_info( + in template (value) TenantInfo p_tenantInfo + ) := { + tenantInfo := p_tenantInfo + } // End of template m_body_json_cse_tenant_info + + template (present) JsonBody mw_body_json_cse_tenant_info( + template (present) TenantInfo p_tenantInfo := ? + ) := { + tenantInfo := p_tenantInfo + } // End of template mw_body_json_cse_tenant_info + + template (value) JsonBody m_body_json_cse_tenant_info_list( + in template (value) TenantInfoList p_tenantInfoList + ) := { + tenantInfoList := p_tenantInfoList + } // End of template m_body_json_fed_cse_tenant_info + + template (present) JsonBody mw_body_json_cse_tenant_info_list( + template (present) TenantInfoList p_tenantInfoList := ? + ) := { + tenantInfoList := p_tenantInfoList + } // End of template mw_body_json_cse_tenant_info_list + + template (value) JsonBody m_body_json_cse_resource_quota_info( + in template (value) ResourceQuotaInfo p_resourceQuotaInfo + ) := { + resourceQuotaInfo := p_resourceQuotaInfo + } // End of template m_body_json_cse_resource_quota_info + + template (present) JsonBody mw_body_json_cse_resource_quota_info( + template (present) ResourceQuotaInfo p_resourceQuotaInfo:= ? + ) := { + resourceQuotaInfo := p_resourceQuotaInfo + } // End of template mw_body_json_cse_resource_quota_info + + template (value) JsonBody m_body_json_resource_usage_subscription( + in template (value) ResourceUsageSubscription p_resourceUsageSubscription + ) := { + resourceUsageSubscription := p_resourceUsageSubscription + } // End of template m_body_json_resource_usage_subscription + + template (present) JsonBody mw_body_json_resource_usage_subscription( + template (present) ResourceUsageSubscription p_resourceUsageSubscription := ? + ) := { + resourceUsageSubscription := p_resourceUsageSubscription + } // End of template mw_body_json_resource_usage_subscription + + template (value) JsonBody m_body_json_site_resource_usage_subscription( + in template (value) SiteResourceUsageSubscription p_siteResourceUsageSubscription + ) := { + siteResourceUsageSubscription := p_siteResourceUsageSubscription + } // End of template m_body_json_site_resource_usage_subscription + + template (present) JsonBody mw_body_json_site_resource_usage_subscription( + template (present) SiteResourceUsageSubscription p_siteResourceUsageSubscription := ? + ) := { + siteResourceUsageSubscription := p_siteResourceUsageSubscription + } // End of template mw_body_json_site_resource_usage_subscription + + template (value) JsonBody m_body_json_cse_subscription_link_list( + in template (value) SelfServiceEnablementAPI_TypesAndValues.SubscriptionLinkList p_subscription_link_list + ) := { + subscriptionLinkList := p_subscription_link_list + } // End of template m_body_json_cse_subscription_link_list + + template (present) JsonBody mw_body_json_cse_subscription_link_list( + template (present) SelfServiceEnablementAPI_TypesAndValues.SubscriptionLinkList p_subscription_link_list := ? + ) := { + subscriptionLinkList := p_subscription_link_list + } // End of template mw_body_json_cse_subscription_link_list + + template (present) JsonBody m_body_json_site_resource_usage_notification( + template (value) SiteResourceUsageNotification p_siteResourceUsageNotification + ) := { + siteResourceUsageNotification := p_siteResourceUsageNotification + } // End of template m_body_json_site_resource_usage_notification + template (present) JsonBody mw_body_json_site_resource_usage_notification( + template (present) SiteResourceUsageNotification p_siteResourceUsageNotification := ? + ) := { + siteResourceUsageNotification := p_siteResourceUsageNotification + } // End of template mw_body_json_site_resource_usage_notification + + template (present) JsonBody m_body_json_resource_usage_notification( + template (value) ResourceUsageNotification p_resourceUsageNotification + ) := { + resourceUsageNotification := p_resourceUsageNotification + } // End of template m_body_json_site_resource_usage_notification + template (present) JsonBody mw_body_json_resource_usage_notification( + template (present) ResourceUsageNotification p_resourceUsageNotification := ? + ) := { + resourceUsageNotification := p_resourceUsageNotification + } // End of template mw_body_json_site_resource_usage_notification + + } // End of group cse + } // End of module LibHttp_JsonTemplates -- GitLab From fc358faaebd04ce373f01e52537100c873a752ea Mon Sep 17 00:00:00 2001 From: Muhammad Umair Khan Date: Tue, 3 Jun 2025 06:19:34 +0000 Subject: [PATCH 2/3] add MEC048 SiteResourceQuotaInfo testcases and ResourceQuotaInfo post testcase --- .../AtsMec_SelfServiceEnablementAPI.cf_ | 107 +++ ...ec_SelfServiceEnablementAPI_TestCases.ttcn | 822 +++++++++++++++++- ..._SelfServiceEnablementAPI_TestControl.ttcn | 13 + .../module.mk | 0 .../SelfServiceEnablementAPI_Functions.ttcn | 88 +- .../ttcn/SelfServiceEnablementAPI_Pixits.ttcn | 26 +- .../SelfServiceEnablementAPI_Templates.ttcn | 6 +- .../ttcn/LibHttp_JsonMessageBodyTypes.ttcn | 3 + .../ttcn/LibHttp_JsonTemplates.ttcn | 30 +- 9 files changed, 1078 insertions(+), 17 deletions(-) create mode 100644 etc/AtsMec_SelfServiceEnablement/AtsMec_SelfServiceEnablementAPI.cf_ rename ttcn/{AtsMec_SelfServiceEnablementAPI => AtsMec_SelfServiceEnablement}/AtsMec_SelfServiceEnablementAPI_TestCases.ttcn (53%) rename ttcn/{AtsMec_SelfServiceEnablementAPI => AtsMec_SelfServiceEnablement}/AtsMec_SelfServiceEnablementAPI_TestControl.ttcn (77%) rename ttcn/{AtsMec_SelfServiceEnablementAPI => AtsMec_SelfServiceEnablement}/module.mk (100%) diff --git a/etc/AtsMec_SelfServiceEnablement/AtsMec_SelfServiceEnablementAPI.cf_ b/etc/AtsMec_SelfServiceEnablement/AtsMec_SelfServiceEnablementAPI.cf_ new file mode 100644 index 0000000..6a30bc8 --- /dev/null +++ b/etc/AtsMec_SelfServiceEnablement/AtsMec_SelfServiceEnablementAPI.cf_ @@ -0,0 +1,107 @@ +[MODULE_PARAMETERS] +# This section shall contain the values of all parameters that are defined in your TTCN-3 modules. + +# IUT roles + +LibCommon_Time.PX_TAC := 30.0 +#LibCommon_Time.PX_TWAIT := 30.0 +LibCommon_Sync.PX_TSYNC_TIME_LIMIT := 30.0; +LibCommon_Sync.PX_TSHUT_DOWN_TIME_LIMIT := 30.0; + +LibHttp_Pics.PICS_HEADER_HOST := "192.168.1.21" #"192.168.1.39" + +LibHttp_Pics.PICS_HEADER_CONTENT_TYPE := "application/json" +LibHttp_Pics.PICS_USE_TOKEN_HEADER := true +#LibHttp_Pics.PICS_TOKEN_HEADER := "Basic WrongToken" + +# LibMec_Pixits +LibMec_Pics.PICS_ROOT_API := "/sbxykqjr17/mep1/" # Need to sign in on https://mec-platform.etsi.org/, section 'Try-it from your MEC application' + +[LOGGING] +# In this section you can specify the name of the log file and the classes of events +# you want to log into the file or display on console (standard error). + +LogFile := "../logs/AtsMec_FederationEnablement/%e.%h-%r.%s" +FileMask := LOG_ALL | USER | DEBUG | MATCHING +ConsoleMask := LOG_ALL | USER | DEBUG | MATCHING +#FileMask := ERROR | WARNING | USER | MATCHING | EXECUTOR_RUNTIME | VERDICTOP | PORTEVENT | TESTCASE +#ConsoleMask := ERROR | WARNING | USER | MATCHING | EXECUTOR_RUNTIME | VERDICTOP | PORTEVENT | TESTCASE +LogSourceInfo := Stack +LogEntityName:= Yes +LogEventTypes:= Yes +#TimeStampFormat := DateTime + +[TESTPORT_PARAMETERS] +# In this section you can specify parameters that are passed to Test Ports. +#system.httpPort.params := "HTTP(codecs=json:json_codec_mec015)/TCP(debug=1,server=172.26.214.231,port=3001,use_ssl=0)" +#system.httpPort.params := "HTTP(codecs=json:json_codec)/TCP(debug=1,server=try-mec.etsi.org,port=443,use_ssl=1)" +#system.httpPort_notif.params := "HTTP(codecs=json:json_codec_mec015)/TCP(debug=1,server_mode=1,use_ssl=0)" + +[DEFINE] +# In this section you can create macro definitions, +# that can be used in other configuration file sections except [INCLUDE] and [ORDERED_INCLUDE]. + +[INCLUDE] +# To use configuration settings given in other configuration files, +# the configuration files just need to be listed in this section, with their full or relative pathnames. + +[ORDERED_INCLUDE] +# To use configuration settings given in other configuration files, +# the configuration files just need to be listed in this section, with their full or relative pathnames. + +[EXTERNAL_COMMANDS] +# This section can define external commands (shell scripts) to be executed by the ETS +# whenever a control part or test case is started or terminated. + +#BeginTestCase := "" +#EndTestCase := "" +#BeginControlPart := "" +#EndControlPart := "" + +[EXECUTE] +# In this section you can specify what parts of your test suite you want to execute. +#AtsMec_TestControl.control + +# Check that the IUT creates the resourceQuotaInfo for an existing tenant when requested to a CSE +#AtsMec_SelfServiceEnablementAPI_TestCases.TC_MEC_MEC048_MEO_CSE_008_OK +# Check that the IUT returns an error on creating the resourceQuotaInfo for a not existing tenant when requested to a CSE +#AtsMec_SelfServiceEnablementAPI_TestCases.TC_MEC_MEC048_MEO_CSE_008_NF +# Check that the IUT returns the list of per site resource quota for a specific tenant when requested to a CSE - No filter +#AtsMec_SelfServiceEnablementAPI_TestCases.TC_MEC_MEC048_MEO_CSE_009_OK +# Check that the IUT returns the list of per site resource quota for a specific tenant when requested to a CSE - siteId filter" +AtsMec_SelfServiceEnablementAPI_TestCases.TC_MEC_MEC048_MEO_CSE_009_OK_01 +# Check that the IUT returns an error on requesting site resource quota info on a not existing tenant when requested to a CSE +#AtsMec_SelfServiceEnablementAPI_TestCases.TC_MEC_MEC048_MEO_CSE_009_NF +# Check that the IUT creates a site resource quota info for a existing tenant when requested to a CSE +#AtsMec_SelfServiceEnablementAPI_TestCases.TC_MEC_MEC048_MEO_CSE_010_OK +# Check that the IUT returns an error on creating a site resource quota with wrong parameters +#AtsMec_SelfServiceEnablementAPI_TestCases.TC_MEC_MEC048_MEO_CSE_010_BR +# Check that the IUT returns the site resource quota for a specific tenant and site identifier when requested to a CSE +#AtsMec_SelfServiceEnablementAPI_TestCases.TC_MEC_MEC048_MEO_CSE_011_OK +# Check that the IUT returns an error on requesting site resource quota info on a not existing tenant when requested to a CSE +#AtsMec_SelfServiceEnablementAPI_TestCases.TC_MEC_MEC048_MEO_CSE_011_NF +# Check that the IUT updates a site resource quota info for a existing tenant when requested to a CSE +#AtsMec_SelfServiceEnablementAPI_TestCases.TC_MEC_MEC048_MEO_CSE_012_OK +# Check that the IUT returns an error updating a site resource quota info for a existing tenant when requested to a CSE +#AtsMec_SelfServiceEnablementAPI_TestCases.TC_MEC_MEC048_MEO_CSE_012_BR +# Check that the IUT returns an error updating a site resource quota info for a not existing tenant when requested to a CSE +#AtsMec_SelfServiceEnablementAPI_TestCases.TC_MEC_MEC048_MEO_CSE_012_NF + + + + + + +[GROUPS] +# In this section you can specify groups of hosts. These groups can be used inside the +# [COMPONENTS] section to restrict the creation of certain PTCs to a given set of hosts. + +[COMPONENTS] +# This section consists of rules restricting the location of created PTCs. + +[MAIN_CONTROLLER] +# The options herein control the behavior of MC. +KillTimer := 10.0 +LocalAddress := 127.0.0.1 +TCPPort := 12000 +NumHCs := 1 diff --git a/ttcn/AtsMec_SelfServiceEnablementAPI/AtsMec_SelfServiceEnablementAPI_TestCases.ttcn b/ttcn/AtsMec_SelfServiceEnablement/AtsMec_SelfServiceEnablementAPI_TestCases.ttcn similarity index 53% rename from ttcn/AtsMec_SelfServiceEnablementAPI/AtsMec_SelfServiceEnablementAPI_TestCases.ttcn rename to ttcn/AtsMec_SelfServiceEnablement/AtsMec_SelfServiceEnablementAPI_TestCases.ttcn index a83b927..95ed72c 100644 --- a/ttcn/AtsMec_SelfServiceEnablementAPI/AtsMec_SelfServiceEnablementAPI_TestCases.ttcn +++ b/ttcn/AtsMec_SelfServiceEnablement/AtsMec_SelfServiceEnablementAPI_TestCases.ttcn @@ -24,7 +24,7 @@ module AtsMec_SelfServiceEnablementAPI_TestCases { import from LibMec_Pixits all; group tenant { - + /** * @Desc Check that the IUT responds with a list of all available tenantInfo when requested to a CSE - No query parameters */ @@ -1059,6 +1059,826 @@ module AtsMec_SelfServiceEnablementAPI_TestCases { } // End of testcase TC_MEC_MEC048_MEO_CSE_007_NF + /** + * @desc Check that the IUT creates the resourceQuotaInfo for an existing tenant when requested to a CSE + */ + testcase TC_MEC_MEC048_MEO_CSE_008_OK() runs on HttpComponent system HttpTestAdapter { + // Local variables + var Headers v_headers; + var HttpMessage v_response; + var charstring v_tenant_id; + var TenantInfo v_tenant_info := valueof(m_tenant_info(PX_CSE_CUSTOMER_ID_1, PX_CSE_CUSTOMER_NAME_1, omit, omit, PX_CSE_TENANT_NAME_1)); + + // Test control + if (not(PICS_MEC_PLAT) or not(PICS_SERVICES) or not(PICS_CSE_API_SUPPORTED)) { + log("*** " & testcasename() & ": PICS_MEC_PLAT and PICS_SERVICES and PICS_CSE_API_SUPPORTED required for executing the TC ***"); + setverdict(inconc); + stop; + } + + // Test component configuration + f_cf_01_http_up(); + + // Test adapter configuration + + // Preamble + f_create_tenant_info(v_tenant_info, v_tenant_id); + f_init_default_headers_list(-, -, v_headers); + + httpPort.send( + m_http_request( + m_http_request_post( + PICS_ROOT_API & PX_CSE_TENANTS_INFO & "/" & v_tenant_id & "/resources/quota_in_system", + v_headers, + m_http_message_body_json( + mw_body_json_cse_resource_quota_info( + m_resource_quota_info( + PX_CPU_QUOTA_1, + PX_MEMORY_QUOTA_1, + PX_DISK_QUOTA_1 + )))))); + tc_ac.start; + alt { + [] httpPort.receive( + mw_http_response( + mw_http_response_201_created( + mw_http_message_body_json( + mw_body_json_cse_resource_quota_info( + mw_resource_quota_info( + PX_CPU_QUOTA_1, + PX_MEMORY_QUOTA_1, + PX_DISK_QUOTA_1 + )))))) -> value v_response { + tc_ac.stop; + // Check HTTP Location header + if (f_check_headers(v_response.response.header) == false) { + log("*** " & testcasename() & ": FAIL: IUT failed in creating the resourceQuotaInfo for an existing tenant ***"); + f_selfOrClientSyncAndVerdict(c_tbDone, e_error); + } + + log("*** " & testcasename() & ": PASS: IUT passed in creating the resourceQuotaInfo for an existing tenant ***"); + f_selfOrClientSyncAndVerdict(c_tbDone, e_success); + } + [] tc_ac.timeout { + log("*** " & testcasename() & ": INCONC: Expected message not received ***"); + f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout); + } + } // End of 'alt' statement + + // Postamble + f_delete_tenant_info(v_tenant_info); + f_cf_01_http_down(); + } // End of testcase TC_MEC_MEC048_MEO_CSE_008_OK + + /** + * @desc Check that the IUT returns an error on creating the resourceQuotaInfo for a not existing tenant when requested to a CSE + */ + testcase TC_MEC_MEC048_MEO_CSE_008_NF() runs on HttpComponent system HttpTestAdapter { + // Local variables + var Headers v_headers; + + // Test control + if (not(PICS_MEC_PLAT) or not(PICS_SERVICES) or not(PICS_CSE_API_SUPPORTED)) { + log("*** " & testcasename() & ": PICS_MEC_PLAT and PICS_SERVICES and PICS_CSE_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_CSE_TENANTS_INFO & oct2char(unichar2oct(PX_NON_EXISTENT_TENANT_ID, "UTF-8")) & "/resources/quota_in_system", + v_headers, + m_http_message_body_json( + m_body_json_cse_resource_quota_info( + m_resource_quota_info( + PX_CPU_QUOTA_1, + PX_MEMORY_QUOTA_1, + PX_DISK_QUOTA_1 + )))))); + tc_ac.start; + alt { + [] httpPort.receive( + mw_http_response( + mw_http_response_404_not_found + )) { + tc_ac.stop; + log("*** " & testcasename() & ": PASS: IUT successfully responds with the correct error 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_MEC048_MEO_CSE_008_NF + + /** + * @desc Check that the IUT returns the list of per site resource quota for a specific tenant when requested to a CSE - No filter + */ + testcase TC_MEC_MEC048_MEO_CSE_009_OK() runs on HttpComponent system HttpTestAdapter { + + // Local variables + var Headers v_headers; + var charstring v_tenant_id; + var charstring v_site_id; + var charstring_list v_site_id_list; + + var TenantInfo v_tenant_info := valueof(m_tenant_info(PX_CSE_CUSTOMER_ID_1, PX_CSE_CUSTOMER_NAME_1, omit, omit, PX_CSE_TENANT_NAME_1)); + var SiteResourceQuotaInfoList v_site_resource_quota_info := { + valueof(m_site_resource_quota_info(PX_SITE_ID_1,PX_CPU_QUOTA_1, PX_MEMORY_QUOTA_1, PX_DISK_QUOTA_1)), + valueof(m_site_resource_quota_info(PX_SITE_ID_2,PX_CPU_QUOTA_2, PX_MEMORY_QUOTA_2, PX_DISK_QUOTA_2)), + valueof(m_site_resource_quota_info(PX_SITE_ID_3,PX_CPU_QUOTA_3, PX_MEMORY_QUOTA_3, PX_DISK_QUOTA_3)) + }; + + // Test control + if (not(PICS_MEC_PLAT) or not(PICS_SERVICES) or not(PICS_CSE_API_SUPPORTED)) { + log("*** " & testcasename() & ": PICS_MEC_PLAT and PICS_SERVICES and PICS_CSE_API_SUPPORTED required for executing the TC ***"); + setverdict(inconc); + stop; + } + + // Test component configuration + f_cf_01_http_up(); + + // Test adapter configuration + + // Preamble + f_create_tenant_info(v_tenant_info, v_tenant_id); + f_create_site_resource_quota_info_list(v_site_resource_quota_info, v_site_id_list, v_tenant_id); + f_init_default_headers_list(-, -, v_headers); + httpPort.send( + m_http_request( + m_http_request_get( + PICS_ROOT_API & PX_CSE_TENANTS_INFO & v_tenant_id & "/resources/quota_in_sites", + v_headers + ))); + f_selfOrClientSyncAndVerdict(c_prDone, e_success); + tc_ac.start; + + alt { + [] httpPort.receive( + mw_http_response( + mw_http_response_ok( + mw_http_message_body_json( + mw_body_json_cse_site_resource_quota_info_list( + { + mw_site_resource_quota_info( + PX_SITE_ID_1, + PX_CPU_QUOTA_1, + PX_MEMORY_QUOTA_1, + PX_DISK_QUOTA_1 + ), + mw_site_resource_quota_info( + PX_SITE_ID_2, + PX_CPU_QUOTA_2, + PX_MEMORY_QUOTA_2, + PX_DISK_QUOTA_2 + ), + mw_site_resource_quota_info( + PX_SITE_ID_3, + PX_CPU_QUOTA_3, + PX_MEMORY_QUOTA_3, + PX_DISK_QUOTA_3 + ) + } + ))))) { + tc_ac.stop; + + log("*** " & testcasename() & ": PASS: IUT successfully responds with the list of per site resource quota for a specific tenant ***"); + f_selfOrClientSyncAndVerdict(c_tbDone, e_success); + } + [] tc_ac.timeout { + log("*** " & testcasename() & ": INCONC: Expected message not received ***"); + f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout); + } + } // End of 'alt' statement + + // Postamble + f_delete_tenant_info(v_tenant_info); + f_cf_01_http_down(); + } // End of testcase TC_MEC_MEC048_MEO_CSE_009_OK + + + /** + * @desc Check that the IUT returns the list of per site resource quota for a specific tenant when requested to a CSE - siteId filter" + */ + testcase TC_MEC_MEC048_MEO_CSE_009_OK_01() runs on HttpComponent system HttpTestAdapter { + // Local variables + var Headers v_headers; + var charstring v_tenant_id; + var charstring_list v_site_id_list; + + var TenantInfo v_tenant_info := valueof(m_tenant_info(PX_CSE_CUSTOMER_ID_1, PX_CSE_CUSTOMER_NAME_1, omit, omit, PX_CSE_TENANT_NAME_1)); + var SiteResourceQuotaInfoList v_site_resource_quota_info := { + valueof(m_site_resource_quota_info(PX_SITE_ID_1,PX_CPU_QUOTA_1, PX_MEMORY_QUOTA_1, PX_DISK_QUOTA_1)), + valueof(m_site_resource_quota_info(PX_SITE_ID_2,PX_CPU_QUOTA_2, PX_MEMORY_QUOTA_2, PX_DISK_QUOTA_2)), + valueof(m_site_resource_quota_info(PX_SITE_ID_3,PX_CPU_QUOTA_3, PX_MEMORY_QUOTA_3, PX_DISK_QUOTA_3)) + }; + // Test control + if (not(PICS_MEC_PLAT) or not(PICS_SERVICES) or not(PICS_CSE_API_SUPPORTED)) { + log("*** " & testcasename() & ": PICS_MEC_PLAT and PICS_SERVICES and PICS_CSE_API_SUPPORTED required for executing the TC ***"); + setverdict(inconc); + stop; + } + + // Test component configuration + f_cf_01_http_up(); + + // Test adapter configuration + + // Preamble + f_create_tenant_info(v_tenant_info, v_tenant_id); + f_create_site_resource_quota_info_list(v_site_resource_quota_info, v_site_id_list, v_tenant_id); + + f_init_default_headers_list(-, -, v_headers); + + //TODO: check uri and uri names of all testcases + httpPort.send( + m_http_request( + m_http_request_get( + PICS_ROOT_API & PX_CSE_TENANTS_INFO & "/resources/quota_in_sites?siteId=" & v_site_id_list[0] & "/" & v_site_id_list[1], + v_headers + ))); + f_selfOrClientSyncAndVerdict(c_prDone, e_success); + tc_ac.start; + alt { + [] httpPort.receive( + mw_http_response( + mw_http_response_ok( + mw_http_message_body_json( + mw_body_json_cse_site_resource_quota_info_list( + { + mw_site_resource_quota_info( + PX_SITE_ID_1, + PX_CPU_QUOTA_1, + PX_MEMORY_QUOTA_1, + PX_DISK_QUOTA_1 + ), + mw_site_resource_quota_info( + PX_SITE_ID_2, + PX_CPU_QUOTA_2, + PX_MEMORY_QUOTA_2, + PX_DISK_QUOTA_2 + ) + } + ))))) { + tc_ac.stop; + + log("*** " & testcasename() & ": PASS: IUT successfully responds with the site resource quota for a specific tenant - siteId filter ***"); + f_selfOrClientSyncAndVerdict(c_tbDone, e_success); + } + [] tc_ac.timeout { + log("*** " & testcasename() & ": INCONC: Expected message not received ***"); + f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout); + } + } // End of 'alt' statement + + // Postamble + f_delete_tenant_info(v_tenant_info); + f_cf_01_http_down(); + } // End of testcase TC_MEC_MEC048_MEO_CSE_009_OK_01 + + /** + * @desc Check that the IUT returns an error on requesting site resource quota info on a not existing tenant when requested to a CSE + */ + testcase TC_MEC_MEC048_MEO_CSE_009_NF() runs on HttpComponent system HttpTestAdapter { + // Local variables + var Headers v_headers; + + // Test control + if (not(PICS_MEC_PLAT) or not(PICS_SERVICES) or not(PICS_CSE_API_SUPPORTED)) { + log("*** " & testcasename() & ": PICS_MEC_PLAT and PICS_SERVICES and PICS_CSE_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); + + //TODO: check uri and uri names of all testcases + httpPort.send( + m_http_request( + m_http_request_get( + PICS_ROOT_API & oct2char(unichar2oct(PX_NON_EXISTENT_TENANT_ID, "UTF-8")) & "/resources/quota_in_sites", + v_headers + ))); + f_selfOrClientSyncAndVerdict(c_prDone, e_success); + + // Test body + tc_ac.start; + alt { + [] httpPort.receive( + mw_http_response( + mw_http_response_404_not_found + )) { + tc_ac.stop; + log("*** " & testcasename() & ": PASS: IUT successfully responds with the correct error 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_MEC048_MEO_CSE_009_NF + + /** + * @desc Check that the IUT creates a site resource quota info for a existing tenant when requested to a CSE + */ + testcase TC_MEC_MEC048_MEO_CSE_010_OK() runs on HttpComponent system HttpTestAdapter { + // Local variables + var Headers v_headers; + var HttpMessage v_response; + var charstring v_site_id; + var charstring v_tenant_id; + + var TenantInfo v_tenant_info := valueof(m_tenant_info(PX_CSE_CUSTOMER_ID_1, PX_CSE_CUSTOMER_NAME_1, omit, omit, PX_CSE_TENANT_NAME_1)); + + // Test control + if (not(PICS_MEC_PLAT) or not(PICS_SERVICES) or not(PICS_CSE_API_SUPPORTED)) { + log("*** " & testcasename() & ": PICS_MEC_PLAT and PICS_SERVICES and PICS_CSE_API_SUPPORTED required for executing the TC ***"); + setverdict(inconc); + stop; + } + + // Test component configuration + f_cf_01_http_up(); + + // Test adapter configuration + + // Preamble + f_create_tenant_info(v_tenant_info, v_tenant_id); //TODO: change function name + f_init_default_headers_list(-, -, v_headers); + + //TODO: check uri and uri names of all testcases + httpPort.send( + m_http_request( + m_http_request_post( + PICS_ROOT_API & PX_CSE_TENANTS_INFO & "/" & v_tenant_id & "/resources/quota_in_sites", + v_headers, + m_http_message_body_json( + m_body_json_cse_site_resource_quota_info( + m_site_resource_quota_info( + PX_SITE_ID_1, + PX_CPU_QUOTA_1, + PX_MEMORY_QUOTA_1, + PX_DISK_QUOTA_1 + )))))); + tc_ac.start; + alt { + [] httpPort.receive( + mw_http_response( + mw_http_response_201_created( + mw_http_message_body_json( + mw_body_json_cse_site_resource_quota_info( + mw_site_resource_quota_info( + PX_SITE_ID_1, + PX_CPU_QUOTA_1, + PX_MEMORY_QUOTA_1, + PX_DISK_QUOTA_1 + )))))) -> value v_response { + tc_ac.stop; + // Check HTTP Location header + if (f_check_headers(v_response.response.header) == false) { + log("*** " & testcasename() & ": FAIL: IUT failed in responds with the list of per site resource quota for a specific tenant ***"); + f_selfOrClientSyncAndVerdict(c_tbDone, e_error); + } else { + var charstring_list v_location_header; + f_get_header(v_response.response.header, "Location", v_location_header); + // Build expected regex pattern with specific tenant ID + var charstring v_expected_pattern := "/cse/v1/tenants/" & v_tenant_id & "/resources/quota_in_sites/[^/]+"; + if (regexp(v_location_header[0], v_expected_pattern, 0) != "") { + log("Location header matches expected pattern with tenant ID: " & v_tenant_id); + } else { + setverdict(fail, "Location header does NOT match expected pattern: ", v_location_header[0]); + } + } + log("*** " & testcasename() & ": PASS: IUT passed in creating the site resource quota for an existing tenant ***"); + f_selfOrClientSyncAndVerdict(c_tbDone, e_success); + } + [] tc_ac.timeout { + log("*** " & testcasename() & ": INCONC: Expected message not received ***"); + f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout); + } + } // End of 'alt' statement + + // Postamble + f_delete_tenant_info(v_tenant_info); + f_cf_01_http_down(); + } // End of testcase TC_MEC_MEC048_MEO_CSE_010_OK + + /** + * @desc Check that the IUT returns an error on creating a site resource quota with wrong parameters + */ + testcase TC_MEC_MEC048_MEO_CSE_010_BR() runs on HttpComponent system HttpTestAdapter { + // Local variables + var Headers v_headers; + var charstring v_site_id; + var charstring v_tenant_id; + + var TenantInfo v_tenant_info := valueof(m_tenant_info(PX_CSE_CUSTOMER_ID_1, PX_CSE_CUSTOMER_NAME_1, omit, omit, PX_CSE_TENANT_NAME_1)); + + + // Test control + if (not(PICS_MEC_PLAT) or not(PICS_SERVICES) or not(PICS_CSE_API_SUPPORTED)) { + log("*** " & testcasename() & ": PICS_MEC_PLAT and PICS_SERVICES and PICS_CSE_API_SUPPORTED required for executing the TC ***"); + setverdict(inconc); + stop; + } + + // Test component configuration + f_cf_01_http_up(); + + // Test adapter configuration + + // Preamble + f_create_tenant_info(v_tenant_info, v_tenant_id); + f_init_default_headers_list(-, -, v_headers); + + //TODO: check uri and uri names of all testcases + httpPort.send( + m_http_request( + m_http_request_post( + PICS_ROOT_API & PX_CSE_TENANTS_INFO & "/" & v_tenant_id & "/resources/quota_in_sites", + v_headers, + m_http_message_body_json( + m_body_json_cse_site_resource_quota_info( + m_site_resource_quota_info( + PX_SITE_ID_1, + PX_CPU_QUOTA_1, + PX_MEMORY_QUOTA_1, + - + )))))); + tc_ac.start; + alt { + [] httpPort.receive( + mw_http_response( + mw_http_response_400_bad_request + )) { + tc_ac.stop; + log("*** " & testcasename() & ": PASS: IUT successfully responds with a correct error code ***"); + f_selfOrClientSyncAndVerdict(c_tbDone, e_success); + } + } // End of 'alt' statement + + // Postamble + f_delete_tenant_info(v_tenant_info); + f_cf_01_http_down(); + } // End of testcase TC_MEC_MEC048_MEO_CSE_010_BR + + + /** + * @desc Check that the IUT returns the site resource quota for a specific tenant and site identifier when requested to a CSE + */ + testcase TC_MEC_MEC048_MEO_CSE_011_OK() runs on HttpComponent system HttpTestAdapter { + + // Local variables + var Headers v_headers; + var charstring v_tenant_id; + var charstring v_site_id; + + var TenantInfo v_tenant_info := valueof(m_tenant_info(PX_CSE_CUSTOMER_ID_1, PX_CSE_CUSTOMER_NAME_1, omit, omit, PX_CSE_TENANT_NAME_1)); + var SiteResourceQuotaInfo v_site_resource_quota_info_1 := valueof(m_site_resource_quota_info(PX_SITE_ID_1,PX_CPU_QUOTA_1, PX_MEMORY_QUOTA_1, PX_DISK_QUOTA_1)); + + // Test control + if (not(PICS_MEC_PLAT) or not(PICS_SERVICES) or not(PICS_CSE_API_SUPPORTED)) { + log("*** " & testcasename() & ": PICS_MEC_PLAT and PICS_SERVICES and PICS_CSE_API_SUPPORTED required for executing the TC ***"); + setverdict(inconc); + stop; + } + + // Test component configuration + f_cf_01_http_up(); + + // Test adapter configuration + + // Preamble + f_create_tenant_info(v_tenant_info,v_tenant_id); + f_create_site_resource_quota_info(v_site_resource_quota_info_1, v_site_id, v_tenant_id); + + f_init_default_headers_list(-, -, v_headers); + httpPort.send( + m_http_request( + m_http_request_get( + PICS_ROOT_API & PX_CSE_TENANTS_INFO & "/" & v_tenant_id & "/resources/quota_in_sites" & "/" & v_site_id, + v_headers + ))); + f_selfOrClientSyncAndVerdict(c_prDone, e_success); + tc_ac.start; + + alt { + [] httpPort.receive( + mw_http_response( + mw_http_response_ok( + mw_http_message_body_json( + mw_body_json_cse_site_resource_quota_info( + mw_site_resource_quota_info( + PX_SITE_ID_1, + PX_CPU_QUOTA_1, + PX_MEMORY_QUOTA_1, + PX_DISK_QUOTA_1 + ) + ))))) { + tc_ac.stop; + + log("*** " & testcasename() & ": PASS: IUT successfully responds with the site resource quota for a specific tenant and site identifier when requested to a CSE ***"); + f_selfOrClientSyncAndVerdict(c_tbDone, e_success); + } + [] tc_ac.timeout { + log("*** " & testcasename() & ": INCONC: Expected message not received ***"); + f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout); + } + } // End of 'alt' statement + + // Postamble + f_delete_tenant_info(v_tenant_info); + f_cf_01_http_down(); + } // End of testcase TC_MEC_MEC048_MEO_CSE_011_OK + + /** + * @desc Check that the IUT returns an error on requesting site resource quota info on a not existing tenant when requested to a CSE + */ + testcase TC_MEC_MEC048_MEO_CSE_011_NF() runs on HttpComponent system HttpTestAdapter { + // Local variables + var Headers v_headers; + + // Test control + if (not(PICS_MEC_PLAT) or not(PICS_SERVICES) or not(PICS_CSE_API_SUPPORTED)) { + log("*** " & testcasename() & ": PICS_MEC_PLAT and PICS_SERVICES and PICS_CSE_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); + + //TODO: check uri and uri names of all testcases + httpPort.send( + m_http_request( + m_http_request_get( + PICS_ROOT_API & PX_CSE_TENANTS_INFO & oct2char(unichar2oct(PX_NON_EXISTENT_TENANT_ID, "UTF-8")) & "/resources/quota_in_sites" & "/" & oct2char(unichar2oct(PX_NON_EXISTENT_SITE_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 + )) { + tc_ac.stop; + log("*** " & testcasename() & ": PASS: IUT successfully responds with the correct error 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_MEC048_MEO_CSE_011_NF + + /** + * @desc Check that the IUT updates a site resource quota info for a existing tenant when requested to a CSE + */ + testcase TC_MEC_MEC048_MEO_CSE_012_OK() runs on HttpComponent system HttpTestAdapter { + // Local variables + var Headers v_headers; + var HttpMessage v_response; + var charstring v_tenant_id; + var charstring v_site_id; + + var TenantInfo v_tenant_info := valueof(m_tenant_info(PX_CSE_CUSTOMER_ID_1, PX_CSE_CUSTOMER_NAME_1, omit, omit, PX_CSE_TENANT_NAME_1)); + var SiteResourceQuotaInfo v_site_resource_quota_info_1 := valueof(m_site_resource_quota_info(PX_SITE_ID_1,PX_CPU_QUOTA_1, PX_MEMORY_QUOTA_1, PX_DISK_QUOTA_1)); + + // Test control + if (not(PICS_MEC_PLAT) or not(PICS_SERVICES) or not(PICS_CSE_API_SUPPORTED)) { + log("*** " & testcasename() & ": PICS_MEC_PLAT and PICS_SERVICES and PICS_CSE_API_SUPPORTED required for executing the TC ***"); + setverdict(inconc); + stop; + } + + // Test component configuration + f_cf_01_http_up(); + + // Test adapter configuration + + // Preamble + f_create_tenant_info(v_tenant_info, v_tenant_id); + f_create_site_resource_quota_info(v_site_resource_quota_info_1, v_site_id, v_tenant_id); + f_init_default_headers_list(-, -, v_headers); + + httpPort.send( + m_http_request( + m_http_request_put( + PICS_ROOT_API & PX_CSE_TENANTS_INFO & v_tenant_id & "/resources/quota_in_system/" & v_site_id, + v_headers, + m_http_message_body_json( + m_body_json_cse_site_resource_quota_info( + m_site_resource_quota_info( + PX_SITE_ID_1, + PX_CPU_QUOTA_1, + PX_MEMORY_QUOTA_1, + PX_DISK_QUOTA_1 + )))))); + tc_ac.start; + alt { + [] httpPort.receive( + mw_http_response( + mw_http_response_ok( + mw_http_message_body_json( + mw_body_json_cse_site_resource_quota_info( + mw_site_resource_quota_info( + PX_SITE_ID_1, + PX_CPU_QUOTA_1, + PX_MEMORY_QUOTA_2, + PX_DISK_QUOTA_2 + )))))) -> value v_response { + tc_ac.stop; + + // Check HTTP Location header + if (f_check_headers(v_response.response.header) == false) { + log("*** " & testcasename() & ": FAIL: IUT failed in responds with the list of per site resource quota for a specific tenant ***"); + f_selfOrClientSyncAndVerdict(c_tbDone, e_error); + } else { + var charstring_list v_location_header; + f_get_header(v_response.response.header, "Location", v_location_header); + // Build expected regex pattern with specific tenant ID + var charstring v_expected_pattern := "/cse/v1/tenants/" & v_tenant_id & "/resources/quota_in_sites/[^/]+"; + if (regexp(v_location_header[0], v_expected_pattern, 0) != "") { + log("Location header matches expected pattern with tenant ID: " & v_tenant_id); + } else { + setverdict(fail, "Location header does NOT match expected pattern: ", v_location_header[0]); + } + } + + log("*** " & testcasename() & ": PASS: IUT passed in updating a site resource quota info for a existing tenant when requested to a CSE ***"); + f_selfOrClientSyncAndVerdict(c_tbDone, e_success); + } + + [] tc_ac.timeout { + log("*** " & testcasename() & ": INCONC: Expected message not received ***"); + f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout); + } + } // End of 'alt' statement + + // Postamble + f_delete_tenant_info(v_tenant_info); + f_cf_01_http_down(); + } // End of testcase TC_MEC_MEC048_MEO_CSE_012_OK + + /** + * @desc Check that the IUT returns an error updating a site resource quota info for a existing tenant when requested to a CSE + */ + testcase TC_MEC_MEC048_MEO_CSE_012_BR() runs on HttpComponent system HttpTestAdapter { + // Local variables + var Headers v_headers; + var charstring v_tenant_id; + var charstring v_site_id; + var charstring_list v_header_location; + + var TenantInfo v_tenant_info := valueof(m_tenant_info(PX_CSE_CUSTOMER_ID_1, PX_CSE_CUSTOMER_NAME_1, omit, omit, PX_CSE_TENANT_NAME_1)); + var SiteResourceQuotaInfo v_site_resource_quota_info_1 := valueof(m_site_resource_quota_info(PX_SITE_ID_1,PX_CPU_QUOTA_1, PX_MEMORY_QUOTA_1, PX_DISK_QUOTA_1)); + + // Test control + if (not(PICS_MEC_PLAT) or not(PICS_SERVICES) or not(PICS_CSE_API_SUPPORTED)) { + log("*** " & testcasename() & ": PICS_MEC_PLAT and PICS_SERVICES and PICS_CSE_API_SUPPORTED required for executing the TC ***"); + setverdict(inconc); + stop; + } + + // Test component configuration + f_cf_01_http_up(); + + // Test adapter configuration + + // Preamble + f_create_tenant_info(v_tenant_info, v_tenant_id); + f_create_site_resource_quota_info(v_site_resource_quota_info_1, v_site_id, v_tenant_id); + + f_init_default_headers_list(-, -, v_headers); + + httpPort.send( + m_http_request( + m_http_request_put( + PICS_ROOT_API & PX_CSE_TENANTS_INFO & "/" & v_tenant_id & "/resources/quota_in_system/" & v_site_id, + v_headers, + m_http_message_body_json( + m_body_json_cse_site_resource_quota_info( + m_site_resource_quota_info( //one of cpuQuota, memoryQuota and, diskQuota shall be present. + PX_SITE_ID_1, + -, + -, + - + )))))); + tc_ac.start; + alt { + [] httpPort.receive( + mw_http_response( + mw_http_response_400_bad_request + )) { + tc_ac.stop; + log("*** " & testcasename() & ": PASS: IUT successfully responds with a correct error code ***"); + f_selfOrClientSyncAndVerdict(c_tbDone, e_success); + } + } // End of 'alt' statement + + // Postamble + f_delete_tenant_info(v_tenant_info); + f_cf_01_http_down(); + } // End of testcase TC_MEC_MEC048_MEO_CSE_012_BR + + /** + * @desc Check that the IUT returns an error updating a site resource quota info for a not existing tenant when requested to a CSE + */ + testcase TC_MEC_MEC048_MEO_CSE_012_NF() runs on HttpComponent system HttpTestAdapter { + // Local variables + var Headers v_headers; + var charstring v_tenant_id; + var charstring v_site_id; + var charstring_list v_header_location; + + var TenantInfo v_tenant_info := valueof(m_tenant_info(PX_CSE_CUSTOMER_ID_1, PX_CSE_CUSTOMER_NAME_1, omit, omit, PX_CSE_TENANT_NAME_1)); + var SiteResourceQuotaInfo v_site_resource_quota_info_1 := valueof(m_site_resource_quota_info(PX_SITE_ID_1,PX_CPU_QUOTA_1, PX_MEMORY_QUOTA_1, PX_DISK_QUOTA_1)); + + // Test control + if (not(PICS_MEC_PLAT) or not(PICS_SERVICES) or not(PICS_CSE_API_SUPPORTED)) { + log("*** " & testcasename() & ": PICS_MEC_PLAT and PICS_SERVICES and PICS_CSE_API_SUPPORTED required for executing the TC ***"); + setverdict(inconc); + stop; + } + + // Test component configuration + f_cf_01_http_up(); + + // Test adapter configuration + + // Preamble + f_create_tenant_info(v_tenant_info, v_tenant_id); + f_create_site_resource_quota_info(v_site_resource_quota_info_1, v_site_id, v_tenant_id); + f_init_default_headers_list(-, -, v_headers); + + + httpPort.send( + m_http_request( + m_http_request_put( + PICS_ROOT_API & PX_CSE_TENANTS_INFO & "/" & oct2char(unichar2oct(PX_NON_EXISTENT_TENANT_ID, "UTF-8")) & "/resources/quota_in_system/" & v_site_id, + v_headers, + m_http_message_body_json( + m_body_json_cse_site_resource_quota_info( + m_site_resource_quota_info( + PX_SITE_ID_1, + PX_CPU_QUOTA_1, + PX_MEMORY_QUOTA_1, + PX_DISK_QUOTA_1 + )))))); + tc_ac.start; + alt { + [] httpPort.receive( + mw_http_response( + mw_http_response_404_not_found + )) { + tc_ac.stop; + log("*** " & testcasename() & ": PASS: IUT successfully responds with the correct error 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 + f_cf_01_http_down(); + } // End of testcase TC_MEC_MEC048_MEO_CSE_012_NF + } // End of group tenant } // End of module AtsMec_SelfServiceEnablementAPI_TestCases diff --git a/ttcn/AtsMec_SelfServiceEnablementAPI/AtsMec_SelfServiceEnablementAPI_TestControl.ttcn b/ttcn/AtsMec_SelfServiceEnablement/AtsMec_SelfServiceEnablementAPI_TestControl.ttcn similarity index 77% rename from ttcn/AtsMec_SelfServiceEnablementAPI/AtsMec_SelfServiceEnablementAPI_TestControl.ttcn rename to ttcn/AtsMec_SelfServiceEnablement/AtsMec_SelfServiceEnablementAPI_TestControl.ttcn index 01e66d0..d418a22 100644 --- a/ttcn/AtsMec_SelfServiceEnablementAPI/AtsMec_SelfServiceEnablementAPI_TestControl.ttcn +++ b/ttcn/AtsMec_SelfServiceEnablement/AtsMec_SelfServiceEnablementAPI_TestControl.ttcn @@ -31,6 +31,19 @@ module AtsMec_SelfServiceEnablementAPI_TestControl { execute(TC_MEC_MEC048_MEO_CSE_007_OK()); execute(TC_MEC_MEC048_MEO_CSE_007_NF()); + execute(TC_MEC_MEC048_MEO_CSE_008_OK()); + execute(TC_MEC_MEC048_MEO_CSE_008_NF()); + execute(TC_MEC_MEC048_MEO_CSE_009_OK()); + execute(TC_MEC_MEC048_MEO_CSE_009_OK_01()); + execute(TC_MEC_MEC048_MEO_CSE_009_NF()); + execute(TC_MEC_MEC048_MEO_CSE_010_OK()); + execute(TC_MEC_MEC048_MEO_CSE_010_BR()); + execute(TC_MEC_MEC048_MEO_CSE_011_OK()); + execute(TC_MEC_MEC048_MEO_CSE_011_NF()); + execute(TC_MEC_MEC048_MEO_CSE_012_OK()); + execute(TC_MEC_MEC048_MEO_CSE_012_BR()); + execute(TC_MEC_MEC048_MEO_CSE_012_NF()); + execute(TC_MEC_MEC048_MEO_CSE_013_OK()); execute(TC_MEC_MEC048_MEO_CSE_013_OK_02()); execute(TC_MEC_MEC048_MEO_CSE_014_OK()); diff --git a/ttcn/AtsMec_SelfServiceEnablementAPI/module.mk b/ttcn/AtsMec_SelfServiceEnablement/module.mk similarity index 100% rename from ttcn/AtsMec_SelfServiceEnablementAPI/module.mk rename to ttcn/AtsMec_SelfServiceEnablement/module.mk diff --git a/ttcn/LibMec/SelfServiceEnablementAPI/ttcn/SelfServiceEnablementAPI_Functions.ttcn b/ttcn/LibMec/SelfServiceEnablementAPI/ttcn/SelfServiceEnablementAPI_Functions.ttcn index a16934c..7e4823d 100644 --- a/ttcn/LibMec/SelfServiceEnablementAPI/ttcn/SelfServiceEnablementAPI_Functions.ttcn +++ b/ttcn/LibMec/SelfServiceEnablementAPI/ttcn/SelfServiceEnablementAPI_Functions.ttcn @@ -157,9 +157,9 @@ module SelfServiceEnablementAPI_Functions { m_http_message_body_json( m_body_json_cse_resource_quota_info( m_resource_quota_info( - PX_CPU_QUOTA, - PX_MEMORY_QUOTA, - PX_DISK_QUOTA + PX_CPU_QUOTA_1, + PX_MEMORY_QUOTA_1, + PX_DISK_QUOTA_1 ) ))))); tc_ac.start; @@ -170,9 +170,9 @@ module SelfServiceEnablementAPI_Functions { mw_http_message_body_json( mw_body_json_cse_resource_quota_info( mw_resource_quota_info( - PX_CPU_QUOTA, - PX_MEMORY_QUOTA, - PX_DISK_QUOTA + PX_CPU_QUOTA_1, + PX_MEMORY_QUOTA_1, + PX_DISK_QUOTA_1 ) ))))) -> value v_response { tc_ac.stop; @@ -187,4 +187,78 @@ module SelfServiceEnablementAPI_Functions { } // End of function f_create_resource_quota_info - } // End of module SelfServiceEnablementAPI_Functions + function f_create_site_resource_quota_info_list( + inout SiteResourceQuotaInfoList p_site_resource_quota_info, + out charstring_list p_site_resource_quota_info_id_list, + in charstring p_tenant_id + ) runs on HttpComponent { + log(">>> f_create_site_resource_quota_info_list: ", p_site_resource_quota_info); + var charstring v_site_resource_quota_info_id; + for (var integer i := 0; i < lengthof(p_site_resource_quota_info); i := i + 1) { + f_create_site_resource_quota_info(p_site_resource_quota_info[i], -, p_tenant_id); + p_site_resource_quota_info_id_list := p_site_resource_quota_info_id_list & { v_site_resource_quota_info_id }; + } + } // End of function f_create_tenant_info_list + + function f_create_site_resource_quota_info( + inout SiteResourceQuotaInfo p_site_resource_quota_info, + out charstring v_site_id, + in charstring p_tenant_id + ) runs on HttpComponent { + var Headers v_headers; + var HttpMessage v_response; + + log(">>> f_create_site_resource_quota_info: ", p_site_resource_quota_info); + + f_init_default_headers_list(-, -, v_headers); + httpPort.send( + m_http_request( + m_http_request_post( + PICS_ROOT_API & PX_CSE_TENANTS_INFO & "/" & p_tenant_id & "/resources/quota_in_sites", + v_headers, + m_http_message_body_json( + m_body_json_cse_site_resource_quota_info( + m_site_resource_quota_info( + PX_SITE_ID_1, + PX_CPU_QUOTA_1, + PX_MEMORY_QUOTA_1, + PX_DISK_QUOTA_1 + ) + ))))); + tc_ac.start; + alt { + [] httpPort.receive( + mw_http_response( + mw_http_response_201_created( + mw_http_message_body_json( + mw_body_json_cse_site_resource_quota_info( + mw_site_resource_quota_info( + PX_SITE_ID_1, + PX_CPU_QUOTA_1, + PX_MEMORY_QUOTA_1, + PX_DISK_QUOTA_1 + ) + ))))) -> value v_response { + tc_ac.stop; + p_site_resource_quota_info := v_response.response.body.json_body.siteResourceQuotaInfo; + + // Extract HTTP Location header + var charstring_list site_id; + f_get_header(v_response.response.header, "Location", site_id); + // Extract HTTP subssription id + v_site_id := regexp( + site_id[0], + "?+" & PX_CSE_TENANTS_INFO & "/" & p_tenant_id & "/(?*)", + 0 + ); + + log("f_create_site_resource_quota_info: INFO: IUT successfully creates the resources: ", p_site_resource_quota_info); + } + [] tc_ac.timeout { + log("f_create_site_resource_quota_info: INCONC: Expected message not received"); + } + } // End of 'alt' statement + + } // End of function f_create_site_resource_quota_info + +} // End of module SelfServiceEnablementAPI_Functions diff --git a/ttcn/LibMec/SelfServiceEnablementAPI/ttcn/SelfServiceEnablementAPI_Pixits.ttcn b/ttcn/LibMec/SelfServiceEnablementAPI/ttcn/SelfServiceEnablementAPI_Pixits.ttcn index c0532ba..e677770 100644 --- a/ttcn/LibMec/SelfServiceEnablementAPI/ttcn/SelfServiceEnablementAPI_Pixits.ttcn +++ b/ttcn/LibMec/SelfServiceEnablementAPI/ttcn/SelfServiceEnablementAPI_Pixits.ttcn @@ -37,11 +37,31 @@ module SelfServiceEnablementAPI_Pixits { modulepar Json.String PX_NEW_TENANT_NAME := "newTenat"; - modulepar Json.Integer PX_CPU_QUOTA := 4; + modulepar Json.String PX_SITE_ID_1 := "209153c9-0c28-428f-930f-d61328c30ffd"; - modulepar Json.Integer PX_MEMORY_QUOTA := 2048; + modulepar Json.String PX_SITE_ID_2 := "77e093bc-830c-4bcc-9ad8-6c3eff048335"; - modulepar Json.Integer PX_DISK_QUOTA := 50; + modulepar Json.String PX_SITE_ID_3 := "7d6b6123-b3b7-413e-ae73-b8bb349bda46"; + + modulepar Json.Integer PX_CPU_QUOTA_1 := 4; + + modulepar Json.Integer PX_MEMORY_QUOTA_1 := 2048; + + modulepar Json.Integer PX_DISK_QUOTA_1 := 50; + + modulepar Json.Integer PX_CPU_QUOTA_2 := 4; + + modulepar Json.Integer PX_MEMORY_QUOTA_2 := 2048; + + modulepar Json.Integer PX_DISK_QUOTA_2 := 50; + + modulepar Json.Integer PX_CPU_QUOTA_3 := 4; + + modulepar Json.Integer PX_MEMORY_QUOTA_3 := 2048; + + modulepar Json.Integer PX_DISK_QUOTA_3 := 50; + + modulepar Json.String PX_NON_EXISTENT_SITE_ID := "9344"; modulepar Json.AnyURI PX_CSE_SUB_CALLBACK_URI := "http://127.0.0.1/callback"; diff --git a/ttcn/LibMec/SelfServiceEnablementAPI/ttcn/SelfServiceEnablementAPI_Templates.ttcn b/ttcn/LibMec/SelfServiceEnablementAPI/ttcn/SelfServiceEnablementAPI_Templates.ttcn index 2c9bb1e..d661a15 100644 --- a/ttcn/LibMec/SelfServiceEnablementAPI/ttcn/SelfServiceEnablementAPI_Templates.ttcn +++ b/ttcn/LibMec/SelfServiceEnablementAPI/ttcn/SelfServiceEnablementAPI_Templates.ttcn @@ -70,9 +70,9 @@ module SelfServiceEnablementAPI_Templates { template (omit) SiteResourceQuotaInfo m_site_resource_quota_info( in Json.String p_siteId, - in template (omit) Json.Integer p_cpuQuota, - in template (omit) Json.Integer p_memoryQuota, - in template (omit) Json.Integer p_diskQuota + in template (omit) Json.Integer p_cpuQuota := omit, + in template (omit) Json.Integer p_memoryQuota :=omit, + in template (omit) Json.Integer p_diskQuota := omit ) := { siteId := p_siteId, cpuQuota := p_cpuQuota, diff --git a/ttcn/patch_lib_http/ttcn/LibHttp_JsonMessageBodyTypes.ttcn b/ttcn/patch_lib_http/ttcn/LibHttp_JsonMessageBodyTypes.ttcn index 5576ee7..c6f0c37 100644 --- a/ttcn/patch_lib_http/ttcn/LibHttp_JsonMessageBodyTypes.ttcn +++ b/ttcn/patch_lib_http/ttcn/LibHttp_JsonMessageBodyTypes.ttcn @@ -209,10 +209,13 @@ module LibHttp_JsonMessageBodyTypes { TenantInfo tenantInfo, TenantInfoList tenantInfoList, ResourceQuotaInfo resourceQuotaInfo, + SiteResourceQuotaInfo siteResourceQuotaInfo, + SiteResourceQuotaInfoList siteResourceQuotaInfoList, ResourceUsageSubscription resourceUsageSubscription, SiteResourceUsageSubscription siteResourceUsageSubscription, SiteResourceUsageNotification siteResourceUsageNotification, ResourceUsageNotification resourceUsageNotification, + SelfServiceEnablementAPI_TypesAndValues.SubscriptionLinkList subscription_link_list_cse, // TODO Add here your custom variants universal charstring raw diff --git a/ttcn/patch_lib_http/ttcn/LibHttp_JsonTemplates.ttcn b/ttcn/patch_lib_http/ttcn/LibHttp_JsonTemplates.ttcn index 97d704a..0f8b63d 100644 --- a/ttcn/patch_lib_http/ttcn/LibHttp_JsonTemplates.ttcn +++ b/ttcn/patch_lib_http/ttcn/LibHttp_JsonTemplates.ttcn @@ -2025,12 +2025,36 @@ module LibHttp_JsonTemplates { resourceQuotaInfo := p_resourceQuotaInfo } // End of template m_body_json_cse_resource_quota_info - template (present) JsonBody mw_body_json_cse_resource_quota_info( + template (present) JsonBody mw_body_json_cse_resource_quota_info ( template (present) ResourceQuotaInfo p_resourceQuotaInfo:= ? ) := { resourceQuotaInfo := p_resourceQuotaInfo } // End of template mw_body_json_cse_resource_quota_info + template (value) JsonBody m_body_json_cse_site_resource_quota_info ( + in template (value) SiteResourceQuotaInfo p_siteResourceQuotaInfo + ) := { + siteResourceQuotaInfo := p_siteResourceQuotaInfo + } // End of template m_body_json_cse_resource_quota_info + + template (present) JsonBody mw_body_json_cse_site_resource_quota_info ( + template (present) SiteResourceQuotaInfo p_siteResourceQuotaInfo:= ? + ) := { + siteResourceQuotaInfo := p_siteResourceQuotaInfo + } // End of template mw_body_json_cse_resource_quota_info + + template (value) JsonBody m_body_json_cse_site_resource_quota_info_list( + in template (value) SiteResourceQuotaInfoList p_siteResourceQuotaInfoList + ) := { + siteResourceQuotaInfoList := p_siteResourceQuotaInfoList + } // End of template m_body_json_fed_cse_tenant_info + + template (present) JsonBody mw_body_json_cse_site_resource_quota_info_list( + template (present) SiteResourceQuotaInfoList p_siteResourceQuotaInfoList := ? + ) := { + siteResourceQuotaInfoList := p_siteResourceQuotaInfoList + } // End of template mw_body_json_cse_tenant_info_list + template (value) JsonBody m_body_json_resource_usage_subscription( in template (value) ResourceUsageSubscription p_resourceUsageSubscription ) := { @@ -2058,13 +2082,13 @@ module LibHttp_JsonTemplates { template (value) JsonBody m_body_json_cse_subscription_link_list( in template (value) SelfServiceEnablementAPI_TypesAndValues.SubscriptionLinkList p_subscription_link_list ) := { - subscriptionLinkList := p_subscription_link_list + subscription_link_list_cse := p_subscription_link_list } // End of template m_body_json_cse_subscription_link_list template (present) JsonBody mw_body_json_cse_subscription_link_list( template (present) SelfServiceEnablementAPI_TypesAndValues.SubscriptionLinkList p_subscription_link_list := ? ) := { - subscriptionLinkList := p_subscription_link_list + subscription_link_list_cse := p_subscription_link_list } // End of template mw_body_json_cse_subscription_link_list template (present) JsonBody m_body_json_site_resource_usage_notification( -- GitLab From 75803dc398299a9bc80e87094610174bb76e8fb7 Mon Sep 17 00:00:00 2001 From: Mubeena Ishaq Date: Mon, 30 Jun 2025 15:31:01 +0500 Subject: [PATCH 3/3] Implement TPs for Subscription/Notification of MEC048 --- .../Json/json_codec_factory_mec048.hh | 46 + ccsrc/Protocols/Json/json_codec_mec048.cc | 104 ++ ccsrc/Protocols/Json/json_codec_mec048.hh | 25 + .../AtsMec_SelfServiceEnablementAPI.cf_ | 66 +- ...ec_SelfServiceEnablementAPI_TestCases.ttcn | 1161 ++++++++++++++++- .../SelfServiceEnablementAPI_Functions.ttcn | 299 +++++ .../ttcn/SelfServiceEnablementAPI_Pixits.ttcn | 2 +- .../SelfServiceEnablementAPI_Templates.ttcn | 141 +- ...lfServiceEnablementAPI_TypesAndValues.ttcn | 77 +- .../ttcn/LibHttp_JsonMessageBodyTypes.ttcn | 3 +- .../ttcn/LibHttp_JsonTemplates.ttcn | 24 +- 11 files changed, 1820 insertions(+), 128 deletions(-) create mode 100644 ccsrc/Protocols/Json/json_codec_factory_mec048.hh create mode 100644 ccsrc/Protocols/Json/json_codec_mec048.cc create mode 100644 ccsrc/Protocols/Json/json_codec_mec048.hh diff --git a/ccsrc/Protocols/Json/json_codec_factory_mec048.hh b/ccsrc/Protocols/Json/json_codec_factory_mec048.hh new file mode 100644 index 0000000..3049de1 --- /dev/null +++ b/ccsrc/Protocols/Json/json_codec_factory_mec048.hh @@ -0,0 +1,46 @@ +/*! + * \file json_codec_factory_mec048.hh + * \brief Header file for ITS JSON/IP protocol codec factory. + * \author ETSI STF569 / TTF T027 // TTF T043 + * \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. + * \version 0.1 + */ +#pragma once + +#include "codec_stack_builder.hh" + +#include "json_codec_mec048.hh" + +class Record_Type; //! TITAN forward declaration + +/*! + * \class json_codec_factory_mec048 + * \brief This class provides a factory class to create an json_codec class instance + */ +class json_codec_factory_mec048: public codec_factory { + static json_codec_factory_mec048 _f; //! Reference to the unique instance of this class +public: //! \publicsection + /*! + * \brief Default constructor + * Create a new instance of the json_codec_factory_mec048 class + * \remark The HELD/IP codec identifier is HELD + */ + json_codec_factory_mec048() { + // register factory + codec_stack_builder::register_codec_factory("json_codec_mec048", this); + }; + /*! + * \fn codec* create_codec(const std::string & type, const std::string & param); + * \brief Create the codecs stack based on the provided codecs stack description + * \param[in] p_type The provided codecs stack description + * \param[in] p_params Optional parameters + * \return 0 on success, -1 otherwise + * \inline + */ + inline virtual codec_gen* create_codec() { + return (codec_gen*)new json_codec_mec048(); + }; +}; // End of class json_codec_factory_mec048 diff --git a/ccsrc/Protocols/Json/json_codec_mec048.cc b/ccsrc/Protocols/Json/json_codec_mec048.cc new file mode 100644 index 0000000..9d8cdf6 --- /dev/null +++ b/ccsrc/Protocols/Json/json_codec_mec048.cc @@ -0,0 +1,104 @@ +#include +#include +#include + +#include "json_codec_factory_mec048.hh" + +#include "loggers.hh" + +#include "LibHttp_JsonMessageBodyTypes.hh" + +int json_codec_mec048::encode (const LibHttp__JsonMessageBodyTypes::JsonBody& msg, OCTETSTRING& data) +{ + loggers::get_instance().log_msg(">>> json_codec_mec048::encode: ", (const Base_Type&)msg); + TTCN_EncDec::clear_error(); + TTCN_EncDec::set_error_behavior(TTCN_EncDec::ET_ALL, TTCN_EncDec::EB_DEFAULT); + TTCN_Buffer encoding_buffer; + + if (msg.ischosen(LibHttp__JsonMessageBodyTypes::JsonBody::ALT_tenantInfo)) { + const SelfServiceEnablementAPI__TypesAndValues::TenantInfo& tenant_info = msg.tenantInfo(); + tenant_info.encode(SelfServiceEnablementAPI__TypesAndValues::TenantInfo_descr_, encoding_buffer, TTCN_EncDec::CT_JSON); + data = /*char2oct(CHARSTRING("{\"TenantInfo\": ")) + */OCTETSTRING(encoding_buffer.get_len(), encoding_buffer.get_data())/* + char2oct(CHARSTRING("}"))*/; + } else if (msg.ischosen(LibHttp__JsonMessageBodyTypes::JsonBody::ALT_resourceUsageSubscription)) { + const SelfServiceEnablementAPI__TypesAndValues::ResourceUsageSubscription& resource_usage_subscription = msg.resourceUsageSubscription(); + resource_usage_subscription.encode(SelfServiceEnablementAPI__TypesAndValues::ResourceUsageSubscription_descr_, encoding_buffer, TTCN_EncDec::CT_JSON); + data = /*char2oct(CHARSTRING("{\"ResourceUsageSubscription\": ")) + */OCTETSTRING(encoding_buffer.get_len(), encoding_buffer.get_data())/* + char2oct(CHARSTRING("}"))*/; + } else if (msg.ischosen(LibHttp__JsonMessageBodyTypes::JsonBody::ALT_siteResourceUsageSubscription)) { + const SelfServiceEnablementAPI__TypesAndValues::SiteResourceUsageSubscription& site_resource_usage_subscription = msg.siteResourceUsageSubscription(); + site_resource_usage_subscription.encode(SelfServiceEnablementAPI__TypesAndValues::SiteResourceUsageSubscription_descr_, encoding_buffer, TTCN_EncDec::CT_JSON); + data = /*char2oct(CHARSTRING("{\"SiteResourceUsageSubscription\": ")) + */OCTETSTRING(encoding_buffer.get_len(), encoding_buffer.get_data())/* + char2oct(CHARSTRING("}"))*/; + } else { + return json_codec::encode(msg, data); + } + + loggers::get_instance().log("<<< json_codec_mec048::encode"); + return 0; +} + +int json_codec_mec048::decode (const OCTETSTRING& p_data, LibHttp__JsonMessageBodyTypes::JsonBody& msg, params* p_params) +{ + loggers::get_instance().log_msg(">>> json_codec_mec048::decode: p_data=", p_data); + + // Sanity checks + params::const_iterator it; + if (p_params == nullptr) { + loggers::get_instance().warning("json_codec_mec048::decode: Failed to access p_params (null pointer)"); + return -1; // TODO Use p_data instead of return -1 + } else { + it = p_params->find("decode_str"); + if (it == p_params->cend()) { + loggers::get_instance().warning("json_codec_mec048::decode: Failed to access p_params item (decode_str)"); + return -1; // TODO Use p_data instead of return -1 + } + loggers::get_instance().log("json_codec_mec048::decode: it->second='%c' / '%s'", it->second.c_str()[0], it->second.c_str()); + } + + // Remove data structure name (if present) ... + std::string str; + if ((it->second[0] != '[') && (it->second[0] != '{')) { + int idx_begin = it->second.find(":"); + int idx_end = it->second.rfind("}") - 1; // Remove the last '}' + str = it->second.substr(idx_begin + 1, idx_end - idx_begin); + } else { + str = it->second; + } + // ..and create the decoding buffer + TTCN_EncDec::set_error_behavior(TTCN_EncDec::ET_ALL, TTCN_EncDec::EB_DEFAULT); + TTCN_EncDec::clear_error(); + loggers::get_instance().log("json_codec_mec048::decode: decoding_buffer='%c' / '%s'", str[0], str.c_str()); + TTCN_Buffer decoding_buffer(OCTETSTRING(str.length(), (const unsigned char*)str.c_str())); + + if (it->second.find("\"tenantId\"") != std::string::npos) { // Be careful to the order + if (it->second[0] == '[') { + SelfServiceEnablementAPI__TypesAndValues::TenantInfoList tenant_info_list; + tenant_info_list.decode(SelfServiceEnablementAPI__TypesAndValues::TenantInfoList_descr_, decoding_buffer, TTCN_EncDec::CT_JSON); + msg.tenantInfoList() = tenant_info_list; + } else { + SelfServiceEnablementAPI__TypesAndValues::TenantInfo tenant_info; + tenant_info.decode(SelfServiceEnablementAPI__TypesAndValues::TenantInfo_descr_, decoding_buffer, TTCN_EncDec::CT_JSON); + msg.tenantInfo() = tenant_info; + } + } else if ( + (it->second.find("\"_links\"") != std::string::npos) && + ((it->second.find("\"subscriptions\"") != std::string::npos) || (it->second.find("\"subscriptionType\"") == std::string::npos)) + ) { + SelfServiceEnablementAPI__TypesAndValues::SubscriptionLinkList subscription_link_list; + subscription_link_list.decode(SelfServiceEnablementAPI__TypesAndValues::SubscriptionLinkList_descr_, decoding_buffer, TTCN_EncDec::CT_JSON); + msg.subscriptionLinkList__cse() = subscription_link_list; + } else if ((it->second.find("\"subscriptionType\"") != std::string::npos) && (it->second.find("\"ResourceUsageSubscription\"") != std::string::npos)) { + SelfServiceEnablementAPI__TypesAndValues::ResourceUsageSubscription resource_usage_subscription; + resource_usage_subscription.decode(SelfServiceEnablementAPI__TypesAndValues::ResourceUsageSubscription_descr_, decoding_buffer, TTCN_EncDec::CT_JSON); + msg.resourceUsageSubscription() = resource_usage_subscription; + } else if ((it->second.find("\"subscriptionType\"") != std::string::npos) && (it->second.find("\"SiteResourceUsageSubscription\"") != std::string::npos)) { + SelfServiceEnablementAPI__TypesAndValues::SiteResourceUsageSubscription site_resource_usage_subscription; + site_resource_usage_subscription.decode(SelfServiceEnablementAPI__TypesAndValues::SiteResourceUsageSubscription_descr_, decoding_buffer, TTCN_EncDec::CT_JSON); + msg.siteResourceUsageSubscription() = site_resource_usage_subscription; + } else { + return json_codec::decode(p_data, msg, p_params); + } + + loggers::get_instance().log_msg("<<< json_codec_mec048::decode: ", (const Base_Type&)msg); + return 0; +} + +json_codec_factory_mec048 json_codec_factory_mec048::_f; diff --git a/ccsrc/Protocols/Json/json_codec_mec048.hh b/ccsrc/Protocols/Json/json_codec_mec048.hh new file mode 100644 index 0000000..b15860e --- /dev/null +++ b/ccsrc/Protocols/Json/json_codec_mec048.hh @@ -0,0 +1,25 @@ +#pragma once + +#include "codec_gen.hh" +#include "params.hh" + +#include "json_codec.hh" + +class Base_Type; +class TTCN_Typedescriptor_t; +class TTCN_Buffer; + +namespace LibHttp__JsonMessageBodyTypes { + class JsonBody; +} + +class json_codec_mec048: public json_codec +{ +public: + explicit json_codec_mec048() : json_codec() { }; + virtual ~json_codec_mec048() { }; + + int encode (const LibHttp__JsonMessageBodyTypes::JsonBody&, OCTETSTRING& data); + int decode (const OCTETSTRING& p_data, LibHttp__JsonMessageBodyTypes::JsonBody&, params* p_params = NULL); + +}; // End of class json_codec_mec048 diff --git a/etc/AtsMec_SelfServiceEnablement/AtsMec_SelfServiceEnablementAPI.cf_ b/etc/AtsMec_SelfServiceEnablement/AtsMec_SelfServiceEnablementAPI.cf_ index 6a30bc8..5a8b1e6 100644 --- a/etc/AtsMec_SelfServiceEnablement/AtsMec_SelfServiceEnablementAPI.cf_ +++ b/etc/AtsMec_SelfServiceEnablement/AtsMec_SelfServiceEnablementAPI.cf_ @@ -62,6 +62,38 @@ LogEventTypes:= Yes # In this section you can specify what parts of your test suite you want to execute. #AtsMec_TestControl.control +# Check that the IUT responds with a list of all available tenantInfo when requested to a CSE - No query parameters +#AtsMec_SelfServiceEnablementAPI_TestCases.TC_MEC_MEC048_MEO_CSE_001_OK +# Check that the IUT responds with a list of all available tenantInfo when requested to a CSE - customerId attribute as query parameter +#AtsMec_SelfServiceEnablementAPI_TestCases.TC_MEC_MEC048_MEO_CSE_001_OK_02 +# Check that the IUT responds with a list of all available tenantInfo when requested to a CSE - customerName as query parameter +#AtsMec_SelfServiceEnablementAPI_TestCases.TC_MEC_MEC048_MEO_CSE_001_OK_03 +# Check that the IUT creates a new tenantInfo when requested to a CSE +#AtsMec_SelfServiceEnablementAPI_TestCases.TC_MEC_MEC048_MEO_CSE_002_OK +# Check that the IUT responds with an error on creating a tenantInfo with resourceUseInfo and siteList +#AtsMec_SelfServiceEnablementAPI_TestCases.TC_MEC_MEC048_MEO_CSE_002_BR +# Check that the IUT responds with a specific tenantInfo when requested to a MEC Consumer +#AtsMec_SelfServiceEnablementAPI_TestCases.TC_MEC_MEC048_MEO_CSE_003_OK +# Check that the IUT returns an error when requesting a not existing tenantInfo to a MEC Consumer +#AtsMec_SelfServiceEnablementAPI_TestCases.TC_MEC_MEC048_MEO_CSE_003_NF +# Check that the IUT updates an existing tenantInfo when requested to a CSE +#AtsMec_SelfServiceEnablementAPI_TestCases.TC_MEC_MEC048_MEO_CSE_004_OK +# Check that the IUT returns an error on updating a not existing tenantInfo requested to a CSE +#AtsMec_SelfServiceEnablementAPI_TestCases.TC_MEC_MEC048_MEO_CSE_004_NF +# Check that the IUT returns an error on updating with invalid values tenantInfo requested to a CSE +#AtsMec_SelfServiceEnablementAPI_TestCases.TC_MEC_MEC048_MEO_CSE_004_BR +# Check that the IUT removes a tenantInfo when requested to a CSE +#AtsMec_SelfServiceEnablementAPI_TestCases.TC_MEC_MEC048_MEO_CSE_005_OK +# Check that the IUT returns an error on deleting a not existing tenantInfo when requested to a CSE +#AtsMec_SelfServiceEnablementAPI_TestCases.TC_MEC_MEC048_MEO_CSE_005_NF +# Check that the IUT returns a resourceQuotaInfo for a specific tenant when requested to a CSE +#AtsMec_SelfServiceEnablementAPI_TestCases.TC_MEC_MEC048_MEO_CSE_006_OK +# Check that the IUT returns an error on retrieving resourceQuotaInfo for a not existing tenant when requested to a CSE +#AtsMec_SelfServiceEnablementAPI_TestCases.TC_MEC_MEC048_MEO_CSE_006_NF +# Check that the IUT updates the resourceQuotaInfo for an existing tenant when requested to a CSE +#AtsMec_SelfServiceEnablementAPI_TestCases.TC_MEC_MEC048_MEO_CSE_007_OK +# Check that the IUT returns an error on updating the resourceQuotaInfo for a not existing tenant when requested to a CSE +#AtsMec_SelfServiceEnablementAPI_TestCases.TC_MEC_MEC048_MEO_CSE_007_NF # Check that the IUT creates the resourceQuotaInfo for an existing tenant when requested to a CSE #AtsMec_SelfServiceEnablementAPI_TestCases.TC_MEC_MEC048_MEO_CSE_008_OK # Check that the IUT returns an error on creating the resourceQuotaInfo for a not existing tenant when requested to a CSE @@ -86,10 +118,36 @@ AtsMec_SelfServiceEnablementAPI_TestCases.TC_MEC_MEC048_MEO_CSE_009_OK_01 #AtsMec_SelfServiceEnablementAPI_TestCases.TC_MEC_MEC048_MEO_CSE_012_BR # Check that the IUT returns an error updating a site resource quota info for a not existing tenant when requested to a CSE #AtsMec_SelfServiceEnablementAPI_TestCases.TC_MEC_MEC048_MEO_CSE_012_NF - - - - +# Check that the IUT returns the list of subscriptions when requested to a CSE - no filter +#AtsMec_SelfServiceEnablementAPI_TestCases.TC_MEC_MEC048_MEO_CSE_013_OK +# Check that the IUT returns the list of subscriptions when requested to a CSE - subscription_type filter +#AtsMec_SelfServiceEnablementAPI_TestCases.TC_MEC_MEC048_MEO_CSE_013_OK_02 +# Check that the IUT creates a new subscription when requested to a CSE +#AtsMec_SelfServiceEnablementAPI_TestCases.TC_MEC_MEC048_MEO_CSE_014_OK +# Check that the IUT creates a new subscription when requested to a CSE +#AtsMec_SelfServiceEnablementAPI_TestCases.TC_MEC_MEC048_MEO_CSE_014_OK_02 +# Check that the IUT returns an error on creating a new subscription when requested to a CSE +#AtsMec_SelfServiceEnablementAPI_TestCases.TC_MEC_MEC048_MEO_CSE_014_BR +# Check that the IUT returns a subscription when requested by a CSE +#AtsMec_SelfServiceEnablementAPI_TestCases.TC_MEC_MEC048_MEO_CSE_015_OK +# Check that the IUT returns an error on requesting a not existing subscription when requested by a CSE +#AtsMec_SelfServiceEnablementAPI_TestCases.TC_MEC_MEC048_MEO_CSE_015_NF +# Check that the IUT updates an existing subscription when requested by a CSE +#AtsMec_SelfServiceEnablementAPI_TestCases.TC_MEC_MEC048_MEO_CSE_016_OK +# Check that the IUT returns an error updating an not existing subscription when requested by a CSE +#AtsMec_SelfServiceEnablementAPI_TestCases.TC_MEC_MEC048_MEO_CSE_016_NF +# Check that the IUT returns an error updating an existing subscription with wrong parameters when requested by a CSE +#AtsMec_SelfServiceEnablementAPI_TestCases.TC_MEC_MEC048_MEO_CSE_016_BR +# Check that the IUT deletes an existing subscription when requested by a CSE +#AtsMec_SelfServiceEnablementAPI_TestCases.TC_MEC_MEC048_MEO_CSE_017_OK +# Check that the IUT returns an error on a deletion of a not existing subscription when requested by a CSE +#AtsMec_SelfServiceEnablementAPI_TestCases.TC_MEC_MEC048_MEO_CSE_017_NF +# Check that the CSE sends a site resource usage notification if the CSE has an associated subscription and the event is generated +#AtsMec_SelfServiceEnablementAPI_TestCases.TC_MEC_MEC048_MEO_CSE_018_OK +# Check that the CSE sends a resource usage notification if the CSE has an associated subscription and the event is generated +#AtsMec_SelfServiceEnablementAPI_TestCases.TC_MEC_MEC048_MEO_CSE_019_OK +# Check that the CSE sends a notification on subscription expiration if the CSE has an associated subscription and the event is generated +#AtsMec_SelfServiceEnablementAPI_TestCases.TC_MEC_MEC048_MEO_CSE_020_OK [GROUPS] diff --git a/ttcn/AtsMec_SelfServiceEnablement/AtsMec_SelfServiceEnablementAPI_TestCases.ttcn b/ttcn/AtsMec_SelfServiceEnablement/AtsMec_SelfServiceEnablementAPI_TestCases.ttcn index 95ed72c..eb2e0b3 100644 --- a/ttcn/AtsMec_SelfServiceEnablement/AtsMec_SelfServiceEnablementAPI_TestCases.ttcn +++ b/ttcn/AtsMec_SelfServiceEnablement/AtsMec_SelfServiceEnablementAPI_TestCases.ttcn @@ -21,6 +21,7 @@ module AtsMec_SelfServiceEnablementAPI_TestCases { // LibMec import from LibMec_Functions all; import from LibMec_Pics all; + import from LibMec_Templates all; import from LibMec_Pixits all; group tenant { @@ -470,7 +471,7 @@ module AtsMec_SelfServiceEnablementAPI_TestCases { httpPort.send( m_http_request( m_http_request_get( - PICS_ROOT_API & PX_CSE_TENANTS_INFO & "/" & oct2char(unichar2oct(PX_CSE_TENANT_ID_1, "UTF-8")), + PICS_ROOT_API & PX_CSE_TENANTS_INFO & "/" & oct2char(unichar2oct(PX_CSE_TENANT_ID, "UTF-8")), v_headers ))); f_selfOrClientSyncAndVerdict(c_prDone, e_success); @@ -816,7 +817,7 @@ module AtsMec_SelfServiceEnablementAPI_TestCases { // Local variables var Headers v_headers; var TenantInfo v_tenant_info := valueof(m_tenant_info(PX_CSE_CUSTOMER_ID_1, PX_CSE_CUSTOMER_NAME_1, "Retail", omit, PX_CSE_TENANT_NAME_1)); - var ResourceQuotaInfo v_resource_quota_info := valueof(m_resource_quota_info(PX_CPU_QUOTA, PX_MEMORY_QUOTA, PX_DISK_QUOTA)); + var ResourceQuotaInfo v_resource_quota_info := valueof(m_resource_quota_info(PX_CPU_QUOTA_1, PX_MEMORY_QUOTA_1, PX_DISK_QUOTA_1)); var charstring v_tenant_id; // Test control if (not(PICS_SERVICES) or not(PICS_CSE_API_SUPPORTED)) { @@ -851,9 +852,9 @@ module AtsMec_SelfServiceEnablementAPI_TestCases { mw_http_message_body_json( mw_body_json_cse_resource_quota_info( mw_resource_quota_info( - PX_CPU_QUOTA, - PX_MEMORY_QUOTA, - PX_DISK_QUOTA + PX_CPU_QUOTA_1, + PX_MEMORY_QUOTA_1, + PX_DISK_QUOTA_1 ) ))))) { tc_ac.stop; @@ -933,7 +934,7 @@ module AtsMec_SelfServiceEnablementAPI_TestCases { // Local variables var Headers v_headers; var TenantInfo v_tenant_info := valueof(m_tenant_info(PX_CSE_CUSTOMER_ID_1, PX_CSE_CUSTOMER_NAME_1, "Retail", omit, PX_CSE_TENANT_NAME_1)); - var ResourceQuotaInfo v_resource_quota_info := valueof(m_resource_quota_info(PX_CPU_QUOTA, PX_MEMORY_QUOTA, PX_DISK_QUOTA)); + var ResourceQuotaInfo v_resource_quota_info := valueof(m_resource_quota_info(PX_CPU_QUOTA_1, PX_MEMORY_QUOTA_1, PX_DISK_QUOTA_1)); var charstring v_tenant_id; // Test control @@ -1133,6 +1134,7 @@ module AtsMec_SelfServiceEnablementAPI_TestCases { /** * @desc Check that the IUT returns an error on creating the resourceQuotaInfo for a not existing tenant when requested to a CSE */ + testcase TC_MEC_MEC048_MEO_CSE_008_NF() runs on HttpComponent system HttpTestAdapter { // Local variables var Headers v_headers; @@ -1164,25 +1166,25 @@ module AtsMec_SelfServiceEnablementAPI_TestCases { PX_MEMORY_QUOTA_1, PX_DISK_QUOTA_1 )))))); - tc_ac.start; - alt { - [] httpPort.receive( - mw_http_response( - mw_http_response_404_not_found - )) { - tc_ac.stop; - log("*** " & testcasename() & ": PASS: IUT successfully responds with the correct error 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_MEC048_MEO_CSE_008_NF + tc_ac.start; + alt { + [] httpPort.receive( + mw_http_response( + mw_http_response_404_not_found + )) { + tc_ac.stop; + log("*** " & testcasename() & ": PASS: IUT successfully responds with the correct error 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_MEC048_MEO_CSE_008_NF /** * @desc Check that the IUT returns the list of per site resource quota for a specific tenant when requested to a CSE - No filter @@ -1225,7 +1227,7 @@ module AtsMec_SelfServiceEnablementAPI_TestCases { v_headers ))); f_selfOrClientSyncAndVerdict(c_prDone, e_success); - tc_ac.start; + tc_ac.start; alt { [] httpPort.receive( @@ -1270,7 +1272,6 @@ module AtsMec_SelfServiceEnablementAPI_TestCases { f_cf_01_http_down(); } // End of testcase TC_MEC_MEC048_MEO_CSE_009_OK - /** * @desc Check that the IUT returns the list of per site resource quota for a specific tenant when requested to a CSE - siteId filter" */ @@ -1546,7 +1547,6 @@ module AtsMec_SelfServiceEnablementAPI_TestCases { f_cf_01_http_down(); } // End of testcase TC_MEC_MEC048_MEO_CSE_010_BR - /** * @desc Check that the IUT returns the site resource quota for a specific tenant and site identifier when requested to a CSE */ @@ -1881,4 +1881,1109 @@ module AtsMec_SelfServiceEnablementAPI_TestCases { } // End of group tenant + group subscription{ + + /** + * @desc Check that the IUT returns the list of subscriptions when requested to a CSE - no filter + */ + testcase TC_MEC_MEC048_MEO_CSE_013_OK() runs on HttpComponent system HttpTestAdapter { + // Local variables + var Headers v_headers; + var ResourceUsageSubscription v_resource_usage_subscription; + var SiteResourceUsageSubscription v_site_resource_usage_subscription; + var ResourceUsageSubscription v_resource_usage_subscription_2; + var charstring v_res_usage_sub_id; + var charstring v_site_res_usage_sub_id; + var charstring v_res_usage_sub_id_2; + + // Test control + if (not(PICS_SERVICES) or not(PICS_CSE_API_SUPPORTED)) { + log("*** " & testcasename() & ": PICS_SERVICES and PICS_CSE_API_SUPPORTED required for executing the TC ***"); + setverdict(inconc); + stop; + } + + // Test component configuration + f_cf_01_http_up(); + + // Test adapter configuration + + // Preamble + f_create_resource_usage_subscription(v_resource_usage_subscription, v_res_usage_sub_id); + f_create_site_resource_usage_subscription(v_site_resource_usage_subscription, v_site_res_usage_sub_id); + f_create_resource_usage_subscription_2(v_resource_usage_subscription_2, v_res_usage_sub_id_2); + + f_init_default_headers_list(-, -, v_headers); + httpPort.send( + m_http_request( + m_http_request_get( + PICS_ROOT_API & PX_CSE_LIST_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_cse_subscription_link_list( + mw_subscription_link_list( + mw_links_sub( + -, + { + mw_subscription( + v_resource_usage_subscription.links.self_.href, + "ResourceUsageSubscription" + ), + mw_subscription( + v_site_resource_usage_subscription.links.self_.href, + "SiteResourceUsageSubscription" + ), + mw_subscription( + v_resource_usage_subscription_2.links.self_.href, + "ResourceUsageSubscription" + ) + } + ) + + )))))) { + tc_ac.stop; + + log("*** " & testcasename() & ": PASS: IUT successfully responds with a list of SubscriptionLinks ***"); + f_selfOrClientSyncAndVerdict(c_tbDone, e_success); + } + [] tc_ac.timeout { + log("*** " & testcasename() & ": INCONC: Expected message not received ***"); + f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout); + } + } // End of 'alt' statement + + // Postamble + f_delete_cse_subscription(v_res_usage_sub_id); + f_delete_cse_subscription(v_site_res_usage_sub_id); + f_delete_cse_subscription(v_res_usage_sub_id_2); + + f_cf_01_http_down(); + } // End of testcase TC_MEC_MEC048_MEO_CSE_013_OK + + /** + * @desc Check that the IUT returns the list of subscriptions when requested to a CSE - subscription_type filter + */ + testcase TC_MEC_MEC048_MEO_CSE_013_OK_02() runs on HttpComponent system HttpTestAdapter { + // Local variables + var Headers v_headers; + var ResourceUsageSubscription v_resource_usage_subscription; + var SiteResourceUsageSubscription v_site_resource_usage_subscription; + var ResourceUsageSubscription v_resource_usage_subscription_2; + var charstring v_res_usage_sub_id; + var charstring v_site_res_usage_sub_id; + var charstring v_res_usage_sub_id_2; + + // Test control + if (not(PICS_SERVICES) or not(PICS_CSE_API_SUPPORTED)) { + log("*** " & testcasename() & ": PICS_SERVICES and PICS_CSE_API_SUPPORTED required for executing the TC ***"); + setverdict(inconc); + stop; + } + + // Test component configuration + f_cf_01_http_up(); + + // Test adapter configuration + + // Preamble + f_create_resource_usage_subscription(v_resource_usage_subscription, v_res_usage_sub_id); + f_create_site_resource_usage_subscription(v_site_resource_usage_subscription, v_site_res_usage_sub_id); + f_create_resource_usage_subscription_2(v_resource_usage_subscription_2, v_res_usage_sub_id_2); + + f_init_default_headers_list(-, -, v_headers); + httpPort.send( + m_http_request( + m_http_request_get( + PICS_ROOT_API & PX_CSE_LIST_SUBS & "?" & "subscription_type=ResourceUsageSubscription", + 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_cse_subscription_link_list( + mw_subscription_link_list( + mw_links_sub( + -, + { + mw_subscription( + v_resource_usage_subscription.links.self_.href, + "ResourceUsageSubscription" + ), + mw_subscription( + v_resource_usage_subscription_2.links.self_.href, + "ResourceUsageSubscription" + ) + } + ) + + )))))) { + tc_ac.stop; + + log("*** " & testcasename() & ": PASS: IUT successfully responds with a list of SubscriptionLinks ***"); + f_selfOrClientSyncAndVerdict(c_tbDone, e_success); + } + [] tc_ac.timeout { + log("*** " & testcasename() & ": INCONC: Expected message not received ***"); + f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout); + } + } // End of 'alt' statement + + // Postamble + f_delete_cse_subscription(v_res_usage_sub_id); + f_delete_cse_subscription(v_site_res_usage_sub_id); + f_delete_cse_subscription(v_res_usage_sub_id_2); + + f_cf_01_http_down(); + } // End of testcase TC_MEC_MEC048_MEO_CSE_013_OK_02 + + /** + * @desc Check that the IUT creates a new subscription when requested to a CSE + */ + testcase TC_MEC_MEC048_MEO_CSE_014_OK() runs on HttpComponent system HttpTestAdapter { + // Local variables + var Headers v_headers; + var HttpMessage v_response; + var charstring v_subscription_id; + + // Test control + if (not(PICS_SERVICES) or not(PICS_CSE_API_SUPPORTED)) { + log("*** " & testcasename() & ": PICS_SERVICES and PICS_CSE_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_CSE_LIST_SUBS, + v_headers, + m_http_message_body_json( + m_body_json_resource_usage_subscription( + m_resource_usage_subscription( + PX_CSE_SUB_CALLBACK_URI, + omit, omit, + omit, + PX_CSE_CUSTOMER_ID_1, + PX_CSE_TENANT_ID, + m_notification_trigger ( + e_tt_ten, + 4, + false + ) + )))))); + 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_resource_usage_subscription( + mw_resource_usage_subscription( + PX_CSE_SUB_CALLBACK_URI, + true, + *, + *, + PX_CSE_CUSTOMER_ID_1, + PX_CSE_TENANT_ID, + m_notification_trigger ( + e_tt_ten, + 4, + false + ) + )))))) -> value v_response { + tc_ac.stop; + + // Check HTTP Location header + if (f_check_headers(v_response.response.header) == false) { + log("*** " & testcasename() & ": FAIL: IUT failed in resourceUsgaeSubscription ***"); + f_selfOrClientSyncAndVerdict(c_tbDone, e_error); + } else { + var charstring_list v_header_location; + f_get_header(v_response.response.header, "Location", v_header_location); + v_subscription_id := regexp( + v_header_location[0], + "?+" & PX_CSE_LIST_SUBS & "/(?*)", + 0 + ); + } + log("*** " & testcasename() & ": PASS: IUT successfully responds with a resourceUsageSubscription, SubscriptionId: ", v_subscription_id," ***"); + f_selfOrClientSyncAndVerdict(c_tbDone, e_success); + } + [] tc_ac.timeout { + log("*** " & testcasename() & ": INCONC: Expected message not received ***"); + f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout); + } + } // End of 'alt' statement + + // Postamble + f_delete_cse_subscription(v_subscription_id); + + f_cf_01_http_down(); + } // End of testcase TC_MEC_MEC048_MEO_CSE_014_OK + + /** + * @desc Check that the IUT creates a new subscription when requested to a CSE + */ + testcase TC_MEC_MEC048_MEO_CSE_014_OK_02() runs on HttpComponent system HttpTestAdapter { + // Local variables + var Headers v_headers; + var HttpMessage v_response; + var charstring v_subscription_id; + + // Test control + if (not(PICS_SERVICES) or not(PICS_CSE_API_SUPPORTED)) { + log("*** " & testcasename() & ": PICS_SERVICES and PICS_CSE_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_CSE_LIST_SUBS, + v_headers, + m_http_message_body_json( + m_body_json_site_resource_usage_subscription( + m_site_resource_usage_subscription( + PX_CSE_SUB_CALLBACK_URI, + true, + omit, + -, + PX_CSE_CUSTOMER_ID_1, + PX_CSE_TENANT_ID, + { m_site_id("site-001"), + m_site_id("site-002") }, + m_notification_trigger ( + e_tt_ten, + 4, + false + ) + )))))); + 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( + m_body_json_site_resource_usage_subscription( + m_site_resource_usage_subscription( + PX_CSE_SUB_CALLBACK_URI, + true, omit, + -, + PX_CSE_CUSTOMER_ID_1, + PX_CSE_TENANT_ID, + { m_site_id("site-001"), + m_site_id("site-002") }, + m_notification_trigger ( + e_tt_ten, + 4, + false + ) + )))))) -> value v_response { + tc_ac.stop; + + // Check HTTP Location header + if (f_check_headers(v_response.response.header) == false) { + log("*** " & testcasename() & ": FAIL: IUT failed in siteResourceUsgaeSubscription ***"); + f_selfOrClientSyncAndVerdict(c_tbDone, e_error); + } else { + var charstring_list v_header_location; + f_get_header(v_response.response.header, "Location", v_header_location); + v_subscription_id := regexp( + v_header_location[0], + "?+" & PX_CSE_LIST_SUBS & "/(?*)", + 0 + ); + } + log("*** " & testcasename() & ": PASS: IUT successfully responds with a siteResourceUsageSubscription, SubscriptionId: ", v_subscription_id," ***"); + f_selfOrClientSyncAndVerdict(c_tbDone, e_success); + } + [] tc_ac.timeout { + log("*** " & testcasename() & ": INCONC: Expected message not received ***"); + f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout); + } + } // End of 'alt' statement + + // Postamble + f_delete_cse_subscription(v_subscription_id); + + f_cf_01_http_down(); + } // End of testcase TC_MEC_MEC048_MEO_CSE_014_OK_02 + + /** + * @desc Check that the IUT returns an error on creating a new subscription when requested to a CSE + */ + testcase TC_MEC_MEC048_MEO_CSE_014_BR() runs on HttpComponent system HttpTestAdapter { + // Local variables + var Headers v_headers; + var HttpMessage v_response; + + // Test control + if (not(PICS_SERVICES) or not(PICS_CSE_API_SUPPORTED)) { + log("*** " & testcasename() & ": PICS_SERVICES and PICS_CSE_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_CSE_LIST_SUBS, + v_headers, + m_http_message_body_json( + m_body_json_resource_usage_subscription( + m_resource_usage_subscription( + omit, + true, + omit, + -, + PX_CSE_CUSTOMER_ID_1, + PX_CSE_TENANT_ID, + m_notification_trigger ( + e_tt_ten, + 4, + false + ) + )))))); + f_selfOrClientSyncAndVerdict(c_prDone, e_success); + + // Test Body + tc_ac.start; + alt { + [] httpPort.receive( + mw_http_response( + mw_http_response_400_bad_request + )) { + tc_ac.stop; + + log("*** " & testcasename() & ": PASS: IUT successfully responds with the correct error 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_MEC048_MEO_CSE_014_BR + + /** + * @desc Check that the IUT returns a subscription when requested by a CSE + */ + testcase TC_MEC_MEC048_MEO_CSE_015_OK() runs on HttpComponent system HttpTestAdapter { + // Local variables + var Headers v_headers; + var ResourceUsageSubscription v_resource_usage_subscription; + var SiteResourceUsageSubscription v_site_resource_usage_subscription; + var ResourceUsageSubscription v_resource_usage_subscription_2; + var charstring v_res_usage_sub_id; + var charstring v_site_res_usage_sub_id; + var charstring v_res_usage_sub_id_2; + + // Test control + if (not(PICS_SERVICES) or not(PICS_CSE_API_SUPPORTED)) { + log("*** " & testcasename() & ": PICS_SERVICES and PICS_CSE_API_SUPPORTED required for executing the TC ***"); + setverdict(inconc); + stop; + } + + // Test component configuration + f_cf_01_http_up(); + + // Test adapter configuration + + // Preamble + f_create_resource_usage_subscription(v_resource_usage_subscription, v_res_usage_sub_id); + f_create_site_resource_usage_subscription_2(v_site_resource_usage_subscription, v_site_res_usage_sub_id); + f_create_resource_usage_subscription_2(v_resource_usage_subscription_2, v_res_usage_sub_id_2); + + f_init_default_headers_list(-, -, v_headers); + httpPort.send( + m_http_request( + m_http_request_get( + PICS_ROOT_API & PX_CSE_LIST_SUBS & "?" & "subscription_type=SiteResourceUsageSubscription", + 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_site_resource_usage_subscription( + mw_site_resource_usage_subscription( + PX_CSE_SUB_CALLBACK_URI, + *, omit, + -, + PX_CSE_CUSTOMER_ID_1, + PX_CSE_TENANT_ID, + { m_site_id("site-001"), + m_site_id("site-002") }, + m_notification_trigger ( + e_tt_ten, + 4, + false + ) + )))))) { + tc_ac.stop; + + log("*** " & testcasename() & ": PASS: IUT successfully responds with a SiteResourceUsageSubscription ***"); + f_selfOrClientSyncAndVerdict(c_tbDone, e_success); + } + [] tc_ac.timeout { + log("*** " & testcasename() & ": INCONC: Expected message not received ***"); + f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout); + } + } // End of 'alt' statement + + // Postamble + f_delete_cse_subscription(v_res_usage_sub_id); + f_delete_cse_subscription(v_site_res_usage_sub_id); + f_delete_cse_subscription(v_res_usage_sub_id_2); + + f_cf_01_http_down(); + + } // End of testcase TC_MEC_MEC048_MEO_CSE_015_OK + + /** + * @desc Check that the IUT returns an error on requesting a not existing subscription when requested by a CSE + */ + testcase TC_MEC_MEC048_MEO_CSE_015_NF() runs on HttpComponent system HttpTestAdapter { + + // Local variables + var Headers v_headers; + + // Test control + if (not(PICS_SERVICES) or not(PICS_CSE_API_SUPPORTED)) { + log("*** " & testcasename() & ": PICS_SERVICES and PICS_CSE_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_CSE_LIST_SUBS & "/" & oct2char(unichar2oct(PX_UNKNOWN_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 + )) { + tc_ac.stop; + + log("*** " & testcasename() & ": PASS: IUT successfully responds with a correct error 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_MEC048_MEO_CSE_015_NF + + /** + * @desc Check that the IUT updates an existing subscription when requested by a CSE + */ + testcase TC_MEC_MEC048_MEO_CSE_016_OK() runs on HttpComponent system HttpTestAdapter { + // Local variables + var Headers v_headers; + var SiteResourceUsageSubscription v_site_resource_usage_subscription; + var charstring v_site_res_usage_sub_id; + var Links v_links; + var HttpMessage v_response; + + // Test control + if (not(PICS_SERVICES) or not(PICS_CSE_API_SUPPORTED)) { + log("*** " & testcasename() & ": PICS_SERVICES and PICS_CSE_API_SUPPORTED required for executing the TC ***"); + setverdict(inconc); + stop; + } + + // Test component configuration + f_cf_01_http_up(); + + // Test adapter configuration + + // Preamble + f_create_site_resource_usage_subscription(v_site_resource_usage_subscription, v_site_res_usage_sub_id, v_links); + f_init_default_headers_list(-, -, v_headers); + httpPort.send( + m_http_request( + m_http_request_put( + PICS_ROOT_API & PX_CSE_LIST_SUBS & "/" & v_site_res_usage_sub_id, + v_headers, + m_http_message_body_json( + m_body_json_site_resource_usage_subscription( + m_site_resource_usage_subscription( + PX_CSE_SUB_CALLBACK_URI, + true, + omit, + v_links, + PX_CSE_CUSTOMER_ID_1, + PX_CSE_TENANT_ID, + { m_site_id("site-001"), + m_site_id("site-002") }, + m_notification_trigger ( + e_tt_ten, + 4, + false + ) + )))))); + 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_site_resource_usage_subscription( + mw_site_resource_usage_subscription( + PX_CSE_SUB_CALLBACK_URI, + true, + omit, + -, + PX_CSE_CUSTOMER_ID_1, + PX_CSE_TENANT_ID, + { m_site_id("site-001"), + m_site_id("site-002") }, + m_notification_trigger ( + e_tt_ten, + 4, + false + ) + )))))) -> value v_response { + tc_ac.stop; + + log("*** " & testcasename() & ": PASS: IUT successfully updates the siteResourceUsageSubscription ***"); + f_selfOrClientSyncAndVerdict(c_tbDone, e_success); + } + [] tc_ac.timeout { + log("*** " & testcasename() & ": INCONC: Expected message not received ***"); + f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout); + } + } // End of 'alt' statement + + // Postamble + f_delete_cse_subscription(v_site_res_usage_sub_id); + + f_cf_01_http_down(); + } // End of testcase TC_MEC_MEC048_MEO_CSE_016_OK + + /** + * @desc Check that the IUT returns an error updating an not existing subscription when requested by a CSE + */ + testcase TC_MEC_MEC048_MEO_CSE_016_NF() runs on HttpComponent system HttpTestAdapter { + // Local variables + var Headers v_headers; + + // Test control + if (not(PICS_SERVICES) or not(PICS_CSE_API_SUPPORTED)) { + log("*** " & testcasename() & ": PICS_SERVICES and PICS_CSE_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_put( + PICS_ROOT_API & PX_CSE_LIST_SUBS & "/" & oct2char(unichar2oct(PX_NON_EXISTENT_SUBSCRIPTION_ID, "UTF-8")), + v_headers, + m_http_message_body_json( + m_body_json_site_resource_usage_subscription( + m_site_resource_usage_subscription( + PX_CSE_SUB_CALLBACK_URI, + true, + omit, + -, + PX_CSE_CUSTOMER_ID_1, + PX_CSE_TENANT_ID, + { m_site_id("site-001"), + m_site_id("site-002") }, + m_notification_trigger ( + e_tt_ten, + 4, + false + ) + )))))); + f_selfOrClientSyncAndVerdict(c_prDone, e_success); + + // Test Body + tc_ac.start; + alt { + [] httpPort.receive( + mw_http_response( + mw_http_response_404_not_found + )) { + tc_ac.stop; + + log("*** " & testcasename() & ": PASS: IUT successfully responds with the correct error 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_MEC048_MEO_CSE_016_NF + + /** + * @desc Check that the IUT returns an error updating an existing subscription with wrong parameters when requested by a CSE + */ + testcase TC_MEC_MEC048_MEO_CSE_016_BR() runs on HttpComponent system HttpTestAdapter { + // Local variables + var Headers v_headers; + var SiteResourceUsageSubscription v_site_resource_usage_subscription; + var charstring v_site_res_usage_sub_id; + + // Test control + if (not(PICS_SERVICES) or not(PICS_CSE_API_SUPPORTED)) { + log("*** " & testcasename() & ": PICS_SERVICES and PICS_CSE_API_SUPPORTED required for executing the TC ***"); + setverdict(inconc); + stop; + } + + // Test component configuration + f_cf_01_http_up(); + + // Test adapter configuration + + // Preamble + f_create_site_resource_usage_subscription(v_site_resource_usage_subscription, v_site_res_usage_sub_id); + f_init_default_headers_list(-, -, v_headers); + httpPort.send( + m_http_request( + m_http_request_post( + PICS_ROOT_API & PX_CSE_LIST_SUBS, + v_headers, + m_http_message_body_json( + m_body_json_resource_usage_subscription( + m_resource_usage_subscription( + omit, + true, + omit, + -, + PX_CSE_CUSTOMER_ID_1, + PX_CSE_TENANT_ID, + m_notification_trigger ( + e_tt_ten, + 4, + false + ) + )))))); + f_selfOrClientSyncAndVerdict(c_prDone, e_success); + + // Test Body + tc_ac.start; + alt { + [] httpPort.receive( + mw_http_response( + mw_http_response_400_bad_request + )) { + tc_ac.stop; + + log("*** " & testcasename() & ": PASS: IUT successfully responds with the correct error 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_MEC048_MEO_CSE_016_BR + + /** + * @desc Check that the IUT deletes an existing subscription when requested by a CSE + */ + testcase TC_MEC_MEC048_MEO_CSE_017_OK() runs on HttpComponent system HttpTestAdapter { + // Local variables + var Headers v_headers; + var ResourceUsageSubscription v_resource_usage_subscription; + var charstring v_res_usage_sub_id; + + // Test control + if (not(PICS_SERVICES) or not(PICS_CSE_API_SUPPORTED)) { + log("*** " & testcasename() & ": PICS_SERVICES and PICS_CSE_API_SUPPORTED required for executing the TC ***"); + setverdict(inconc); + stop; + } + + // Test component configuration + f_cf_01_http_up(); + + // Test adapter configuration + + // Preamble + f_create_resource_usage_subscription(v_resource_usage_subscription, v_res_usage_sub_id); + f_init_default_headers_list(-, -, v_headers); + httpPort.send( + m_http_request( + m_http_request_delete( + PICS_ROOT_API & PX_CSE_LIST_SUBS & "/" & v_res_usage_sub_id, + v_headers + ))); + f_selfOrClientSyncAndVerdict(c_prDone, e_success); + + // Test Body + tc_ac.start; + alt { + [] httpPort.receive( + mw_http_response( + mw_http_response_204_no_content + )) { + tc_ac.stop; + + log("*** " & testcasename() & ": PASS: IUT successfully deletes the resourceUsageSubscription ***"); + 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_MEC048_MEO_CSE_017_OK + + /** + * @desc Check that the IUT returns an error on a deletion of a not existing subscription when requested by a CSE + */ + testcase TC_MEC_MEC048_MEO_CSE_017_NF() runs on HttpComponent system HttpTestAdapter { + + // Local variables + var Headers v_headers; + + // Test control + if (not(PICS_SERVICES) or not(PICS_CSE_API_SUPPORTED)) { + log("*** " & testcasename() & ": PICS_SERVICES and PICS_CSE_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_CSE_LIST_SUBS & "/" & oct2char(unichar2oct(PX_UNKNOWN_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 + )) { + tc_ac.stop; + + log("*** " & testcasename() & ": PASS: IUT successfully responds with a correct error 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_MEC048_MEO_CSE_017_NF + + } // End of group subscription + + group notification{ + + /** + * @desc Check that the CSE sends a site resource usage notification if the CSE has an associated subscription and the event is generated + */ + testcase TC_MEC_MEC048_MEO_CSE_018_OK() runs on HttpComponent system HttpTestAdapter { + // Local variables + var Headers v_headers; + var SiteResourceUsageSubscription v_site_resource_usage_subscription; + var charstring v_site_res_usage_sub_id; + + // Test control + if (not(PICS_SERVICES) or not(PICS_CSE_API_SUPPORTED)) { + log("*** " & testcasename() & ": PICS_SERVICES and PICS_CSE_API_SUPPORTED required for executing the TC ***"); + setverdict(inconc); + stop; + } + + // Test component configuration + f_cf_01_http_notif_up(); + + // Test adapter configuration + + // Preamble + f_create_site_resource_usage_subscription_2(v_site_resource_usage_subscription, v_site_res_usage_sub_id); + action("Trigger notification"); + f_selfOrClientSyncAndVerdict(c_prDone, e_success); + + // Test Body + tc_wait.start; + alt { + [] httpPort_notif.receive( + mw_http_request( + mw_http_request_post( + oct2char(unichar2oct(PX_CSE_SUB_CALLBACK_URI, "UTF-8")), + -, + mw_http_message_body_json( + mw_body_json_site_resource_usage_notification( + mw_site_resource_usage_notification( + { seconds := 1684748494, nanoSeconds := 123456789 }, + PX_CSE_CUSTOMER_ID_1, + PX_CSE_TENANT_ID, + mw_site_resource_use_info( + PX_SITE_ID_1, + 5 + ) + )))))) { + tc_wait.stop; + + f_init_default_headers_list(-, -, v_headers); + httpPort_notif.send( + m_http_response( + m_http_response_ok_no_body( + 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_delete_cse_subscription(v_site_res_usage_sub_id); + f_cf_01_http_notif_down(); + } // End of testcase TC_MEC_MEC048_MEO_CSE_018_OK + + /** + * @desc Check that the CSE sends a resource usage notification if the CSE has an associated subscription and the event is generated + */ + testcase TC_MEC_MEC048_MEO_CSE_019_OK() runs on HttpComponent system HttpTestAdapter { + // Local variables + var Headers v_headers; + var ResourceUsageSubscription v_resource_usage_subscription; + var charstring v_res_usage_sub_id; + + // Test control + if (not(PICS_SERVICES) or not(PICS_CSE_API_SUPPORTED)) { + log("*** " & testcasename() & ": PICS_SERVICES and PICS_CSE_API_SUPPORTED required for executing the TC ***"); + setverdict(inconc); + stop; + } + + // Test component configuration + f_cf_01_http_notif_up(); + + // Test adapter configuration + + // Preamble + f_create_resource_usage_subscription_2(v_resource_usage_subscription, v_res_usage_sub_id); + action("Trigger notification"); + f_selfOrClientSyncAndVerdict(c_prDone, e_success); + + // Test Body + tc_wait.start; + alt { + [] httpPort_notif.receive( + mw_http_request( + mw_http_request_post( + oct2char(unichar2oct(PX_CSE_SUB_CALLBACK_URI, "UTF-8")), + -, + mw_http_message_body_json( + mw_body_json_resource_usage_notification( + mw_resource_usage_notification( + *, + PX_CSE_CUSTOMER_ID_1, + PX_CSE_TENANT_ID, + mw_resource_use_info ( + 5 + ) + )))))) { + tc_wait.stop; + + f_init_default_headers_list(-, -, v_headers); + httpPort_notif.send( + m_http_response( + m_http_response_ok_no_body( + 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_delete_cse_subscription(v_res_usage_sub_id); + f_cf_01_http_notif_down(); + + } // End of testcase TC_MEC_MEC048_MEO_CSE_019_OK + + /** + * @desc Check that the CSE sends a notification on subscription expiration if the CSE has an associated subscription and the event is generated + */ + testcase TC_MEC_MEC048_MEO_CSE_020_OK() runs on HttpComponent system HttpTestAdapter { + // Local variables + var Headers v_headers; + var ResourceUsageSubscription v_resource_usage_subscription; + var charstring v_res_usage_sub_id; + + // Test control + if (not(PICS_SERVICES) or not(PICS_CSE_API_SUPPORTED)) { + log("*** " & testcasename() & ": PICS_SERVICES and PICS_CSE_API_SUPPORTED required for executing the TC ***"); + setverdict(inconc); + stop; + } + + // Test component configuration + f_cf_01_http_notif_up(); + + // Test adapter configuration + + // Preamble + f_create_resource_usage_subscription_2(v_resource_usage_subscription, v_res_usage_sub_id); + action("Wait for subscription expiration"); + f_selfOrClientSyncAndVerdict(c_prDone, e_success); + + // Test Body + tc_wait.start; + alt { + [] httpPort_notif.receive( + mw_http_request( + mw_http_request_post( + oct2char(unichar2oct(PX_CSE_SUB_CALLBACK_URI, "UTF-8")), + -, + mw_http_message_body_json( + mw_body_json_cse_expiry_notification( + mw_cse_expiry_notification( + -, + { seconds := 1684748494, nanoSeconds := 123456789 } + ) + ))))) { + tc_wait.stop; + + // Send 204 No Content + httpPort_notif.send(m_http_response(m_http_response_204_no_content(v_headers))); + + log("*** " & testcasename() & ": PASS: IUT successfully sends expiry 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_delete_cse_subscription(v_res_usage_sub_id); + f_cf_01_http_notif_down(); + + } // End of testcase TC_MEC_MEC048_MEO_CSE_020_OK + + } //End of group notification + } // End of module AtsMec_SelfServiceEnablementAPI_TestCases diff --git a/ttcn/LibMec/SelfServiceEnablementAPI/ttcn/SelfServiceEnablementAPI_Functions.ttcn b/ttcn/LibMec/SelfServiceEnablementAPI/ttcn/SelfServiceEnablementAPI_Functions.ttcn index 7e4823d..d65a164 100644 --- a/ttcn/LibMec/SelfServiceEnablementAPI/ttcn/SelfServiceEnablementAPI_Functions.ttcn +++ b/ttcn/LibMec/SelfServiceEnablementAPI/ttcn/SelfServiceEnablementAPI_Functions.ttcn @@ -261,4 +261,303 @@ module SelfServiceEnablementAPI_Functions { } // End of function f_create_site_resource_quota_info + function f_create_resource_usage_subscription( + out ResourceUsageSubscription p_resource_usage_subscription, + out charstring p_subscription_id + ) runs on HttpComponent { + var Headers v_headers; + var HttpMessage v_response; + + f_init_default_headers_list(-, -, v_headers); + httpPort.send( + m_http_request( + m_http_request_post( + PICS_ROOT_API & PX_CSE_LIST_SUBS, + v_headers, + m_http_message_body_json( + m_body_json_resource_usage_subscription( + m_resource_usage_subscription( + PX_CSE_SUB_CALLBACK_URI, + omit, omit, omit, + PX_CSE_CUSTOMER_ID_1, + PX_CSE_TENANT_ID, + m_notification_trigger( + e_tt_ten, + 5, + true + ) + ) + ))))); + tc_ac.start; + alt { + [] httpPort.receive( + mw_http_response( + mw_http_response_201_created( + mw_http_message_body_json( + mw_body_json_resource_usage_subscription( + mw_resource_usage_subscription( + PX_CSE_SUB_CALLBACK_URI, + true, + *, + *, + ?,?,? + ) + ))))) -> value v_response { + tc_ac.stop; + + // Extract HTTP Location header + var charstring_list v_subscription_id; + f_get_header(v_response.response.header, "Location", v_subscription_id); + // Extract HTTP subscription id + p_subscription_id := regexp( + v_subscription_id[0], + "?+" & PX_CSE_LIST_SUBS & "/(?*)", + 0 + ); + p_resource_usage_subscription := v_response.response.body.json_body.resourceUsageSubscription; + log("f_create_resource_usage_subscription: INFO: IUT successfully responds to the subscription: ", p_resource_usage_subscription); + log("f_create_resource_usage_subscription: INFO: p_subscription_id: ", p_subscription_id); + } + [] tc_ac.timeout { + log("f_create_resource_usage_subscription: Expected message not received"); + } + } // End of 'alt' statement + } // End of function f_create_resource_usage_subscription + + function f_create_site_resource_usage_subscription( + out SiteResourceUsageSubscription p_site_resource_usage_subscription, + out charstring p_subscription_id, + out Links p_links + ) runs on HttpComponent { + var Headers v_headers; + var HttpMessage v_response; + + f_init_default_headers_list(-, -, v_headers); + httpPort.send( + m_http_request( + m_http_request_post( + PICS_ROOT_API & PX_CSE_LIST_SUBS, + v_headers, + m_http_message_body_json( + m_body_json_site_resource_usage_subscription( + m_site_resource_usage_subscription( + PX_CSE_SUB_CALLBACK_URI, + omit, omit, omit, + PX_CSE_CUSTOMER_ID_1, + PX_CSE_TENANT_ID, + { m_site_id("site-001"), + m_site_id("site-002") }, + m_notification_trigger( + e_tt_ten, + 5, + true + ) + ) + ))))); + tc_ac.start; + alt { + [] httpPort.receive( + mw_http_response( + mw_http_response_201_created( + mw_http_message_body_json( + mw_body_json_site_resource_usage_subscription( + mw_site_resource_usage_subscription( + PX_CSE_SUB_CALLBACK_URI, + true, + *, + *, + PX_CSE_CUSTOMER_ID_1, + PX_CSE_TENANT_ID + ) + ))))) -> value v_response { + tc_ac.stop; + + // Extract HTTP Location header + var charstring_list v_subscription_id; + f_get_header(v_response.response.header, "Location", v_subscription_id); + // Extract HTTP subscription id + p_subscription_id := regexp( + v_subscription_id[0], + "?+" & PX_CSE_LIST_SUBS & "/(?*)", + 0 + ); + p_site_resource_usage_subscription := v_response.response.body.json_body.siteResourceUsageSubscription; + p_links := v_response.response.body.json_body.siteResourceUsageSubscription.links; + + log("f_create_site_resource_usage_subscription: INFO: IUT successfully responds to the subscription: ", p_site_resource_usage_subscription); + log("f_create_site_resource_usage_subscription: INFO: p_subscription_id: ", p_subscription_id); + } + [] tc_ac.timeout { + log("f_create_site_resource_usage_subscription: Expected message not received"); + } + } // End of 'alt' statement + } // End of function f_create_site_resource_usage_subscription + + function f_create_resource_usage_subscription_2( + out ResourceUsageSubscription p_resource_usage_subscription, + out charstring p_subscription_id + ) runs on HttpComponent { + var Headers v_headers; + var HttpMessage v_response; + + f_init_default_headers_list(-, -, v_headers); + httpPort.send( + m_http_request( + m_http_request_post( + PICS_ROOT_API & PX_CSE_LIST_SUBS, + v_headers, + m_http_message_body_json( + m_body_json_resource_usage_subscription( + m_resource_usage_subscription( + PX_CSE_SUB_CALLBACK_URI, + omit, omit, omit, + PX_CSE_CUSTOMER_ID_1, + PX_CSE_TENANT_ID, + m_notification_trigger ( + e_tt_ten, + 4, + false + ) + ) + ))))); + tc_ac.start; + alt { + [] httpPort.receive( + mw_http_response( + mw_http_response_201_created( + mw_http_message_body_json( + mw_body_json_resource_usage_subscription( + mw_resource_usage_subscription( + PX_CSE_SUB_CALLBACK_URI, + true, + *, + -, + PX_CSE_CUSTOMER_ID_1, + PX_CSE_TENANT_ID + ) + ))))) -> value v_response { + tc_ac.stop; + + // Extract HTTP Location header + var charstring_list v_subscription_id; + f_get_header(v_response.response.header, "Location", v_subscription_id); + // Extract HTTP subscription id + p_subscription_id := regexp( + v_subscription_id[0], + "?+" & PX_CSE_LIST_SUBS & "/(?*)", + 0 + ); + p_resource_usage_subscription := v_response.response.body.json_body.resourceUsageSubscription; + log("f_create_resource_usage_subscription_2: INFO: IUT successfully responds to the subscription: ", p_resource_usage_subscription); + log("f_create_resource_usage_subscription_2: INFO: p_subscription_id: ", p_subscription_id); + } + [] tc_ac.timeout { + log("f_create_resource_usage_subscription_2: Expected message not received"); + } + } // End of 'alt' statement + + } // End of function f_create_resource_usage_subscription_2 + + function f_create_site_resource_usage_subscription_2( + out SiteResourceUsageSubscription p_site_resource_usage_subscription, + out charstring p_subscription_id + ) runs on HttpComponent { + var Headers v_headers; + var HttpMessage v_response; + + f_init_default_headers_list(-, -, v_headers); + httpPort.send( + m_http_request( + m_http_request_post( + PICS_ROOT_API & PX_CSE_LIST_SUBS, + v_headers, + m_http_message_body_json( + m_body_json_site_resource_usage_subscription( + m_site_resource_usage_subscription( + PX_CSE_SUB_CALLBACK_URI, + true, omit, + omit, + PX_CSE_CUSTOMER_ID_1, + PX_CSE_TENANT_ID, + { m_site_id("site-001"), + m_site_id("site-002") }, + m_notification_trigger ( + e_tt_ten, + 4, + false + ) + )))))); + tc_ac.start; + alt { + [] httpPort.receive( + mw_http_response( + mw_http_response_201_created( + mw_http_message_body_json( + mw_body_json_site_resource_usage_subscription( + mw_site_resource_usage_subscription( + PX_CSE_SUB_CALLBACK_URI, + true, + omit, + -, + PX_CSE_CUSTOMER_ID_1, + PX_CSE_TENANT_ID, + { m_site_id("site-001"), + m_site_id("site-002") }, + m_notification_trigger ( + e_tt_ten, + 4, + false + ) + ) + ))))) -> value v_response { + tc_ac.stop; + + // Extract HTTP Location header + var charstring_list v_subscription_id; + f_get_header(v_response.response.header, "Location", v_subscription_id); + // Extract HTTP subscription id + p_subscription_id := regexp( + v_subscription_id[0], + "?+" & PX_CSE_LIST_SUBS & "/(?*)", + 0 + ); + p_site_resource_usage_subscription := v_response.response.body.json_body.siteResourceUsageSubscription; + log("f_create_site_resource_usage_subscription: INFO: IUT successfully responds to the subscription: ", p_site_resource_usage_subscription); + log("f_create_site_resource_usage_subscription: INFO: p_subscription_id: ", p_subscription_id); + } + [] tc_ac.timeout { + log("f_create_resource_usage_subscription: Expected message not received"); + } + } // End of 'alt' statement + } // End of function f_create_site_resource_usage_subscription + + function f_delete_cse_subscription( + in charstring p_subscription_id + ) runs on HttpComponent { + // Local variables + var Headers v_headers; + + f_init_default_headers_list(-, -, v_headers); + httpPort.send( + m_http_request( + m_http_request_delete( + PICS_ROOT_API & PX_CSE_LIST_SUBS & "/" & p_subscription_id, + v_headers + ))); + tc_ac.start; + alt { + [] httpPort.receive( + mw_http_response( + mw_http_response_204_no_content + )) { + tc_ac.stop; + log("f_delete_cse_subscription: INFO: Subscription successfully deleted: ", p_subscription_id); + } + [] tc_ac.timeout { + log("f_delete_cse_subscription: INCONC: Expected message not received"); + } + } // End of 'alt' statement + + } // End of function f_delete_cse_subscription + } // End of module SelfServiceEnablementAPI_Functions diff --git a/ttcn/LibMec/SelfServiceEnablementAPI/ttcn/SelfServiceEnablementAPI_Pixits.ttcn b/ttcn/LibMec/SelfServiceEnablementAPI/ttcn/SelfServiceEnablementAPI_Pixits.ttcn index e677770..6ed7a28 100644 --- a/ttcn/LibMec/SelfServiceEnablementAPI/ttcn/SelfServiceEnablementAPI_Pixits.ttcn +++ b/ttcn/LibMec/SelfServiceEnablementAPI/ttcn/SelfServiceEnablementAPI_Pixits.ttcn @@ -13,7 +13,7 @@ module SelfServiceEnablementAPI_Pixits { modulepar Json.String PX_CSE_CUSTOMER_NAME_1 := "customerName"; - modulepar Json.String PX_CSE_TENANT_ID_1 := ""; + modulepar Json.String PX_CSE_TENANT_ID := ""; modulepar Json.String PX_CSE_TENANT_NAME_1 := "tenantX"; diff --git a/ttcn/LibMec/SelfServiceEnablementAPI/ttcn/SelfServiceEnablementAPI_Templates.ttcn b/ttcn/LibMec/SelfServiceEnablementAPI/ttcn/SelfServiceEnablementAPI_Templates.ttcn index d661a15..8e14ba5 100644 --- a/ttcn/LibMec/SelfServiceEnablementAPI/ttcn/SelfServiceEnablementAPI_Templates.ttcn +++ b/ttcn/LibMec/SelfServiceEnablementAPI/ttcn/SelfServiceEnablementAPI_Templates.ttcn @@ -13,14 +13,14 @@ module SelfServiceEnablementAPI_Templates { import from SelfServiceEnablementAPI_TypesAndValues all; template (omit) TenantInfo m_tenant_info( - in Json.String p_customerId, - in Json.String p_customerName, - in template (omit) Json.String p_customerCategory, - in template (omit) Json.String p_tenantId, - in Json.String p_tenantName, - in template (omit) ResourceInfo p_resourceUseInfo := omit, - in template (omit) SiteInfo p_siteList := omit - ) := { + in Json.String p_customerId, + in Json.String p_customerName, + in template (omit) Json.String p_customerCategory, + in template (omit) Json.String p_tenantId, + in Json.String p_tenantName, + in template (omit) ResourceInfo p_resourceUseInfo := omit, + in template (omit) SiteInfo p_siteList := omit + ) := { customerId := p_customerId, customerName := p_customerName, customerCategory := p_customerCategory, @@ -161,7 +161,7 @@ module SelfServiceEnablementAPI_Templates { in template (omit) Links p_links := omit, in Json.String p_customerId, in Json.String p_tenantId, - in template (value) SiteId p_siteList, + in template (value) SiteIdList p_siteList, in template (value) NotificationTrigger p_notificationTrigger, in template (omit) TimeStamp p_expiryDeadline := omit ) := { @@ -184,7 +184,7 @@ module SelfServiceEnablementAPI_Templates { template Links p_links := *, template (present) Json.String p_customerId := ?, template (present) Json.String p_tenantId := ?, - template (present) SiteId p_siteList := ?, + template (present) SiteIdList p_siteList := ?, template (present) NotificationTrigger p_notificationTrigger := ?, template TimeStamp p_expiryDeadline := * ) := { @@ -201,13 +201,13 @@ module SelfServiceEnablementAPI_Templates { } // End of template mw_site_resource_usage_subscription template (value) SubscriptionLinkList m_subscription_link_list( - in template (value) Links p_links + in template (value) LinksSub p_links ) := { links := p_links } // End of template m_subscription_link_list template (present) SubscriptionLinkList mw_subscription_link_list( - template (present) Links p_links := ? + template (present) LinksSub p_links := ? ) := { links := p_links } // End of template mw_subscription_link_list @@ -297,14 +297,14 @@ module SelfServiceEnablementAPI_Templates { } // End of template mw_site_resource_usage_notification template (omit) SiteResourceUseInfo m_site_resource_use_info( - in Json.String p_siteId, - in template (omit) Json.Integer p_cpuUsed, - in template (omit) Json.Integer p_cpuRemain, - in template (omit) Json.Integer p_memoryUsed, - in template (omit) Json.Integer p_memoryRemain, - in template (omit) Json.Integer p_diskUsed, - in template (omit) Json.Integer p_diskRemain - ) := { + in Json.String p_siteId, + in template (omit) Json.Integer p_cpuUsed, + in template (omit) Json.Integer p_cpuRemain, + in template (omit) Json.Integer p_memoryUsed, + in template (omit) Json.Integer p_memoryRemain, + in template (omit) Json.Integer p_diskUsed, + in template (omit) Json.Integer p_diskRemain + ) := { siteId := p_siteId, cpuUsed := p_cpuUsed, cpuRemain := p_cpuRemain, @@ -315,14 +315,14 @@ module SelfServiceEnablementAPI_Templates { } // End of template m_site_resource_use_info template (present) SiteResourceUseInfo mw_site_resource_use_info( - template (present) Json.String p_siteId := ?, - template Json.Integer p_cpuUsed := *, - template Json.Integer p_cpuRemain := *, - template Json.Integer p_memoryUsed := *, - template Json.Integer p_memoryRemain := *, - template Json.Integer p_diskUsed := *, - template Json.Integer p_diskRemain := * - ) := { + template (present) Json.String p_siteId := ?, + template Json.Integer p_cpuUsed := *, + template Json.Integer p_cpuRemain := *, + template Json.Integer p_memoryUsed := *, + template Json.Integer p_memoryRemain := *, + template Json.Integer p_diskUsed := *, + template Json.Integer p_diskRemain := * + ) := { siteId := p_siteId, cpuUsed := p_cpuUsed, cpuRemain := p_cpuRemain, @@ -332,40 +332,53 @@ module SelfServiceEnablementAPI_Templates { diskRemain := p_diskRemain } // End of template mw_site_resource_use_info - template (value) ExpiryNotification m_expiry_notification( - in template (value) Links p_links, - in template (value) TimeStamp p_expiryDeadline - ) := { - notificationType := "ExpiryNotification", - expiryDeadline := p_expiryDeadline, - links := p_links + template (value) ExpiryNotification m_cse_expiry_notification( + in template (value) LinkExpiry p_links, + in template (value) TimeStamp p_expiryDeadline + ) := { + notificationType := "ExpiryNotification", + links := p_links, + expiryDeadline := p_expiryDeadline } // End of template m_expiry_notification - template (present) ExpiryNotification mw_expiry_notification( - template (present) Links p_links := ?, - template (present) TimeStamp p_expiryDeadline := ? - ) := { + template (present) ExpiryNotification mw_cse_expiry_notification( + template (present) LinkExpiry p_links := ?, + template (present) TimeStamp p_expiryDeadline := ? + ) := { notificationType := "ExpiryNotification", - expiryDeadline := p_expiryDeadline, - links := p_links + links := p_links, + expiryDeadline := p_expiryDeadline + } // End of template mw_expiry_notification template (value) Links m_links( - in LinkType p_self_, - in template (omit) Subscriptions p_subscription := omit + in template (value) LinkType p_self_ ) :={ - self_ := p_self_, - subscription := p_subscription + self_ := p_self_ } // End of template m_links template (present) Links mw_links( - template (present) LinkType p_self_ := ?, - template Subscriptions p_subscription := * - ) :={ - self_ := p_self_, - subscription := p_subscription + template (present) LinkType p_self_ := ? + ) :={ + self_ := p_self_ } // End of template mw_links + template (value) LinksSub m_links_sub( + in template (value) LinkType p_self_, + in template (omit) Subscriptions p_subscription := omit + ) :={ + self_ := p_self_, + subscriptions := p_subscription + } // End of template m_links_sub + + template (present) LinksSub mw_links_sub( + template (present) LinkType p_self_ := ?, + template Subscriptions p_subscription := * + ) :={ + self_ := p_self_, + subscriptions := p_subscription + } // End of template mw_links_sub + template (value) Subscription m_subscription( in Json.AnyURI p_href, in Json.String p_subscriptionType @@ -382,8 +395,8 @@ module SelfServiceEnablementAPI_Templates { subscriptionType := p_subscriptionType } // End of template mw_subscription - template SiteInfo m_site_info( - in template Json.String p_siteId, + template (omit) SiteInfo m_site_info( + in Json.String p_siteId, in template (omit) ResourceInfo p_resourceInfo := omit ) := { siteId := p_siteId, @@ -398,15 +411,15 @@ module SelfServiceEnablementAPI_Templates { resourceInfo := p_resourceInfo } // End of template mw_site_info - template SiteId m_site_id( - in template Json.String p_siteId - ) := { + template (value) SiteId m_site_id( + in Json.String p_siteId + ) := { siteId := p_siteId } // End of template m_site_id template (present) SiteId mw_site_id( - template (present) Json.String p_siteId := ? - ) := { + template (present) Json.String p_siteId := ? + ) := { siteId := p_siteId } // End of template mw_site_id @@ -452,6 +465,18 @@ module SelfServiceEnablementAPI_Templates { diskQuota := p_diskQuota, diskUsed := p_diskUsed, diskRemain := p_diskRemain -} // End of template mw_resource_info + } // End of template mw_resource_info + + template (value) LinkExpiry m_link_expiry( + in template (value) LinkType p_subscription + ) := { + subscription := p_subscription + } //End of temaplate m_link_expiry + + template (present) LinkExpiry mw_link_expiry( + template (present) LinkType p_subscription := ? + ) := { + subscription := p_subscription + } //End of temaplate mw_link_expiry } // End of module SelfServiceEnablementAPI_Templates diff --git a/ttcn/LibMec/SelfServiceEnablementAPI/ttcn/SelfServiceEnablementAPI_TypesAndValues.ttcn b/ttcn/LibMec/SelfServiceEnablementAPI/ttcn/SelfServiceEnablementAPI_TypesAndValues.ttcn index 9de9a4b..7fa6b01 100644 --- a/ttcn/LibMec/SelfServiceEnablementAPI/ttcn/SelfServiceEnablementAPI_TypesAndValues.ttcn +++ b/ttcn/LibMec/SelfServiceEnablementAPI/ttcn/SelfServiceEnablementAPI_TypesAndValues.ttcn @@ -15,7 +15,7 @@ module SelfServiceEnablementAPI_TypesAndValues { * @param tenantName Name of the tenant * @param resourceUseInfo Resource in the MEC system that can be used by the tenant * @param siteList A list of edge sites that can be used by the tenant - * @see ETSI GS MEC 048 V3.1.1 (2024-04) Table 6.2.2-1: Definition of type TenantInfo + * @see ETSI GS MEC 048 V3.2.1 (2025-09) Table 6.2.2-1: Definition of type TenantInfo */ type record TenantInfo { Json.String customerId, @@ -33,7 +33,7 @@ module SelfServiceEnablementAPI_TypesAndValues { * @param cpuQuota Allowed number of CPUs in the MEC system that can be used by the tenant * @param memoryQuota Allowed amount of memory (MB) in the MEC system that can be used by the tenant * @param diskQuota Allowed amount of disk (GB) in the MEC system that can be used by the tenant - * @see ETSI GS MEC 048 V3.1.1 (2024-04) Table 6.2.3-1: Definition of type ResourceQuotaInfo + * @see ETSI GS MEC 048 V3.2.1 (2025-09) Table 6.2.3-1: Definition of type ResourceQuotaInfo */ type record ResourceQuotaInfo { Json.Integer cpuQuota optional, @@ -47,7 +47,7 @@ module SelfServiceEnablementAPI_TypesAndValues { * @param cpuQuota Allowed number of CPUs in the MEC system that can be used by the tenant * @param memoryQuota Allowed amount of memory (MB) in the MEC system that can be used by the tenant * @param diskQuota Allowed amount of disk (GB) in the MEC system that can be used by the tenant - * @see ETSI GS MEC 048 V3.1.1 (2024-04) Table 6.2.4-1: Definition of type SiteResourceQuotaInfo + * @see ETSI GS MEC 048 V3.2.1 (2025-09) Table 6.2.4-1: Definition of type SiteResourceQuotaInfo */ type record SiteResourceQuotaInfo { Json.String siteId, @@ -68,7 +68,7 @@ module SelfServiceEnablementAPI_TypesAndValues { * @param tenantId Identifier of the tenant * @param notificationTrigger Set for trigger-based event notification reporting * @param expiryDeadline The expiration time of the subscription determined by the CSE - * @see ETSI GS MEC 048 V3.1.1 (2024-04) Table 6.3.2-1: Definition of type ResourceUsageSubscription + * @see ETSI GS MEC 048 V3.2.1 (2025-09) Table 6.3.2-1: Definition of type ResourceUsageSubscription */ type record ResourceUsageSubscription { Json.String subscriptionType, @@ -95,7 +95,7 @@ module SelfServiceEnablementAPI_TypesAndValues { * @param tenantId Identifier of the tenant * @param notificationTrigger Set for trigger-based event notification reporting * @param expiryDeadline The expiration time of the subscription determined by the CSE - * @see ETSI GS MEC 048 V3.1.1 (2024-04) Table 6.3.3-1: Definition of type SiteResourceUsageSubscription + * @see ETSI GS MEC 048 V3.2.1 (2025-09) Table 6.3.3-1: Definition of type SiteResourceUsageSubscription */ type record SiteResourceUsageSubscription { Json.String subscriptionType, @@ -105,7 +105,7 @@ module SelfServiceEnablementAPI_TypesAndValues { Links links optional, Json.String customerId, Json.String tenantId, - SiteId siteList, + SiteIdList siteList, NotificationTrigger notificationTrigger, TimeStamp expiryDeadline optional } with { @@ -115,10 +115,10 @@ module SelfServiceEnablementAPI_TypesAndValues { /** * @desc This type represents a list of links related to currently existing subscriptions for the service consumer * @param _links List of hyperlinks related to the resource - * @see ETSI GS MEC 048 V3.1.1 (2024-04) Table 6.3.4-1: Attributes of type SubscriptionLinkList + * @see ETSI GS MEC 048 V3.2.1 (2025-09) Table 6.3.4-1: Attributes of type SubscriptionLinkList */ type record SubscriptionLinkList { - Links links + LinksSub links } with { variant (links) "name as '_links'"; } @@ -130,7 +130,7 @@ module SelfServiceEnablementAPI_TypesAndValues { * @param customerId Identifier to uniquely specify the customer for the subscription * @param tenantId Identifier of the tenant * @param resourceUseInfo Resource usage in the MEC system by the tenant - * @see ETSI GS MEC 048 V3.1.1 (2024-04) Table 6.4.2-1: Attributes of type ResourceUsageNotification + * @see ETSI GS MEC 048 V3.2.1 (2025-09) Table 6.4.2-1: Attributes of type ResourceUsageNotification */ type record ResourceUsageNotification { Json.String notificationType, @@ -148,7 +148,7 @@ module SelfServiceEnablementAPI_TypesAndValues { * @param memoryRemain Remaining amount of memory (MB) that can be used by the tenant * @param diskUsed Used amount of disk (GB) by the tenant * @param diskRemain Remaining amount of disk (GB) that can be used by the tenant - * @see ETSI GS MEC 048 V3.1.1 (2024-04) Table 6.4.2-1: Attributes of type ResourceUseInfo + * @see ETSI GS MEC 048 V3.2.1 (2025-09) Table 6.4.2-1: Attributes of type ResourceUseInfo */ type record ResourceUseInfo { Json.Integer cpuUsed optional, @@ -166,7 +166,7 @@ module SelfServiceEnablementAPI_TypesAndValues { * @param customerId Identifier to uniquely specify the customer for the subscriptionc * @param tenantId Identifier of the tenant * @param resourceUseInfo Resource usage in the MEC system by the tenant - * @see ETSI GS MEC 048 V3.1.1 (2024-04) Table 6.4.3-1: Attributes of type SiteResourceUsageNotification + * @see ETSI GS MEC 048 V3.2.1 (2025-09) Table 6.4.3-1: Attributes of type SiteResourceUsageNotification */ type record SiteResourceUsageNotification { Json.String notificationType, @@ -185,7 +185,7 @@ module SelfServiceEnablementAPI_TypesAndValues { * @param memoryRemain Remaining amount of memory (MB) that can be used by the tenant * @param diskUsed Used amount of disk (GB) by the tenant * @param diskRemain Remaining amount of disk (GB) that can be used by the tenant - * @see ETSI GS MEC 048 V3.1.1 (2024-04) Table 6.4.3-1: Attributes of type SiteResourceUseInfo + * @see ETSI GS MEC 048 V3.2.1 (2025-09) Table 6.4.3-1: Attributes of type SiteResourceUseInfo */ type record SiteResourceUseInfo { Json.String siteId, @@ -202,12 +202,12 @@ module SelfServiceEnablementAPI_TypesAndValues { * @param notificationType Shall be set to "ExpiryNotification" * @param _links Object containing hyperlinks related to the resource * @param expiryDeadline Time stamp - * @see ETSI GS MEC 048 V3.1.1 (2024-04) Table 6.4.4-1: Attributes of type ExpiryNotification + * @see ETSI GS MEC 048 V3.2.1 (2025-09) Table 6.4.4-1: Attributes of type ExpiryNotification */ type record ExpiryNotification { Json.String notificationType, - TimeStamp expiryDeadline, - Links links + LinkExpiry links, + TimeStamp expiryDeadline } with { variant (links) "name as '_links'"; } @@ -216,7 +216,7 @@ module SelfServiceEnablementAPI_TypesAndValues { * @desc This type represents the information on an edge site * @param siteId Identifier of an edge site * @param resourceInfo Resource information in the edge site that is associated with a specific tenant - * @see ETSI GS MEC 048 V3.1.1 (2024-04) Table 6.5.2-1: Attributes of type SiteInfo + * @see ETSI GS MEC 048 V3.2.1 (2025-09) Table 6.5.2-1: Attributes of type SiteInfo */ type record SiteInfo { Json.String siteId, @@ -234,7 +234,7 @@ module SelfServiceEnablementAPI_TypesAndValues { * @param diskQuota Allowed amount of disk (GB) that can be used by the tenant * @param diskUsed Used amount of disk (GB) by the tenant * @param diskRemain Remaining amount of disk (GB) that can be used by the tenant - * @see ETSI GS MEC 048 V3.1.1 (2024-04) Table 6.4.3-1: Attributes of type ResourceInfo + * @see ETSI GS MEC 048 V3.2.1 (2025-09) Table 6.4.3-1: Attributes of type ResourceInfo */ type record ResourceInfo { Json.Integer cpuQuota optional, @@ -252,7 +252,7 @@ module SelfServiceEnablementAPI_TypesAndValues { * @desc This type represents the information on an edge site * @param siteId Identifier of an edge site * @param resourceInfo Resource information in the edge site that is associated with a specific tenant - * @see ETSI GS MEC 048 V3.1.1 (2024-04) Table 6.5.2-1: Attributes of type SiteInfo + * @see ETSI GS MEC 048 V3.2.1 (2025-09) Table 6.5.2-1: Attributes of type SiteInfo */ type record NotificationTrigger { TriggerType triggerType, @@ -262,7 +262,7 @@ module SelfServiceEnablementAPI_TypesAndValues { /** * @desc Trigger for the notification - * @see ETSI GS MEC 048 V3.1.1 (2024-04) Table 6.3.2-1: Enumeration TriggerType + * @see ETSI GS MEC 048 V3.2.1 (2025-09) Table 6.3.2-1: Enumeration TriggerType */ type enumerated TriggerType { e_tt_ten (10), // 10 = Notification trigged based on the number of used CPUs @@ -278,11 +278,11 @@ module SelfServiceEnablementAPI_TypesAndValues { /** * @desc Hyperlink related to the resource * @member subscription URI identifying the subscription for the test notification - * @see ETSI GS MEC 048 V3.1.1 (2024-04) : Definition of type Links - */ - type record Links { + * @see ETSI GS MEC 048 V3.2.1 (2025-09) : Definition of type Links + */ + type record LinksSub { LinkType self_, - Subscriptions subscription optional + Subscriptions subscriptions optional } with { variant (self_) "name as 'self'"; } @@ -291,18 +291,30 @@ module SelfServiceEnablementAPI_TypesAndValues { * @desc The service consumer's subscriptions * @member href The URI referring to the subscription * @member subscriptionType Type of the subscription - * @see ETSI GS MEC 048 V3.1.1 (2024-04) Table 6.3.4-11: Type Subscription + * @see ETSI GS MEC 048 V3.2.1 (2025-09) Table 6.3.4-11: Type Subscription */ + type record Subscription { Json.AnyURI href, Json.String subscriptionType } type set of Subscription Subscriptions; + /** + * @desc Hyperlink related to the resource + * @member subscription URI identifying the subscription for the test notification + * @see ETSI GS MEC 048 V3.2.1 (2025-09) Table 6.3.2: Attributes of the Links + */ + type record Links { + LinkType self_ + } with { + variant (self_) "name as 'self'"; + } + /** * @desc This type represents a type of link * @member href URI referring to a resource - * @see ETSI GS MEC 048 V3.1.1 (2024-04) : Definition of type LinkType + * @see ETSI GS MEC 048 V3.2.1 (2025-09) : Definition of type LinkType */ type record LinkType { Json.AnyURI href @@ -311,22 +323,27 @@ module SelfServiceEnablementAPI_TypesAndValues { /** * @desc This type represents the identifier of an edge site. * @param siteId Identifier of an edge site - * @see ETSI GS MEC 048 V3.1.1 (2024-04) Table 6.5.5-1: Attributes of type SiteInfo + * @see ETSI GS MEC 048 V3.2.1 (2025-09) Table 6.5.5-1: Attributes of type SiteInfo */ type record SiteId { Json.String siteId } + type set of SiteId SiteIdList; /** * @desc This type represents configuration for the delivery of subscription notifications over Websockets * @member websocketUri Set by location server to indicate to the service consumer the Websocket URI to be used for delivering notifications * @member requestWebsocketUri Set to true by the service consumer to indicate that Websocket delivery is requested - * @see ETSI GS MEC 048 V3.1.1 (2024-04) Type: WebsockNotifConfig + * @see ETSI GS MEC 048 V3.2.1 (2025-09) Type: WebsockNotifConfig */ type record WebsockNotifConfig { Json.AnyURI websocketUri optional, Json.Bool requestWebsocketUri optional -} with { - encode "JSON" -} + } with { + encode "JSON" + } + + type record LinkExpiry { + LinkType subscription + } } // End of module SelfServiceEnablementAPI_TypesAndValues \ No newline at end of file diff --git a/ttcn/patch_lib_http/ttcn/LibHttp_JsonMessageBodyTypes.ttcn b/ttcn/patch_lib_http/ttcn/LibHttp_JsonMessageBodyTypes.ttcn index c6f0c37..fc74f4e 100644 --- a/ttcn/patch_lib_http/ttcn/LibHttp_JsonMessageBodyTypes.ttcn +++ b/ttcn/patch_lib_http/ttcn/LibHttp_JsonMessageBodyTypes.ttcn @@ -215,7 +215,8 @@ module LibHttp_JsonMessageBodyTypes { SiteResourceUsageSubscription siteResourceUsageSubscription, SiteResourceUsageNotification siteResourceUsageNotification, ResourceUsageNotification resourceUsageNotification, - SelfServiceEnablementAPI_TypesAndValues.SubscriptionLinkList subscription_link_list_cse, + SelfServiceEnablementAPI_TypesAndValues.ExpiryNotification expiryNotification_cse, + SelfServiceEnablementAPI_TypesAndValues.SubscriptionLinkList subscriptionLinkList_cse, // TODO Add here your custom variants universal charstring raw diff --git a/ttcn/patch_lib_http/ttcn/LibHttp_JsonTemplates.ttcn b/ttcn/patch_lib_http/ttcn/LibHttp_JsonTemplates.ttcn index 0f8b63d..fd0b342 100644 --- a/ttcn/patch_lib_http/ttcn/LibHttp_JsonTemplates.ttcn +++ b/ttcn/patch_lib_http/ttcn/LibHttp_JsonTemplates.ttcn @@ -2080,18 +2080,18 @@ module LibHttp_JsonTemplates { } // End of template mw_body_json_site_resource_usage_subscription template (value) JsonBody m_body_json_cse_subscription_link_list( - in template (value) SelfServiceEnablementAPI_TypesAndValues.SubscriptionLinkList p_subscription_link_list + in template (value) SelfServiceEnablementAPI_TypesAndValues.SubscriptionLinkList p_subscriptionLinkList ) := { - subscription_link_list_cse := p_subscription_link_list + subscriptionLinkList_cse := p_subscriptionLinkList } // End of template m_body_json_cse_subscription_link_list template (present) JsonBody mw_body_json_cse_subscription_link_list( - template (present) SelfServiceEnablementAPI_TypesAndValues.SubscriptionLinkList p_subscription_link_list := ? + template (present) SelfServiceEnablementAPI_TypesAndValues.SubscriptionLinkList p_subscriptionLinkList := ? ) := { - subscription_link_list_cse := p_subscription_link_list + subscriptionLinkList_cse := p_subscriptionLinkList } // End of template mw_body_json_cse_subscription_link_list - template (present) JsonBody m_body_json_site_resource_usage_notification( + template (value) JsonBody m_body_json_site_resource_usage_notification( template (value) SiteResourceUsageNotification p_siteResourceUsageNotification ) := { siteResourceUsageNotification := p_siteResourceUsageNotification @@ -2102,7 +2102,7 @@ module LibHttp_JsonTemplates { siteResourceUsageNotification := p_siteResourceUsageNotification } // End of template mw_body_json_site_resource_usage_notification - template (present) JsonBody m_body_json_resource_usage_notification( + template (value) JsonBody m_body_json_resource_usage_notification( template (value) ResourceUsageNotification p_resourceUsageNotification ) := { resourceUsageNotification := p_resourceUsageNotification @@ -2113,6 +2113,18 @@ module LibHttp_JsonTemplates { resourceUsageNotification := p_resourceUsageNotification } // End of template mw_body_json_site_resource_usage_notification + template (value) JsonBody m_body_json_cse_expiry_notification( + in template (value) SelfServiceEnablementAPI_TypesAndValues.ExpiryNotification p_expiryNotification + ) := { + expiryNotification_cse := p_expiryNotification + } // End of template m_body_json_cse_expiry_notification + + template (present) JsonBody mw_body_json_cse_expiry_notification( + template (present) SelfServiceEnablementAPI_TypesAndValues.ExpiryNotification p_expiryNotification := ? + ) := { + expiryNotification_cse := p_expiryNotification + } // End of template mw_body_json_cse_expiry_notification + } // End of group cse } // End of module LibHttp_JsonTemplates -- GitLab