Commit 241d5ef9 authored by garciay's avatar garciay
Browse files

Validate ECRF test cases

parent d54dfb73
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -42,6 +42,12 @@ int lost_codec::encode (const LibItsHttp__XmlMessageBodyTypes::XmlBody& msg, OCT
    it = str.find("pointType");
    str = str.substr(0, it) + "Point" + str.substr(it + 9);
  }
  it = str.find("circleType");
  if (it != std::string::npos) {
    str = str.substr(0, it) + "Circle" + str.substr(it + 10);
    it = str.find("circleType");
    str = str.substr(0, it) + "Circle" + str.substr(it + 10);
  }
  
  data = OCTETSTRING(str.length(), (const unsigned char*)str.c_str());
  //data = OCTETSTRING(encoding_buffer.get_len(), encoding_buffer.get_data());
@@ -81,6 +87,10 @@ int lost_codec::decode (const OCTETSTRING& p_data, LibItsHttp__XmlMessageBodyTyp
    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("<error") != std::string::npos) {
    urn__ietf__params__xml__ns__lost1::ExceptionContainer exception;
    exception.decode(urn__ietf__params__xml__ns__lost1::Errors_descr_, decoding_buffer, TTCN_EncDec::CT_XER, XER_EXTENDED);
    msg.exceptionContainer() = exception;
  } else {
    loggers::get_instance().warning("lost_codec::decode: Unsupported variant");
    return -1;
+4 −3
Original line number Diff line number Diff line
@@ -15,10 +15,10 @@ LibItsHttp_Pics.PICS_HEADER_CONTENT_TYPE := "application/lost+xml;charset=utf-8"

#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>+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>+331234567893</uri>" # Civic location
#LibNg112_Pixits.PX_DEVICE_URI_TEL := "<uri>+331234567893</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
@@ -82,7 +82,8 @@ system.httpPort.params := "HTTP(codecs=lost:lost_codec;held:held_codec)/TCP(debu
#AtsNg112_TestCases.TC_LIS_HTTP_GET_BV_01
#AtsNg112_TestCases.TC_LIS_HTTP_GET_BV_02
#AtsNg112_TestCases.TC_ECRF_HTTP_POST_BV_01
AtsNg112_TestCases.TC_ECRF_HTTP_POST_BV_02
#AtsNg112_TestCases.TC_ECRF_HTTP_POST_BV_02
AtsNg112_TestCases.TC_ECRF_HTTP_POST_BV_03

[GROUPS]
# In this section you can specify groups of hosts. These groups can be used inside the
+107 −24
Original line number Diff line number Diff line
@@ -620,7 +620,7 @@ module AtsNg112_TestCases {
                                               mw_http_response_ok(
                                                                   mw_http_message_body_xml(
                                                                                            mw_body_xml_location_response_error(
                                                                                                                                mw_error_type
                                                                                                                                mw_error_type("locationUnknown")
                                                                                                                                ))))) {
            tc_ac.stop;
            log("*** " & testcasename() & ": PASS: Error message received ***");
@@ -828,7 +828,7 @@ module AtsNg112_TestCases {
                                               mw_http_response_ok(
                                                                   mw_http_message_body_xml(
                                                                                            mw_body_xml_location_response_error(
                                                                                                                                mw_error_type
                                                                                                                                mw_error_type("cannotProvideLiType")
                                                                                                                          ))))) -> value v_response {
            log("*** " & testcasename() & ": PASS: Expected error message received ***");
            f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
@@ -1065,13 +1065,13 @@ module AtsNg112_TestCases {
     * @remark PICS Selection PICS_HTTP_POST_REQUEST PICS_SERVICE_LOST
     * <pre>
     * Initial conditions with {
     *   the IUT entity havingServiceBoundaryFor the SERVICE_BOUNDARY_1 containing
     *     serviceMappingFor SERVICE_URN_1 containing
     *        URI indicating value SIP_URI_1;
     *   the IUT entity havingServiceBoundaryFor the E_POLICE_SERVICE_URN containing
     *     serviceMappingFor E_POLICE_SERVICE_URN containing
     *        URI indicating value E_POLICE_SERVICE_URN;
     *   ;
     *   and the IUT entity havingServiceBoundaryFor the SERVICE_BOUNDARY_2 containing
     *     serviceMappingFor SERVICE_URN_2 containing
     *        URI indicating value SIP_URI_2;
     *   and the IUT entity havingServiceBoundaryFor the V_POLICE_SERVICE_BOUNDARY containing
     *     serviceMappingFor V_POLICE_SERVICE_BOUNDARY containing
     *        URI indicating value V_POLICE_SIP_URI;
     *   ;
     * }
     * </pre>
@@ -1105,12 +1105,12 @@ module AtsNg112_TestCases {
                                                                                                                                    {
                                                                                                                                      m_location(
                                                                                                                                                 PX_LOST_ID,
                                                                                                                                                 { m_extension_point(encvalue_unichar(valueof(m_point(PX_LOST_NO_LOST, PX_SRS_NAME, "point1")))) },
                                                                                                                                                 { m_extension_point(encvalue_unichar(valueof(m_point(PX_POINT_IN_E_POLICE_SERVICE_BOUNDARY, PX_SRS_NAME, "point1")))) },
                                                                                                                                                 "geodetic-2d" // TODO Use a Pixit
                                                                                                                                                 )
                                                                                                                                      },
                                                                                 { /*m_notLost(encvalue_unichar(valueof(m_point(PX_LOST_NO_LOST, PX_SRS_NAME, "point1"))))*/ },
                                                                                                                                    PX_LOST_SERVICE_URN_1,
                                                                                                                                    PX_E_POLICE_SERVICE_URN,
                                                                                                                                    true,
                                                                                                                                    value_
                                                                                                                                    )))
