Commit c6eb2578 authored by garciay's avatar garciay
Browse files

Validate TC LIS 01..05, Implement TP LIS 06

parent 3b740c32
Loading
Loading
Loading
Loading
+15 −2
Original line number Diff line number Diff line
@@ -18,6 +18,8 @@ int held_codec::encode (const LibItsHttp__XmlMessageBodyTypes::XmlBody& msg, OCT
  TTCN_EncDec::set_error_behavior(TTCN_EncDec::ET_ALL, TTCN_EncDec::EB_DEFAULT);
  TTCN_Buffer encoding_buffer;
  
  CHARSTRING h("<?xml version=\"1.0\" ?>\n");
  encoding_buffer.put_s(h.lengthof(), (const unsigned char*)static_cast<const char*>(h));
  if (msg.ischosen(LibItsHttp__XmlMessageBodyTypes::XmlBody::ALT_locationRequest)) {
    const urn__ietf__params__xml__ns__geopriv__held::LocationRequestType& location_request = msg.locationRequest();
    loggers::get_instance().log_msg("held_codec::encode: Process LocationRequestType", (const Base_Type&)location_request);
@@ -31,6 +33,17 @@ int held_codec::encode (const LibItsHttp__XmlMessageBodyTypes::XmlBody& msg, OCT
    return -1;
  }
  data = OCTETSTRING(encoding_buffer.get_len(), encoding_buffer.get_data());
  { // TITAN issue: variant "name as 'device'"; does not work, need to replace "deviceIdenty" by "device"
    std::string s(static_cast<const unsigned char*>(data), data.lengthof() + static_cast<const unsigned char*>(data));
    size_t idx = 0;
    std::string f("deviceIdentity");
    std::string t("device");
    while ((idx = s.find(f)) != std::string::npos) {
      s.replace(idx, f.length(), t);
      idx += t.length();
    } // End of 'while' statement
    data = OCTETSTRING(s.length(), (const unsigned char*)s.c_str());
  }
  loggers::get_instance().log_msg("held_codec::decode: After encoding: ", data);
  
  loggers::get_instance().log("<<< held_codec::encode");
+5 −3
Original line number Diff line number Diff line
@@ -7,8 +7,9 @@ LibItsHttp_Pics.PICS_HEADER_HOST := "location-information-service.azurewebsites.

LibNg112_Pics.PICS_LIS_URI := "/api/held";

#LibNg112_Pixits.PX_DEVICE_URI_TEL := "<uri>+331234567890</uri>" # Position
LibNg112_Pixits.PX_DEVICE_URI_TEL := "<uri>+331234567891</uri>" # Circle
#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>" # Civc 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
@@ -61,7 +62,8 @@ system.httpPort.params := "HTTP(codecs=lost:lost_codec;held:held_codec)/TCP(debu
#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_GET_BV_01
AtsNg112_TestCases.TC_LIS_HTTP_POST_BV_06
#AtsNg112_TestCases.TC_LIS_HTTP_GET_BV_01
#AtsNg112_TestCases.TC_ECRF_HTTP_POST_BV_01

[GROUPS]
+135 −49
Original line number Diff line number Diff line
@@ -404,58 +404,14 @@ module AtsNg112_TestCases {
                                               mw_http_response_ok(
                                                                   mw_http_message_body_xml(
                                                                                            mw_body_xml_location_response(
                                                                                                                          mw_locationResponse(-, ?)
                                                                                                                          mw_locationResponse(
                                                                                                                                              mw_locationUriSet
                                                                                                                                              )
                                                                                                                          ))))) -> value v_response {
            var Presence v_presence;
            var Tuple v_tuple;
            var Geopriv v_geopriv;
            var Circle v_circle;
            var universal charstring v_temp;
            var integer v_result;
            
            tc_ac.stop;

            // Extract presence element from Location-Response
            v_temp := v_response.response.body.xml_body.locationResponse.elem_list[0];
            v_result := decvalue_unichar(v_temp, v_presence);
            if (v_result == 0) {
              log(match(v_presence, mw_presence)); // FIXME Required by TITAN to get details in case of mismatch
              if (match(v_presence, mw_presence)) {
                // Extract first Tuple element from Presence
                v_tuple := v_presence.tuple_list[0];
                v_temp := v_tuple.status.elem_list[0];
                // Extract Geopriv element from Tuple
                v_result := decvalue_unichar(v_temp, v_geopriv);
                if (v_result == 0) {
                  log(match(v_geopriv, mw_geopriv(mw_location_info({ ? })))); // FIXME Required by TITAN to get details in case of mismatch
                  if (match(v_geopriv, mw_geopriv(mw_location_info({ ? })))) {
                    // Extract Circle element from Tuple
                    v_temp := v_geopriv.location_info.elem_list[0];
                    v_result := decvalue_unichar(v_temp, v_circle);
                    log(match(v_circle, mw_circle(mw_center_group_pos(PX_CIRCLE_POS), mw_radius(PX_CIRCLE_UOM, (PX_CIRCLE_RADIUS - PX_DOUBLE_CMP_EPSILON .. PX_CIRCLE_RADIUS + PX_DOUBLE_CMP_EPSILON)), PX_SRS_NAME))); // FIXME Required by TITAN to get details in case of mismatch
                    if (match(v_circle, mw_circle(mw_center_group_pos(PX_CIRCLE_POS), mw_radius(PX_CIRCLE_UOM, (PX_CIRCLE_RADIUS - PX_DOUBLE_CMP_EPSILON .. PX_CIRCLE_RADIUS + PX_DOUBLE_CMP_EPSILON)), PX_SRS_NAME))) {
            log("*** " & testcasename() & ": PASS: IUT successfully responds with a Point ***");
            f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
                    } else {
                      log("*** " & testcasename() & ": FAIL: Incorrect Circle position ***");
                      f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
                    }
                  } else {
                    log("*** " & testcasename() & ": FAIL: Unexpected response ***");
                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
                  }
                } else {
                  log("*** " & testcasename() & ": FAIL: Unexpected response ***");
                  f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
                }
              } else {
                log("*** " & testcasename() & ": FAIL: Unexpected response ***");
                f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
              }
            } else {
              log("*** " & testcasename() & ": FAIL: Unexpected response ***");
              f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
            }
          }
          [] tc_ac.timeout {
            log("*** " & testcasename() & ": INCONC: Expected message not received ***");
@@ -675,6 +631,136 @@ module AtsNg112_TestCases {
        f_cf_01_http_down();
    } // End of testcase TC_LIS_HTTP_POST_BV_05
    
    /**
     * @desc IUT successfully responds with a CIVIC address when it receives a HTTP POST location request without location type
     * @reference
     *           ETSI TS 103 479 Vm.t.e (yyyy-mm) Clause 5.5 Location Information Server (LIS)
     *           Next Generation 112 Long Term Definition http://www.eena.org/uploads/gallery/files/pdf/2013-03-15-eena_ng_longtermdefinitionupdated.pdf Clause 4.10
     *           https://tools.ietf.org/html/rfc5985
     * @remark PICS Selection PICS_HTTP_POST_REQUEST PICS_LOCATION_HELD
     * <pre>
     * Initial conditions with {
     *   the IUT entity havingLocationMappingFor the DEVICE_NUMBER_CIVIC containing
     *     "CIVIC_ADDRESS"
     *     ;
     *   ;
     * }
     * </pre>
     */
    testcase TC_LIS_HTTP_POST_BV_06() runs on HttpComponent system TestAdapter {
        // Local variables
        var HeaderLines v_headers;
        var HttpMessage v_response;
        
        // Test control
        if (not(PICS_LIS_IUT) or (not PICS_HTTP_POST_REQUEST) or (not PICS_LOCATION_HELD)) {
            log("*** " & testcasename() & ": PICS_LIS_IUT and PICS_HTTP_POST_REQUEST and PICS_LOCATION_HELD 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);
        f_remove_headears_list({ c_header_accept }, v_headers);
        httpPort.send(
                      m_http_request(
                                     m_http_request_post(
                                                         PICS_LIS_URI,
                                                         v_headers,
                                                         m_http_message_body_xml(m_body_xml_location_request(
                                                                                                             m_locationRequest(
                                                                                                                               { encvalue_unichar(valueof(m_device({ PX_DEVICE_URI_TEL }))) },
                                                                                                                               m_locationTypeType(
                                                                                                                                                  m_locationTypeBase_civic,
                                                                                                                                                  true
                                                                                                                                                  )
                                                                                                                               )
                                                                                                             )
                                                                                 )
                                                         )
                                     )
                      );
        f_selfOrClientSyncAndVerdictTestBody(c_prDone, e_success);
        
        // Test body
        tc_ac.start;
        alt {
          [] httpPort.receive(
                              mw_http_response(
                                               mw_http_response_ok(
                                                                   mw_http_message_body_xml(
                                                                                            mw_body_xml_location_response(
                                                                                                                          mw_locationResponse(-, ?)
                                                                                                                          ))))) -> value v_response {
            var Presence v_presence;
            var Tuple v_tuple;
            var Geopriv v_geopriv;
            var universal charstring v_temp;
            var CivicAddress v_civic_address;
            var integer v_result;
            
            tc_ac.stop;
            
            // Extract presence element from Location-Response
            v_temp := v_response.response.body.xml_body.locationResponse.elem_list[0];
            v_result := decvalue_unichar(v_temp, v_presence);
            if (v_result == 0) {
              log(match(v_presence, mw_presence)); // FIXME Required by TITAN to get details in case of mismatch
              if (match(v_presence, mw_presence)) {
                // Extract first Tuple element from Presence
                v_tuple := v_presence.tuple_list[0];
                v_temp := v_tuple.status.elem_list[0];
                // Extract Geopriv element from Tuple
                v_result := decvalue_unichar(v_temp, v_geopriv);
                log("################### v_geopriv: ", v_geopriv);
                if (v_result == 0) {
                  log(match(v_geopriv, mw_geopriv(mw_location_info({ ? })))); // FIXME Required by TITAN to get details in case of mismatch
                  if (match(v_geopriv, mw_geopriv(mw_location_info({ ? })))) {
                    // Extract Civic address element from Tuple
                    v_temp := v_geopriv.location_info.elem_list[0];
                    log("################### v_temp: ", v_temp);
                    v_result := decvalue_unichar(v_temp, v_civic_address);
                    log("################### v_civic_address: ", v_civic_address);
                    log(match(v_civic_address, mw_civicAddress("AU"))); // FIXME Required by TITAN to get details in case of mismatch
                    if (match(v_civic_address,  mw_civicAddress("AU"))) {
                      log("*** " & testcasename() & ": PASS: IUT successfully responds with a Point ***");
                      f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
                    } else {
                      log("*** " & testcasename() & ": FAIL: Incorrect CivicAddress position ***");
                      f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
                    }
                  } else {
                    log("*** " & testcasename() & ": FAIL: Unexpected response ***");
                    f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
                  }
                } else {
                  log("*** " & testcasename() & ": FAIL: Unexpected response ***");
                  f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
                }
              } else {
                log("*** " & testcasename() & ": FAIL: Unexpected response ***");
                f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
              }
            } else {
              log("*** " & testcasename() & ": FAIL: Unexpected response ***");
              f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
            }
          }
          [] tc_ac.timeout {
            log("*** " & testcasename() & ": INCONC: Expected message not received ***");
            f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_timeout);
          }
        } // End of 'alt' statement
        
        // Postamble
        f_cf_01_http_down();
    } // End of testcase TC_LIS_HTTP_POST_BV_06
    
    /**
     * @desc IUT successfully returns the location when a locationURI is dereferenced
     * @reference
+2 −1
Original line number Diff line number Diff line
@@ -44,7 +44,7 @@ import from XSD all;

type DeviceIdentity Device
with {
  variant "name as uncapitalized";
  variant "name as 'device'";
  variant "element";
};

@@ -55,6 +55,7 @@ type record DeviceIdentity
}
with {
  variant "name as uncapitalized";
  variant (elem_list) "namespace as 'urn:ietf:params:xml:ns:geopriv:held:id' prefix 'id'";
  variant (elem_list) "untagged";
  variant (elem_list[-]) "anyElement";
};
+1 −1
Original line number Diff line number Diff line
@@ -683,7 +683,7 @@ type union NotLost
}
with {
  variant "untagged";
  variant (elem) "anyElement from unqualified";
  variant (elem) "anyElement from unqualified, 'http://www.opengis.net/gml'";
};


Loading