AtsImsIot_TP_behavior_GM.ttcn 230 KB
Newer Older
Bostjan Pintar's avatar
Bostjan Pintar committed
/**
 *  @author     STF 574
 *  @version    $Id$
 *  @desc       This module provides the TP behaviour functions at GM interface
 */

module AtsImsIot_TP_behavior_GM {

    // LibIms
    import from LibIms_Templates all;
    import from LibIms_UpperTester all;
    // LibIot
    import from LibIot_TypesAndValues all;
    import from LibIot_Functions all;
    import from LibIot_TestInterface all;
    import from LibIot_PIXITS all;
    // LibSip
    import from LibSip_SIPTypesAndValues all;
    import from LibSip_Templates all;
    import from LibSip_Common all;
    import from LibSip_SDPTypes all;
    // LibMsrp
    import from LibMsrp_TypesAndValues all;
    import from LibMsrp_Functions all;
    import from LibMsrp_Templates all;
    // AtsImsIot
    import from AtsImsIot_TestSystem all;
    import from AtsImsIot_Templates all;
    import from AtsImsIot_Templates_GM all;
    import from AtsImsIot_TypesAndValues all;
    import from AtsImsIot_Functions all;
    
    group imsMessages {
        
        /**
         * @desc Verify that the P-CSCF successfully processes a SIP messages greater than 1300 bytes
         * Initial conditions with {
         *     the UE_A entity isAttachedTo the EPC_A and
         *     the UE_A entity isNotRegisteredTo the IMS_A
         * }
         * 
         * Expected behaviour
         *     ensure that {
         *         when {
         *             the UE_A entity isRequestedToSend a MESSAGE containing
         *                 From indicating value PX_UE_A_SIP_URI,
         *                 To indicating value PX_UE_A_SIP_URI,
         *                 CallId indicating value PX_UE_A_CALLID,
         *                 Via indicating value PX_UE_A_VIA,
         *                 ContentLength indicating value greater than 1300 bytes
         *                 ;
         *             to the IMS_P_CSCF_A entity
         *         }
         *         then {
         *             the IMS_P_CSCF_A entity receives the MESSAGE containing
         *                 From indicating value PX_UE_A_SIP_URI,
         *                 To indicating value PX_UE_A_SIP_URI,
         *                 CallId indicating value PX_UE_A_CALLID,
         *                 Via indicating value PX_UE_A_VIA,
         *                 ContentLength indicating value greater than 1300 bytes
         *                 ;
         *             from the UE_A entity
         *             and the IMS_P_CSCF_A entity sends a 200_Ok containing
         *                 From indicating value PX_UE_A_SIP_URI,
         *                 To indicating value PX_UE_A_SIP_URI,
         *                 CallId indicating value PX_UE_A_CALLID,
         *                 Via indicating value PX_UE_A_VIA,
         *                 PChargingVector containing
         *                     orig_ioi indicating value PX_OPERATOR_ID_A,
         *                     term_ioi indicating value PX_OPERATOR_ID_B,
         *                 not PAccessNetworkInfo
         *             ;;
         *             to the UE_A entity
         *         }
         *     }
         */
        function f_mtc_check_TP_GM_PCSCF_MESSAGE_01(
                                                    SipInterfaceMonitor p_monitorCompRef,
                                                    in boolean p_checkMessage := true
                                                    ) runs on ImsTestCoordinator {
            if (isvalue(p_monitorCompRef)) {
                p_monitorCompRef.start(
                                       f_Iot_Sip_receive(
                                                        {
                                                            mw_SipRequest(mdw_MESSAGE_1500c)
                                                        }, // FIXME CallId and more can be checked
                                                        { mw_SipRequest(mw_MESSAGE_Request_Base) },
                                                        {0, omit},
                                                        "TP_GM_PCSCF_MESSAGE_01 - Request",
                                                        false,
                                                        p_checkMessage
                                                        )
                                       );
                p_monitorCompRef.done;
                p_monitorCompRef.start(
                                       f_Iot_Sip_receive(
                                                        {
                                                            mw_SipResponse(mw_200OK_Base)
                                                        }, // FIXME CallId and more can be checked
                                                        { },
                                                        {0, omit},
                                                        "TP_GM_PCSCF_MESSAGE_01 - Response",
                                                        false,
                                                        p_checkMessage
                                                        )
                                       );
                p_monitorCompRef.done;
            }
        } // End of function f_mtc_check_TP_GM_PCSCF_MESSAGE_01
        
    } // End of group imsMessages
    