@@ -1129,16 +1129,14 @@ module AtsNg112_TestCases {
                                                                                                                                                         { mw_mapping(
                                                                                                                                                                      mw_expires_date_time(PX_LOST_EXPIRES),
                                                                                                                                                                      PX_LOST_LAST_UPDATED,
                                                                                                                                                                      PX_LOST_SOURCE,
                                                                                                                                                                      PX_LOST_SOURCE_ID,
                                                                                                                                                                      -,
                                                                                                                                                                      { PX_LOST_URI } ) }
                                                                                                                                                                      PX_V_POLICE_SOURCE,
                                                                                                                                                                      PX_V_POLICE_SOURCE_ID,
                                                                                                                                                                      { mw_display_name(-, PX_V_POLICE_DISPLAY_NAME) },
                                                                                                                                                                      { PX_E_POLICE_SIP_URI } ) }
            )))))) {
                tc_ac.stop;
                // TODO Need to decode content
                log("*** " & testcasename() & ": PASS: IUT successfully responds with a Point ***");
                f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
                
            }
            [] tc_ac.timeout {
                log("*** " & testcasename() & ": INCONC: Expected message not received ***");
@@ -1199,12 +1197,12 @@ module AtsNg112_TestCases {
                                                                                                                                    {
                                                                                                                                      m_location(
                                                                                                                                                 PX_LOST_ID,
                                                                                                                                                 { m_extension_point(encvalue_unichar(valueof(m_circle(m_center_group_pos(PX_CIRCLE_POS), m_radius(PX_SRS_NAME, PX_CIRCLE_RADIUS), "circle1")))) },
                                                                                                                                                 { m_extension_point(encvalue_unichar(valueof(m_circle(m_center_group_pos(PX_CIRCLE_POS), m_radius(PX_CIRCLE_UOM, PX_CIRCLE_RADIUS), PX_SRS_NAME)))) },
                                                                                                                                                 "geodetic-2d" // TODO Use a Pixit
                                                                                                                                                 )
                                                                                                                                      },
                                                                                 { /*m_notLost(encvalue_unichar(valueof(m_point(PX_LOST_NO_LOST, PX_SRS_NAME, "point1"))))*/ },
                                                                                                                                    PX_LOST_SERVICE_URN_1,
                                                                                                                                    PX_E_POLICE_SERVICE_URN,
                                                                                                                                    true,
                                                                                                                                    value_
                                                                                                                                    )))
