Commit dfe39c4a authored by tepelmann's avatar tepelmann
Browse files

Harmonized UT handling.

parent 1243e0f8
Loading
Loading
Loading
Loading
+30 −54
Original line number Diff line number Diff line
@@ -15,6 +15,7 @@
    
    // LibItsCommon
    import from LibItsCommon_Functions all;
    import from LibItsCommon_TypesAndValues all;
    
    // LibItsBtp
    import from LibItsBtp_TestSystem all;
@@ -33,7 +34,7 @@
            utPort.send(p_init);
            tc_wait.start;
            alt {
                [] utPort.receive(UtResult:true) {
                [] utPort.receive(UtInitializeResult:true) {
                    tc_wait.stop;
                    log("*** f_utInitializeIut: INFO: IUT initialized ***");
                }
@@ -58,12 +59,11 @@
         * @desc    Triggers event from the application layer
         * @param   p_event The event to trigger.
         */
        function f_utTriggerEvent(template (value) UtEvent p_event) runs on ItsBtp {
            var template (value) UtTrigger v_utMsg := { p_event };
        function f_utTriggerEvent(template (value) UtBtpTrigger p_event) runs on ItsBtp {
            
            utPort.send(v_utMsg);
            utPort.send(p_event);
            alt {
                [] utPort.receive(UtResult:true) {
                [] utPort.receive(UtBtpTriggerResult:true) {
                    tc_wait.stop;
                }
                [] utPort.receive {
@@ -78,48 +78,6 @@
            }
        }
        
        /**
         * @desc Checks that the event was indicated at the application layer
         * @param p_event The event to check.
         * @param   p_discard The event should not appear. Default value: FALSE.
         */
        function f_utCheckEvent(template (value) UtEvent p_event, boolean p_discard) runs on ItsBtp {
            var template (value) UtCheck v_utMsg := { p_event };
            
            utPort.send(v_utMsg);
            tc_wait.start;
            alt {
                [] utPort.receive(UtResult:true) {
                    tc_wait.stop;
                    if (p_discard == false) {
                        log("*** f_utCheckEvent: INFO: Event correctly indicated at application layer ***");
                    }
                    else {
                        log("*** f_utCheckEvent: ERROR: Event indicated at application layer where it should be discarded ***");
                        f_selfOrClientSyncAndVerdict("error", e_error);
                    }
                }
                [] utPort.receive(UtResult:false) {
                    tc_wait.stop;
                    if (p_discard == false) {
                        log("*** f_utCheckEvent: ERROR: Event not correctly indicated at application layer ***");
                        f_selfOrClientSyncAndVerdict("error", e_error);
                    }
                    else {
                        log("*** f_utCheckEvent: INFO: Event not indicated at application layer***");
                    }
                }
                [] tc_wait.timeout {
                    log("*** f_utCheckEvent: ERROR: Timeout while waiting for event check result ***");
                    f_selfOrClientSyncAndVerdict("error", e_timeout);                    
                }
                [else] { // Shortcut defaults
                    //f_sleep(0.050); // 50 ms
                    repeat; 
                }
            }
        }
                    
    } // End of group utFunctions
     
    group configurationFunctions {
@@ -174,6 +132,23 @@
                stop;   
            }
        }
        
        /**
         * @desc The default for handling upper tester messages.
         */
        altstep a_utDefault() runs on ItsBtp {
            var UtBtpEventInd v_ind;
            [] utPort.receive(UtBtpEventInd:?) -> value v_ind {
                //store every upper tester indication received
                vc_utEvents[lengthof(vc_utEvents)] := v_ind;
                repeat;
            }
            [] utPort.receive {
                log("*** " & testcasename() & ": INFO: Received unexpected UT message from IUT ***");
                repeat;
            }
        }
        
    } //end btpAltsteps

    group preambles {
@@ -183,6 +158,7 @@
         */
        function f_prDefault() runs on ItsBtp {
            activate(a_default());
            activate(a_utDefault());
        }
        
        /**
+38 −48
Original line number Diff line number Diff line
@@ -11,6 +11,7 @@ module LibItsBtp_Templates {
    import from LibItsBtp_TestSystem all;
    import from LibItsBtp_TypesAndValues all;
    import from LibItsBtp_Pixits all;
    import from LibItsCommon_TypesAndValues all;
        
    group btpPrimitivesTemplates {

@@ -40,8 +41,7 @@ module LibItsBtp_Templates {
             * @desc Initializes the BTP IUT. 
             */
            template (value) UtInitialize m_btpInitialize := {
                utBtpInitialize := {
                }
                hashedId8 := '0000000000000000'O
            }
            
            /**
@@ -49,9 +49,9 @@ module LibItsBtp_Templates {
             * @param p_destPort  The destination port
             * @param p_srcPort   The source port
             */
            template (value) UtEvent m_generateBtpA(in BtpPortId p_destPort, in BtpPortId p_srcPort) := {
                utBtpEvent := {
            template (value) UtBtpTrigger m_generateBtpA(in BtpPortId p_destPort, in BtpPortId p_srcPort) := {
                btpA := {
                    btpAHeader := {
                        destinationPort := p_destPort,
                        sourcePort := p_srcPort
                    }
@@ -63,25 +63,15 @@ module LibItsBtp_Templates {
             * @param p_destPort      The destination port
             * @param p_destPortInfo  The destination port information
             */
            template (value) UtEvent m_generateBtpB(in BtpPortId p_destPort, in BtpPortInfo p_destPortInfo) := {
                utBtpEvent := {
            template (value) UtBtpTrigger m_generateBtpB(in BtpPortId p_destPort, in BtpPortInfo p_destPortInfo) := {
                btpB := {
                    btpBHeader := {
                        destinationPort := p_destPort,
                        destinationPortInfo := p_destPortInfo
                    }
                }
            }
                        
            /**
             * @desc Upper Tester template for checking that BTP payload has been transmitted to upper layer
             * @param p_payload Payload to be checked
             */
            template (value) UtEvent m_checkPayload(in BtpPayload p_payload) := {
                utBtpEvent := {
                    payload := p_payload
                }
            }
            
        } // end utPrimitives
        
    } // btpPrimitivesTemplates
+5 −2
Original line number Diff line number Diff line
@@ -13,6 +13,7 @@ module LibItsBtp_TestSystem {
    
    // LibIts
    import from LibItsCommon_TestSystem all;
    import from LibItsCommon_TypesAndValues all;
    import from LibItsBtp_TypesAndValues all;
    
    group portDefinitions {
@@ -22,9 +23,9 @@ module LibItsBtp_TestSystem {
         */
        type port UpperTesterPort message {
            out 
                UtInitialize, UtTrigger, UtCheck;
                UtInitialize, UtBtpTrigger;
            in 
                UtResult;
                UtInitializeResult, UtBtpTriggerResult, UtBtpEventInd;
        } // end UpperTesterPort
        
    } // end portDefinitions
@@ -77,6 +78,8 @@ module LibItsBtp_TestSystem {
                
        // timers
                
        var UtBtpEventIndList vc_utEvents := {};
        
    } // End of component ItsBtp
        
    group networkAndTransportPrimitives { 
+25 −31
Original line number Diff line number Diff line
@@ -117,58 +117,52 @@ module LibItsBtp_TypesAndValues {
        group utCommonPrimitives {
            
            /**
             * @desc Upper Tester message to initialize IUT 
             * @desc    UT primitives for BTP
             * @member  btpA      -
             * @member  btpB    -
             */
            type union UtInitialize {
                UtBtpInitialize utBtpInitialize
            type union UtBtpTrigger {
                GenerateBtpA btpA,
                GenerateBtpB btpB
            }
    
            /**
             * @desc Upper Tester message describing an action/event 
             */
            type union UtEvent {
                UtBtpEvent utBtpEvent
            }
            type boolean UtBtpTriggerResult;
            
            /**
             * @desc Upper Tester message to trigger an action on IUT 
             * @desc Upper Tester message to request triggering of an BTPA message at IUT 
             */
            type record UtTrigger {
                UtEvent utEvent
            type record GenerateBtpA {
                BtpAHeader btpAHeader
            }
                    
            /**
             * @desc Upper Tester message to check event/status on IUT 
             * @desc Upper Tester message to request triggering of an BTPB message at IUT 
             */
            type record UtCheck {
                UtEvent utEvent
            type record GenerateBtpB {
                BtpBHeader btpBHeader
            }
            
            /**
             * @desc Upper Tester response message  
             * @desc Upper Tester message to check event/status on BTP IUT 
             */    
            type boolean UtResult;
        }
        with {
            encode "LibItsCommon"
            type record UtBtpEventInd {
                BtpRawPayload rawPayload
            }
            
            /**
         * @desc Upper Tester message to initialize BTP IUT 
             * @desc List of Upper Tester messages to check event/status on CAM IUT 
             */    
        type record UtBtpInitialize {
            type record of UtBtpEventInd UtBtpEventIndList;
        }
//        with {
//            encode "LibItsCommon"
//        }
                
        /**
         * @desc Upper Tester message generating BTP packet
         */
        type union UtBtpEvent {
            BtpAHeader  btpA,
            BtpBHeader  btpB,
            BtpPayload  payload
        }
        
    } // end utPrimitives
    with {
        encode "UpperTester"
    }
    
}
with {