    // 5.2  IMS Registration
    group imsRegistration {
        
        /**
         * @desc Verify that the P-CSCF successfully processes a first registration (Successful)
         * Initial conditions with {
         *     the UE_A entity isAttachedTo the EPC_A and
         *     the UE_A entity isNotRegisteredTo the IMS_A and
         *     the UE_B entity isNotRegisteredTo the IMS_B
         * }
         * 
         * Expected behaviour
         *     ensure that {
         *         when {
         *             the UE_A entity isTriggeredToStart
         *         }
         *         then {
         *             the UE_A entity sends a REGISTER containing
         *                 From indicating value PX_UE_A_SIP_URI,
         *                 To indicating value PX_UE_A_SIP_URI,
         *                 CallId indicating value PX_UE_A_CALLID,
         *                 Via indicating value PX_UE_A_VIA,
         *                 Authorization containing
         *                     Authentication_Schema indicating value PX_TO_BE_DEFINED,
         *                     Authentication_URI indicating value PX_TO_BE_DEFINED,
         *                     Username indicating value PX_UE_A_USERNAME,
         *                     Realm indicating value PX_UE_A_REALM,
         *                     Algorithm indicating value PX_UE_A_AUTH_ALG,
         *                     Nonce indicating value "",
         *                     not term_ioi,
         *                 not SecurityClient
         *                 ;;
         *             to the IMS_P_CSCF_A entity
         *             and the UE_A entity receives an 401_Unauthorized containing
         *                 From indicating value PX_UE_A_SIP_URI,
         *                 To indicating value PX_UE_A_SIP_URI,
         *                 CallId indicating value PX_UE_A_CALLID,
         *                 Via indicating value PX_UE_A_VIA,
         *                 Path,
         *                 Warning,
         *                 PAccessNetworkInfo,
         *                 WwwAuthenticate containing
         *                     Digest,
         *                     Realm indicating value PX_UE_A_REALM,
         *                     Algorithm indicating value PX_UE_A_AUTH_ALG,
         *                     Nonce indicating value "not empty",
         *                     qop indicating value "auth"
         *                 ;;
         *             from the IMS_P_CSCF_A entity
         *         }
         *     }
         */
        function f_mtc_check_TP_GM_PCSCF_REGISTER_01(
                                                     in SipInterfaceMonitor p_monitorCompRef,
                                                     in boolean p_checkMessage := false
                                                     ) runs on ImsTestCoordinator {
            if (isvalue(p_monitorCompRef)) {
                var ImsUserInfo v_userInfoA := f_getSipUserId(PX_EUT_A);
                var SipMessage v_sip;
                
                // Check the first REGISTER
                p_monitorCompRef.start(
                                       f_Iot_Sip_receive(
                                                         { 
                                                            mw_SipRequest(
                                                                          mw_TP_GM_PCSCF_REGISTER_01( // FIXME Add CallId...
                                                                                                     mw_From_AddrUnion_SipUrl(omit, v_userInfoA.publicId, v_userInfoA.domain),
                                                                                                     mw_To_AddrUnion_SipUrl(omit, v_userInfoA.publicId, v_userInfoA.domain),
                                                                                                     mw_Authorization_other
                                                                                                     )
                                                                          )
                                                        },
                                                        { 
                                                            mw_SipRequest(mw_REGISTER_Request_Base)
                                                        },
                                                        {0, omit},
                                                        "TP_GM_PCSCF_REGISTER_01 - First request",
                                                        true,
                                                        p_checkMessage
                                                        )
                                       );
                p_monitorCompRef.done;
                // Retrieve messge
                f_getSipMsgFromMonitor(p_monitorCompRef, v_sip);
                if (not(isbound(v_sip))) {
                    return;
                }
                // Check REGISTER 401 Unauthorized response
                p_monitorCompRef.start(
                                       f_Iot_Sip_receive(
                                                        { 
                                                            mw_SipResponse(mw_401Unauthorized(v_sip.request.msgHeader.cSeq, mw_WwwAuthenticate))
                                                        },
                                                        {
                                                            mw_SipResponse(mw_401Unauthorized_Base),
                                                            mw_SipResponse(mw_Response_4xx_Base(
                                                                                                v_sip.request.msgHeader.callId,
                                                                                                v_sip.request.msgHeader.cSeq
                                                                                                )) 
                                                        },
                                                        {0, omit},
                                                        "TP_GM_PCSCF_REGISTER_01 - 401 Unauthorized",
                                                        false,
                                                        p_checkMessage
                                                        )
                                       );
                p_monitorCompRef.done;
            }
        } // End of function f_mtc_check_TP_GM_PCSCF_REGISTER_01
        
        /**
         * @desc Verify that the P-CSCF successfully processes a first registration (Successful)
         * Initial conditions with {
         *     the UE_A entity isAttachedTo the EPC_A and
         *     the UE_A entity isNotRegisteredTo the IMS_A and
         *     the UE_B entity isNotRegisteredTo the IMS_B
         * }
         * 
         * Expected behaviour
         *     ensure that {
         *         when {
         *             the UE_A entity isTriggeredToStart
         *         }
         *         then {
         *             the UE_A entity sends a REGISTER containing
         *                 From indicating value PX_UE_A_SIP_URI,
         *                 To indicating value PX_UE_A_SIP_URI,
         *                 CallId indicating value PX_UE_A_CALLID,
         *                 Via indicating value PX_UE_A_VIA,
         *                 Authorization containing
         *                     Authentication_Schema indicating value PX_TO_BE_DEFINED,
         *                     Authentication_URI indicating value PX_TO_BE_DEFINED,
         *                     Username indicating value PX_UE_A_USERNAME,
         *                     Realm indicating value PX_UE_A_REALM,
         *                     Algorithm indicating value PX_UE_A_AUTH_ALG,
         *                     Nonce indicating value "",
         *                     not term_ioi,
         *                 not SecurityClient
         *                 ;;
         *             to the IMS_P_CSCF_A entity
         *             and the UE_A entity receives an 401_Unauthorized containing
         *                 From indicating value PX_UE_A_SIP_URI,
         *                 To indicating value PX_UE_A_SIP_URI,
         *                 CallId indicating value PX_UE_A_CALLID,
         *                 Via indicating value PX_UE_A_VIA,
         *                 Path,
         *                 Warning,
         *                 PAccessNetworkInfo,
         *                 WwwAuthenticate containing
         *                     Digest,
         *                     Realm indicating value PX_UE_A_REALM,
         *                     Algorithm indicating value PX_UE_A_AUTH_ALG,
         *                     Nonce indicating value "not empty",
         *                     qop indicating value "auth"
         *                 ;,
         *                 Contact indicating value "sos"
         *                 ;
         *             from the IMS_P_CSCF_A entity
         *         }
         *     }
         */
        function f_mtc_check_TP_GM_PCSCF_ECO_REGISTER_01(
                                                         in SipInterfaceMonitor p_monitorCompRef,
                                                         in boolean p_checkMessage := false
                                                         ) runs on ImsTestCoordinator {
            if (isvalue(p_monitorCompRef)) {
                var ImsUserInfo v_userInfoA := f_getSipUserId(PX_EUT_A);
                var SipMessage v_sip;
                
                // Check the first REGISTER
                p_monitorCompRef.start(
                                       f_Iot_Sip_receive(
                                                         { 
                                                            mw_SipRequest(
                                                                          mw_TP_GM_PCSCF_ECO_REGISTER_01( // FIXME Add CallId...
                                                                                                         mw_From_AddrUnion_SipUrl(omit, v_userInfoA.publicId, v_userInfoA.domain),
                                                                                                         mw_To_AddrUnion_SipUrl(omit, v_userInfoA.publicId, v_userInfoA.domain),
                                                                                                         mw_Authorization_other,
                                                                                                         -, -,
                                                                                                         mw_contact(mw_ContactAddress)
                                                                                                         )
                                                                          )
                                                        },
                                                        { 
                                                            mw_SipRequest(mw_REGISTER_Request_Base)
                                                        },
                                                        {0, omit},
                                                        "TP_GM_PCSCF_REGISTER_01 - First request",
                                                        true,
                                                        p_checkMessage
                                                        )
                                       );
                p_monitorCompRef.done;
                // Retrieve messge
                f_getSipMsgFromMonitor(p_monitorCompRef, v_sip);
                if (not(isbound(v_sip))) {
                    return;
                }
                // Check REGISTER 401 Unauthorized response
                p_monitorCompRef.start(
                                       f_Iot_Sip_receive(
                                                        { 
                                                            mw_SipResponse(mw_401Unauthorized(v_sip.request.msgHeader.cSeq, mw_WwwAuthenticate))
                                                        },
                                                        {
                                                            mw_SipResponse(mw_401Unauthorized_Base),
                                                            mw_SipResponse(mw_Response_4xx_Base(
                                                                                                v_sip.request.msgHeader.callId,
                                                                                                v_sip.request.msgHeader.cSeq
                                                                                                )) 
                                                        },
                                                        {0, omit},
                                                        "TP_GM_PCSCF_REGISTER_01 - 401 Unauthorized",
                                                        false,
                                                        p_checkMessage
                                                        )
                                       );
                p_monitorCompRef.done;
            }
        } // End of function f_mtc_check_TP_GM_PCSCF_ECO_REGISTER_01
        
Bostjan Pintar's avatar
Bostjan Pintar committed
        /**
         * @desc Verify that the P-CSCF successfully processes a first registration (Successful)
         * Initial conditions with {
         *     the UE_A entity isAttachedTo the EPC_A and
         *     the UE_A entity isNotRegisteredTo the IMS_A and
         *     the UE_B entity isNotRegisteredTo the IMS_B
         * }
         * 
         * Expected behaviour
         * ensure that {
         *     when {
         *         the IMS_P_CSCF_A entity receives a REGISTER containing
         *             From indicating value PX_UE_A_SIP_URI,
         *             To indicating value PX_UE_A_SIP_URI,
         *             CallId indicating value PX_UE_A_CALLID,
         *             Via indicating value PX_UE_A_VIA,
         *             Authorization containing
         *                 Authentication_Schema indicating value PX_TO_BE_DEFINED,
         *                 Authentication_URI indicating value PX_TO_BE_DEFINED,
         *                 Username indicating value PX_UE_A_USERNAME,
         *                 Realm indicating value PX_UE_A_REALM,
         *                 Algorithm indicating value PX_UE_A_AUTH_ALG,
         *                 Nonce indicating value "not empty",
         *                 qop indicating value "auth",
         *             not SecurityClient
         *             ;;
         *         from the UE_A entity
         *     }
         *     then {
         *         the IMS_P_CSCF_A entity sends an 200_Ok containing
         *             From indicating value PX_UE_A_SIP_URI,
         *             To indicating value PX_UE_A_SIP_URI,
         *             CallId indicating value PX_UE_A_CALLID,
         *             Via indicating value PX_UE_A_VIA,
         *             AuthenticationInfo,
         *             PAccessNetworkInfo,
         *             PAssociatedURI indicating value PX_UE_A_SIP_URI,
         *             PChargingVector,
         *                orig_ioi_parameter 
         *                    indicating value "Operator Identifier Of ImsA" ,
         *                term_ioi_parameter 
         *                    indicating value "Operator Identifier Of ImsB"
         *             Path,
         *             ServiceRoute
         *             ;
         *         to the UE_A entity
         *         }
         *     }
         */
        function f_mtc_check_TP_GM_PCSCF_REGISTER_02(
                                                     in SipInterfaceMonitor p_monitorCompRef,
                                                     in boolean p_checkMessage := false
                                                     ) runs on ImsTestCoordinator {
            if (isvalue(p_monitorCompRef)){
                var ImsUserInfo v_userInfoA := f_getSipUserId(PX_EUT_A);
                var SipMessage v_sip;
                
                // Check the first REGISTER
                p_monitorCompRef.start(
                                       f_Iot_Sip_receive(
                                                        {
                                                            mw_SipRequest(
                                                                          mw_TP_GM_PCSCF_REGISTER_02(
                                                                                                     mw_From_AddrUnion_SipUrl(omit, v_userInfoA.publicId, v_userInfoA.domain),
                                                                                                     mw_To_AddrUnion_SipUrl(omit, v_userInfoA.publicId, v_userInfoA.domain),
                                                                                                     mw_Authorization_other
                                                                                                     )
                                                                          )
                                                        },
                                                        { 
                                                            mw_SipRequest(mw_REGISTER_Request_Base)
                                                        },
                                                        {0, omit},
                                                        "TP_GM_PCSCF_REGISTER_02 - Second request",
                                                        true,
                                                        p_checkMessage
                                                        )
                                       );
                p_monitorCompRef.done;
                // Retrieve messge
                f_getSipMsgFromMonitor(p_monitorCompRef, v_sip);
                if (not(isbound(v_sip))) {
                    return;
                }
                // Check REGISTER 200 OK response
                p_monitorCompRef.start(
                                       f_Iot_Sip_receive(
                                                        {
                                                            mw_SipResponse(mw_200OK(
                                                                                    v_sip.request.msgHeader.cSeq,
                                                                                    v_sip.request.msgHeader.callId,
                                                                                    v_sip.request.msgHeader.fromField,
                                                                                    v_sip.request.msgHeader.toField
                                                                                    ))
                                                        },
                                                        {
                                                            mw_SipResponse(mw_Response_2xx_Base)
                                                        },
                                                        {0, omit},
                                                        "TP_GM_PCSCF_REGISTER_02 - 200 OK",
                                                        false,
                                                        p_checkMessage
                                                        )
                                       );
                p_monitorCompRef.done;
            }
        } // End of function f_mtc_check_TP_GM_PCSCF_REGISTER_02
        
        /**
         * @desc Verify that the P-CSCF successfully processes an invalid first registration (Unsuccessful).
         * Initial conditions with {
         *     the UE_A entity isAttachedTo the EPC_A and
         *     the UE_A entity isNotRegisteredTo the IMS_A and
         *     the UE_B entity isNotRegisteredTo the IMS_B
         * }
         * 
         * Expected behaviour
         *     ensure that {
         *         when {
         *             the UE_A entity isTriggeredToStart
         *         }
         *         then {
         *             the IMS_P_CSCF_A entity receives a REGISTER containing
         *                 From indicating value PX_UE_A_SIP_URI,
         *                 To indicating value PX_UE_A_SIP_URI,
         *                 CallId indicating value PX_UE_A_CALLID,
         *                 Via indicating value PX_UE_A_VIA,
         *                 Authorization containing
         *                     Authentication_Schema indicating value PX_TO_BE_DEFINED,
         *                     Authentication_URI indicating value PX_TO_BE_DEFINED,
         *                     Username indicating value PX_UE_A_INVALID_USERNAME,
         *                     Realm indicating value PX_UE_A_REALM,
         *                     Algorithm indicating value PX_UE_A_AUTH_ALG,
         *                     Nonce indicating value ""
         *                 ;;
         *             from the UE_A entity
         *             and the IMS_P_CSCF_A entity sends an 404_NotFound containing
         *                 From indicating value PX_UE_A_SIP_URI,
         *                 To indicating value PX_UE_A_SIP_URI,
         *                 CallId indicating value PX_UE_A_CALLID
         *                 ;
         *             to the UE_A entity
         *         }
         *     }
         */
        function f_mtc_check_TP_GM_PCSCF_REGISTER_03(
                                                     in SipInterfaceMonitor p_monitorCompRef,
                                                     in boolean p_checkMessage := false
                                                     ) runs on ImsTestCoordinator {
            if (isvalue(p_monitorCompRef)) {
                var ImsUserInfo v_userInfoA := f_getSipUserId(PX_EUT_A); // User removed from HSS
                var SipMessage v_sip;
                
                // Check the first REGISTER
                p_monitorCompRef.start(
                                       f_Iot_Sip_receive(
                                                         { 
                                                            mw_SipRequest(
                                                                          mw_TP_GM_PCSCF_REGISTER_03(
                                                                                                     mw_From_AddrUnion_SipUrl(omit, v_userInfoA.publicId, v_userInfoA.domain),
                                                                                                     mw_To_AddrUnion_SipUrl(omit, v_userInfoA.publicId, v_userInfoA.domain),
                                                                                                     mw_Authorization_other
                                                                                                     )
                                                                          )
                                                        },
                                                        { 
                                                            mw_SipRequest(mw_REGISTER_Request_Base)
                                                        },
                                                        {0, omit},
                                                        "TP_GM_PCSCF_REGISTER_03 - First request",
                                                        true,
                                                        p_checkMessage
                                                        )
                                       );
                p_monitorCompRef.done;
                // Retrieve messge
                f_getSipMsgFromMonitor(p_monitorCompRef, v_sip);
                if (not(isbound(v_sip))) {
                    return;
                }
                log("v_sip", v_sip);
                // Check REGISTER 404 Not Found response
                p_monitorCompRef.start(
                                       f_Iot_Sip_receive(
                                                        { 
                                                            mw_SipResponse(mw_404NotFound(v_sip.request.msgHeader.cSeq/*, mw_WwwAuthenticate*/)),
                                                            mw_SipResponse(mw_480TemporaryUnavailable(-, v_sip.request.msgHeader.cSeq/*, mw_WwwAuthenticate*/))
                                                        },
                                                        {
                                                            mw_SipResponse(mw_Response_4xx_Base(
                                                                                                v_sip.request.msgHeader.callId,
                                                                                                v_sip.request.msgHeader.cSeq
                                                                                                )) 
                                                        },
                                                        {0, omit},
                                                        "TP_GM_PCSCF_REGISTER_03 - 404 Not Found",
                                                        false,
                                                        p_checkMessage
                                                        )
                                       );
                p_monitorCompRef.done;
            }
        } // End of function f_mtc_check_TP_GM_PCSCF_REGISTER_03
        
        /**
         * @desc Verify that the P-CSCF successfully processes an invalid first registration (Unsuccessful).
         * Initial conditions with {
         *     the UE_A entity isAttachedTo the EPC_A and
         *     the UE_A entity isNotRegisteredTo the IMS_A and
         *     the UE_B entity isNotRegisteredTo the IMS_B
         * }
         * 
         * Expected behaviour
         *     ensure that {
         *         when {
         *             the UE_A entity isTriggeredToStart
         *         }
         *         then {
         *             the IMS_P_CSCF_A entity receives a REGISTER containing
         *                 From indicating value PX_UE_A_SIP_URI,
         *                 To indicating value PX_UE_A_SIP_URI,
         *                 CallId indicating value PX_UE_A_CALLID,
         *                 Via indicating value PX_UE_A_VIA,
         *                 Authorization containing
         *                     Authentication_Schema indicating value PX_TO_BE_DEFINED,
         *                     Authentication_URI indicating value PX_TO_BE_DEFINED,
         *                     Username indicating value PX_UE_A_INVALID_USERNAME,
         *                     Realm indicating value PX_UE_A_REALM,
         *                     Algorithm indicating value PX_UE_A_AUTH_ALG,
         *                     Nonce indicating value ""
         *                 ;;
         *             from the UE_A entity
         *             and the IMS_P_CSCF_A entity sends an 404_NotFound containing
         *                 From indicating value PX_UE_A_SIP_URI,
         *                 To indicating value PX_UE_A_SIP_URI,
         *                 CallId indicating value PX_UE_A_CALLID
         *                 ;
         *             to the UE_A entity
         *         }
         *     }
         */
        function f_mtc_check_TP_GM_PCSCF_ECO_REGISTER_03(
                                                         in SipInterfaceMonitor p_monitorCompRef,
                                                         in boolean p_checkMessage := false
                                                         ) runs on ImsTestCoordinator {
            if (isvalue(p_monitorCompRef)) {
                var ImsUserInfo v_userInfoA := f_getSipUserId(PX_EUT_A); // User removed from HSS
                var SipMessage v_sip;
                
                // Check the first REGISTER
                p_monitorCompRef.start(
                                       f_Iot_Sip_receive(
                                                         { 
                                                            mw_SipRequest(
                                                                          mw_TP_GM_PCSCF_ECO_REGISTER_03(
                                                                                                         mw_From_AddrUnion_SipUrl(omit, v_userInfoA.publicId, v_userInfoA.domain),
                                                                                                         mw_To_AddrUnion_SipUrl(omit, v_userInfoA.publicId, v_userInfoA.domain),
                                                                                                         mw_Authorization_other,
                                                                                                         -, -,
                                                                                                         mw_contact(mw_ContactAddress)
                                                                                                         )
                                                                          )
                                                        },
                                                        { 
                                                            mw_SipRequest(mw_REGISTER_Request_Base)
                                                        },
                                                        {0, omit},
                                                        "TP_GM_PCSCF_REGISTER_03 - First request",
                                                        true,
                                                        p_checkMessage
                                                        )
                                       );
                p_monitorCompRef.done;
                // Retrieve messge
                f_getSipMsgFromMonitor(p_monitorCompRef, v_sip);
                if (not(isbound(v_sip))) {
                    return;
                }
                log("v_sip", v_sip);
                // Check REGISTER 404 Not Found response
                p_monitorCompRef.start(
                                       f_Iot_Sip_receive(
                                                        { 
                                                            mw_SipResponse(mw_404NotFound(v_sip.request.msgHeader.cSeq/*, mw_WwwAuthenticate*/)),
                                                            mw_SipResponse(mw_480TemporaryUnavailable(-, v_sip.request.msgHeader.cSeq/*, mw_WwwAuthenticate*/))
                                                        },
                                                        {
                                                            mw_SipResponse(mw_Response_4xx_Base(
                                                                                                v_sip.request.msgHeader.callId,
                                                                                                v_sip.request.msgHeader.cSeq
                                                                                                )) 
                                                        },
                                                        {0, omit},
                                                        "TP_GM_PCSCF_REGISTER_03 - 404 Not Found",
                                                        false,
                                                        p_checkMessage
                                                        )
                                       );
                p_monitorCompRef.done;
            }
        } // End of function f_mtc_check_TP_GM_PCSCF_ECO_REGISTER_03
        
Bostjan Pintar's avatar
Bostjan Pintar committed
        function f_mtc_check_TP_GM_PCSCF_REGISTER_04( // FIXME RMI To be reviewed
                                                     in SipInterfaceMonitor p_monitorCompRef,
                                                     in boolean p_checkMessage := false
                                                     ) runs on ImsTestCoordinator {
            if (isvalue(p_monitorCompRef)){
                var ImsUserInfo v_userInfoA := f_getSipUserId(PX_EUT_A);
                var SipMessage v_sip;
                
                // Check the first REGISTER
                p_monitorCompRef.start(
                                       f_Iot_Sip_receive(
                                                        {
                                                            mw_SipRequest(
                                                                          mw_TP_GM_PCSCF_REGISTER_04(
                                                                                                     mw_From_AddrUnion_SipUrl(omit, v_userInfoA.publicId, v_userInfoA.domain),
                                                                                                     mw_To_AddrUnion_SipUrl(omit, v_userInfoA.publicId, v_userInfoA.domain),
                                                                                                     mw_Authorization_other
                                                                                                     )
                                                                          )
                                                        },
                                                        { 
                                                            mw_SipRequest(mw_REGISTER_Request_Base)
                                                        },
                                                        {0, omit},
                                                        "TP_GM_PCSCF_REGISTER_04 - First request",
                                                        true,
                                                        p_checkMessage
                                                        )
                                       );
                p_monitorCompRef.done;
                // Retrieve messge
                f_getSipMsgFromMonitor(p_monitorCompRef, v_sip);
                if (not(isbound(v_sip))) {
                    return;
                }
                
                // Check REGISTER 404 Not Found response
                p_monitorCompRef.start(
                                       f_Iot_Sip_receive(
                                                        { 
                                                            mw_SipResponse(mw_401Unauthorized(v_sip.request.msgHeader.cSeq, mw_WwwAuthenticate)),
                                                            mw_SipResponse(mw_480TemporaryUnavailable(-, v_sip.request.msgHeader.cSeq, mw_WwwAuthenticate))
                                                        },
                                                        {
                                                            mw_SipResponse(mw_401Unauthorized_Base),
                                                            mw_SipResponse(mw_Response_4xx_Base(
                                                                                                v_sip.request.msgHeader.callId,
                                                                                                v_sip.request.msgHeader.cSeq
                                                                                                )) 
                                                        },
                                                        {0, omit},
                                                        "TP_GM_PCSCF_REGISTER_04 - 401 Unauthorized",
                                                        false,
                                                        p_checkMessage
                                                        )
                                       );
                p_monitorCompRef.done;
            }
        } // End of function f_mtc_check_TP_GM_PCSCF_REGISTER_04
        
        function f_mtc_check_TP_GM_PCSCF_REGISTER_05( // FIXME RMI To be reviewed
                                                     in SipInterfaceMonitor p_monitorCompRef,
                                                     in boolean p_checkMessage := false
                                                     ) runs on ImsTestCoordinator {
            if (isvalue(p_monitorCompRef)){
                var ImsUserInfo v_userInfoA := f_getSipUserId(PX_EUT_A);
                var SipMessage v_sip;
                
                // Check the first REGISTER
                p_monitorCompRef.start(
                                       f_Iot_Sip_receive(
                                                        {
                                                            mw_SipRequest(
                                                                          mw_TP_GM_PCSCF_REGISTER_05(
                                                                                                     mw_From_AddrUnion_SipUrl(omit, v_userInfoA.publicId, v_userInfoA.domain),
                                                                                                     mw_To_AddrUnion_SipUrl(omit, v_userInfoA.publicId, v_userInfoA.domain),
                                                                                                     mw_Authorization_other
                                                                                                     )
                                                                          )
                                                        },
                                                        { 
                                                            mw_SipRequest(mw_REGISTER_Request_Base)
                                                        },
                                                        {0, omit},
                                                        "TP_GM_PCSCF_REGISTER_05 - Second request",
                                                        true,
                                                        p_checkMessage
                                                        )
                                       );
                p_monitorCompRef.done;
                // Retrieve messge
                f_getSipMsgFromMonitor(p_monitorCompRef, v_sip);
                if (not(isbound(v_sip))) {
                    return;
                }
                // Check REGISTER 200 OK response
                p_monitorCompRef.start(
                                       f_Iot_Sip_receive(
                                                        {
                                                            mw_SipResponse(mw_200OK(
                                                                                    v_sip.request.msgHeader.cSeq,
                                                                                    v_sip.request.msgHeader.callId,
                                                                                    v_sip.request.msgHeader.fromField,
                                                                                    v_sip.request.msgHeader.toField
                                                                                    ))
                                                        },
                                                        {
                                                            mw_SipResponse(mw_Response_2xx_Base)
                                                        },
                                                        {0, omit},
                                                        "TP_GM_PCSCF_REGISTER_05 - 200 OK",
                                                        false,
                                                        p_checkMessage
                                                        )
                                       );
                p_monitorCompRef.done;
            }
        } // End of function f_mtc_check_TP_GM_PCSCF_REGISTER_05
        
    } // End of group imsRegistration
    
