Commit 5727e106 authored by garciay's avatar garciay
Browse files

Create repository

parent 9b06edd5
Loading
Loading
Loading
Loading
+293 −0
Original line number Diff line number Diff line
/**
 * @author      ETSI/STF498
 * @version     $Url$
 *              $Id$
 * @dec         Testcases and component functions module for INT GTPv2-C protocol - SGW role
 */
module LibGtpv2C_SGW_Functions { 
    
    // Libcommon
    import from LibCommon_BasicTypesAndValues all;
    import from LibCommon_DataStrings all;
    import from LibCommon_VerdictControl {type FncRetCode;}
    import from LibCommon_Sync all;
    import from LibCommon_Time all;
    
    // LibGtpv2C
    import from LibGtpv2C_TestSystem all;
    import from LibGtpv2C_Pics all;
    import from LibGtpv2C_Configuration all;
    import from LibGtpv2C_Templates {
        template
            m_gtpv2ExtendedHeader_noteid,
            m_gtpv2EchoRequest,
            m_gtpv2Payload_echoRequest,
            m_gtpv2Pdu,
            m_gtpv2Req_SGW,
            m_mheader_noteid,
            m_mheader_noteid_invalid_version,
            m_negative_cause,
            m_recovery,
            m_recovery_invalid,
            mw_gtpv2EchoResponse,
            mw_gtpv2Ind,
            mw_gtpv2Payload_echoResponse,
            mw_gtpv2Pdu,
            mw_mheader_noteid;
    }
    
    /**
     * @desc This group contains all test case for IUT acting as a SGW
     * @see ETSI TS 103 202-2 V0.0.2 (2014-03), clause 5.2.1
     */
    group pathManagement {
        
        /**
         * @desc Verify the successful answering of Echo Request with Echo Response - SGW role
         * @verdict pass on success, inconc on timeout, fail otherwise
         */
        function f_TC_S11_SGW_PM_01() runs on Gtpv2CComponent {
            
            // Local variables
            
            // Preamble
            f_preamble_SGW();
            gtpv2CPort.send(
                m_gtpv2Req_SGW( 
                    m_gtpv2Pdu(
                        m_mheader_noteid(e_echoRequest),
                        m_gtpv2ExtendedHeader_noteid(f_getNextSequenceNumber()),
                        m_gtpv2Payload_echoRequest(
                            m_gtpv2EchoRequest(
                                m_recovery(
                                    f_getNextRestartCounter()
                                )
                            )
                        )
                    )
                )
            );
            f_selfOrClientSyncAndVerdict(c_prDone, e_success);
            log("*** " & __SCOPE__ & ": INFO: Preamble done. ***");
            
            // Test Body
            tc_ac.start;
            alt {
                [] gtpv2CPort.receive(
                    mw_gtpv2Ind( 
                        mw_gtpv2Pdu(
                            mw_mheader_noteid(
                                e_echoResponse 
                            ),
                            -,
                            mw_gtpv2Payload_echoResponse 
                        ) 
                    )
                ) { 
                    tc_ac.stop;
                    log("*** " & testcasename() & ": PASS: Successful Echo Request Procedure ***");
                    f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                }
                [] tc_ac.timeout {
                    log("*** " & testcasename() & ": INCONC: Expected message not received ***");
                    f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
                }
            } // End of 'alt' statement
            
            // Postamble
            f_postamble_SGW();
            f_selfOrClientSyncAndVerdict(c_poDone, e_success);
            log("*** " & __SCOPE__ & ": INFO: Postamble done. ***");
            
        } // End of function f_TC_S11_SGW_PM_01 
        
        /**
         * @desc Verify the successful answering of Echo Request with Echo Response with a negative cause value - SGW role
         * @verdict pass on success, inconc on timeout, fail otherwise
         */
        function f_TC_S11_SGW_PM_02() runs on Gtpv2CComponent {
            
            // Local variables
            
            // Preamble
            f_preamble_SGW();
            gtpv2CPort.send(
                m_gtpv2Req_SGW( 
                    m_gtpv2Pdu(
                        m_mheader_noteid(e_echoRequest),
                        m_gtpv2ExtendedHeader_noteid(f_getNextSequenceNumber()),
                        m_gtpv2Payload_echoRequest(
                            m_gtpv2EchoRequest(
                                m_recovery_invalid(
                                    f_getNextRestartCounter()
                                )
                            )
                        )
                    )
                )
            );
            f_selfOrClientSyncAndVerdict(c_prDone, e_success);
            log("*** " & __SCOPE__ & ": INFO: Preamble done. ***");
            
            // Test Body
            tc_ac.start;
            alt {
                [] gtpv2CPort.receive(
                    mw_gtpv2Ind( 
                        mw_gtpv2Pdu(
                            mw_mheader_noteid(
                                e_echoResponse 
                            ),
                            -,
                            mw_gtpv2Payload_echoResponse(
                                mw_gtpv2EchoResponse(
                                    -,
                                    m_negative_cause(
                                        67 // FIXME Crete constance See 3GPP TS 29.274 version 9.11.0 Release 9 Table 8.4-1: Cause values
                                    )
                                )
                            ) 
                        ) 
                    )
                ) { 
                    tc_ac.stop;
                    log("*** " & testcasename() & ": PASS: Unsuccessful Echo Request Procedure ***");
                    f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                }
                [] tc_ac.timeout {
                    log("*** " & testcasename() & ": INCONC: Expected message not received ***");
                    f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
                }
            } // End of 'alt' statement
            
            // Postamble
            f_postamble_SGW();
            f_selfOrClientSyncAndVerdict(c_poDone, e_success);
            log("*** " & __SCOPE__ & ": INFO: Postamble done. ***");
            
        } // End of function f_TC_S11_SGW_PM_02 
        
        /**
         * @desc Verify the GTP version that the sending entity supports.  If a GTP network element receives a message of unsupported GTP version, verify that the network element returns a Version Not Supported Indication message and that it discards the received message - SGW role
         * @verdict pass on success, inconc on timeout, fail otherwise
         */
        function f_TC_S11_SGW_PM_03() runs on Gtpv2CComponent {
            
            // Local variables
            
            // Preamble
            f_preamble_SGW();
            gtpv2CPort.send(
                m_gtpv2Req_SGW( 
                    m_gtpv2Pdu(
                        m_mheader_noteid_invalid_version(e_echoRequest),
                        m_gtpv2ExtendedHeader_noteid(f_getNextSequenceNumber()),
                        m_gtpv2Payload_echoRequest(
                            m_gtpv2EchoRequest(
                                m_recovery_invalid(
                                    f_getNextRestartCounter()
                                )
                            )
                        )
                    )
                )
            );
            f_selfOrClientSyncAndVerdict(c_prDone, e_success);
            log("*** " & __SCOPE__ & ": INFO: Preamble done. ***");
            
            // Test Body
            tc_ac.start;
            alt {
                [] gtpv2CPort.receive(
                    mw_gtpv2Ind( 
                        mw_gtpv2Pdu(
                            mw_mheader_noteid(
                                e_versionNotSupported 
                            ),
                            -,
                            mw_gtpv2Payload_echoResponse(
                                mw_gtpv2EchoResponse(
                                    -,
                                    m_negative_cause(
                                        66 // FIXME Crete constance See 3GPP TS 29.274 version 9.11.0 Release 9 Table 8.4-1: Cause values
                                    )
                                )
                            ) 
                        ) 
                    )
                ) { 
                    tc_ac.stop;
                    log("*** " & testcasename() & ": PASS: Unsuccessful Echo Request Procedure ***");
                    f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                }
                [] tc_ac.timeout {
                    log("*** " & testcasename() & ": INCONC: Expected message not received ***");
                    f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
                }
            } // End of 'alt' statement
            
            // Postamble
            f_postamble_SGW();
            f_selfOrClientSyncAndVerdict(c_poDone, e_success);
            log("*** " & __SCOPE__ & ": INFO: Postamble done. ***");
            
        } // End of function f_TC_S11_SGW_PM_03 
        
    } // End of group pathManagement 
    
