Commit d5ae834b authored by Michael Proestler's avatar Michael Proestler
Browse files

Add TC_LIS_SIP_BV_01

add ability to record Notify Message
add synchronous HttpSipComponent
parent 885c505e
Loading
Loading
Loading
Loading
+11 −2
Original line number Diff line number Diff line
@@ -7,6 +7,7 @@ module AtsLIS_Functions {
	import from LibItsHttp_XmlTemplates all;
	
	import from LibCommon_Sync all;
  import from LibSip_Steps all;

	import from AtsLIS_Pics all;
	import from AtsLIS_Pixits all;
@@ -93,6 +94,15 @@ module AtsLIS_Functions {
    }
	}
	
  function f_findLocationUri(ReturnLocationType.locationURI_list p_uris, charstring schema) return charstring {
    for(var integer i:=0; i < lengthof(p_uris); i := i + 1) {
      if (substr(p_uris[i], 0, lengthof(schema)) == schema) {
        return oct2char(unichar2oct(p_uris[i]));
      }
    }
    return "";
  }

	function f_receiveResponse(template HttpMessage p_message) runs on HttpComponent return HttpMessage {
	  var HttpMessage v_response;

@@ -130,5 +140,4 @@ module AtsLIS_Functions {
        
        return v_response;
	}

}
+125 −0
Original line number Diff line number Diff line
@@ -600,6 +600,131 @@ module AtsLIS_TestCases {
  
  } // End of Group Errors

 group Subscriptions {

    /**
     * @desc "IUT responds to a SIP Subscribe for presence event package with an 200 OK" 
     */
    testcase TC_LIS_SIP_BV_01() runs on HttpSipComponent system TestAdapter {             
        // Local variables
        var ImsComponent v_subscriber;
        var HttpComponent v_held;        
        var HttpMessage v_response;
        var SipUrl v_subscription_target;


        // Test control
        f_check_pics({ values := {PICS_LIS_SIP_SUBSCRIPTION, PICS_LIS_HELD_BY_REFERENCE, PICS_LIS_GEOMETRY_POINT}, names := {"PICS_LIS_SIP_SUBSCRIPTION", "PICS_LIS_HELD_BY_REFERENCE", "PICS_LIS_GEOMETRY_POINT"}});
        
        // Test component configuration              
        f_cf_01_up();        
        
        // Preamble
        // Step 1: Request Location by Reference
        f_sendRequest(m_locationRequest(
                    {encvalue_unichar(valueof(m_device({ PX_DEVICE_NUMBER[PX_DEVICE_NUMBER_POINT] })))},
                    m_locationTypeType(
                              m_locationTypeBase_locationUri,
                                              true
                                              )       
                                    )
          )
                                                                  
        template LocationResponseType mdw_location_response modifies mw_location_response := {
          locationUriSet := {
            expires := ?,
            locationURI_list := ? length (1 .. infinity)
          },
          presence := omit
        }
                      
        v_response := f_receiveResponsePreamble(mw_http_location_response(mdw_location_response));
        
        log(v_response.response.body.xml_body);
        log(v_response.response.body.xml_body.locationResponse.locationUriSet.locationURI_list);        
        var charstring v_url := f_findLocationUri(v_response.response.body.xml_body.locationResponse.locationUriSet.locationURI_list, "sip");
              
        v_subscription_target := f_initSipUrlFromCharstring(v_url);

        // Step 2: Subscribe for Presence
        var CSeq v_cSeq_s := {
          fieldName := CSEQ_E,
          seqNumber := 0,
          method := "SUBSCRIBE"
        };
              
        
          // Test component configuration
        f_init_userprofile(c_userProfile_ESINetSubscriber);        
        f_init_interfaceprofile(c_interfaceProfile_SUT_LIS);
        
        LibIms_Steps.f_setHeadersSUBSCRIBE(v_cSeq_s, v_subscription_target, f_initSipUrl(c_serviceProfile_SUBSCRIBER));          
        
              
        template SUBSCRIBE_Request request := m_SUBSCRIBE_Presence_Request_Event(
          v_subscription_target, vc_callId ,v_cSeq_s, vc_from, vc_to, vc_via, omit
        );    

        f_SendSUBSCRIBE(request);
        f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);

        // Test Body
        f_awaitingResponse(mw_Response_Base(c_statusLine200, vc_callId, vc_cSeq));
        
        template Point mw_expected_point := mw_point_1((PX_DEVICE_NUMBER_POINT_POS[0] - PX_DOUBLE_CMP_EPSILON .. PX_DEVICE_NUMBER_POINT_POS[0] + PX_DOUBLE_CMP_EPSILON), (PX_DEVICE_NUMBER_POINT_POS[1] - PX_DOUBLE_CMP_EPSILON .. PX_DEVICE_NUMBER_POINT_POS[1] + PX_DOUBLE_CMP_EPSILON));

        template Presence mw_presence := {          
            entity := ?,
            tuple_list := {
              	{
              	  	id := ?,          		
                  	status := {
	                    basic := *,
    	            	geopriv := mw_geopriv({ point := mw_expected_point}),
    	            	elem_list := { * }
        	      	},
                    elem_list := ?,
                    contact := *,
                    note_list := ?,
                    timestamp_ := *        	      	                     
          		}
            },
		   	note_list := ?,
			elem_list := ?                  
        }

        var NOTIFY_Request v_msg_recv;
        f_awaitingNOTIFY_sendReply(mw_NOTIFY_Request_Base(vc_callId), v_msg_recv); 
        
        log(v_msg_recv);
        var integer v_result;
        var universal charstring v_temp;
        var Presence v_presence;

        v_temp := v_msg_recv.messageBody.textplain;
        v_result := decvalue_unichar(v_temp, v_presence);
        if (match(v_presence, mw_presence)) {
          f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
        } else {
          log(match(v_presence, mw_presence));
          f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
        }
        

        // Postamble
        LibIms_Steps.f_setHeadersSUBSCRIBE(v_cSeq_s, v_subscription_target, f_initSipUrl(c_serviceProfile_SUBSCRIBER));        
        f_SendSUBSCRIBE(m_UNSUBSCRIBE_Presence_Request_Event(
                                                            v_subscription_target, vc_callId ,v_cSeq_s, vc_from, vc_to, vc_via, omit
                                                          )
        );
        f_awaitingResponse(mw_Response_Base(c_statusLine200, vc_callId, vc_cSeq));
        f_awaitingNOTIFY_sendReply(mw_NOTIFY_Request_Base(vc_callId), v_msg_recv); 

        f_cf_01_down();
    } // End of testcase TC_LIS_SIP_BV_01    
  }


  group AdvancedMobileLocation {
    
    /**
+17 −15
Original line number Diff line number Diff line
@@ -43,14 +43,17 @@ module LibNg112_Functions {
          
      } // End of function f_cf_01_http_up
      
      function f_cf_01_sip_up(
                          out ImsComponent p_subscriber                          
                          ) runs on HttpImsComponent {
        p_subscriber := ImsComponent.create("Subscriber") alive;        
      function f_cf_01_up() runs on HttpSipComponent {
          // Map ports
          map(self:httpPort, system:httpPort);
          map(self:SIPP, system:SIPP);
          
          // Connect
        connect(p_subscriber:syncPort, self:syncPort);
        map(p_subscriber:SIPP, system:SIPP);        
          f_connect4SelfOrClientSync();
          
          activate(a_cf_01_http_down());
          activate(a_default_requests());
          activate(a_default_responses());        
      } // End of function f_cf_01__sip_up

      function f_cf_02_up(
@@ -111,14 +114,13 @@ module LibNg112_Functions {
          deactivate;
      } // End of function f_cf_01_http_down

      function f_cf_01_sip_down(
                            inout ImsComponent p_subscriber                            
                            ) runs on HttpImsComponent {
        
        disconnect(p_subscriber:syncPort, self:syncPort);
        unmap(p_subscriber:SIPP, system:SIPP);
      function f_cf_01_down() runs on HttpSipComponent {        
        // Unmap ports
        unmap(self:httpPort, system:httpPort);
        unmap(self:SIPP, system:SIPP);
        
        p_subscriber.done;        
        // Disconnect ports
        f_disconnect4SelfOrClientSync();
        
        deactivate;
      } // End of function f_cf_02_down
+26 −0
Original line number Diff line number Diff line
@@ -500,6 +500,21 @@ module LibNg112_Pixits {
	
    } // End of group SUT_CONF

    group SUT_LIS {

      /** @desc charstring for SUT - LIS IP address to exchange SIP messages
       */
      modulepar charstring  PX_SUT_LIS_SIP_IPADDR := "172.31.10.8";

      /** @desc	integer for SUT - LIS port number to exchange SIP messages
       */
      modulepar integer	  PX_SUT_LIS_SIP_PORT := 5060;
	
      /** @desc	charstring for SUT/LIS domain
       */
      modulepar charstring  PX_SUT_LIS_SIP_HOME_DOMAIN := "esinet.io";
    }
    
  } // End og grup sut

  group ts_ue1 {
@@ -518,6 +533,17 @@ module LibNg112_Pixits {
    
  } // End of group ts_ue1 

  group ts_esinet_subscriber {
            
    modulepar charstring PX_ESINET_TS_SUBSCRIBER                := "subscriber";
    modulepar integer    PX_ESINET_TS_SUBSCRIBER_PORT           := 5060;
    modulepar charstring PX_ESINET_TS_SUBSCRIBER_IPADDR         := "esinet.io"; 
    modulepar charstring PX_ESINET_TS_SUBSCRIBER_BEARER_IPADDR  := "esinet.io"
    modulepar charstring PX_ESINET_TS_SUBSCRIBER_HOME_DOMAIN    := "esinet.io"
    modulepar charstring PX_ESINET_TS_SUBSCRIBER_PUBLIC_USER    := "subscriber"
    modulepar charstring PX_ESINET_SUT_IPADDR                   := "172.0.0.1";
  }

  modulepar XSD.String PX_PRESENCE_USER := "sip:alice-06@plugtests.net";

  modulepar DoubleList PX_PRESENCE_USER_POS := { 43.623013240241434, 7.046184539794921 }; // ALICE6 position
+106 −12
Original line number Diff line number Diff line
@@ -44,6 +44,8 @@ module LibNg112_Steps {
      const integer c_userProfile_AS1 := 51;                      	// Isc userProfile at AS1
      const integer c_userProfile_AS2 := 52;               		// Isc userProfile at AS2
      
      const integer c_userProfile_ESINetSubscriber := 53;

      // number of interface profile 
      const integer c_interfaceProfile_IMS_SUT_IBCF1  := 100;		// Ic interface at IBCF1 located in SUT
      const integer c_interfaceProfile_IMS_SUT_IBCF2  := 101;		// Ic interface at IBCF2 located in SUT
@@ -56,6 +58,7 @@ module LibNg112_Steps {
      const integer c_interfaceProfile_IMS_SUT_AS     := 116; 			// Isc interface at AS located in SUT
      const integer c_interfaceProfile_IMS_SUT_ECSCF  := 117; 		// Mw interface at E-CSCF located in SUT
      const integer c_interfaceProfile_IMS_SUT_BCF    := 118;          // SIP interface at BCF located in SUT
      const integer c_interfaceProfile_SUT_LIS        := 119;

      // number of conference profile
      const integer c_conferenceProfile_factoryURI := 800;			// conference factory URI
@@ -63,6 +66,7 @@ module LibNg112_Steps {
      // number of service profile
      const integer c_serviceProfile_EMERGENCY := 112;
      const integer c_serviceProfile_EMERGENCY_INVALID := 666;
      const integer c_serviceProfile_SUBSCRIBER := 115;
      
      // number of SIPURL identifiers
      const integer c_interfaceSIPURL_IMS_SUT_PCSCF1_domain := 1101; // c_interfaceProfile_IMS_SUT_PCSCF1
@@ -100,11 +104,74 @@ module LibNg112_Steps {
          vc_userprofile.passwd := PX_IMS_SUT_UE1_PRIVAT_PASSWD;  
          vc_userprofile.registrarDomain := PX_IMS_SUT_UE1_REGISTRAR;
        }
        case (c_userProfile_ESINetSubscriber) {
          vc_userprofile.id             := p_user;
          vc_userprofile.currPort       := PX_ESINET_TS_SUBSCRIBER_PORT;
          vc_userprofile.currIpaddr     := PX_ESINET_TS_SUBSCRIBER_IPADDR;  
          vc_userprofile.contactPort    := PX_ESINET_TS_SUBSCRIBER_PORT;
          vc_userprofile.contactIpaddr  := PX_ESINET_TS_SUBSCRIBER_IPADDR;
          vc_userprofile.bearerIpaddr   := PX_ESINET_SUT_IPADDR;
          vc_userprofile.homeDomain     := PX_ESINET_TS_SUBSCRIBER_HOME_DOMAIN;
          vc_userprofile.publUsername   := PX_ESINET_TS_SUBSCRIBER_PUBLIC_USER;  
        }
        
      } // End of 'select' statement
      
    } // End of function f_init_userprofile
    
    function f_initSipUrlFromCharstring(charstring p_uri) return SipUrl {
      // var charstring v_scheme := regexp(p_uri, charstring:"([a-zA-Z]+):?+", 0);
      // var charstring v_user   := regexp(p_uri, charstring:"([a-zA-Z]+):([a-zA-Z0-9]+)@([a-zA-Z0-9.]+)(:([0-9]+))?", 1);
      // var charstring v_host   := regexp(p_uri, charstring:"([a-zA-Z]+):([a-zA-Z0-9]+)@([a-zA-Z0-9.]+)(:([0-9]+))?", 2);
      
      
      // var charstring v_scheme := regexp(p_uri, charstring:"([a-zA-Z]+):?+", 0);
      // var charstring v_user   := regexp(p_uri, pattern "(sips?):([^@]+)@([^:]+):?(.+)", 1);
      // var template charstring v_uri_pattern := "(http[s]#(0,1))://([^/\\s]+)/(?+)";

      var charstring v_scheme     := regexp(p_uri, charstring:"(sip[s]#(0,1)):([^@\\s]+)@?+", 0);
      var charstring v_user       := regexp(p_uri, charstring:"(sip[s]#(0,1)):([^@\\s]+)@?+", 1);
      var charstring v_host_port  := regexp(p_uri, charstring:"(sip[s]#(0,1)):([^@\\s]+)@(?+)", 2);
      var charstring v_host       := "";
      var charstring v_port       := "";
      
      template charstring t_has_port := pattern "?+:?+";
      if (match(v_host_port,t_has_port)) {
        log("contains port");        
        v_host := regexp(v_host_port, charstring:"(?+):(?+)",0);
        v_port := regexp(v_host_port, charstring:"(?+):(?+)",1);
      } else {
        log("does not contain port");
        v_host := v_host_port;
        v_port := "5060";
      }

      log("f_initSipUrlFromCharstring");
      log(p_uri);
      log(v_scheme);
      log(v_user);      
      log(v_host_port);
      log(v_host);
      log(v_port);

      var SipUrl p_sipUrl := {
                        scheme := v_scheme,              // contains "sip"
                        components := { 
                                        sip := {
                                                userInfo := {userOrTelephoneSubscriber:=v_user, password:=omit},
                                                hostPort := {
                                                            host := v_host,          // hostname, IPv4 or IPv6
                                                            portField := str2int(v_port)      // represented as an integer
                                                }
                                        }
                                      },
                        urlParameters := omit,
                        headers := omit
                        };
      
      return(p_sipUrl)
    }

    function f_initSipUrl(
                          in integer p_user
                          )  return SipUrl {
@@ -136,11 +203,33 @@ module LibNg112_Steps {
                p_sipUrl.components.sip.userInfo := {userOrTelephoneSubscriber:=PX_IMS_SUT_EMERGENCY_SERVICE, password:=omit};
                p_sipUrl.components.sip.hostPort := {host := PX_IMS_SUT_EMERGENCY_HOME_DOMAIN, portField :=omit}
                }
        case (c_serviceProfile_SUBSCRIBER) {
                p_sipUrl.components.sip.userInfo := { userOrTelephoneSubscriber := PX_ESINET_TS_SUBSCRIBER, password := omit};
                p_sipUrl.components.sip.hostPort := {host := PX_ESINET_TS_SUBSCRIBER_HOME_DOMAIN, portField :=omit}                
                }
      }; // End of 'select' statement
      
      return(p_sipUrl)
    } // End of function f_initSipUrl
    

    function f_initTelUrl(
                          in charstring p_subscriber
                          )  return SipUrl {
      var SipUrl p_sipUrl := {
                              scheme := c_telScheme,              // contains "tel"
                              components := { 
                                             tel := {
                                                     subscriber := p_subscriber
                                             }
                                            },
                              urlParameters := omit,
                              headers := omit
                              };
            
      return(p_sipUrl)
    } // End of function f_initSipUrl

    /*
     * @desc sets user parameters with PIXIT values
     * @param p_user identifies the selected user configuration and location
@@ -202,6 +291,11 @@ module LibNg112_Steps {
               vc_interfaceprofile.SUTPort := PX_IMS_SUT_BCF_PORT;
               vc_interfaceprofile.SUTIpaddr := PX_IMS_SUT_BCF_IPADDR;		
               vc_interfaceprofile.SUTHomeDomain := PX_IMS_SUT_BCF_HOME_DOMAIN;
               }
               case (c_interfaceProfile_SUT_LIS) { //variant c_interfaceProfile_SUT_LIS
               vc_interfaceprofile.SUTPort := PX_SUT_LIS_SIP_PORT;
               vc_interfaceprofile.SUTIpaddr := PX_SUT_LIS_SIP_IPADDR;		
               vc_interfaceprofile.SUTHomeDomain := PX_SUT_LIS_SIP_HOME_DOMAIN;
              }              
			}
    } // End of function f_init_interfaceprofile
Loading