Commit 008df3c1 authored by garciay's avatar garciay
Browse files

Create repository

parent 6954805a
Loading
Loading
Loading
Loading
+208 −0
Original line number Diff line number Diff line
module LibGtpv2C_Configuration {
    
    // Libcommon
    import from LibCommon_BasicTypesAndValues all;
    import from LibCommon_DataStrings all;
    import from LibCommon_VerdictControl all;
    import from LibCommon_Sync all;
    import from LibCommon_Time all;
    
    // LibGtpv2C
    import from LibGtpv2C_TypesAndValues all;
    import from LibGtpv2C_TestSystem all;
    import from LibGtpv2C_Templates all;
    
    group configurationFunctions {
        
        /**
         * @desc This configuration features:
         *       - Port mapping
         *       - Sync port connection
         *       - Component setup:
         *           - one SGW node (IUT)
         *           - varaibles initialisation
         * @verdict Unchanged
         */
        function f_cf01_S11Up_MME() runs on Gtpv2CComponent {
            // Map ports
            map(self:acPort, system:acPort);
            map(self:gtpv2CPort, system:gtpv2CPort);
            
            // Connect sync ports
            f_connect4SelfOrClientSync();
            
            // Activate sync default for MTC
            activate(a_mtc_shutdown());
            
            vc_gtpv2c_sgw := Gtpv2CComponent.create; 
            
            vc_sequenceNumber := 0;
            vc_restartCounter := 0;
        } // End of function f_cf01_S11Up_MME 
        
        /**
         * @desc This configuration features:
         *       - Port mapping
         *       - Sync port connection
         *       - Component setup:
         *           - one SGW node (IUT)
         *           - varaibles initialisation
         * @verdict Unchanged
         */
        function f_cf02_S11Up_MME() runs on Gtpv2CComponent {
            // Map ports
            map(self:acPort, system:acPort);
            map(self:gtpv2CPort, system:gtpv2CPort);
            
            // Connect sync ports
            f_connect4SelfOrClientSync();
            
            // Activate sync default for MTC
            activate(a_mtc_shutdown());
            
            vc_gtpv2c_sgw := Gtpv2CComponent.create; 
            vc_gtpv2c_s1mme := Gtpv2CComponent.create; 
            
            vc_sequenceNumber := 0;
            vc_restartCounter := 0;
        } // End of function f_cf02_S11Up_MME 
        
        /**
         * @desc Copmenent shutdown
         * @verdict Unchanged
         */
        function f_cf01_S11Down_MME() runs on Gtpv2CComponent {
            
             // De-activate all
             deactivate;
             
            // Disconnect sync ports
            f_disconnect4SelfOrClientSync();
            
            // Unmap ports
            unmap(self:acPort, system:acPort);
            unmap(self:gtpv2CPort, system:gtpv2CPort);
            
        } // End of function f_cf01_S11Down_MME 
        
        /**
         * @desc Copmenent shutdown
         * @verdict Unchanged
         */
        function f_cf02_S11Down_MME() runs on Gtpv2CComponent {
            
             // De-activate all
             deactivate;
             
            // Disconnect sync ports
            f_disconnect4SelfOrClientSync();
            
            // Unmap ports
            unmap(self:acPort, system:acPort);
            unmap(self:gtpv2CPort, system:gtpv2CPort);
            
        } // End of function f_cf01_S11Down_MME 
        
        /**
         * @desc This configuration features:
         *       - Port mapping
         *       - Sync port connection
         *       - Component setup:
         *           - one MME node (IUT)
         *           - one S1-MME node (UT)
         *           - varaibles initialisation
         */
        function f_cf01_S11Up_SGW() runs on Gtpv2CComponent {
            // Map ports
            map(self:acPort, system:acPort);
            map(self:gtpv2CPort, system:gtpv2CPort);
            
            // Connect sync ports
            f_connect4SelfOrClientSync();
            
            // Activate sync default for MTC
            activate(a_mtc_shutdown());
            
            vc_gtpv2c_mme := Gtpv2CComponent.create; 
            
            vc_sequenceNumber := 0;
            vc_restartCounter := 0;
        } // End of function f_cf01_S11Up_SGW 
        
        /**
         * @desc Copmenent shutdown
         * @verdict Unchanged
         */
        function f_cf01_S11Down_SGW() runs on Gtpv2CComponent {
            
             // De-activate all
             deactivate;
             
            // Disconnect sync ports
            f_disconnect4SelfOrClientSync();
            
            // Unmap ports
            unmap(self:acPort, system:acPort);
            unmap(self:gtpv2CPort, system:gtpv2CPort);
            
        } // End of function f_cf01_S11Down_SGW 
        
        /**
         * @desc Shutdown alstep in case the sync delf server is requesting shutdown
         * @verdict Unchanged
         */
        altstep a_mtc_shutdown() runs on SelfSyncComp {
            []  syncSendPort.receive(m_syncServerStop){
              tc_sync.stop ;
              log("**** a_mtc_shutdown: MTC component received STOP signal **** ");
              stop;
          }
        } // End of altstep a_mtc_shutdown
        
    } // End of group configurationFunctions 
    
    group acFuntions { 
        
    } // End of group acFuntions 
    
    
    /**
     * @desc Variable length information elements calculations
     * 
     * @see ETSI TS 129 274 V9.11.0 Clause 8.2 Information Element Format
     */
    group tlviVariableLengthCalculations { 
        
//        function f_calculateInformationElementLength_cause(in Cause p_cause) return Cause {
//            p_cause.length_ := sizeof(p_cause);
//            
//            return p_cause;
//        } // End of function f_calculateInformationElementLength_cause
        
    }// End of group tlviVariableLengthCalculations 
    
    group helperFunctions { 
        
        /**
         * @desc Increment and return the sequence number
         * @return The new sequence number value
         * @verdict Unchanged
         */
        function f_getNextSequenceNumber() runs on Gtpv2CComponent return UInt24 {
            vc_sequenceNumber := (vc_sequenceNumber + 1) mod c_uInt24Max;
            return vc_sequenceNumber;
        } // End of function f_getNextSequenceNumber
        
        /**
         * @desc Increment and return the restart counter
         * @return The new restart counter value
         * @verdict Unchanged
         */
        function f_getNextRestartCounter() runs on Gtpv2CComponent return UInt16 {
            vc_restartCounter := (vc_restartCounter + 1) mod c_uInt16Max;
            return vc_restartCounter;
        } // End of function f_getNextRestartCounter
        
    } // End of group helperFunctions 
    
} // End of module LibGtpv2C_Configuration 
 No newline at end of file