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

Try an ESRP simulator in TTCN-3

parent b8817aa3
Loading
Loading
Loading
Loading

etc/Simu/AtsNg112.cfg

0 → 100644
+84 −0
Original line number Diff line number Diff line
[MODULE_PARAMETERS]
# This section shall contain the values of all parameters that are defined in your TTCN-3 modules.

# IUT roles
LibNg112_Pics.PICS_LIS_IUT := true;
LibNg112_Pics.PICS_ECRF_IUT := false;
LibNg112_Pics.PICS_ESRP_IUT := false;


LibCommon_Time.PX_TAC := 30.0

LibItsHttp_Pics.PICS_HEADER_HOST := "lis.gridgears.io" # Used for LIS
#LibItsHttp_Pics.PICS_HEADER_HOST := "ecrf.gridgears.io" # Used for ECRF
#LibItsHttp_Pics.PICS_HEADER_HOST := "ptsv2.com"

LibItsHttp_Pics.PICS_HEADER_CONTENT_TYPE := "application/held+xml;charset=utf-8";
#LibItsHttp_Pics.PICS_HEADER_CONTENT_TYPE := "application/lost+xml;charset=utf-8";

#LibNg112_Pics.PICS_HTTP_GET_REQUEST := false
#LibNg112_Pics.PICS_HTTP_POST_REQUEST := false

[LOGGING]
# In this section you can specify the name of the log file and the classes of events
# you want to log into the file or display on console (standard error).

LogFile := "../logs/%e.%h-%r.%s"
FileMask := LOG_ALL | USER | DEBUG | MATCHING
ConsoleMask := LOG_ALL | USER | DEBUG | MATCHING
#FileMask := ERROR | WARNING | USER | MATCHING | EXECUTOR_RUNTIME | VERDICTOP
#ConsoleMask := ERROR | WARNING | USER | MATCHING | EXECUTOR_RUNTIME | VERDICTOP
LogSourceInfo := Stack
LogEntityName:= Yes
LogEventTypes:= Yes
#TimeStampFormat := DateTime

[TESTPORT_PARAMETERS]
# In this section you can specify parameters that are passed to Test Ports.

# LIS
system.httpPort.params := "HTTP(codecs=lost:lost_codec;held:held_codec)/TCP(debug=1,server=lis.gridgears.io,use_ssl=1)"
# ECRF
#system.httpPort.params := "HTTP(codecs=lost:lost_codec;held:held_codec)/TCP(debug=1,server=ecrf.gridgears.io,use_ssl=1)"
# SIP
Ue.SIPP.params := "SIP/UDP(dst_ip=192.168.43.132,dst_port=5060)"
Psap.SIPP.params := "SIP/UDP(dst_ip=192.168.43.132,dst_port=5061)"

[DEFINE]
# In this section you can create macro definitions,
# that can be used in other configuration file sections except [INCLUDE] and [ORDERED_INCLUDE].

[INCLUDE]
# To use configuration settings given in other configuration files,
# the configuration files just need to be listed in this section, with their full or relative pathnames.

[ORDERED_INCLUDE]
# To use configuration settings given in other configuration files,
# the configuration files just need to be listed in this section, with their full or relative pathnames.

[EXTERNAL_COMMANDS]
# This section can define external commands (shell scripts) to be executed by the ETS
# whenever a control part or test case is started or terminated.

#BeginTestCase := ""
#EndTestCase := ""
#BeginControlPart := ""
#EndControlPart := ""

[EXECUTE]
# In this section you can specify what parts of your test suite you want to execute.
AtsNg112_TestCases.TC_ESRP_SIMULATOR

[GROUPS]
# In this section you can specify groups of hosts. These groups can be used inside the
# [COMPONENTS] section to restrict the creation of certain PTCs to a given set of hosts.

[COMPONENTS]
# This section consists of rules restricting the location of created PTCs.

[MAIN_CONTROLLER]
# The options herein control the behavior of MC.
KillTimer := 10.0
LocalAddress := 127.0.0.1
TCPPort := 12666
NumHCs := 1
+255 −0
Original line number Diff line number Diff line
module AtsNg112_Simulators {
  
