Commit c0dad592 authored by YannGarcia's avatar YannGarcia
Browse files

Add V2XInformationService typing

parent abb64338
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -382,7 +382,7 @@ int json_codec::decode (const OCTETSTRING& p_data, LibItsHttp__JsonMessageBodyTy
      BwManagementAPI__TypesAndValues::BwInfoList bw_info_list;
      BwManagementAPI__TypesAndValues::BwInfoList bw_info_list;
      bw_info_list.decode(BwManagementAPI__TypesAndValues::BwInfoList_descr_, decoding_buffer_, TTCN_EncDec::CT_JSON);
      bw_info_list.decode(BwManagementAPI__TypesAndValues::BwInfoList_descr_, decoding_buffer_, TTCN_EncDec::CT_JSON);
      msg.bwInfoList() = bw_info_list;
      msg.bwInfoList() = bw_info_list;
     } else {
    } else { // BwInfo
      BwManagementAPI__TypesAndValues::BwInfo bw_info;
      BwManagementAPI__TypesAndValues::BwInfo bw_info;
       TTCN_Buffer decoding_buffer_(OCTETSTRING(str.length(), (const unsigned char*)str.c_str()));
       TTCN_Buffer decoding_buffer_(OCTETSTRING(str.length(), (const unsigned char*)str.c_str()));
       bw_info.decode(BwManagementAPI__TypesAndValues::BwInfo_descr_, decoding_buffer_, TTCN_EncDec::CT_JSON);
       bw_info.decode(BwManagementAPI__TypesAndValues::BwInfo_descr_, decoding_buffer_, TTCN_EncDec::CT_JSON);
+4 −1
Original line number Original line Diff line number Diff line
@@ -228,7 +228,10 @@ system.httpPort_notif.params := "HTTP(codecs=json:json_codec)/TCP(debug=1,server
#AtsMec_AppEnablementAPI_TestCases.TC_MEC_SRV_TRANS_001_OK
#AtsMec_AppEnablementAPI_TestCases.TC_MEC_SRV_TRANS_001_OK


# ETSI GS MEC 015
# ETSI GS MEC 015
AtsMec_BwManagementAPI_TestCases.TP_MEC_SRV_BWA_001_OK
#AtsMec_BwManagementAPI_TestCases.TC_MEC_SRV_BWA_001_OK
#AtsMec_BwManagementAPI_TestCases.TC_MEC_SRV_BWA_002_OK
#AtsMec_BwManagementAPI_TestCases.TC_MEC_SRV_BWA_002_BR
AtsMec_BwManagementAPI_TestCases.TC_MEC_SRV_BWA_002_NF


[GROUPS]
[GROUPS]
# In this section you can specify groups of hosts. These groups can be used inside the
# In this section you can specify groups of hosts. These groups can be used inside the
+2 −1
Original line number Original line Diff line number Diff line
@@ -462,7 +462,8 @@ class myHandler(http.server.BaseHTTPRequestHandler):
        content_type = 'application/json'
        content_type = 'application/json'
        if p_split[4].startswith('bw_allocations'): # E.g. bw_allocation?app_instance_id=InstApp01
        if p_split[4].startswith('bw_allocations'): # E.g. bw_allocation?app_instance_id=InstApp01
            s = p_split[4].split('?')
            s = p_split[4].split('?')
            if s.__len__() == 1: # ue_identity_tag_info, POST
            if s.__len__() == 1: # BW Allocation list requested
                #resp = self.__db__.getBwAllocationList(self.path)
                # Register/Unregister operation
                # Register/Unregister operation
                body = None
                body = None
                # Extract the body if any
                # Extract the body if any
+256 −4
Original line number Original line Diff line number Diff line
@@ -30,6 +30,7 @@ module AtsMec_BwManagementAPI_TestCases {
  import from BwManagementAPI_Pixits all;
  import from BwManagementAPI_Pixits all;
  
  
  // LibMec
  // LibMec
  import from LibMec_Templates all;
  import from LibMec_Functions all;
  import from LibMec_Functions all;
  import from LibMec_Pics all;
  import from LibMec_Pics all;
  import from LibMec_Pixits all;
  import from LibMec_Pixits all;
@@ -41,7 +42,7 @@ module AtsMec_BwManagementAPI_TestCases {
     * @see https://forge.etsi.org/gitlab/mec/MEC-tests/blob/master/Test%20Purposes/Plat/Mp1/Bandwidth/PlatBandwidthManager.tplan2
     * @see https://forge.etsi.org/gitlab/mec/MEC-tests/blob/master/Test%20Purposes/Plat/Mp1/Bandwidth/PlatBandwidthManager.tplan2
     * @see hhttps://forge.etsi.org/swagger/ui/?url=https://forge.etsi.org/gitlab/mec/gs015-bandwith-mgmt-api/raw/master/BwManagementApi.yaml
     * @see hhttps://forge.etsi.org/swagger/ui/?url=https://forge.etsi.org/gitlab/mec/gs015-bandwith-mgmt-api/raw/master/BwManagementApi.yaml
     */
     */
    testcase TP_MEC_SRV_BWA_001_OK() runs on HttpComponent system HttpTestAdapter {
    testcase TC_MEC_SRV_BWA_001_OK() runs on HttpComponent system HttpTestAdapter {
        // Local variables
        // Local variables
        var Headers v_headers;
        var Headers v_headers;
        var HttpMessage v_response;
        var HttpMessage v_response;
@@ -63,7 +64,7 @@ module AtsMec_BwManagementAPI_TestCases {
        httpPort.send(
        httpPort.send(
                      m_http_request(
                      m_http_request(
                                     m_http_request_get(
                                     m_http_request_get(
                                                        PX_ME_BWM_URI,// & "?app_instance_id=" & oct2char(unichar2oct(PX_APP_INSTANCE_ID, "UTF-8")),
                                                        PX_ME_BWM_URI,
                                                        v_headers
                                                        v_headers
                                                        )
                                                        )
                                     )
                                     )
@@ -81,7 +82,7 @@ module AtsMec_BwManagementAPI_TestCases {
                                                                                             )))) -> value v_response {
                                                                                             )))) -> value v_response {
            tc_ac.stop;
            tc_ac.stop;
            
            
            log("*** " & testcasename() & ": PASS: IUT successfully responds with a ZoneId ***");
            log("*** " & testcasename() & ": PASS: IUT successfully responds with a list of BwInfo ***");
            f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
            f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
          }
          }
          [] tc_ac.timeout {
          [] tc_ac.timeout {
@@ -92,7 +93,258 @@ module AtsMec_BwManagementAPI_TestCases {
        
        
        // Postamble
        // Postamble
        f_cf_01_http_down();
        f_cf_01_http_down();
    } // End of testcase TC_MEC_PLAT_MP1_BWA_BV_001
    } // End of testcase TC_MEC_SRV_BWA_001_OK
    
    /**
     * @desc Check that the IUT responds with a configured bandwidth allocation when queried by a MEC Application
     * @see https://forge.etsi.org/gitlab/mec/MEC-tests/blob/master/Test%20Purposes/Plat/Mp1/Bandwidth/PlatBandwidthManager.tplan2
     * @see hhttps://forge.etsi.org/swagger/ui/?url=https://forge.etsi.org/gitlab/mec/gs015-bandwith-mgmt-api/raw/master/BwManagementApi.yaml
     */
    testcase TC_MEC_SRV_BWA_002_OK() runs on HttpComponent system HttpTestAdapter {
        // Local variables
        var Headers v_headers;
        var HttpMessage v_response;
        
        // Test control
        if (not(PICS_MEC_PLAT) or not(PICS_BWMANAGEMENT_API_SUPPORTED)) {
            log("*** " & testcasename() & ": PICS_MEC_PLAT and PICS_BWMANAGEMENT_API_SUPPORTED required for executing the TC ***");
            setverdict(inconc);
            stop;
        }
        
        // Test component configuration
        f_cf_01_http_up();
        
        // Test adapter configuration
        
        // Preamble
        f_init_default_headers_list(-, -, v_headers);
        httpPort.send(
                      m_http_request(
                                     m_http_request_get(
                                                        PX_ME_BWM_URI & "/" & oct2char(unichar2oct(PX_APP_INSTANCE_ID, "UTF-8")),
                                                        v_headers
                                                        )
                                     )
                      );
        f_selfOrClientSyncAndVerdict(c_prDone, e_success);
        
        // Test Body
        tc_ac.start;
        alt {
          [] httpPort.receive(
                              mw_http_response(
                                               mw_http_response_ok(
                                                                   mw_http_message_body_json(
                                                                                             mw_body_json_bw_info(
                                                                                                                  mw_bw_info(
                                                                                                                             PX_APP_INSTANCE_ID
                                                                                                                             )))))) -> value v_response {
            tc_ac.stop;
            
            log("*** " & testcasename() & ": PASS: IUT successfully responds with a BwInfo ***");
            f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
          }
          [] tc_ac.timeout {
            log("*** " & testcasename() & ": INCONC: Expected message not received ***");
            f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
          }
        } // End of 'alt' statement
        
        // Postamble
        f_cf_01_http_down();
    } // End of testcase TC_MEC_SRV_BWA_002_OK
    
    /**
     * @desc Check that the IUT responds with an error when a request with incorrect parameters is sent by a MEC Application
     * @see https://forge.etsi.org/gitlab/mec/MEC-tests/blob/master/Test%20Purposes/Plat/Mp1/Bandwidth/PlatBandwidthManager.tplan2
     * @see hhttps://forge.etsi.org/swagger/ui/?url=https://forge.etsi.org/gitlab/mec/gs015-bandwith-mgmt-api/raw/master/BwManagementApi.yaml
     */
    testcase TC_MEC_SRV_BWA_002_BR() runs on HttpComponent system HttpTestAdapter {
        // Local variables
        var Headers v_headers;
        var HttpMessage v_response;
        
        // Test control
        if (not(PICS_MEC_PLAT) or not(PICS_BWMANAGEMENT_API_SUPPORTED)) {
            log("*** " & testcasename() & ": PICS_MEC_PLAT and PICS_BWMANAGEMENT_API_SUPPORTED required for executing the TC ***");
            setverdict(inconc);
            stop;
        }
        
        // Test component configuration
        f_cf_01_http_up();
        
        // Test adapter configuration
        
        // Preamble
        f_init_default_headers_list(-, -, v_headers);
        httpPort.send(
                      m_http_request(
                                     m_http_request_get(
                                                        PX_ME_BWM_URI & "/app_instance_id=" & oct2char(unichar2oct(PX_APP_INSTANCE_ID, "UTF-8")), // 'app_instance_id=' is a wrong parameter
                                                        v_headers
                                                        )
                                     )
                      );
        f_selfOrClientSyncAndVerdict(c_prDone, e_success);
        
        // Test Body
        tc_ac.start;
        alt {
          [] httpPort.receive(
                              mw_http_response(
                                               mw_http_response_400_bad_request(
                                                                                mw_http_message_body_json(
                                                                                                          mw_body_json_problem_details(
                                                                                                                                       mw_problem_details(
                                                                                                                                                          -, -, 400
                                                                                                                                                          )))))) {
            tc_ac.stop;
            
            log("*** " & testcasename() & ": PASS: IUT successfully responds with a correct error message ***");
            f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
          }
          [] tc_ac.timeout {
            log("*** " & testcasename() & ": INCONC: Expected message not received ***");
            f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
          }
        } // End of 'alt' statement
        
        // Postamble
        f_cf_01_http_down();
    } // End of testcase TC_MEC_SRV_BWA_002_BR
    
    /**
     * @desc Check that the IUT responds with an error when a request with an unknown resource URI is sent by a MEC Application
     * @see https://forge.etsi.org/gitlab/mec/MEC-tests/blob/master/Test%20Purposes/Plat/Mp1/Bandwidth/PlatBandwidthManager.tplan2
     * @see hhttps://forge.etsi.org/swagger/ui/?url=https://forge.etsi.org/gitlab/mec/gs015-bandwith-mgmt-api/raw/master/BwManagementApi.yaml
     */
    testcase TC_MEC_SRV_BWA_002_NF() runs on HttpComponent system HttpTestAdapter {
        // Local variables
        var Headers v_headers;
        var HttpMessage v_response;
        
        // Test control
        if (not(PICS_MEC_PLAT) or not(PICS_BWMANAGEMENT_API_SUPPORTED)) {
            log("*** " & testcasename() & ": PICS_MEC_PLAT and PICS_BWMANAGEMENT_API_SUPPORTED required for executing the TC ***");
            setverdict(inconc);
            stop;
        }
        
        // Test component configuration
        f_cf_01_http_up();
        
        // Test adapter configuration
        
        // Preamble
        f_init_default_headers_list(-, -, v_headers);
        httpPort.send(
                      m_http_request(
                                     m_http_request_get(
                                                        PX_ME_BWM_URI & "/" & oct2char(unichar2oct(PX_UNKNOWN_APP_INSTANCE_ID, "UTF-8")),
                                                        v_headers
                                                        )
                                     )
                      );
        f_selfOrClientSyncAndVerdict(c_prDone, e_success);
        
        // Test Body
        tc_ac.start;
        alt {
          [] httpPort.receive(
                              mw_http_response(
                                               mw_http_response_404_not_found(
                                                                              mw_http_message_body_json(
                                                                                                        mw_body_json_problem_details(
                                                                                                                                     mw_problem_details(
                                                                                                                                                          -, -, 404
                                                                                                                                                          )))))) {
            tc_ac.stop;
            
            log("*** " & testcasename() & ": PASS: IUT successfully responds with a correct error message ***");
            f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
          }
          [] tc_ac.timeout {
            log("*** " & testcasename() & ": INCONC: Expected message not received ***");
            f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
          }
        } // End of 'alt' statement
        
        // Postamble
        f_cf_01_http_down();
    } // End of testcase TC_MEC_SRV_BWA_002_NF
    
    /**
     * @desc Check that the IUT responds with a registration and initialisation approval for the requested bandwidth requirements sent by a MEC Application
     * @see https://forge.etsi.org/gitlab/mec/MEC-tests/blob/master/Test%20Purposes/Plat/Mp1/Bandwidth/PlatBandwidthManager.tplan2
     * @see hhttps://forge.etsi.org/swagger/ui/?url=https://forge.etsi.org/gitlab/mec/gs015-bandwith-mgmt-api/raw/master/BwManagementApi.yaml
     */
    testcase TC_MEC_SRV_BWA_003_OK() runs on HttpComponent system HttpTestAdapter {
        // Local variables
        var Headers v_headers;
        var HttpMessage v_response;
        
        // Test control
        if (not(PICS_MEC_PLAT) or not(PICS_BWMANAGEMENT_API_SUPPORTED)) {
            log("*** " & testcasename() & ": PICS_MEC_PLAT and PICS_BWMANAGEMENT_API_SUPPORTED required for executing the TC ***");
            setverdict(inconc);
            stop;
        }
        
        // Test component configuration
        f_cf_01_http_up();
        
        // Test adapter configuration
        
        // Preamble
        f_init_default_headers_list(-, -, v_headers);
        httpPort.send(
                      m_http_request(
                                     m_http_request_get(
                                                        PX_ME_BWM_URI,
                                                        v_headers,
                                                        m_http_message_body_json(
                                                                                 m_body_json_bw_info(
                                                                                                     m_bw_info(
                                                                                                               PX_APP_INSTANCE_ID,
                                                                                                               SESSION_SPECIFIC_BW_ALLOCATION, // Request type
                                                                                                               "1024", // FixedAllocation
                                                                                                               Downlink // AllocationDirection
                                                                                                               )
                                                                                                     )
                                                                                 )

                                                        )
                                     )
                      );
        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_bw_info(
                                                                                                                           mw_bw_info(
                                                                                                                                      PX_APP_INSTANCE_ID
                                                                                                                                      )))))) -> value v_response {
            tc_ac.stop;
            
            log("*** " & testcasename() & ": PASS: IUT successfully responds with a BwInfo ***");
            f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
          }
          [] tc_ac.timeout {
            log("*** " & testcasename() & ": INCONC: Expected message not received ***");
            f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
          }
        } // End of 'alt' statement
        
        // Postamble
        f_cf_01_http_down();
    } // End of testcase TC_MEC_SRV_BWA_003_OK
    
    
  } // End of group me_app_role 
  } // End of group me_app_role 
  
  
+4 −1
Original line number Original line Diff line number Diff line
@@ -116,7 +116,10 @@ module AtsMec_TestControl {
    }
    }


    if (PICS_MEC_PLAT and PICS_BWMANAGEMENT_API_SUPPORTED) {
    if (PICS_MEC_PLAT and PICS_BWMANAGEMENT_API_SUPPORTED) {
      execute(TP_MEC_SRV_BWA_001_OK());
      execute(TC_MEC_SRV_BWA_001_OK());
      execute(TC_MEC_SRV_BWA_002_OK());
      execute(TC_MEC_SRV_BWA_002_BR());
      execute(TC_MEC_SRV_BWA_002_NF());
    }
    }
  } // End of 'control' statement
  } // End of 'control' statement


Loading