Commit fc358faa authored by Muhammad Umair Khan's avatar Muhammad Umair Khan
Browse files

add MEC048 SiteResourceQuotaInfo testcases and ResourceQuotaInfo post testcase

parent e189f298
Loading
Loading
Loading
Loading
+107 −0
Original line number Diff line number Diff line
[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
+821 −1

File changed and moved.

Preview size limit exceeded, changes collapsed.

+13 −0
Original line number Diff line number Diff line
@@ -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());
+81 −7
Original line number Diff line number Diff line
@@ -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

  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
Loading