Commit ab55a4c0 authored by garciay's avatar garciay
Browse files

Create repository

parent 448b57f8
Loading
Loading
Loading
Loading
+365 −0
Original line number Original line Diff line number Diff line
/**
 * @author      ETSI/STF498
 * @version     $Url$
 *              $Id$
 * @dec         Testcases and component functions module for INT GTPv2-C protocol - MME role
 */
module LibGtpv2C_MME_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_TypesAndValues all;
    import from LibGtpv2C_TestSystem all;
    import from LibGtpv2C_Pics all;
    import from LibGtpv2C_Configuration all;
    import from LibGtpv2C_Templates all;
    
    /**
     * @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 pathManagement { 
        
        /**
         * @desc Verify the successful answering of Echo Request with Echo Response - MME role
         * @verdict pass on success, inconc on timeout, fail otherwise
         */
        function f_TC_S11_MME_PM_01() runs on Gtpv2CComponent {
            
            // Local variables
            
            // Preamble
            f_preamble_MME();
            // Nothing to do, Echo Request is a periodic message 
            f_selfOrClientSyncAndVerdict(c_prDone, e_success);
            log("*** " & __SCOPE__ & ": INFO: Preamble done. ***");
            
            // Test Body
            tc_wait.start; // Use tc_wait instead of tc_ac to wait for periodic Echo Request message
            alt {
                [] gtpv2CPort.receive(
                    mw_gtpv2Ind( 
                        mw_gtpv2Pdu(
                            mw_mheader_noteid(
                                e_echoRequest 
                            ),
                            -,
                            mw_gtpv2Payload_echoRequest(
                                mw_gtpv2EchoRequest
                            ) 
                        ) 
                    )
                ) { 
                    tc_wait.stop;
                    // Send echo reply
                    gtpv2CPort.send(
                        m_gtpv2Req_MME( 
                            m_gtpv2Pdu(
                                m_mheader_noteid(e_echoResponse),
                                m_gtpv2ExtendedHeader_noteid(f_getNextSequenceNumber()),
                                m_gtpv2Payload_echoResponse(
                                    m_gtpv2EchoResponse(
                                        m_recovery(
                                            f_getNextRestartCounter()
                                        )
                                    )
                                )
                            )
                        )
                    );
                    log("*** " & testcasename() & ": PASS: Successful Echo Request Procedure ***");
                    f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                }
                [] tc_wait.timeout {
                    log("*** " & testcasename() & ": INCONC: Expected message not received ***");
                    f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
                }
            } // End of 'alt' statement
            
            // Postamble
            f_postamble_MME();
            f_selfOrClientSyncAndVerdict(c_poDone, e_success);
            log("*** " & __SCOPE__ & ": INFO: Postamble done. ***");
            
        } // End of function f_TC_S11_MME_PM_01 
        
        /**
         * @desc Verify the successful answering of Echo Request with Echo Response with a negative cause value - MME role
         * @verdict pass on success, inconc on timeout, fail otherwise
         */
        function f_TC_S11_MME_PM_02() runs on Gtpv2CComponent {
            
            // Local variables
            
            // Preamble
            f_preamble_MME();
            action("Trigger MME Echo Request Procedure with an error"); // TODO To be refined
            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_echoRequest 
                            ),
                            -,
                            mw_gtpv2Payload_echoRequest(
                                mw_gtpv2EchoRequest
                            ) 
                        ) 
                    )
                ) { 
                    tc_ac.stop;
                    // Send echo reply
                    gtpv2CPort.send(
                        m_gtpv2Req_MME( 
                            m_gtpv2Pdu(
                                m_mheader_noteid(e_echoResponse),
                                m_gtpv2ExtendedHeader_noteid(f_getNextSequenceNumber()),
                                m_gtpv2Payload_echoResponse(
                                    m_gtpv2EchoResponse(
                                        m_recovery(
                                            f_getNextRestartCounter()
                                        ),
                                        m_negative_cause(
                                            67 // FIXME Crete constance See 3GPP TS 29.274 version 9.11.0 Release 9 Table 8.4-1: Cause values
                                        )
                                    )
                                )
                            )
                        )
                    );
                    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_MME();
            f_selfOrClientSyncAndVerdict(c_poDone, e_success);
            log("*** " & __SCOPE__ & ": INFO: Postamble done. ***");
            
        } // End of function f_TC_S11_MME_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 - MME role
         * @verdict pass on success, inconc on timeout, fail otherwise
         */
        function f_TC_S11_MME_PM_03() runs on Gtpv2CComponent {
            
            // Local variables
            
            // Preamble
            action("Trigger MME the Version Not supported Procedure"); // TODO To be refined
            f_preamble_MME();
            // Nothing to do, Echo Request is a periodic message 
            f_selfOrClientSyncAndVerdict(c_prDone, e_success);
            log("*** " & __SCOPE__ & ": INFO: Preamble done. ***");
            
            // Test Body
            tc_wait.start; // Use tc_wait instead of tc_ac to wait for periodic Echo Request message
            alt {
                [] gtpv2CPort.receive(
                    mw_gtpv2Ind( 
                        mw_gtpv2Pdu(
                            mw_mheader_invalid_version 
                        ) 
                    )
                ) { 
                    tc_wait.stop;
                    // Send echo reply
                    gtpv2CPort.send(
                        m_gtpv2Req_MME( 
                            m_gtpv2Pdu(
                                m_mheader_noteid(e_versionNotSupported),
                                m_gtpv2ExtendedHeader_noteid(f_getNextSequenceNumber()),
                                m_gtpv2Payload_echoResponse(
                                    m_gtpv2EchoResponse(
                                        m_recovery(
                                            f_getNextRestartCounter()
                                        ),
                                        m_negative_cause(
                                            66 // FIXME Crete constance See 3GPP TS 29.274 version 9.11.0 Release 9 Table 8.4-1: Cause values
                                        )
                                    )
                                )
                            )
                        )
                    );
                    log("*** " & testcasename() & ": PASS: Version Not Supported Indication ***");
                    f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                }
                [] tc_wait.timeout {
                    log("*** " & testcasename() & ": INCONC: Expected message not received ***");
                    f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
                }
            } // End of 'alt' statement
            
            // Postamble
            f_postamble_MME();
            f_selfOrClientSyncAndVerdict(c_poDone, e_success);
            log("*** " & __SCOPE__ & ": INFO: Postamble done. ***");
            
        } // End of function f_TC_S11_MME_PM_03 
    } // End of group pathManagement 
    
    /**
     * @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.2
     */
    group tunnelManagement {
        
        /**
         * @desc Validate the Create Session Request/Response and the Modify Bearer Request/Response Procedure between MME and S-GW as part of the ATTACH Procedure - MME role
         * @verdict pass on success, inconc on timeout, fail otherwise
         */
        function f_TC_S11_MME_TM_01() runs on Gtpv2CComponent {
            
            // Local variables
            
            // Preamble
            f_preamble_MME();
            // Nothing to do, Echo Request is a periodic message 
            f_selfOrClientSyncAndVerdict(c_prDone, e_success);
            log("*** " & __SCOPE__ & ": INFO: Preamble done. ***");
            
            // Test Body
            tc_ac.start;
            // 1. Verify that the MME sends Create Session Request and receives the Create Session Response
            alt {
                [] gtpv2CPort.receive(
                    mw_gtpv2Ind( 
                        mw_gtpv2Pdu(
                            mw_mheader_noteid(
                                e_createSessionRequest 
                            ),
                            -,
                            mw_gtpv2Payload_createSessionRequest(
                                mw_gtpv2CreateSessionRequest_dummy
                            ) 
                        ) 
                    )
                ) { 
                    tc_ac.stop;
                    // Send echo reply
                    gtpv2CPort.send(
                        m_gtpv2Req_MME( 
                            m_gtpv2Pdu(
                                m_mheader_noteid(e_createSessionResponse),
                                m_gtpv2ExtendedHeader_noteid(f_getNextSequenceNumber()),
                                m_gtpv2Payload_createSessionResponse(
                                    m_gtpv2createSessionResponse(
                                    )
                                )
                            )
                        )
                    );
                    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 
            // 2. Verify that the MME sends Modify Bearer Request and receives the Modify Bearer Response
            // TODO
            // TODO If S1-MME used, need synchronisation point to trigger Initial Context Setup Response and Attach Commplete messages
            
            
            
            
            
            // Postamble
            f_postamble_MME();
            f_selfOrClientSyncAndVerdict(c_poDone, e_success);
            log("*** " & __SCOPE__ & ": INFO: Postamble done. ***");
            
        } // End of function f_TC_S11_MME_TM_01 
        
    } // End of group tunnelManagement 
    
    group preambules {
        
        /**
         * @desc Preamble function
         */
        function f_preamble_MME() runs on Gtpv2CComponent {
            // Connect client sync port
            f_connect4SelfOrClientSync();
            
            // Activate defaults
            activate(a_mme_default());
            
        } // End of function f_preamble_MME
        
    } // End of group preambules 
    
    group postambles {
        
        /**
         * @desc Postamble function
         */
        function f_postamble_MME() runs on Gtpv2CComponent {
            // Deactivate all defaults
            deactivate;
        } // End of function f_postamble_MME
        
    } // End of group postambles
    
    group s1mmeTrigger {
        
        /**
         * @desc Trigger event on S1-MME interface
         */
        function f_TC_S1_MME_TM_01() runs on Gtpv2CComponent {
            
            // Local variables
            
            // Preamble
            f_selfOrClientSyncAndVerdict(c_prDone, e_success);
            log("*** " & __SCOPE__ & ": INFO: Preamble done. ***");
            
            // Test Body
            if (not(PICS_SUPPORT_S1_MME_TRIGGERS)) {
                action("Switch the UE to initiate a NAS-ATTACH-REQUEST event on MME");
            } else {
                // FIXME To be developed
            }
            
            // Postamble
            f_selfOrClientSyncAndVerdict(c_poDone, e_success);
            
        } // End of function f_TC_S1_MME_TM_01
        
    } // End of group postambles
    
    group mmeAltsteps {
        
        /**
         * @desc Default altstep activated during the preambule
         */
        altstep a_mme_default() runs on Gtpv2CComponent {
            [] gtpv2CPort.receive {
                log("*** a_mme_default: ERROR: Received an unexpected , process it as an error ***");
                f_selfOrClientSyncAndVerdict("error", e_error);
            }
        } // End of altstep a_mme_default
        
    } // End of group mmeAltsteps 
    
} // End of module LibGtpv2C_MME_Functions 
 No newline at end of file