Commit 55049759 authored by schmitting's avatar schmitting
Browse files

UE tests for MWI (nearly) finished

parent 63d9a9e8
Loading
Loading
Loading
Loading
+346 −0
Original line number Diff line number Diff line
module MWI_TC_Functions {
    
    import from LibIms_Templates all;
    import from LibIms_SIPTypesAndValues {const c_userProfile_UE1atSUThome;}
    import from LibIms_Steps {function f_IMS_postamble_awaitDeRegistration;}
    import from LibCommon_Sync all;
    import from LibSip_Templates all;
    import from LibSip_Steps language "TTCN-3:2005" all;
    import from IMS_SS_Functions all;
    import from LibSip_SIPTypesAndValues language "TTCN-3:2005" all;
    import from LibIms_Interface {type ImsComponent;}
    import from LibIms_PIXITS all;

    	modulepar {
    	/** @desc charstring, for the public service identity of the Message Account (MA)
    	*/
    	charstring  PX_IMS_TS_MA;
    	}
    	
        // IMS ETSI name MWI application
        const charstring c_imsEtsiMwiApplication := "application/simple-message-summary";

        template Event m_Event_mwi := 
        {
            fieldName   := EVENT_E,
            eventType   := "message-summary",
            eventParams := omit
        };

        template Event mw_Event_mwi := 
        {
            fieldName   := EVENT_E,
            eventType   := "message-summary",
            eventParams := *
        };

        template Accept m_Accept_mwi := 
        {
            fieldName  := ACCEPT_E,
            acceptArgs := {{mediaRange  := "application/simple-message-summary",
                		   acceptParam := omit}}
        };

        template Accept mw_Accept_mwi := 
        {
            fieldName  := ACCEPT_E,
            acceptArgs := {{mediaRange  := "application/simple-message-summary",
                		   acceptParam := *}}
        };

	template SUBSCRIBE_Request mw_SUBSCRIBE_Request_MWI (
    	template SipUrl p_requestUri,
    	template Accept p_accept, 
		template Event p_event,
		template Expires p_expires
	)  modifies mw_SUBSCRIBE_Request_Base := {
		requestLine	:=
		{
			requestUri := p_requestUri,
			method := SUBSCRIBE_E
		},
		msgHeader :=
		{	accept := p_accept,
			event  := p_event,
			expires := p_expires
		}
	}

    template NOTIFY_Request m_NOTIFY_Request_MWI (SipUrl p_requestUri, 
    											  CallId p_callId, CSeq p_cSeq,
      											  From p_from,
      											  To p_to,
      											  Via p_via,
      											  template MessageBody p_mb) modifies m_NOTIFY_Request_Base :=
    {
        msgHeader :=
        {	
            contentLength	:= {fieldName := CONTENT_LENGTH_E, len:= f_MessageBodyLength(valueof(p_mb))},
            contentType := {fieldName := CONTENT_TYPE_E, mediaType := c_imsEtsiMwiApplication},
            event := m_Event_mwi,
            subscriptionState := m_SubscriptionState_active
        },
        messageBody := p_mb
    }

group ActionsAtTheUE {
	    
    function f_TC_MWI_U01_001(CSeq p_CSeq) runs on ImsComponent {
        f_init_gm_pcscf(p_CSeq);
        
        // ----  preamble   ----->
        f_gm_pcscf_preamble(p_CSeq);
        f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict());
        
        // ----  test body  ----->
        //  Awaiting SUBSCRIBE with event=message-summary
        action("Please subscribe to MWI service via public service identity of the MA"); 
        f_awaitingSubscription(p_CSeq,
        					   mw_SUBSCRIBE_Request_MWI(mw_SipUrl_Host(PX_IMS_TS_MA),
        					   							mw_Accept_mwi,
        					   							mw_Event_mwi,
        					   							?));
        f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict());
        
