Commit 5b06c2f6 authored by YannGarcia's avatar YannGarcia
Browse files

Separate typing and test system

parent 30a18035
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -17,11 +17,11 @@ module ItsBtp_TestCases {
//    import from LibCommon_VerdictControl all;

    // LibIts
    import from LibItsBtp_TypesAndValues all;
    import from LibItsBtp_TestSystem all;
    import from LibItsBtp_Functions all;
    import from LibItsBtp_Templates all;
//    import from LibItsBtp_Pixits all;
//    import from LibItsBtp_TypesAndValues all;
//    import from LibItsCommon_Functions all;
    
    group btpPacketGeneration {
+0 −1
Original line number Diff line number Diff line
@@ -2,7 +2,6 @@ module LibItsBtp_EncdecDeclarations {
    
    // LibItsBtp
    import from LibItsBtp_TypesAndValues all;
    import from LibItsBtp_TestSystem all;
    
    /*  TODO RGy function not implemented! (decvalue() not used by test suite @29-06-2016)    
    external function fx_dec_BtpPayload (inout bitstring b, out BtpPayload p) return integer

lib/LibItsBtp_Functions.ttcn

deleted100644 → 0
+0 −237
Original line number Diff line number Diff line
/**
 *  @author     ETSI / STF405
 *  @version    $Url: https://oldforge.etsi.org/svn/LibIts/tags/20170222_STF527_Final/ttcn/BTP/LibItsBtp_Functions.ttcn $
 *              $Id: LibItsBtp_Functions.ttcn 1318 2017-01-26 10:20:53Z filatov $
 *  @desc       Module containing functions for basic Transport Protocol
 *  @copyright   ETSI Copyright Notification
 *               No part may be reproduced except as authorized by written permission.
 *               The copyright and the foregoing restriction extend to reproduction in all media.
 *               All rights reserved.
 *
 */
 
 module LibItsBtp_Functions {
     
    // LibCommon
    import from LibCommon_Sync all;
    
    // LibItsCommon
    import from LibItsCommon_TypesAndValues all;
    
    // LibItsBtp
    import from LibItsBtp_TestSystem all;
    import from LibItsBtp_TypesAndValues all;
    import from LibItsBtp_Templates all;
    import from LibItsBtp_Pixits all;

    group utFuntions { 
            
        /**
         * @desc    Requests to bring the IUT in an initial state
         * @param   p_init The initialisation to trigger.
         */
        function f_utInitializeIut(template (value) UtBtpInitialize p_init) runs on ItsBtp {
            
            //deactivate btpPort default alts
            vc_btpDefaultActive := false;
            
            utPort.send(p_init);
            tc_wait.start;
            alt {
                [] utPort.receive(UtBtpResults: { utBtpInitializeResult := true}) {
                    tc_wait.stop;
                    log("*** f_utInitializeIut: INFO: IUT initialized ***");
                }
                [] utPort.receive {
                    tc_wait.stop;
                    log("*** f_utInitializeIut: INFO: IUT could not be initialized ***");
                    f_selfOrClientSyncAndVerdict("error", e_error);
                }
                [] tc_wait.timeout {
                    log("*** f_utInitializeIut: INFO: IUT could not be initialized in time ***");
                    f_selfOrClientSyncAndVerdict("error", e_timeout);
                }
            }
            
            //activate btpPort default alts
            vc_btpDefaultActive := true;
            
        }
        
        /**
         * @desc    Triggers event from the application layer
         * @param   p_event The event to trigger.
         */
        function f_utTriggerEvent(template (value) UtBtpTrigger p_event) runs on ItsBtp {
            
            //deactivate btpPort default alts
            vc_btpDefaultActive := false;
            
            utPort.send(p_event);
            alt {
	      [] utPort.receive(UtBtpResults: { utBtpTriggerResult := true }) {
                    tc_wait.stop;
                }
                [] utPort.receive {
                    tc_wait.stop;
                }
                [] tc_wait.timeout {
                }
            }
            
            //activate btpPort default alts
            vc_btpDefaultActive := true;
            
        }
        
    } // End of group utFunctions
     
    group configurationFunctions {
        
        /**
         * @desc    Setups default configuration   
         */
        function f_cfUp() runs on ItsBtp system ItsBtpSystem {
            
            map(self:utPort, system:utPort);
            map(self:btpPort, system:btpPort);
            f_connect4SelfOrClientSync();
            
        } // end f_cfUp
        
        /**
         * @desc    Deletes default configuration 
         */
        function f_cfDown() runs on ItsBtp system ItsBtpSystem {
            
            unmap(self:utPort, system:utPort);
            unmap(self:btpPort, system:btpPort);
            f_disconnect4SelfOrClientSync();
            
        } // end f_cfDown
        
    } // end configurationFunctions
    
    group btpAltsteps {
        
        /**
         * @desc The base default.
         */
        altstep a_default() runs on ItsBtp {
            
            [vc_btpDefaultActive] btpPort.receive {
                log("*** a_default: ERROR: Received an unexpected message ***");
                f_selfOrClientSyncAndVerdict("error", e_error);
            }
            [] tc_wait.timeout {
                log("*** a_default: INCONC: Timeout while awaiting reaction of the IUT prior to Upper Tester action ***");
                f_selfOrClientSyncAndVerdict("error", e_timeout);
            }
            [] tc_ac.timeout {
                log("*** a_default: INCONC: Timeout while awaiting the reception of a message ***");
                f_selfOrClientSyncAndVerdict("error", e_timeout);
            }
            [] a_shutdown() {
                f_poDefault();
                f_cfDown();
                log("*** a_default: INFO: TEST COMPONENT NOW STOPPING ITSELF! ***");
                stop;   
            }
        }
        
        /**
         * @desc The default for handling upper tester messages.
         */
        altstep a_utDefault() runs on ItsBtp {
            var UtBtpEventInd v_ind;
            [vc_utDefaultActive] utPort.receive(UtBtpEventInd:?) -> value v_ind {
                //store every upper tester indication received
                vc_utEvents[lengthof(vc_utEvents)] := v_ind;
                repeat;
            }
            [vc_utDefaultActive] utPort.receive {
                log("*** " & testcasename() & ": INFO: Received unhandled/unknown UT message from IUT ***");
                repeat;
            }
        }
        
    } //end btpAltsteps

    group preambles {
        
        /**
         * @desc The default preamble.
         */
        function f_prDefault() runs on ItsBtp {
            activate(a_default());
            activate(a_utDefault());
        }
        
        /**
         * @desc Brings the IUT into an initial state.
         */
        function f_prInitialState() runs on ItsBtp {
            
            f_utInitializeIut(m_btpInitialize);
            f_prDefault();

        }
        
    } // end of group preambles    
    

    group postambles {
        
        /**
         * @desc The default postamble.
         */
        function f_poDefault() runs on ItsBtp {
            //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 BtpRawPayload {
            return PX_PAYLOAD;
        }
        
    } // end getFunctions
} // end LibItsBtp_Functions
+0 −1
Original line number Diff line number Diff line
@@ -12,7 +12,6 @@
module LibItsBtp_Templates {
    
    // LibIts
    import from LibItsBtp_TestSystem all;
    import from LibItsBtp_TypesAndValues all;
    import from LibItsBtp_Pixits all;
    import from LibItsCommon_TypesAndValues all;

lib/LibItsBtp_TestSystem.ttcn

deleted100644 → 0
+0 −117
Original line number Diff line number Diff line
/**
 *  @author      ETSI / STF405
 *  @version     $Url: https://oldforge.etsi.org/svn/LibIts/tags/20170222_STF527_Final/ttcn/BTP/LibItsBtp_TestSystem.ttcn $
 *               $Id: LibItsBtp_TestSystem.ttcn 1318 2017-01-26 10:20:53Z filatov $
 *  @desc        Test System module for ITS BTP
 *  @copyright   ETSI Copyright Notification
 *               No part may be reproduced except as authorized by written permission.
 *               The copyright and the foregoing restriction extend to reproduction in all media.
 *               All rights reserved.
 *
 */
module LibItsBtp_TestSystem {
    
    // LibCommon
//    import from LibCommon_Time {modulepar all};
//    import from LibCommon_Sync all;
    
    // LibIts
    import from LibItsCommon_TestSystem all;
    import from LibItsCommon_TypesAndValues all;
    import from LibItsBtp_TypesAndValues all;
    
    group portDefinitions {
    
        /**
         * @desc Upper Tester port
         */
        type port UpperTesterPort message {
            out 
                UtBtpInitialize, UtBtpTrigger;
            in 
                UtBtpResults, UtBtpEventInd;
        } // end UpperTesterPort
        
    } // end portDefinitions

    group interfacePorts {

        group networkAndTransportPorts {
            
            group nt1Ports {

                /**
                 * @desc NT1 BTP Port (BTP/GeoNet/G5) 
                 */
                type port BtpPort message {
                    in BtpInd;
                    out BtpReq;
                } // end BtpPort
                                
            } // End of group nt1Ports
            
        } // End of group networkAndTransportPorts
    
    } // End of group interfacePorts
    
    group componentDefinitions {

        /**
         * @desc ITS System Adapter
         */
        type component ItsBtpSystem {
            
            port UpperTesterPort utPort;
            
            // NT1 ports 
            port BtpPort btpPort;
            
        } // end component ItsAdapter
        
    } // End of group componentDefinitions
    
    /**
     * @desc Test component for ITS Network and Transport layer 
     */
    type component ItsBtp extends ItsBaseComponent {
        
        port UpperTesterPort utPort;
        
        // NT1 ports 
        port BtpPort btpPort;
                
        // timers
                
        var UtBtpEventIndList vc_utEvents := {};
        
        var boolean vc_utDefaultActive := true;
        var boolean vc_btpDefaultActive := true;
        
    } // End of component ItsBtp
        
    group networkAndTransportPrimitives { 
            
        group nt1Primitives {

            /**
             * @desc NT1 BTP Indication Primitive 
             */
            type record BtpInd {
                BtpPacket msgIn
            }
        
            /**
             * @desc NT1 BTP Request Primitive 
             */
            type record BtpReq {
                BtpPacket msgOut
            }
                        
        } // end nt1Primitives
        
    } // End of group networkAndTransportPrimitives    
        with {
           encode "LibIts_Interface"
    } // end interfacePrimitives    
     
} // End of module LibItsBtp_TestSystem
Loading