    /**
     * @desc This group contains all test case for IUT acting as a SGW
     * @see ETSI TS 103 202-2 V0.0.2 (2014-03), clause 5.2.2
     */
    group tunnelManagement {
        
        
    } // End of group tunnelManagement 
    
    /**
     * @desc This group contains all test case for IUT acting as a MME
     * @see ETSI TS 103 202-2 V0.0.2 (2014-03), clause 5.2.1
     */
    group preambules {
        
        /**
         * @desc Preamble function
         */
        function f_preamble_SGW() runs on Gtpv2CComponent {
            // Connect client sync port
            f_connect4SelfOrClientSync();
            
            // Activate defaults
            activate(a_sgw_default());
            
        } // End of function f_preamble_SGW
        
    } // End of group preambules 
    
    group postambles {
        
        /**
         * @desc Postamble function
         */
        function f_postamble_SGW() runs on Gtpv2CComponent {
            // Deactivate all defaults
            deactivate;
        } // End of function f_postamble_SGW
        
    } // End of group postambles
    
    group sgwAltsteps {
        
        /**
         * @desc Default altstep activated during the preambule
         */
        altstep a_sgw_default() runs on Gtpv2CComponent {
            [] gtpv2CPort.receive {
                log("*** a_sgw_default: ERROR: Received an unexpected , process it as an error ***");
                f_selfOrClientSyncAndVerdict("error", e_error);
            }
        } // End of altstep a_sgw_default
        
    } // End of group sgwAltsteps 
    
} // End of module LibGtpv2C_SGW_Functions 
 No newline at end of file