    group imsDeRegistration {
        
        /**
         * @desc Verify that the P-CSCF successfully processes a user de-registration (no SIP session active).
         * Initial conditions with {
         *     the UE_A entity isAttachedTo the EPC_A and
         *     the UE_A entity isRegisteredTo the IMS_A
         * }
         * 
         * Expected behaviour
         *     ensure that {
         *         when {
         *             the UE_A entity isTriggeredToDetachUser
         *         }
         *         then {
         *             the UE_A entity sends a REGISTER containing
         *                 Expire indicating value 0
         *                 ;
         *             to the IMS_P_CSCF_A entity
         *         }
         *     }
         */
        function f_mtc_check_TP_GM_PCSCF_REGISTER_07(
                                                     in SipInterfaceMonitor p_monitorCompRef,
                                                     in boolean p_checkMessage := false
                                                     ) runs on ImsTestCoordinator {
            if (isvalue(p_monitorCompRef)) {
                var ImsUserInfo v_userInfoA := f_getTelUserId(PX_EUT_A);
                var SipMessage v_sip;
                
                // Check first DeREGISTER request
                p_monitorCompRef.start(
                                       f_Iot_Sip_receive(
                                                        { 
                                                            mw_SipRequest(
                                                                          mw_TP_GM_PCSCF_REGISTER_07(
                                                                                                     mw_From_AddrUnion_SipUrl(omit, v_userInfoA.publicId, v_userInfoA.domain),
                                                                                                     mw_To_AddrUnion_SipUrl(omit, v_userInfoA.publicId, v_userInfoA.domain),
                                                                                                     mw_Authorization_other/*(mw_credentialIntegrityYes)*/
                                                                                                     )
                                                                          )
                                                        },
                                                        { 
                                                            mw_SipRequest(mw_REGISTER_Request_Base)
                                                        },
                                                        {0, omit},
                                                        "TP_GM_PCSCF_REGISTER_07 - Request",
                                                        true,
                                                        p_checkMessage
                                                        )
                                       );
                p_monitorCompRef.done;
                // Retrieve messge
                f_getSipMsgFromMonitor(p_monitorCompRef, v_sip);
                if (not(isbound(v_sip))) {
                    return;
                }
                // Check DeREGISTER 200 OK response
                p_monitorCompRef.start(
                                       f_Iot_Sip_receive(
                                                        {
                                                            mw_SipResponse(mw_200OK(
                                                                                    v_sip.request.msgHeader.cSeq,
                                                                                    v_sip.request.msgHeader.callId,
                                                                                    v_sip.request.msgHeader.fromField,
                                                                                    v_sip.request.msgHeader.toField
                                                                                    ))
                                                        },
                                                        {
                                                            mw_SipResponse(mw_Response_2xx_Base)
                                                        },
                                                        {0, omit},
                                                        "TP_GM_PCSCF_REGISTER_07 - 200 OK",
                                                        false,
                                                        p_checkMessage
                                                        )
                                       );
               p_monitorCompRef.done;
            }
        } // End of function f_mtc_check_TP_GM_PCSCF_REGISTER_07
        
        /**
         * @desc Verify that the P-CSCF successfully processes a user de-registration (no SIP session active).
         * Initial conditions with {
         *     the UE_A entity isAttachedTo the EPC_A and
         *     the UE_A entity isRegisteredTo the IMS_A
         *     the UE_A entity isRegisteredTo the IMS_A and
         *     the UE_B entity isRegisteredTo the IMS_B and
         *     the UE_A entity previouslyEstablishedCallWith the UE_B
         * }
         * 
         * Expected behaviour
         *     ensure that {
         *         when {
         *             the UE_A entity isTriggeredToDetachUser
         *         }
         *         then {
         *             the UE_A entity sends a REGISTER containing
         *                 Expire indicating value 0
         *                 ;
         *             to the IMS_P_CSCF_A entity and
         *             the UE_A entity receives a BYE
         *             from the IMS_P_CSCF_A entity
         *         }
         *     }
         */
        function f_mtc_check_TP_GM_PCSCF_REGISTER_10(
                                                     in SipInterfaceMonitor p_monitorCompRef,
                                                     in boolean p_checkMessage := true
                                                     ) runs on ImsTestCoordinator {
            if (isvalue(p_monitorCompRef)) {
            p_monitorCompRef.start(
                                   f_Iot_Sip_receive(
                                                    { 
                                                        mw_SipRequest(mw_REGISTER_Request_Base)
                                                        //AXR mw_SipRequest(mw_BYE_Base),
                                                    },
                                                    {},
                                                    {0, omit},
                                                    "TP_GM_PCSCF_REGISTER_10",
                                                    false,
                                                    p_checkMessage
                                                    )
                                   );
           p_monitorCompRef.done;
        }} // End of function f_mtc_check_TP_GM_PCSCF_REGISTER_10
        
    } // End of group imsDeRegistration
    
