LibItsBtp_Functions.ttcn 4.29 KB
Newer Older
berge's avatar
berge committed
/**
 *  @author     ETSI / STF405
 *  @version    $URL$
 *              $Id$
 *  @desc       Module containing functions for basic Transport Protocol
 *
 */
fischer's avatar
fischer committed
 
 module LibItsBtp_Functions {
     
    // LibCommon
    import from LibCommon_Sync all;
fischer's avatar
fischer committed
    import from LibCommon_VerdictControl all;
    
    // LibIts
    import from LibIts_Interface all;
    import from LibItsBtp_TypesAndValues all;
    import from LibItsBtp_Templates all;
    import from LibItsBtp_Pixits all;
    import from LibItsCommon_Functions all;
fischer's avatar
fischer committed
     
    group configurationFunctions {
        
        /**
         * @desc    Setups default configuration   
         */
        function f_cfUp() runs on ItsNt {
            
            map(self:utPort, system:utPort);
            map(self:btpPort, system:btpPort);
            f_connect4SelfOrClientSync();
            
        } // end f_cfUp
        
        /**
         * @desc    Deletes default configuration 
         */
        function f_cfDown() runs on ItsNt {
            
            unmap(self:utPort, system:utPort);
            unmap(self:btpPort, system:btpPort);
            f_disconnect4SelfOrClientSync();
            
        } // end f_cfDown
        
    } // end configurationFunctions
berge's avatar
berge committed
    
tepelmann's avatar
tepelmann committed
    group btpAltsteps {
        
        /**
         * @desc The base default.
         */
        altstep a_default() runs on ItsNt {
            
            [] btpPort.receive {
                log("*** a_default: ERROR: Received an unexpected message ***");
berge's avatar
berge committed
                f_selfOrClientSyncAndVerdict("error", e_error);
tepelmann's avatar
tepelmann committed
            }
            [] tc_wait.timeout {
                log("*** a_default: INCONC: Timeout while awaiting reaction of the IUT prior to Upper Tester action ***");
berge's avatar
berge committed
                f_selfOrClientSyncAndVerdict("error", e_timeout);
tepelmann's avatar
tepelmann committed
            }
            [] tc_ac.timeout {
                log("*** a_default: INCONC: Timeout while awaiting the reception of a message ***");
berge's avatar
berge committed
                f_selfOrClientSyncAndVerdict("error", e_timeout);
tepelmann's avatar
tepelmann committed
            }
            [] a_shutdown() {
                f_poDefault();
                f_cfDown();
                log("*** a_default: INFO: TEST COMPONENT NOW STOPPING ITSELF! ***");
                stop;   
            }
        }
    } //end btpAltsteps

fischer's avatar
fischer committed
    group preambles {
        
tepelmann's avatar
tepelmann committed
        /**
         * @desc The default preamble.
         */
        function f_prDefault() runs on ItsNt {
            activate(a_default());
        }
        
fischer's avatar
fischer committed
        /**
         * @desc Brings the IUT into an initial state.
         */
berge's avatar
berge committed
        function f_prInitialState() runs on ItsNt {
fischer's avatar
fischer committed
            
tepelmann's avatar
tepelmann committed
            f_prDefault();
            f_utInitializeIut(m_btpInitialize);
fischer's avatar
fischer committed
        }
        
    } // end of group preambles    
    

tepelmann's avatar
tepelmann committed
    group postambles {
        
        /**
         * @desc The default postamble.
         */
        function f_poDefault() runs on ItsNt {
            //empty
        }
        
    } // end postambles
    
    group getFunctions {
        
        /**
         * @desc Gets the BTP source port of the IUT.
         * @return BTP source port ID
         */
        function f_getBtpSrcPort() return BtpPortId {
            return PX_SOURCE_PORT;
        }
        
        /**
         * @desc Gets the BTP destination port of the IUT.
         * @return BTP destination port ID
         */
        function f_getBtpDstPort() return BtpPortId {
            return PX_DESTINATION_PORT;
        }
        
        /**
         * @desc Gets a unknown BTP destination port of the IUT.
         * @return Unknown BTP destination port ID
        function f_getBtpUnknownDstPort() return BtpPortId {
            return PX_UNKNOWN_DESTINATION_PORT;
        }
        
        /**
         * @desc Gets the BTP destination port info of the IUT.
         * @return BTP destination port info
         */
        function f_getBtpDstPortInfo() return BtpPortId {
            return PX_DESTINATION_PORT_INFO;
        }
        
        /**
         * @desc Gets the BTP payload to use.
         * @return BTP payload
         */
        function f_getBtpPayload() return BtpPayload {
            return PX_PAYLOAD;
        }
        
    } // end getFunctions
berge's avatar
berge committed
} // end LibItsBtp_Functions