Commit 6d46c526 authored by tepelmann's avatar tepelmann
Browse files

Moved tx_wait to ItsAdapterComponent.

Harmonized upper tester functionality in centralizing it in LibItsCommon_Functions and LibItsCommon_TypesAndValues.
parent ab9f720b
Loading
Loading
Loading
Loading
+4 −85
Original line number Original line Diff line number Diff line
@@ -15,6 +15,8 @@
    // LibIts
    // LibIts
    import from LibIts_Interface all;
    import from LibIts_Interface all;
    import from LibItsBtp_TypesAndValues all;
    import from LibItsBtp_TypesAndValues all;
    import from LibItsBtp_Templates all;
    import from LibItsCommon_Functions all;
     
     
    group configurationFunctions {
    group configurationFunctions {
        
        
@@ -82,7 +84,7 @@
        function f_prInitialState() runs on ItsNt {
        function f_prInitialState() runs on ItsNt {
            
            
            f_prDefault();
            f_prDefault();
            f_utInitializeIut();
            f_utInitializeIut(m_btpInitialize);


        }
        }
        
        
@@ -100,87 +102,4 @@
        
        
    } // end postambles
    } // end postambles
    
    
    group upperTester {
        
        /**
         * @desc    Requests to bring the IUT in an initial state
         */
        function f_utInitializeIut() runs on ItsNt {
            
            utPort.send(UtBtpInitialize:{});
            tc_wait.start;
            alt {
                [] utPort.receive(UtBtpResult:true) {
                    tc_wait.stop;
                    log("*** f_utInitializeIut: INFO: IUT initialized ***");
                }
                [] utPort.receive {
                    tc_wait.stop;
                    f_selfOrClientSyncAndVerdict("error", e_error, "*** IUT could not be initialized ***");
                }
                [] tc_wait.timeout {
                    f_selfOrClientSyncAndVerdict("error", e_timeout, "*** IUT could not be initialized in time ***");
                }
            }
            
        }
        
        /**
         * @desc    Triggers event from the application layer
         * @param   p_event The event to trigger.
         * @return 
         */
        function f_utTriggerEvent(template (value) UtBtpEvent p_event) runs on ItsNt return FncRetCode {
            var FncRetCode v_ret := e_success;
            var template (value) UtBtpTrigger v_utMsg := { p_event };
            
            utPort.send(v_utMsg);
            
            return v_ret;
        }
        
        /**
         * @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.
         * @return 
         */
        function f_utCheckEvent(template (value) UtBtpEvent p_event, boolean p_discard := false) runs on ItsNt {
            var template (value) UtBtpCheck v_utMsg := { p_event };
            
            utPort.send(v_utMsg);
            tc_wait.start;
            alt {
                [] utPort.receive(UtBtpResult:true) {
                    tc_wait.stop;
                    if (p_discard == false) {
                        log("*** f_utCheckEvent: Event correctly indicated at application layer ***");
                    }
                    else {
                        f_selfOrClientSyncAndVerdict("error", e_error, "*** f_utCheckEvent: Event indicated at application layer where it should be discarded ***");
                    }
                }
                [] utPort.receive {
                    tc_wait.stop;
                    if (p_discard == false) {
                        f_selfOrClientSyncAndVerdict("error", e_error, "*** f_utCheckEvent: Event not correctly indicated at application layer ***");
                    }
                    else {
                        log("*** f_utCheckEvent: Another event indicated at application layer, repeating check ***");
                        repeat;
                    }
                }
                [] tc_wait.timeout {
                    if (p_discard == false) {
                        f_selfOrClientSyncAndVerdict("error", e_timeout, "*** f_utCheckEvent: Timeout while waiting for event check result ***");
                    }
                    else {
                        log("*** f_utCheckEvent: Event not indicated at application layer ***");
                    }
                }
            }
        }
        
    } // end of group upper tester    
    
} // end LibItsBtp_Functions
} // end LibItsBtp_Functions
 No newline at end of file