  // RFC5985 Held
  import from urn_ietf_params_xml_ns_geopriv_held language "XSD" all
    with {
        extension "File:../xsd/RFC5985_held.xsd";
    }
  // RFC6155 Held ID
  import from urn_ietf_params_xml_ns_geopriv_held_id language "XSD" all
    with {
        extension "File:../xsd/RFC6155_held_id.xsd";
    }
  // RFC3863 PIDF
  import from urn_ietf_params_xml_ns_pidf language "XSD" all
  with {
    extension "File:../xsd/urn_ietf_params_xml_ns_pidf.ttcn"
  }
  import from urn_ietf_params_xml_ns_pidf_geopriv10 language "XSD" all
    with {
        extension "File:../xsd/RFC4119_geopriv10.xsd";
    }
  import from urn_ietf_params_xml_ns_pidf_geopriv10_basicPolicy language "XSD" all
    with {
        extension "File:../xsd/RFC4119_geopriv10_basic_policy.xsd";
    }
  import from urn_ietf_params_xml_ns_pidf_geopriv10_civicAddr language "XSD" all
    with {
        extension "File:../xsd/RFC5139_pdif_geopriv10_civic_address.xsd";
    }

  // RFC3863 
  import from urn_ietf_params_xml_ns_pidf language "XSD" all
    with {
        extension "File:../xsd/RFC3863_pidf.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 {
        extension "File:../xsd/GLM_pidf_lo_shape.xsd";
    }
  import from http_www_opengis_net_gml language "XSD" all
    with {
        extension "File:../xsd/gmlBase.xsd";
        extension "File:../xsd/basicTypes.xsd";
        extension "File:../xsd/measures.xsd";
        extension "File:../xsd/geometryPrimitives.xsd";
        extension "File:../xsd/geometryBasic0d1d.xsd";
        extension "File:../xsd/geometryBasic2d.xsd";
    }
  
  // 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_XmlTemplates all;
  import from LibItsHttp_TestSystem all;
  
  // LibSip
  import from LibSip_SIPTypesAndValues all;
  import from LibSip_Steps all;
  import from LibSip_Templates all;
  import from LibSip_Interface all;
  
  // LibIms
  import from LibIms_SIPTypesAndValues all;
  import from LibIms_Steps all;
  import from LibIms_Templates all;
  import from LibIms_Interface all;
  
  // LibNg112
  import from LibNg112_TypesAndValues all;
  import from LibNg112_Functions all;
  import from LibNg112_TestSystem all;
  import from LibNg112_Steps all;
  import from LibNg112_Pics all;
  import from LibNg112_Pixits all;
  