        // ----  postamble - Deregistration of UE ---->      
        f_IMS_postamble_awaitDeRegistration();
        f_selfOrClientSyncAndVerdict(c_poDone, f_getVerdict());

    }// end function f_TC_MWI_U01_001

    function f_TC_MWI_U01_002(CSeq p_CSeq) runs on ImsComponent {
        f_init_gm_pcscf(p_CSeq);
        
        // ----  preamble   ----->
        f_gm_pcscf_preamble(p_CSeq);
        f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict());
        
        // ----  test body  ----->
        //  Awaiting SUBSCRIBE with event=message-summary
        action("Please subscribe to MWI service via public user identity of the subscriber"); 
        f_awaitingSubscription(p_CSeq,
        					   mw_SUBSCRIBE_Request_MWI(mw_SipUrl_Host(PX_IMS_SUT_UE1_PUBLIC_USER),
        					   							mw_Accept_mwi,
        					   							mw_Event_mwi,
        					   							?));
        f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict());
        
        // ----  postamble - Deregistration of UE ---->      
        f_IMS_postamble_awaitDeRegistration();
        f_selfOrClientSyncAndVerdict(c_poDone, f_getVerdict());
        
    }// end function f_TC_MWI_U01_002

    function f_TC_MWI_U01_003(CSeq p_CSeq) runs on ImsComponent {
        var CallId v_callId;
        f_init_gm_pcscf(p_CSeq);
        
        // ----  preamble   ----->
        f_gm_pcscf_preamble(p_CSeq);
        f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict());
        
        // ----  test body  ----->
        //  Awaiting SUBSCRIBE with event=message-summary
        action("Please subscribe to MWI service"); 
        f_awaitingSubscription(p_CSeq,
        					   mw_SUBSCRIBE_Request_MWI(?,
        					   							mw_Accept_mwi,
        					   							mw_Event_mwi,
        					   							?));
        v_callId := vc_callId;

        //  Awaiting second SUBSCRIBE with event=message-summary
        action("Please re-subscribe to MWI service"); 
        f_awaitingSubscription(p_CSeq,
        					   mw_SUBSCRIBE_Request_MWI(?,
        					   							mw_Accept_mwi,
        					   							mw_Event_mwi,
        					   							?));
        if(not v_callId == vc_callId)
        {setverdict(fail);}

        f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict());
        
        // ----  postamble - Deregistration of UE ---->      
        f_IMS_postamble_awaitDeRegistration();
        f_selfOrClientSyncAndVerdict(c_poDone, f_getVerdict());
        
    }// end function f_TC_MWI_U01_003

    function f_TC_MWI_U01_004(CSeq p_CSeq) runs on ImsComponent {
        var Request	v_request;
        f_init_gm_pcscf(p_CSeq);
        
        // ----  preamble   ----->
        f_gm_pcscf_preamble(p_CSeq);
        f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict());
        
        // ----  test body  ----->
        //  Awaiting SUBSCRIBE with event=message-summary
        action("Please subscribe to MWI service"); 
        f_awaitingSubscription(p_CSeq,
        					   mw_SUBSCRIBE_Request_MWI(?,
        					   							mw_Accept_mwi,
        					   							mw_Event_mwi,
        					   							?));

        //  Awaiting second SUBSCRIBE with event=message-summary
        action("Please re-subscribe to MWI service"); 
        tc_wait.start(2.0);
        alt
        {
          [] SIPP.receive(mw_SUBSCRIBE_Request_MWI(?,
                                                   mw_Accept_mwi,
                                                   mw_Event_mwi,
                                                   ?))-> value v_request sender vc_sent_label
            {
              f_setHeadersOnReceiptOfSUBSCRIBE(v_request);
              f_sendResponse(m_Response_Base(c_statusLine500, vc_callId, vc_cSeq, vc_caller_From, vc_caller_To, vc_via));
            }
        }    
        f_awaitingSubscription(p_CSeq,
        					   mw_SUBSCRIBE_Request_MWI(?,
        					   							mw_Accept_mwi,
        					   							mw_Event_mwi,
        					   							?));

        f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict());
        
        // ----  postamble - Deregistration of UE ---->      
        f_IMS_postamble_awaitDeRegistration();
        f_selfOrClientSyncAndVerdict(c_poDone, f_getVerdict());
        
    }// end function f_TC_MWI_U01_004

    function f_TC_MWI_U01_005(CSeq p_CSeq) runs on ImsComponent {
        var CallId v_callId;
        f_init_gm_pcscf(p_CSeq);
        
        // ----  preamble   ----->
        f_gm_pcscf_preamble(p_CSeq);
        f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict());
        
        // ----  test body  ----->
        //  Awaiting SUBSCRIBE with event=message-summary
        action("Please subscribe to MWI service"); 
        f_awaitingSubscription(p_CSeq,
        					   mw_SUBSCRIBE_Request_MWI(?,
        					   							mw_Accept_mwi,
        					   							mw_Event_mwi,
        					   							?));
        v_callId := vc_callId;

        //  Awaiting second SUBSCRIBE with event=message-summary
        action("Please unsubscribe from MWI service"); 
        f_awaitingSubscription(p_CSeq,
        					   mw_SUBSCRIBE_Request_MWI(?,
        					   							mw_Accept_mwi,
        					   							mw_Event_mwi,
        												m_Expires("0")));
        if(not v_callId == vc_callId)
        {setverdict(fail);}

        f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict());
        
        // ----  postamble - Deregistration of UE ---->      
        f_IMS_postamble_awaitDeRegistration();
        f_selfOrClientSyncAndVerdict(c_poDone, f_getVerdict());
        
    }// end function f_TC_MWI_U01_005
	    
    function f_TC_MWI_U01_006(CSeq p_CSeq) runs on ImsComponent {
        f_init_gm_pcscf(p_CSeq);
        
        // ----  preamble   ----->
        f_gm_pcscf_preamble(p_CSeq);
        f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict());
        
        // ----  test body  ----->
        //  Awaiting SUBSCRIBE with event=message-summary
        action("Please subscribe to MWI service"); 
        f_awaitingSubscription(p_CSeq,
        					   mw_SUBSCRIBE_Request_MWI(?,
        					   							mw_Accept_mwi,
        					   							mw_Event_mwi,
        					   							?));

        f_SendNOTIFY(m_NOTIFY_Request_MWI(vc_requestUri, 
        								  vc_callId,
        								  vc_cSeq,
        								  vc_from,
        								  vc_to,
        								  vc_via,
        								  m_mBody_plainText("blabla")));
                                        
        f_awaitingResponse(mw_Response_Base(c_statusLine200, vc_callId, vc_cSeq));

        f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict());
        
        // ----  postamble - Deregistration of UE ---->      
        f_IMS_postamble_awaitDeRegistration();
        f_selfOrClientSyncAndVerdict(c_poDone, f_getVerdict());

    }// end function f_TC_MWI_U01_006

    function f_TC_MWI_U01_007(CSeq p_CSeq) runs on ImsComponent {
        f_init_gm_pcscf(p_CSeq);
        
        // ----  preamble   ----->
        f_gm_pcscf_preamble(p_CSeq);
        f_selfOrClientSyncAndVerdict(c_prDone, f_getVerdict());
        
        // ----  test body  ----->
        //  Awaiting SUBSCRIBE with event=message-summary
        action("Please subscribe to MWI service"); 
        f_awaitingSubscription(p_CSeq,
        					   mw_SUBSCRIBE_Request_MWI(?,
        					   							mw_Accept_mwi,
        					   							mw_Event_mwi,
        					   							?));

        f_SendNOTIFY(m_NOTIFY_Request_MWI(vc_requestUri, 
        								  vc_callId,
        								  vc_cSeq,
        								  vc_from,
        								  vc_to,
        								  vc_via,
        								  m_mBody_plainText("blabla")));
                                        
        f_awaitingResponse(mw_Response_Base(c_statusLine200, vc_callId, vc_cSeq));

        f_SendNOTIFY(m_NOTIFY_Request_MWI(vc_requestUri, 
        								  vc_callId,
        								  vc_cSeq,
        								  vc_from,
        								  vc_to,
        								  vc_via,
        								  m_mBody_plainText("blabla")));
                                        
        f_awaitingResponse(mw_Response_Base(c_statusLine200, vc_callId, vc_cSeq));

        f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict());
        
        // ----  postamble - Deregistration of UE ---->      
        f_IMS_postamble_awaitDeRegistration();
        f_selfOrClientSyncAndVerdict(c_poDone, f_getVerdict());

    }// end function f_TC_MWI_U01_007
}// end group ActionsAtTheUE   

group ActionsAtTheAS {
    
    function f_TC_MWI_N01_001(CSeq p_CSeq) runs on ImsComponent {
        f_init_ics_scscf(p_CSeq);
        
        // ----  test body  ----->
		
        // send INVITE        
        LibIms_Steps.f_setHeadersINVITE(vc_cSeq, c_userProfile_UE1atSUThome);
        
        //TODO add AS B2B UA behavior
        
				
        f_selfOrClientSyncAndVerdict(c_tbDone, f_getVerdict());
    }// end function f_TC_MWI_N01_001
}// end group ActionsAtTheAS     
}// end module MWI_TC_Functions
 No newline at end of file

MWI/MWI_TestCases.ttcn

0 → 100644
+476 −0

File added.

Preview size limit exceeded, changes collapsed.