+25 −10
Original line number Original line Diff line number Diff line
@@ -11,6 +11,7 @@ module LibItsBtp_Templates {
    import from LibIts_Interface all;
    import from LibIts_Interface all;
    import from LibItsBtp_TypesAndValues all;
    import from LibItsBtp_TypesAndValues all;
    import from LibItsBtp_Pixits all;
    import from LibItsBtp_Pixits all;
    import from LibItsCommon_TypesAndValues all;
        
        
    group btpPrimitivesTemplates {
    group btpPrimitivesTemplates {


@@ -36,38 +37,52 @@ module LibItsBtp_Templates {
    
    
        group utPrimitives {
        group utPrimitives {
            
            
            /**
             * @desc Initializes the BTP IUT. 
             */
            template (value) UtInitialize m_btpInitialize := {
                utBtpInitialize := {
                }
            }
            
            /**
            /**
             * @desc Generate a BTP A packet
             * @desc Generate a BTP A packet
             * @param p_destPort  The destination port
             * @param p_destPort  The destination port
             * @param p_srcPort   The source port
             * @param p_srcPort   The source port
             */
             */
            template (value) UtBtpEvent m_generateBtpAPacket(in BtpPortId p_destPort, in BtpPortId p_srcPort) := {
            template (value) UtEvent m_generateBtpAPacket(in BtpPortId p_destPort, in BtpPortId p_srcPort) := {
                utBtpEvent := {
                    btpA := {
                    btpA := {
                        destinationPort := p_destPort,
                        destinationPort := p_destPort,
                        sourcePort := p_srcPort
                        sourcePort := p_srcPort
                    }
                    }
                }
                }
            }
            
            
            /**
            /**
             * @desc Generate a BTP B packet
             * @desc Generate a BTP B packet
             * @param p_destPort      The destination port
             * @param p_destPort      The destination port
             * @param p_destPortInfo  The destination port information
             * @param p_destPortInfo  The destination port information
             */
             */
            template (value) UtBtpEvent m_generateBtpBPacket(in BtpPortId p_destPort, in BtpPortInfo p_destPortInfo) := {
            template (value) UtEvent m_generateBtpBPacket(in BtpPortId p_destPort, in BtpPortInfo p_destPortInfo) := {
                utBtpEvent := {
                    btpB := {
                    btpB := {
                        destinationPort := p_destPort,
                        destinationPort := p_destPort,
                        destinationPortInfo := p_destPortInfo
                        destinationPortInfo := p_destPortInfo
                    }
                    }
                }
                }
            }
            
            
            /**
            /**
             * @desc Generate a BTP B packet
             * @desc Generate a BTP B packet
             * @param p_destPort      The destination port
             * @param p_destPort      The destination port
             * @param p_destPortInfo  The destination port information
             * @param p_destPortInfo  The destination port information
             */
             */
            template (value) UtBtpEvent m_checkPayload(in BtpPayload p_payload) := {
            template (value) UtEvent m_checkPayload(in BtpPayload p_payload) := {
                utBtpEvent := {
                    payload := p_payload
                    payload := p_payload
                }
                }
            }
            
            
        } // end utPrimitives
        } // end utPrimitives
        
        
+0 −10
Original line number Original line Diff line number Diff line
@@ -87,16 +87,6 @@ module LibItsBtp_TypesAndValues {
        type record UtBtpInitialize {
        type record UtBtpInitialize {
        }
        }
        
        
        type record UtBtpTrigger {
            UtBtpEvent utEvent
        }
        
        type record UtBtpCheck {
            UtBtpEvent utEvent
        }
        
        type boolean UtBtpResult;
        
        type union UtBtpEvent {
        type union UtBtpEvent {
            BtpAHeader  btpA,
            BtpAHeader  btpA,
            BtpBHeader  btpB,
            BtpBHeader  btpB,
+82 −73
Original line number Original line Diff line number Diff line
@@ -89,7 +89,7 @@ module LibItsCam_Functions {
            // basic default altstep
            // basic default altstep
            activate(a_default());
            activate(a_default());
                      
                      
            f_utInitializeIut();
            f_utInitializeIut(m_camInitialize);
            
            
        } // end f_prInitialState
        } // end f_prInitialState
    
    
@@ -128,78 +128,87 @@ module LibItsCam_Functions {
    
    
    } // end group otherFunctions
    } // end group otherFunctions


    group upperTester {
//    group upperTester {
    
//    
        /**
//        /**
         * @desc    Requests to bring the IUT in an initial state
//         * @desc    Requests to bring the IUT in an initial state
         */
//         */
        function f_utInitializeIut() runs on ItsFa {
//        function f_utInitializeIut() runs on ItsFa {
            
//            
            utPort.send(UtCamInitialize:{});
//            utPort.send(UtCamInitialize:{});
            tc_wait.start;
//            tc_wait.start;
            alt {
//            alt {
                [] utPort.receive(UtCamResult:true) {
//                [] utPort.receive(UtCamResult:true) {
                    tc_wait.stop;
//                    tc_wait.stop;
                    log("*** f_utInitializeIut: IUT initialized ***");
//                    log("*** f_utInitializeIut: IUT initialized ***");
                }
//                }
                [] utPort.receive {
//                [] utPort.receive {
                    tc_wait.stop;
//                    tc_wait.stop;
                    f_selfOrClientSyncAndVerdict("error", e_error, "*** f_utInitializeIut: IUT could not be initialized ***");
//                    f_selfOrClientSyncAndVerdict("error", e_error, "*** f_utInitializeIut: IUT could not be initialized ***");
                    stop;
//                }
                }
//                [] tc_wait.timeout {
                [] tc_wait.timeout {
//                    f_selfOrClientSyncAndVerdict("error", e_timeout, "*** f_utInitializeIut: IUT could not be initialized in time ***");
                    f_selfOrClientSyncAndVerdict("error", e_timeout, "*** f_utInitializeIut: IUT could not be initialized in time ***");
//                }
                    stop;
//            }
                }
//            
            }
//        }
            
//        
        }
//        /**
        
//         * @desc    Triggers event from the application layer
        /**
//         * @param   p_event The event to trigger.
         * @desc    Triggers event from the application layer
//         */
         * @param   p_event The event to trigger.
//        function f_utTriggerEvent(template (value) UtCamEvent p_event) runs on ItsFa return FncRetCode {
         */
//            var FncRetCode v_ret := e_success;
        function f_utTriggerEvent(template (value) UtCamEvent p_event) runs on ItsFa return FncRetCode {
//            var template (value) UtCamTrigger v_utMsg := { p_event };
            var FncRetCode v_ret := e_success;
//            
            var template (value) UtCamTrigger v_utMsg := { p_event };
//            utPort.send(v_utMsg);
            
//            
            utPort.send(v_utMsg);
//            return v_ret;
            
//        }
            return v_ret;
//        
        }
//        /**
        
//         * @desc    Checks that the event was indicated at the application layer
        /**
//         * @param   p_event The event to check.
         * @desc    Checks that the event was indicated at the application layer
//         * @param   p_discard The event should not appear. Default value: FALSE.
         * @param   p_event The event to check.
//         */
         */
//        function f_utCheckEvent(template (value) CamPdu p_event, boolean p_discard := false) runs on ItsFa {
        function f_utCheckEvent(template (value) CamPdu p_event) runs on ItsFa return FncRetCode {
//            var template (value) UtCamCheck v_utMsg := { p_event };
            var FncRetCode v_ret := e_success;
//            
            var template (value) UtCamCheck v_utMsg := { p_event };
//            utPort.send(v_utMsg);
            
//            tc_wait.start;
            utPort.send(v_utMsg);
//            alt {
            tc_wait.start;
//                [] utPort.receive(UtCamResult:true) {
            alt {
//                    tc_wait.stop;
                [] utPort.receive(UtCamResult:true) {
//                    if (p_discard == false) {
                    tc_wait.stop;
//                        log("*** f_utCheckEvent: Event correctly indicated at application layer ***");
                    log("*** f_utCheckEvent: PASS: Event correctly indicated at application layer ***");
//                    }
                    v_ret := e_success;
//                    else {
                }
//                        f_selfOrClientSyncAndVerdict("error", e_error, "*** f_utCheckEvent: Event indicated at application layer where it should be discarded ***");
                [] utPort.receive {
//                    }
                    tc_wait.stop;
//                }
                    f_selfOrClientSyncAndVerdict("error", e_error, "*** f_utCheckEvent: Event not correctly indicated at application layer ***");
//                [] utPort.receive {
                    v_ret := e_error;
//                    tc_wait.stop;
                }
//                    if (p_discard == false) {
                [] tc_wait.timeout {
//                        f_selfOrClientSyncAndVerdict("error", e_error, "*** f_utCheckEvent: Event not correctly indicated at application layer ***");
                    f_selfOrClientSyncAndVerdict("error", e_timeout, "*** f_utCheckEvent: Timeout while waiting for event check result ***");
//                    }
                    v_ret := e_timeout;
//                    else {
                }
//                        log("*** f_utCheckEvent: Another event indicated at application layer, repeating check ***");
            }
//                        repeat;
            
//                    }
            return v_ret;
//                }
        }
//                [] tc_wait.timeout {
        
//                    if (p_discard == false) {
    } // end group upperTester
//                        f_selfOrClientSyncAndVerdict("error", e_timeout, "*** f_utCheckEvent: Timeout while waiting for event check result ***");
    
//                    }
//                    else {
//                        log("*** f_utCheckEvent: Event not indicated at application layer ***");
//                    }
//                }
//            }
//        }
//        
//    } // end group upperTester
//    
    group getIutFunctions {
    group getIutFunctions {
          
          
        /** 
        /** 
+87 −34
Original line number Original line Diff line number Diff line
@@ -12,6 +12,7 @@ module LibItsCam_Templates {
    import from LibItsCam_Pixits all;
    import from LibItsCam_Pixits all;
    import from CAM_PDU_Descriptions language "ASN.1:1997" all;
    import from CAM_PDU_Descriptions language "ASN.1:1997" all;
    import from DENM_PDU_Descriptions language "ASN.1:1997" all;
    import from DENM_PDU_Descriptions language "ASN.1:1997" all;
    import from LibItsCommon_TypesAndValues all;
    
    
    group Primitives {
    group Primitives {
        
        
@@ -37,142 +38,194 @@ module LibItsCam_Templates {
        
        
        group utPrimitives {
        group utPrimitives {
            
            
            /**
             * @desc Initializes the CAM IUT. 
             */
            template (value) UtInitialize m_camInitialize := {
                utCamInitialize := {
                }
            }
            
            /**
            /**
             * @desc Change the heading
             * @desc Change the heading
             * @param p_offset Offset to the current heading
             * @param p_offset Offset to the current heading
             */
             */
            template (value) UtCamEvent m_changeHeading(Direction p_offset) := {
            template (value) UtEvent m_changeHeading(Direction p_offset) := {
                utCamEvent := {
                    changeHeading := p_offset
                    changeHeading := p_offset
                }
                }
            }
            
            
            /**
            /**
             * @desc Change the position in the direction of the current heading
             * @desc Change the position in the direction of the current heading
             * @param p_offset Offset to the current position
             * @param p_offset Offset to the current position
             */
             */
            template (value) UtCamEvent m_changePosition(integer p_offset) := {
            template (value) UtEvent m_changePosition(integer p_offset) := {
                utCamEvent := {
                    changePosition := p_offset
                    changePosition := p_offset
                }
                }
            }
            
            
            /**
            /**
             * @desc Change the speed
             * @desc Change the speed
             * @param p_offset Offset to the current position
             * @param p_offset Offset to the current position
             */
             */
            template (value) UtCamEvent m_changeSpeed(Speed p_offset) := {
            template (value) UtEvent m_changeSpeed(Speed p_offset) := {
                utCamEvent := {
                    changeSpeed := p_offset
                    changeSpeed := p_offset
                }
                }
            }
            
            
            /**
            /**
             * @desc Set the crash status
             * @desc Set the crash status
             * @param p_status The status to set
             * @param p_status The status to set
             */
             */
            template (value) UtCamEvent m_setCrashSignal(CrashStatus p_status) := {
            template (value) UtEvent m_setCrashSignal(CrashStatus p_status) := {
                utCamEvent := {
                    setCrashSignal := p_status
                    setCrashSignal := p_status
                }
                }
            }
            
            
            /**
            /**
             * @desc Set the dangerous goods status
             * @desc Set the dangerous goods status
             * @param p_status The status to set
             * @param p_status The status to set
             */
             */
            template (value) UtCamEvent m_setDangerousGoodsStatus(DangerousGoods p_status) := {
            template (value) UtEvent m_setDangerousGoodsStatus(DangerousGoods p_status) := {
                utCamEvent := {
                    setDangerousGoodsStatus := p_status
                    setDangerousGoodsStatus := p_status
                }
                }
            }
            
            
            //TODO not clear which parameter type to use
            //TODO not clear which parameter type to use
            /**
            /**
             * @desc Set the length and width precision
             * @desc Set the length and width precision
             * @param p_precision The precision to set
             * @param p_precision The precision to set
             */
             */
            template (value) UtCamEvent m_setLengthWidthPrecision(boolean p_precision) := {
            template (value) UtEvent m_setLengthWidthPrecision(boolean p_precision) := {
                utCamEvent := {
                    setLengthWidthPrecision := p_precision
                    setLengthWidthPrecision := p_precision
                }
                }
            }
            
            
            /**
            /**
             * @desc Set the distance to the stop line
             * @desc Set the distance to the stop line
             * @param p_distance The distance to set
             * @param p_distance The distance to set
             */
             */
            template (value) UtCamEvent m_setDistanceToStopLine(Distance p_distance) := {
            template (value) UtEvent m_setDistanceToStopLine(Distance p_distance) := {
                utCamEvent := {
                    setDistanceToStopLine := p_distance
                    setDistanceToStopLine := p_distance
                }
                }
            }
            
            
            /**
            /**
             * @desc Set the turn advice
             * @desc Set the turn advice
             * @param p_turnAdvice The turn advice to set
             * @param p_turnAdvice The turn advice to set
             */
             */
            template (value) UtCamEvent m_setTurnAdvice(TurnAdvice p_turnAdvice) := {
            template (value) UtEvent m_setTurnAdvice(TurnAdvice p_turnAdvice) := {
                utCamEvent := {
                    setTurnAdvice := p_turnAdvice
                    setTurnAdvice := p_turnAdvice
                }
                }
            }
            
            
            /**
            /**
             * @desc Change the curvature
             * @desc Change the curvature
             * @param p_offset Offset to the current curvature
             * @param p_offset Offset to the current curvature
             */
             */
            template (value) UtCamEvent m_changeCurvature(Curvature p_offset) := {
            template (value) UtEvent m_changeCurvature(Curvature p_offset) := {
                utCamEvent := {
                    changeCurvature := p_offset
                    changeCurvature := p_offset
                }
                }
            }
            
            
            /**
            /**
             * @desc Set the occupancy
             * @desc Set the occupancy
             * @param p_occupancy The occupancy to set
             * @param p_occupancy The occupancy to set
             */
             */
            template (value) UtCamEvent m_setOccupancy(Occupancy p_occupancy) := {
            template (value) UtEvent m_setOccupancy(Occupancy p_occupancy) := {
                utCamEvent := {
                    setOccupancy := p_occupancy
                    setOccupancy := p_occupancy
                }
                }
            }
            
            
            /**
            /**
             * @desc Set the door status
             * @desc Set the door status
             * @param p_status The status to set
             * @param p_status The status to set
             */
             */
            template (value) UtCamEvent m_setDoorStatus(DoorOpen p_status) := {
            template (value) UtEvent m_setDoorStatus(DoorOpen p_status) := {
                utCamEvent := {
                    setDoorStatus := p_status
                    setDoorStatus := p_status
                }
                }
            }
            
            
            /**
            /**
             * @desc Set the light bar status
             * @desc Set the light bar status
             * @param p_status The status to set
             * @param p_status The status to set
             */
             */
            template (value) UtCamEvent m_setLightBarStatus(SimpleSystemState p_status) := {
            template (value) UtEvent m_setLightBarStatus(SimpleSystemState p_status) := {
                utCamEvent := {
                    setLightBarStatus := p_status
                    setLightBarStatus := p_status
                }
                }
            }
            
            
            /**
            /**
             * @desc Set the sirene status
             * @desc Set the sirene status
             * @param p_status The status to set
             * @param p_status The status to set
             */
             */
            template (value) UtCamEvent m_setSireneStatus(SimpleSystemState p_status) := {
            template (value) UtEvent m_setSireneStatus(SimpleSystemState p_status) := {
                utCamEvent := {
                    setSireneStatus := p_status
                    setSireneStatus := p_status
                }
                }
            }
            
            
            /**
            /**
             * @desc Set the traffic light priority
             * @desc Set the traffic light priority
             * @param p_priority The priority to set
             * @param p_priority The priority to set
             */
             */
            template (value) UtCamEvent m_setTrafficLightPriority(Priority p_priority) := {
            template (value) UtEvent m_setTrafficLightPriority(Priority p_priority) := {
                utCamEvent := {
                    setTrafficLightPriority := p_priority
                    setTrafficLightPriority := p_priority
                }
                }
            }
            
            
            /**
            /**
             * @desc Set the schedule deviation
             * @desc Set the schedule deviation
             * @param p_scheduleDeviation The schedule deviation to set
             * @param p_scheduleDeviation The schedule deviation to set
             */
             */
            template (value) UtCamEvent m_setScheduleDeviation(ScheduleDeviation p_scheduleDeviation) := {
            template (value) UtEvent m_setScheduleDeviation(ScheduleDeviation p_scheduleDeviation) := {
                utCamEvent := {
                    setScheduleDeviation := p_scheduleDeviation
                    setScheduleDeviation := p_scheduleDeviation
                }
                }
            }
            
            
            /**
            /**
             * @desc Set the PT line description
             * @desc Set the PT line description
             * @param p_ptLineDescription The PT line description to set
             * @param p_ptLineDescription The PT line description to set
             */
             */
            template (value) UtCamEvent m_setPtLineDescription(PTLineDescription p_ptLineDescription) := {
            template (value) UtEvent m_setPtLineDescription(PTLineDescription p_ptLineDescription) := {
                utCamEvent := {
                    setPtLineDescription := p_ptLineDescription
                    setPtLineDescription := p_ptLineDescription
                }
                }
            }
            
            
            /**
            /**
             * @desc Set the exterior lights status
             * @desc Set the exterior lights status
             * @param p_status The status to set
             * @param p_status The status to set
             */
             */
            template (value) UtCamEvent m_setExteriorLightsStatus(ExteriorLights p_status) := {
            template (value) UtEvent m_setExteriorLightsStatus(ExteriorLights p_status) := {
                utCamEvent := {
                    setExteriorLightsStatus := p_status
                    setExteriorLightsStatus := p_status
                }
                }
            }
            
            /**
             * @desc Checks the receive of a message at LDM
             * @param p_message The CAM message to check
             */
            template (value) UtEvent m_checkLDM(CamPdu p_message) := {
                utCamEvent := {
                    checkLdm := p_message
                }
            }
            
            
        } // end utPrimitives
        } // end utPrimitives
        
        
Loading