    group imsSubscribe {
        
        /**
         * @desc Verify that the P-CSCF successfully processes a SUBSCRIBE.
         * Initial conditions with {
         *     the UE_A entity isAttachedTo the EPC_A and
         *     the UE_A entity isRegisteredTo the IMS_A
         * }
         * 
         * Expected behaviour
         * ensure that {
         *     when {
         *         the UE_A entity isRequestedToSend a SUBSCRIBE
         *     }
         *     then {
         *         the IMS_P_CSCF_A entity receives an SUBSCRIBE containing
         *             From indicating value PX_UE_A_SIP_URI,
         *             To indicating value PX_UE_B_SIP_URI,
         *             CallId indicating value PX_UE_A_CALLID,
         *             Via indicating value PX_UE_A_VIA,
         *             Route indicating value PX_UE_A_SERVICE_ROUTE
         *             ;
         *          from the UE_A entity
         *          and the IMS_P_CSCF_A entity sends a 200_Ok containing
         *             From indicating value PX_UE_A_SIP_URI,
         *             To indicating value PX_UE_B_SIP_URI,
         *             CallId indicating value PX_UE_A_CALLID,
         *             Via indicating value PX_UE_A_VIA
         *             ;
         *          to the UE_A entity
         *         }
         *     }
         */
        function f_mtc_check_TP_GM_PCSCF_SUBSCRIBE_01(
                                                      in SipInterfaceMonitor p_monitorCompRef,
                                                      in boolean p_checkMessage := false
                                                      ) runs on ImsTestCoordinator {
            if (isvalue(p_monitorCompRef)){
                var ImsUserInfo v_userInfoA := f_getTelUserId(PX_EUT_A);
                var ImsUserInfo v_userInfoB := f_getTelUserId(PX_EUT_B);
                var SipMessage v_sip;
                
                // Check the SUBSCRIBE
                p_monitorCompRef.start(
                                       f_Iot_Sip_receive(
                                                        { 
                                                            mw_SipRequest(
                                                                          mw_TP_GM_PCSCF_SUBSCRIBE_01(
                                                                                                      -, // FIXME Set expected value
                                                                                                      mw_From_AddrUnion_TelUrl(v_userInfoA.publicId),
                                                                                                      mw_To_AddrUnion_TelUrl(v_userInfoB.publicId)
                                                                                                      ))
                                                        },
                                                        { mw_SipRequest(mw_SUBSCRIBE_Request_Base) },
                                                        {0, omit},
                                                        "TP_GM_PCSCF_SUBSCRIBE_01 - Request",
                                                        true,
                                                        p_checkMessage
                                                        )
                                       );
                p_monitorCompRef.done;
                // Retrieve messge
                f_getSipMsgFromMonitor(p_monitorCompRef, v_sip);
                if (not(isbound(v_sip))) {
                    return;
                }
                // Check REGISTER 200 OK response
                p_monitorCompRef.start(
                                       f_Iot_Sip_receive(
                                                        {
                                                            mw_SipResponse(mw_200OK(
                                                                                    v_sip.request.msgHeader.cSeq,
                                                                                    v_sip.request.msgHeader.callId,
                                                                                    v_sip.request.msgHeader.fromField,
                                                                                    v_sip.request.msgHeader.toField
                                                                                    ))
                                                        },
                                                        {
                                                            mw_SipResponse(mw_Response_2xx_Base)
                                                        },
                                                        {0, omit},
                                                        "TP_MW_PCSCF_SUBSCRIBE_01 - Response",
                                                        false,
                                                        p_checkMessage
                                                        )
                                       );
                p_monitorCompRef.done;
            }
        } // End of function f_mtc_check_TP_GM_PCSCF_SUBSCRIBE_01
        
        function f_mtc_check_TP_GM_PCSCF_SUBSCRIBE_02( // FIXME RMI To be reviewed
                                                      in SipInterfaceMonitor p_monitorCompRef,
                                                      in boolean p_checkMessage := false
                                                      ) runs on ImsTestCoordinator {
            if (isvalue(p_monitorCompRef)){
//                var ImsUserInfo v_userInfoA := f_getSipUserId(PX_EUT_A);
//                var ImsUserInfo v_userInfoB := f_getSipUserId(PX_EUT_B);
                var ImsUserInfo v_userInfoA := f_getTelUserId(PX_EUT_A);
                var ImsUserInfo v_userInfoB := f_getTelUserId(PX_EUT_B);
                var SipMessage v_sip;
                
                // Check the SUBSCRIBE
                p_monitorCompRef.start(
                                       f_Iot_Sip_receive(
                                                        { 
                                                            mw_SipRequest(
                                                                          mw_TP_GM_PCSCF_SUBSCRIBE_02(
                                                                                                      -, // FIXME Set expected value
                                                                                                      mw_From_AddrUnion_TelUrl(v_userInfoA.publicId),
                                                                                                      mw_To_AddrUnion_TelUrl(v_userInfoB.publicId)
//                                                                                                      mw_From_AddrUnion_SipUrl(omit, v_userInfoA.publicId, v_userInfoA.domain),
//                                                                                                      mw_To_AddrUnion_SipUrl(omit, v_userInfoB.publicId, v_userInfoB.domain)
                                                                                                      ))
                                                        },
                                                        {mw_SipRequest(mw_SUBSCRIBE_Request_Base)},