@@ -1223,16 +1221,14 @@ module AtsNg112_TestCases {
                                                                                                                                                         { mw_mapping(
                                                                                                                                                                      mw_expires_date_time(PX_LOST_EXPIRES),
                                                                                                                                                                      PX_LOST_LAST_UPDATED,
                                                                                                                                                                      PX_LOST_SOURCE,
                                                                                                                                                                      PX_LOST_SOURCE_ID,
                                                                                                                                                                      -,
                                                                                                                                                                      { PX_LOST_URI } ) }
                                                                                                                                                                      PX_V_POLICE_SOURCE,
                                                                                                                                                                      PX_V_POLICE_SOURCE_ID,
                                                                                                                                                                      { mw_display_name(-, PX_V_POLICE_DISPLAY_NAME) },
                                                                                                                                                                      { PX_E_POLICE_SIP_URI } ) }
            )))))) {
                tc_ac.stop;
                // TODO Need to decode content
                log("*** " & testcasename() & ": PASS: IUT successfully responds with a Point ***");
                f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
                
            }
            [] tc_ac.timeout {
                log("*** " & testcasename() & ": INCONC: Expected message not received ***");
@@ -1244,6 +1240,93 @@ module AtsNg112_TestCases {
        f_cf_01_http_down();
    } // End of testcase TC_ECRF_HTTP_POST_BV_02
    
    /**
     * @desc "IUT successfully responds with an error response for an unknown Service URN in the service boundary"
     * @reference
     *           "ETSI TS 103 479 Vm.t.e (yyyy-mm) Clause XXX EMERGENCY CALL ROUTING FUNCTION (ECRF)",
     *           "Next Generation 112 Long Term Definition http://www.eena.org/uploads/gallery/files/pdf/2013-03-15-eena_ng_longtermdefinitionupdated.pdf Clause 4.4",
     *           "https://tools.ietf.org/html/rfc5222"
     * @remark PICS Selection PICS_HTTP_POST_REQUEST PICS_SERVICE_LOST
     * <pre>
     * Initial conditions with {
     *   the IUT entity havingServiceBoundaryFor the SERVICE_BOUNDARY_1 containing
     *     serviceMappingFor SERVICE_URN_1 containing
     *        URI indicating value SIP_URI_1;
     *   ;
     *   and the IUT entity havingServiceBoundaryFor the SERVICE_BOUNDARY_2 containing
     *     serviceMappingFor SERVICE_URN_2 containing
     *        URI indicating value SIP_URI_2;
     *   ;
     * }
     * </pre>
     */
    testcase TC_ECRF_HTTP_POST_BV_03() runs on HttpComponent system TestAdapter {
        // Local variables
        var HeaderLines v_headers;
        
        // Test control
        if (not(PICS_ECRF_IUT) or (not PICS_HTTP_POST_REQUEST) or (not PICS_SERVICE_LOST)) {
            log("*** " & testcasename() & ": PICS_ECRF_IUT and PICS_HTTP_POST_REQUEST and PICS_SERVICE_LOST 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_post(
                                                         PICS_ECRF_URI,
                                                         v_headers,
                                                         m_http_message_body_xml(
                                                                                 m_body_xml_find_service_request(
                                                                                                             m_find_service_request(
                                                                                                                                    {
                                                                                                                                      m_location(
                                                                                                                                                 PX_LOST_ID,
                                                                                                                                                 { m_extension_point(encvalue_unichar(valueof(m_point(PX_POINT_IN_E_POLICE_SERVICE_BOUNDARY, PX_SRS_NAME, "point2")))) },
                                                                                                                                                 "geodetic-2d" // TODO Use a Pixit
                                                                                                                                                 )
                                                                                                                                      },
                                                                                                                                    { },
                                                                                                                                    PX_E_FIRE_SERVICE_URN,
                                                                                                                                    true,
                                                                                                                                    value_
                                                                                                                                    )))
        )));
        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_find_service_response_error(
                                                                                                                                      mw_exception_serviceNotImplemented(
                                                                                                                                                                         PX_E_FIRE_SERVICE_URN,
                                                                                                                                                                         mw_basic_exception
                                                                                                                                                                         )))))) {
              tc_ac.stop;
              log("*** " & testcasename() & ": PASS: IUT successfully responds with a Point ***");
              f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
            }
            [] 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_ECRF_HTTP_POST_BV_03
    
  } // End of group ecrf_role
  
} // End of module AtsNg112_TestCases 
+28 −10
Original line number Diff line number Diff line
@@ -14,6 +14,12 @@ module LibNg112_Pixits {
        extension "File:../xsd/RFC5139_pdif_geopriv10_civic_address.xsd";
    }
  
  // RFC5222
  import from urn_ietf_params_xml_ns_lost1 language "XSD" all
    with {
        extension "File:../xsd/RFC5222_lost.xsd";
    }

  // OpenGIS
  import from http_www_opengis_net_pidflo_1_0 language "XSD" all
    with {
@@ -76,25 +82,37 @@ module LibNg112_Pixits {
  
  modulepar XSD.String PX_CIVIC_ADDR_LMK := "University of Wollongong";



  
  modulepar XSD.Token PX_LOST_ID := "6020688f1ce1896d";

  modulepar XSD.String PX_LOST_SOURCE := "ecrf.gridgears";
  modulepar XSD.String PX_V_POLICE_DISPLAY_NAME := "ETSI Police";
  
  modulepar XSD.AnyURI PX_LOST_SOURCE_ID := "viennaPoliceId";
  modulepar XSD.String PX_V_POLICE_SOURCE := "ecrf.gridgears";
  
  modulepar XSD.AnyURI PX_LOST_SERVICE_URN_1 := "urn:service:sos.police";
  modulepar XSD.AnyURI PX_V_POLICE_SOURCE_ID := "etsiPoliceId";
  
  modulepar XSD.AnyURI PX_LOST_SERVICE_URN_2 := "urn:service:sos.police";
  modulepar XSD.AnyURI PX_E_POLICE_SERVICE_URN := "urn:service:sos.police";
  
  modulepar XSD.AnyURI PX_LOST_SERVICE := "urn:service:sos.police";
  modulepar XSD.AnyURI PX_E_POLICE_SIP_URI := "sip:police@etsi.com";
  
  modulepar XSD.AnyURI PX_V_POLICE_SERVICE_URN := "urn:service:sos.police";
  
  modulepar DoubleList PX_POINT_IN_E_POLICE_SERVICE_BOUNDARY := { 43.616891, 7.053179 };
  
  modulepar XSD.DateTime PX_LOST_EXPIRES := "2019-08-30T08:48:17+00:00";
  
  modulepar XSD.DateTime PX_LOST_LAST_UPDATED := "2018-08-30T08:48:17+00:00";

  modulepar XSD.AnyURI PX_LOST_URI := "sip:police@vienna.com";

  modulepar DoubleList PX_LOST_NO_LOST := { 48.2153879, 16.2903 };


  modulepar XSD.AnyURI PX_E_FIRE_SERVICE_URN := "urn:service:sos.fire";
  

  
  

  
} // End of module LibNg112_Pixits
+2 −0
Original line number Diff line number Diff line
@@ -50,6 +50,7 @@ import from http_www_opengis_net_gml all;

type CircleType Circle
with {
  variant "name as 'Circle'";
  variant "element";
};

@@ -66,6 +67,7 @@ type record CircleType
	LengthType radius
}
with {
  variant "name as uncapitalized";
  variant (axisLabels) "attribute";
  variant (gid) "attribute";
  variant (id) "attribute";
Loading