Commit d6f1eac6 authored by Yann Garcia's avatar Yann Garcia
Browse files

Add RLOC tests

parent a49e6b3a
Loading
Loading
Loading
Loading
+3 −12
Original line number Diff line number Diff line
@@ -239,7 +239,7 @@ int http_codec::encode_response (const LibItsHttp__TypesAndValues::Response& p_r
  }
  p_encoding_buffer.put_cs("\r\n");
  
  // Encode headers excepeted the Content-Length
  // Encode headers excepted the Content-Length
  const LibItsHttp__TypesAndValues::HeaderLines& headers = p_response.header();
  std::string content_type;
  for (int i = 0; i < headers.size_of(); i++) {
@@ -504,16 +504,7 @@ int http_codec::decode_body(TTCN_Buffer& decoding_buffer, LibItsHttp__MessageBod
  OCTETSTRING s(decoding_buffer.get_len() - decoding_buffer.get_pos(), decoding_buffer.get_data() + decoding_buffer.get_pos());
  loggers::get_instance().log_msg("http_codec::decode_body: raw body=", s);
  
#if defined(GEMALTO_FIX) // Temporary fix to be removed
  // GEMALTO Encode in hex string
  if ((s.lengthof() & 0x00000001) == 0x00000001) {
    s = int2oct(0, 1) + s;
  }
  s = str2oct(CHARSTRING(s.lengthof(), (const char*)(static_cast<const unsigned char*>(s))));
  loggers::get_instance().log_msg("http_codec::decode_body: Convert string to binary: ", s);
#endif
  
  // Align the payload length with the specified Content-Lenght value
  // Align the payload length with the specified Content-Length value
  loggers::get_instance().log("http_codec::decode_body: _dc.length=%d - body length=%d", _dc.length, s.lengthof());
  OCTETSTRING body;
  if (_dc.length != 0) {
@@ -524,7 +515,7 @@ int http_codec::decode_body(TTCN_Buffer& decoding_buffer, LibItsHttp__MessageBod
      body = OCTETSTRING(_dc.length, p);
    }
  } else {
    loggers::get_instance().warning("http_codec::decode_body: No Conten-Length header, process all remaining bytes");
    loggers::get_instance().warning("http_codec::decode_body: No Content-Length header, process all remaining bytes");
    body = s;
  }
  loggers::get_instance().log_msg("http_codec::decode_body: Aligned body=", body);
+9 −4
Original line number Diff line number Diff line
@@ -59,6 +59,11 @@ int json_codec::decode (const OCTETSTRING& p_data, LibItsHttp__JsonMessageBodyTy
      LocationAPI__TypesAndValues::UserList user_list;
      user_list.decode(LocationAPI__TypesAndValues::UserList_descr_, decoding_buffer, TTCN_EncDec::CT_JSON);
      msg.userList() = user_list;
    } else if (it->second.find("\"accessPointList\"") != std::string::npos) { // Be carefull to the order
                                                                       // TODO To be refined, find("\"accessPointList\"") is not optimal
    LocationAPI__TypesAndValues::AccessPointList access_point_list;
    access_point_list.decode(LocationAPI__TypesAndValues::AccessPointList_descr_, decoding_buffer, TTCN_EncDec::CT_JSON);
    msg.accessPointList() = access_point_list;
  } else if (it->second.find("\"userInfo\"") != std::string::npos) {
    LocationAPI__TypesAndValues::UserInfo user_info;
    user_info.decode(LocationAPI__TypesAndValues::UserInfo_descr_, decoding_buffer, TTCN_EncDec::CT_JSON);
+3 −2
Original line number Diff line number Diff line
@@ -7,7 +7,8 @@ LibCommon_Time.PX_TAC := 30.0
LibCommon_Sync.PX_TSYNC_TIME_LIMIT := 30.0;
LibCommon_Sync.PX_TSHUT_DOWN_TIME_LIMIT := 30.0;

LibItsHttp_Pics.PICS_HEADER_HOST := "192.168.1.140"
#LibItsHttp_Pics.PICS_HEADER_HOST := "192.168.1.140"
LibItsHttp_Pics.PICS_HEADER_HOST := "172.16.3.114"
#LibItsHttp_Pics.PICS_HEADER_HOST := "172.28.4.87"

LibItsHttp_Pics.PICS_HEADER_CONTENT_TYPE := "application/json"
@@ -31,7 +32,7 @@ LogEventTypes:= Yes

[TESTPORT_PARAMETERS]
# In this section you can specify parameters that are passed to Test Ports.
system.httpPort.params := "HTTP(codecs=json:json_codec)/TCP(debug=1,server=192.168.1.140,port=8081,use_ssl=0)"
system.httpPort.params := "HTTP(codecs=json:json_codec)/TCP(debug=1,server=172.16.3.114,port=8081,use_ssl=0)"

[DEFINE]
# In this section you can create macro definitions,
+1 −1
Original line number Diff line number Diff line
@@ -100,4 +100,4 @@ module AtsMec_LocationAPI_TestCases {
    
  } // End of group me_app_role 
  
} // End of module AtsMec_TestCases 
} // End of module AtsMec_LocationAPI_TestCases 
+99 −0
Original line number Diff line number Diff line
/**
 *    @author   ETSI / STF569
 *    @version  $URL:$
 *              $ID:$
 *    @desc     This module provides the MEC test cases.
 *    @copyright   ETSI Copyright Notification
 *                 No part may be reproduced except as authorized by written permission.
 *                 The copyright and the foregoing restriction extend to reproduction in all media.
 *                 All rights reserved.
 *    @see      ETSI GS MEC 003, Draft ETSI GS MEC 013 V2.0.3 (2018-10)
 */
module AtsMec_RadioNodeLocationAPI_TestCases {
  
  // Libcommon
  import from LibCommon_Time all;
  import from LibCommon_VerdictControl all;
  import from LibCommon_Sync all;
  
  // LibHttp
  import from LibItsHttp_TypesAndValues all;
  import from LibItsHttp_Functions all;
  import from LibItsHttp_Templates all;
  import from LibItsHttp_JsonTemplates all;
  import from LibItsHttp_TestSystem all;
  
  // LibMec_LocationAPI
  import from LocationAPI_TypesAndValues all;
  import from LocationAPI_Templates all;
  import from LocationAPI_Pics all;
  import from LocationAPI_Pixits all;
  
  // LibMec
  import from LibMec_Functions all;
  import from LibMec_Pics all;
  import from LibMec_Pixits all;
  
  group me_app_role {
    
    /**
     * @desc Check that the IUT responds with the list of radio nodes currently associated with the MEC host and the location of each radio node when queried by a MEC Application
     * @see https://forge.etsi.org/gitlab/mec/MEC-tests/blob/master/Test%20Purposes/Plat/Mp1/RadioNode/PlatRadioNodeLocation.tplan2
     * @see https://forge.etsi.org/gitlab/mec/gs013-location-api/blob/master/LocationAPI.yaml#/definitions/AccessPointList
     */
    testcase TC_MEC_PLAT_MP1_RLOC_BV_001() runs on HttpComponent system HttpTestAdapter {
        // Local variables
        var HeaderLines v_headers;
        var HttpMessage v_response;
        
        // Test control
        if (not(PICS_PLAT_IUT) or not(PICS_LOCATION_API_SUPPORTED)) {
            log("*** " & testcasename() & ": PICS_PLAT_IUT and PICS_LOCATION_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_ME_APP_Q_ZONE_ID_URI & "/" & oct2char(unichar2oct(PX_ZONE_ID, "UTF-8")) & "/accessPoints",
                                                        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_access_point_list(
                                                                                                                            mw_access_point_list(
                                                                                                                                                 PX_ZONE_ID
                                                                                                                                                 )))))) -> value v_response {
            log("*** " & testcasename() & ": PASS: IUT successfully responds with an AccessPoint list containing a ZoneId ***");
            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_PLAT_MP1_RLOC_BV_001
    
  } // End of group me_app_role 
  
} // End of module AtsMec_RadioNodeLocationAPI_TestCases 
Loading