  group esrp_role {
    
    /**
     * @desc "IUT successfully forwards an incoming SIP INVITE to the correct downstream element, based on the ECRF response" 
     */
    testcase TC_ESRP_SIMULATOR(
                                      in CSeq p_cSeq_s
                                      ) runs on HttpImsComponent /*system TestAdapter*/ {
        // Local variables
        var HttpComponent v_ecrf;
        var ImsComponent v_ue;
        var ImsComponent v_psap;
        
        // Test control
        if (not(PICS_ESRP_IUT) or (not PICS_HTTP_POST_REQUEST) or (not PICS_SERVICE_LOST) or not(PICS_E_SIP_URN1) or not(PICS_L_FIS_GEO1)) {
          log("*** " & testcasename() & ": PICS_ESRP_IUT and PICS_HTTP_POST_REQUEST and PICS_SERVICE_LOST and PICS_E_SIP_URN1 and PICS_L_FIS_GEO1 required for executing the TC ***");
          setverdict(inconc);
          stop;
        }
        
        // Test component configuration
        f_cf_03_up(v_ecrf, v_ue, v_psap);
        
        // Test adapter configuration
        
        // Preamble
        
        // Test Body
        v_ecrf.start(f_TC_ESRP_SIMULATOR_ecrf());
        f_incCSeq(p_cSeq_s); v_ue.start(f_TC_ESRP_SIMULATOR_ue(p_cSeq_s));
        f_incCSeq(p_cSeq_s); v_psap.start(f_TC_ESRP_SIMULATOR_psap(p_cSeq_s));
        f_serverSyncNClientsAndStop(3, {c_prDone, c_tbDone, c_poDone});
        
        // Postamble
        f_cf_03_down(v_ecrf, v_ue, v_psap);
      
    } // End of testcase TC_ESRP_SIMULATOR
    
    group f_TC_ESRP_SIMULATOR {
      
      function f_TC_ESRP_SIMULATOR_ecrf() runs on HttpComponent {
        // Local variables
        var HeaderLines v_headers;
        var HttpMessage v_response;
        
        // Test control
        
        // Test component configuration
        f_cf_01_http_up();
        
        // Test adapter configuration
        
        // Preamble
        f_init_default_headers_list(v_headers);
        f_selfOrClientSyncAndVerdictTestBody(c_prDone, e_error);
        
        // test body
        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[1] }))) }
                                                                                                                               )
                                                                                                             )
                                                                                 )
                                                         )
                                     )
                      );
        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 {
            tc_ac.stop;
            
            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' staement
        
        // Postamble
        f_cf_01_http_down();
        
      } // End of function f_TC_ESRP_SIMULATOR_ecrf
      
      function f_TC_ESRP_SIMULATOR_ue(
                                               in CSeq p_cSeq_s
                                               ) runs on ImsComponent {
        // Local variables
        
        // Test control
        
        // Test component configuration
        f_init_userprofile(c_userProfile_UE1atSUThome);
        f_initSipUrl(c_serviceProfile_EMERGENCY);
        f_init_interfaceprofile(c_interfaceProfile_IMS_SUT_PCSCF1);
        
        // Test adapter configuration
        
        // Preamble
        f_IMS_preamble_woRegistration(p_cSeq_s)
        LibIms_Steps.f_setHeadersINVITE(p_cSeq_s, f_initSipUrl(c_serviceProfile_EMERGENCY), f_initSipUrl(c_userProfile_UE1atSUThome));
        f_awaitingINVITE_PassOnTimeout(
                                       m_INVITE_Request_noBody_UE(vc_requestUri,
                                                                  vc_callId,
                                                                  p_cSeq_s,
                                                                  vc_from,
                                                                  vc_to,
                                                                  vc_via,
                                                                  vc_contact
                                                                  ));
        f_selfOrClientSyncAndVerdictTestBody(c_prDone, e_error);
        
        // test body
        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
        
        // Postamble
        
      } // End of function f_TC_ESRP_SIMULATOR_ue
      
      function f_TC_ESRP_SIMULATOR_psap(
                                               in CSeq p_cSeq_s
                                               ) runs on ImsComponent {
        // Local variables
        
        // Test control
        f_init_userprofile(c_userProfile_UE1atSUThome);
        f_initSipUrl(c_serviceProfile_EMERGENCY);
        f_init_interfaceprofile(c_interfaceProfile_IMS_SUT_PCSCF1);
        
        // Test component configuration
        
        // Test adapter configuration
        
        // Preamble
        f_IMS_preamble_woRegistration(p_cSeq_s)
        LibIms_Steps.f_setHeadersINVITE(p_cSeq_s, f_initSipUrl(c_serviceProfile_EMERGENCY), f_initSipUrl(c_userProfile_UE1atSUThome));
        f_selfOrClientSyncAndVerdictTestBody(c_prDone, e_error);
        
        // test body
        f_awaitingINVITE_PassOnTimeout(mw_INVITE_Request_RequestURI(vc_requestUri));
        f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
        
        // Postamble
        
      } // End of function f_TC_ESRP_SIMULATOR_psap
      
    } // End of group f_TC_ESRP_SIMULATOR 
    
  } // End of group esrp_role
  
} // End of module AtsNg112_Simulators