Commit b30bee5c authored by garciay's avatar garciay
Browse files

Validate TC_ECRF_HTTP_POST_BV_01

parent 6580ca29
Loading
Loading
Loading
Loading
+4 −5
Original line number Diff line number Diff line
@@ -440,7 +440,7 @@ int http_codec::decode_body(TTCN_Buffer& decoding_buffer, LibItsHttp__MessageBod
       LibItsHttp__XmlMessageBodyTypes::XmlBody xml_body;
       // TODO To be refined adding a string identifier to check which codec to use. E.g. held_code.id() returns "xmlns=\"urn:ietf:params:xml:ns:geopriv:held\">"
       if (
           (p["decode_str"].find("xmlns=\"urn:ietf:params:xml:ns:geopriv:held\">") != std::string::npos) ||
           (p["decode_str"].find("xmlns=\"urn:ietf:params:xml:ns:geopriv:held\"") != std::string::npos) ||
           (p["decode_str"].find("xmlns=\"urn:ietf:params:xml:ns:pidf\">") != std::string::npos)
           ) {
         loggers::get_instance().log("http_codec::decode_body: Identified Held'");
@@ -457,9 +457,8 @@ int http_codec::decode_body(TTCN_Buffer& decoding_buffer, LibItsHttp__MessageBod
           loggers::get_instance().warning("http_codec::decode_body: No codec for HELD");
           xml_body.raw() = CHARSTRING(body.lengthof(), (char*)static_cast<const unsigned char*>(body));
         }
         message_body.xml__body() = xml_body;
       } else if (p["decode_str"].find("xmlns=\"urn:ietf:params:xml:ns:lost1\">") != std::string::npos) {
         loggers::get_instance().log("http_codec::decode_body: Find 'urn:ietf:params:xml:ns:loat1'");
       } else if (p["decode_str"].find("xmlns=\"urn:ietf:params:xml:ns:lost1\"") != std::string::npos) {
         loggers::get_instance().log("http_codec::decode_body: Find 'urn:ietf:params:xml:ns:lost1'");
         if (_codecs["lost"].get() != nullptr) {
           loggers::get_instance().log("http_codec::decode_body: Call 'lost_codec'");
           if (_codecs["lost"]->decode(body, (Record_Type&)xml_body, &p) == -1) {
@@ -473,11 +472,11 @@ int http_codec::decode_body(TTCN_Buffer& decoding_buffer, LibItsHttp__MessageBod
           loggers::get_instance().warning("http_codec::decode_body: No codec for LOST");
           xml_body.raw() = CHARSTRING(body.lengthof(), (char*)static_cast<const unsigned char*>(body));
         }
         message_body.xml__body() = xml_body;
       } else {
         loggers::get_instance().warning("http_codec::decode_body: No codec found");
         xml_body.raw() = CHARSTRING(body.lengthof(), (char*)static_cast<const unsigned char*>(body));
       }
       message_body.xml__body() = xml_body;
    } else if (p["decode_str"].find("<html>") != std::string::npos) { // Try to identify HTML
      loggers::get_instance().log("http_codec::decode_body: Find html message");
      LibItsHttp__MessageBodyTypes::TextBody txt_body;
+10 −9
Original line number Diff line number Diff line
@@ -41,10 +41,6 @@ int lost_codec::decode (const OCTETSTRING& p_data, LibItsHttp__XmlMessageBodyTyp
{
  loggers::get_instance().log_msg(">>> lost_codec::decode: p_data=", p_data);

  TTCN_EncDec::set_error_behavior(TTCN_EncDec::ET_ALL, TTCN_EncDec::EB_DEFAULT);
  TTCN_EncDec::clear_error();
  TTCN_Buffer decoding_buffer(p_data);

  // Sanity checks
  params::const_iterator it;
  if (p_params == nullptr) {
@@ -58,14 +54,19 @@ int lost_codec::decode (const OCTETSTRING& p_data, LibItsHttp__XmlMessageBodyTyp
    }
  }
  
  if (it->second.find("<findService") != std::string::npos) {
    urn__ietf__params__xml__ns__lost1::FindService find_service;
    find_service.decode(urn__ietf__params__xml__ns__lost1::FindService_descr_, decoding_buffer, TTCN_EncDec::CT_XER, XER_EXTENDED);
    msg.findServiceRequest() = find_service;
  } else if (it->second.find("<findServiceResponse") != std::string::npos) {
  TTCN_EncDec::set_error_behavior(TTCN_EncDec::ET_ALL, TTCN_EncDec::EB_DEFAULT);
  TTCN_EncDec::clear_error();
  TTCN_Buffer decoding_buffer(p_data);
  
  if (it->second.find("<findServiceResponse") != std::string::npos) {
    loggers::get_instance().warning("lost_codec::decode: Process FindServiceResponse");
    urn__ietf__params__xml__ns__lost1::FindServiceResponse find_service_response;
    find_service_response.decode(urn__ietf__params__xml__ns__lost1::FindServiceResponse_descr_, decoding_buffer, TTCN_EncDec::CT_XER, XER_EXTENDED);
    msg.findServiceResponse() = find_service_response;
 } else if (it->second.find("<findService") != std::string::npos) {
    urn__ietf__params__xml__ns__lost1::FindService find_service;
    find_service.decode(urn__ietf__params__xml__ns__lost1::FindService_descr_, decoding_buffer, TTCN_EncDec::CT_XER, XER_EXTENDED);
    msg.findServiceRequest() = find_service;
  } else {
    loggers::get_instance().warning("lost_codec::decode: Unsupported variant");
    return -1;
+47 −6
Original line number Diff line number Diff line
@@ -138,32 +138,64 @@ int sip_codec_request::encode_request_headers(const LibSip__SIPTypesAndValues::M
  const LibSip__SIPTypesAndValues::From from = p_msg_header.fromField();
  osip_from_t* from_header = nullptr;
  if (encode_from_header(p_msg_header.fromField(), from_header) == -1) {
    loggers::get_instance().warning("sip_codec_request::encode_request_headers: Faile to encode From header");
    return -1;
  }
  char* hvalue;
  ::osip_from_to_str(from_header, &hvalue);
  loggers::get_instance().log("sip_codec_request::encode_request_headers: From:%s", hvalue);
  ::osip_message_set_from(p_sip_message, hvalue);
  ::osip_from_free(from_header);
  //  ::osip_from_free(from_header);
  
  // To
  const LibSip__SIPTypesAndValues::To to = p_msg_header.toField();
  osip_to_t* to_header = nullptr;
  if (encode_to_header(p_msg_header.toField(), to_header) == -1) {
    loggers::get_instance().warning("sip_codec_request::encode_request_headers: Faile to encode To header");
    return -1;
  }
  ::osip_to_to_str(to_header, &hvalue);
  loggers::get_instance().log("sip_codec_request::encode_request_headers: To:%s", hvalue);
  ::osip_message_set_to(p_sip_message, hvalue);
  ::osip_to_free(to_header);
  //  ::osip_to_free(to_header);

  // Via
  const LibSip__SIPTypesAndValues::Via via = p_msg_header.via();
  osip_via_t* via_header = nullptr;
  if (encode_via_header(p_msg_header.via(), via_header) == -1) {
    loggers::get_instance().warning("sip_codec_request::encode_request_headers: Faile to encode Via header");
    return -1;
  }
  ::osip_via_to_str(via_header, &hvalue);
  loggers::get_instance().log("sip_codec_request::encode_request_headers: Via:%s", hvalue);
  ::osip_message_set_via(p_sip_message, hvalue);
  ::osip_via_free(via_header);
  //  ::osip_via_free(via_header);






  char* buffer = nullptr;
  size_t length = 0;
  int result = ::osip_message_to_str(p_sip_message, &buffer, &length);
  if (result != 0) {
    loggers::get_instance().warning("sip_codec_request::encode_request_headers: Failed to encode data structures");
  } else {
    loggers::get_instance().log("sip_codec_request::encode_request_headers: Message:%s", buffer);
  }











  
  
  return 0;
} // End of method encode_request_headers
@@ -211,12 +243,12 @@ int sip_codec_request::encode_sip_url(const LibSip__SIPTypesAndValues::SipUrl& p
    }
  } else if (components.ischosen(LibSip__SIPTypesAndValues::UriComponents::ALT_tel)) {
    const LibSip__SIPTypesAndValues::TelUriComponents& t = p_sip_uri.components().tel();
    loggers::get_instance().error("sip_codec_request::encode_request_line: Unsupported LibSip__SIPTypesAndValues::UriComponents::ALT_tel");
    loggers::get_instance().error("sip_codec_request::encode_sip_uri: Unsupported LibSip__SIPTypesAndValues::UriComponents::ALT_tel");
  } else if (components.ischosen(LibSip__SIPTypesAndValues::UriComponents::ALT_urn)) {
    const LibSip__SIPTypesAndValues::UrnUriComponents& u = p_sip_uri.components().urn();
    loggers::get_instance().error("sip_codec_request::encode_request_line: Unsupported LibSip__SIPTypesAndValues::UriComponents::ALT_urn");
    loggers::get_instance().error("sip_codec_request::encode_sip_uri: Unsupported LibSip__SIPTypesAndValues::UriComponents::ALT_urn");
  } else if (components.ischosen(LibSip__SIPTypesAndValues::UriComponents::ALT_other)) {
    loggers::get_instance().error("sip_codec_request::encode_request_line: Unsupported LibSip__SIPTypesAndValues::UriComponents::ALT_other");
    loggers::get_instance().error("sip_codec_request::encode_sip_uri: Unsupported LibSip__SIPTypesAndValues::UriComponents::ALT_other");
  } // else, noting to do
  
  if (uri != nullptr) {
@@ -225,6 +257,15 @@ int sip_codec_request::encode_sip_url(const LibSip__SIPTypesAndValues::SipUrl& p
    *p_uri = nullptr;
  }
  
  char* buffer = nullptr;
  size_t length = 0;
  int result = ::osip_uri_to_str(*p_uri, &buffer);
  if (result != 0) {
    loggers::get_instance().warning("sip_codec_request::encode_sip_uri: Failed to encode data structures");
  } else {
    loggers::get_instance().log("sip_codec_request::encode_sip_uri: URI:%s", buffer);
  }
  
  return 0;
} // End of method encode_sip_url

+9 −18
Original line number Diff line number Diff line
@@ -3,14 +3,14 @@

LibCommon_Time.PX_TAC := 30.0

LibItsHttp_Pics.PICS_HEADER_HOST := "location-information-service.azurewebsites.net"
#LibItsHttp_Pics.PICS_HEADER_HOST := "location-information-service.azurewebsites.net"
LibItsHttp_Pics.PICS_HEADER_HOST := "ptsv2.com"

LibNg112_Pics.PICS_LIS_URI := "/api/held"
#LibNg112_Pics.PICS_HTTP_GET_REQUEST := false

#LibNg112_Pixits.PX_DEVICE_URI_TEL := "<uri>+331234567890</uri>" # Position location
LibNg112_Pixits.PX_DEVICE_URI_TEL := "<uri>+331234567891</uri>" # Circle location
#LibNg112_Pixits.PX_DEVICE_URI_TEL := "<uri>+331234567892</uri>" # Civic location
#LibNg112_Pixits.PX_DEVICE_URI_TEL := "<uri>+331234567891</uri>" # Circle location
LibNg112_Pixits.PX_DEVICE_URI_TEL := "<uri>+331234567892</uri>" # Civic location
LibNg112_Pixits.PX_DEVICE_NUMBER_POINT := { 43.616891, 7.053179 }
LibNg112_Pixits.PX_CIRCLE_POS := { 43.617174, 7.05275 }
LibNg112_Pixits.PX_CIRCLE_RADIUS := 15.000
@@ -31,14 +31,10 @@ LogEventTypes:= Yes

[TESTPORT_PARAMETERS]
# In this section you can specify parameters that are passed to Test Ports.
<<<<<<< HEAD
system.SIPP.params := "SIP/UDP(dst_ip=192.168.1.250,dst_port=5060,src_ip=192.168.1.253,src_port=5060)/ETH(mac_src=080027d2b658,mac_dst=90fd61e61902,eth_type=0800)/PCAP(mac_src=080027d2b658,nic=eth1,filter=and udp port 12345)"
system.httpPort.params := "HTTP/TCP(debug=1,server=httpbin.org,port=80,use_ssl=0)"
=======
system.httpPort.params := "HTTP(codecs=lost:lost_codec;held:held_codec)/TCP(debug=1,server=location-information-service.azurewebsites.net,port=80,use_ssl=0)"
#system.httpPort.params := "HTTP(codecs=lost:lost_codec;held:held_codec)/TCP(debug=1,server=ptsv2.com,port=80,use_ssl=0)"
#system.httpPort.params := "HTTP(codecs=lost:lost_codec;held:held_codec)/TCP(debug=1,server=location-information-service.azurewebsites.net,port=80,use_ssl=0)"
system.httpPort.params := "HTTP(codecs=lost:lost_codec;held:held_codec)/TCP(debug=1,server=ptsv2.com,port=80,use_ssl=0)"

#system.SIPP.params := "SIP/UDP(dst_ip=192.168.1.250,dst_port=5060,src_ip=192.168.1.253,src_port=5060)/ETH(mac_src=080027d2b658,mac_dst=90fd61e61902,eth_type=0800)/PCAP(mac_src=080027d2b658,nic=eth1,filter=and udp port 12345)"
>>>>>>> TTCN_3_Developments

[DEFINE]
# In this section you can create macro definitions,
@@ -63,20 +59,15 @@ system.httpPort.params := "HTTP(codecs=lost:lost_codec;held:held_codec)/TCP(debu

[EXECUTE]
# In this section you can specify what parts of your test suite you want to execute.
<<<<<<< HEAD
#AtsNg112_TestCases.TC_1
AtsNg112_TestCases.TC_2
=======
#AtsNg112_TestCases.TC_LIS_HTTP_POST_BV_01
#AtsNg112_TestCases.TC_LIS_HTTP_POST_BV_02
#AtsNg112_TestCases.TC_LIS_HTTP_POST_BV_03
#AtsNg112_TestCases.TC_LIS_HTTP_POST_BV_04
#AtsNg112_TestCases.TC_LIS_HTTP_POST_BV_05
#AtsNg112_TestCases.TC_LIS_HTTP_POST_BV_06
AtsNg112_TestCases.TC_LIS_HTTP_GET_BV_01
#AtsNg112_TestCases.TC_LIS_HTTP_GET_BV_01
#AtsNg112_TestCases.TC_LIS_HTTP_GET_BV_02
#AtsNg112_TestCases.TC_ECRF_HTTP_POST_BV_01
>>>>>>> TTCN_3_Developments
AtsNg112_TestCases.TC_ECRF_HTTP_POST_BV_01

[GROUPS]
# In this section you can specify groups of hosts. These groups can be used inside the
+2 −2
Original line number Diff line number Diff line
@@ -54,12 +54,12 @@ system.httpPort.params := "HTTP(codecs=held:held_codec;html:html_codec;json:json
[EXECUTE]
# In this section you can specify what parts of your test suite you want to execute.
#TestCodec_Register.tc_register_request_1
#TestCodec_Register.tc_register_request_2
TestCodec_Register.tc_register_request_2
#TestCodec_Register.tc_invite_request_2
#TestCodec_Register.tc_invite_request_2
#TestCodec_HttpRequest.tc_http_get_1
#TestCodec_HttpResponse.tc_http_200_ok_1
TestCodec_HttpPort.tc_http_map_1
#TestCodec_HttpPort.tc_http_map_1

[GROUPS]
# In this section you can specify groups of hosts. These groups can be used inside the
Loading