Commit 7f101dd3 authored by tepelmann's avatar tepelmann
Browse files

Implemented

	TC_DEN_MSGF_BV_01-02,
	TC_DEN_EVGN_BV_01-15,
	TC_DEN_SSCI_BV_01-03,
	TC_DEN_TDEV_BV_01,
	TC_DEN_TNEV_BV_01-04,
	TC_DEN_DRCX_BV_01-04
Added TODOs.
Trigger and preamble functions are just dummy implementations.
Resend of messages not yet handled in TTCN-3.
parent 641ce670
Loading
Loading
Loading
Loading
+312 −0
Original line number Diff line number Diff line
@@ -10,6 +10,13 @@ module LibItsDenm_Functions {
    // LibIts
    import from LibIts_TestSystem all;
    import from LibIts_Interface all; 
    import from LibItsDenm_TypesAndValues all; 
    import from LibItsDenm_Templates all; 
    import from CAM_PDU_Descriptions language "ASN.1:1997" all;
    import from DENM_PDU_Descriptions language "ASN.1:1997" all;
    
    // LibCommon
    import from LibCommon_VerdictControl all;

    /**
     * @desc 	Create Facility component and connects DENM port
@@ -47,4 +54,309 @@ module LibItsDenm_Functions {
        
    } // end f_ptcDenmDown
    
    group altsteps {
        
        /**
         * @desc The base default.
         */
        altstep a_default() runs on ItsFa {
            [] denmPort.receive {
                setverdict (inconc, "Received an unexpected message");
                //TODO shall stop be called here?
                stop;
            }
            [] tc_wait.timeout {
                setverdict (inconc, "Timeout while awaiting reaction of the IUT prior to Upper Tester action");
                //TODO shall stop be called here?
                stop;
            }
            [] tc_ac.timeout {
                setverdict (inconc, "Timeout while awaiting the reception of a message");
                //TODO shall stop be called here?
                stop;
            }
        }
        
    } // end group altsteps
    
    group preambles {
        
        /**
         * @desc The default preamble.
         */
        function f_prDefault() runs on ItsFa {
            vc_default := activate(a_default());
        }
        
        /**
         * @desc Brings the IUT into an initial state.
         * @return 
         */
        function f_prInitialState() runs on ItsFa return FncRetCode {
            var FncRetCode v_ret := e_success;
            
            f_prDefault();
            
            //TODO raise action or send message via port
            
            f_setVerdictPreOrPostamble(v_ret);
            
            return v_ret;
        }
        
    } // end group preambles
    
    group postambles {
        
        /**
         * @desc The default postamble.
         */
        function f_poDefault() runs on ItsFa {
            var FncRetCode v_ret := e_success;
            //empty
            f_setVerdictPreOrPostamble(v_ret);
            
        }
        
        /**
         * @desc Postamble including cancellation of an event.
         * @param p_trigger Indicates if the cancellation have to be raised by the test system(e_ets) or at the application layer of the IUT(e_iut).
         * @param p_event The event to cancel.
         * @verdict 
         */
        function f_poCancelEvent(template (value) Trigger p_trigger, template (value) Situation p_event) runs on ItsFa {
            var FncRetCode v_ret := e_success;
            
            if (p_trigger == e_ets) {
                f_sendDENM(
                    m_denmReq(
                        m_denmWithCause(c_dataVersionCancellation, p_event)
                    )
                );
            }
            else {
                v_ret := f_triggerEventCancellation(p_event);
            }
            //empty
            f_setVerdictPreOrPostamble(v_ret);
            
            f_poDefault();
        }
        
    } // end group postambles
    
    group eventFunctions {
        
        //TODO check if type Situation is suitable
        /**
         * @desc Triggers event from the application layer
         * @param p_event The event cause and subcause.
         * @return 
         */
        function f_triggerEvent(template (value) Situation p_event) runs on ItsFa return FncRetCode {
            var FncRetCode v_ret := e_success;
            
            //TODO raise action or send message via port
            
            return v_ret;
        }
        
        /**
         * @desc Triggers cancellation event from the application layer
         * @param p_event The event cause and subcause.
         * @return 
         */
        function f_triggerEventCancellation(template (value) Situation p_event) runs on ItsFa return FncRetCode {
            var FncRetCode v_ret := e_success;
            var DataVersion v_dataVersion := c_dataVersionCancellation;
            
            //TODO raise action or send message via port
            
            return v_ret;
        }
        
        /**
         * @desc Triggers event negation from the application layer
         * @param p_event The event cause and subcause.
         * @return 
         */
        function f_triggerEventNegation(template (value) Situation p_event) runs on ItsFa return FncRetCode {
            var FncRetCode v_ret := e_success;
            var DecentralizedEnvironmentalNotificationMessage.management.isNegation isNegation := true;
            
            //TODO raise action or send message via port
            
            return v_ret;
        }
        
        /**
         * @desc Triggers event with additional TrafficFlowEffect information field included from the application layer
         * @param p_event The event cause and subcause.
         * @param p_tfe The Traffic Flow Effect.
         * @return 
         */
        function f_triggerEventTrafficFlowEffect(
            template (value) Situation p_event, 
            template (value) TrafficFlowEffect p_tfe
            ) runs on ItsFa return FncRetCode {
            var FncRetCode v_ret := e_success;
            
            //TODO raise action or send message via port
            
            return v_ret;
        }
        
        /**
         * @desc Triggers event with additional LinkedCause information field included from the application layer
         * @param p_event The event cause and subcause.
         * @param p_linkedCause The linked event.
         * @return 
         */
        function f_triggerEventLinkedCause(
            template (value) Situation p_event, 
            template (value) Situation p_linkedCause
            ) runs on ItsFa return FncRetCode {
            var FncRetCode v_ret := e_success;
            
            //TODO raise action or send message via port
            
            return v_ret;
        }
        
        /**
         * @desc Triggers event with additional Event Characteristics information field included from the application layer
         * @param p_event The event cause and subcause.
         * @param p_eventCharact The event characteristics.
         * @return 
         */
        function f_triggerEventEventCharact(
            template (value) Situation p_event, 
            template (value) DecentralizedSituation.eventCharact p_eventCharact
            ) runs on ItsFa return FncRetCode {
            var FncRetCode v_ret := e_success;
            
            //TODO raise action or send message via port
            
            return v_ret;
        }
        
        //TODO check if type Situation is suitable
        /**
         * @desc Checks that the event was indicated the application layer
         * @param p_event The event cause and subcause.
         * @return 
         */
        function f_checkEvent(template (value) Situation p_event) runs on ItsFa return FncRetCode {
            var FncRetCode v_ret := e_success;
            
            //TODO raise action or send message via port
            
            return v_ret;
        }
        
        /**
         * @desc Checks that the event cancellation was indicated to the application layer
         * @param p_event The event cause and subcause.
         * @return 
         */
        function f_checkEventCancellation(template (value) Situation p_event) runs on ItsFa return FncRetCode {
            var FncRetCode v_ret := e_success;
            
            //TODO raise action or send message via port
            
            return v_ret;
        }
        
        /**
         * @desc Checks that the event negation was indicated to the application layer
         * @param p_event The event cause and subcause.
         * @return 
         */
        function f_checkEventNegation(template (present) Situation p_event) runs on ItsFa return FncRetCode {
            var FncRetCode v_ret := e_success;
            
            //TODO raise action or send message via port
            
            return v_ret;
        }
        
    } // end group eventFunctions
    
    group sendFunctions {
        
        /**
         * @desc Sends a DEN message
         * @param p_sendMsg The DEN message to send.
         * @return 
         */
        function f_sendDENM(template (value) DenmReq p_sendMsg) runs on ItsFa {
            p_sendMsg.msgOut.management.actionID.sequenceNo := vc_sequenceNo;
            
            denmPort.send(p_sendMsg);
        }
        
    } // end sendFunctions
    
    group receiveFunctions {
        
        /**
         * @desc Awaits a DEN message
         * @param p_rcvMsg The expected message to be received.
         * @return 
         */
        function f_awaitDENMessage(template (present) DenmInd p_rcvMsg) runs on ItsFa return FncRetCode {
            var DenmInd v_denmInd;
            return f_awaitDENMessageOut(p_rcvMsg, v_denmInd);
        }
        
        /**
         * @desc Awaits a DEN message
         * @param p_rcvMsg The expected message to be received.
         * @param p_rcvdMsg The received message - OUT.
         * @return 
         */
        function f_awaitDENMessageOut(in template (present) DenmInd p_rcvMsg, out template (value) DenmInd p_rcvdMsg) runs on ItsFa return FncRetCode {
            var FncRetCode v_ret := e_success;
            
            tc_wait.start;
            alt {
                [] denmPort.receive(p_rcvMsg) -> value p_rcvdMsg {
                    tc_wait.stop;
                    v_ret := e_success;
                }
            }
            
            return v_ret;
        }
        
    } // end receiveFunctions
    
    group getFunctions {
        
        /**
         * @desc Gets the station identifier to be used.
         * @return 
         */
        function f_getStationId() return StationID {
            var StationID v_stationId;
            
            //TODO get the value from PIXIT or MIB
            
            return v_stationId;
        }
        
        /**
         * @desc Gets the position of the test system.
         * @return 
         */
        function f_getCurrentPosition() return DecentralizedSituationLocation.eventPosition {
            var DecentralizedSituationLocation.eventPosition v_eventPos;
            
            //TODO get the value from PIXIT or ...
            
            return v_eventPos;
        }
        
    } // end group getFunctions
    
} // end LibItsDenm_Functions
 No newline at end of file
+231 −0
Original line number Diff line number Diff line
@@ -7,6 +7,237 @@
 */
module LibItsDenm_Templates {
    
    //LibIts
    import from DENM_PDU_Descriptions language "ASN.1:1997" all;
    import from CAM_PDU_Descriptions language "ASN.1:1997" all;
    import from LibItsDenm_Functions all;
    import from LibIts_Interface all;
    import from LibItsDenm_TypesAndValues all;

    group primitives_Templates {
        
        template DenmReq m_denmReq(
            template (omit) DecentralizedEnvironmentalNotificationMessage p_denMsg
            ) := {
            msgOut := p_denMsg
        }
        
        template DenmInd mw_denmInd(
            template (present) DecentralizedEnvironmentalNotificationMessage p_denMsg
            ) := {
            msgIn := p_denMsg
        }
        
    } // end primitives
    
    group DecentralizedEnvironmentalNotificationMessage_Templates {
        
        template DecentralizedEnvironmentalNotificationMessage m_denm(
            template (value) DecentralizedSituationManagement p_mgmt,
            template (value) DecentralizedSituation p_sit,
            template (value) DecentralizedSituationLocation p_loc
            ) := {
            management := p_mgmt, 
            situation := p_sit, 
            location := p_loc
        }
    
        template DecentralizedEnvironmentalNotificationMessage mw_denm(
            template (present) DecentralizedSituationManagement p_mgmt,
            template (present) DecentralizedSituation p_sit,
            template (present) DecentralizedSituationLocation p_loc
            ) := {
            management := p_mgmt, 
            situation := p_sit, 
            location := p_loc
        }
    
        template DecentralizedEnvironmentalNotificationMessage m_denmWithCause(
            template (value) DataVersion p_dataVersion,
            template (value) Situation p_sit
            ) := {
            management := m_denmMgmtCon(p_dataVersion), 
            situation := m_denmSitCon(p_sit, informative),
            location := m_denmSitLoc(
                            f_getCurrentPosition(),
                            m_locationRef
                        )
        }
        template DecentralizedEnvironmentalNotificationMessage m_denmWithCauseIsNeg(
            template (value) DataVersion p_dataVersion,
            template (value) Situation p_sit,
            template (value) DecentralizedSituationManagement.isNegation p_isNeg
        ) modifies m_denmWithCause := {
            management := m_denmMgmtCon_IsNeg(p_dataVersion, p_isNeg)
        }
    
    } // end group DecentralizedEnvironmentalNotificationMessage_Templates
    
    group DecentralizedSituationManagement_Templates {
        
        template DecentralizedSituationManagement m_denmMgmtCon(
            template (value) DataVersion p_dataVersion
            ) := {
            protocolVersion := c_protocolVersion_DENM,
            messageID := c_messageId,
            generationtime := 0, //TODO document: 0 indicates that the lower layer should add the time while sending
            actionID := {
                stationID := f_getStationId(), 
                sequenceNo := 0
            },
            dataVersion := p_dataVersion,
            expiryTime := omit,
            frequency := omit,
            reliability := 0,
            isNegation := false
        }
        
        template DecentralizedSituationManagement mw_denmMgmtCon (
            template (present) DataVersion p_dataVersion
            ):= {
            protocolVersion := c_protocolVersion_DENM,
            messageID := c_messageId,
            generationtime := ?,
            actionID := {
                stationID := ?, 
                sequenceNo := ?
            },
            dataVersion := p_dataVersion,
            expiryTime := *,
            frequency := *,
            reliability := ?,
            isNegation := ?
        }
        
        template DecentralizedSituationManagement m_denmMgmtCon_IsNeg(
            template (value) DataVersion p_dataVersion,
            template (value) DecentralizedSituationManagement.isNegation p_isNeg
            ) modifies m_denmMgmtCon := {
            isNegation := p_isNeg
        }
        
        template DecentralizedSituationManagement mw_denmMgmtCon_IsNeg(
            template (present) DataVersion p_dataVersion,
            template (present) DecentralizedSituationManagement.isNegation p_isNeg
            ) modifies mw_denmMgmtCon := {
            isNegation := p_isNeg
        }
        
    } // end group DecentralizedSituationManagement_Templates
    
    group DecentralizedSituation_Templates {
        
        template DecentralizedSituation m_denmSitCon(
            template (value) Situation p_sit,
            template (value) Severity p_sev
            ) := {
            trafficFlowEffect := omit,
            situation := p_sit,
            linkedCause := omit,
            severity := p_sev,
            eventCharact := omit,
            profile := omit
        }
        
        template DecentralizedSituation mw_denmSitCon := {
            trafficFlowEffect := *,
            situation := ?,
            linkedCause := *,
            severity := ?,
            eventCharact := *,
            profile := *
        }
        
        template DecentralizedSituation mw_denmSitCon_Sit(
            template (present) Situation p_sit
            ) modifies mw_denmSitCon := {
            situation := p_sit
        }
        
        template DecentralizedSituation mw_denmSitCon_SitTfe(
            template (present) Situation p_sit,
            template (present) TrafficFlowEffect p_tfe
            ) modifies mw_denmSitCon_Sit := {
                trafficFlowEffect := p_tfe
        }
        
        template DecentralizedSituation mw_denmSitCon_SitLc(
            template (present) Situation p_sit,
            template (present) Situation p_lc
            ) modifies mw_denmSitCon_Sit := {
                linkedCause := p_lc
        }
        
        template DecentralizedSituation mw_denmSitCon_SitEc(
            template (present) Situation p_sit,
            template (present) DecentralizedSituation.eventCharact p_ec
            ) modifies mw_denmSitCon_Sit := {
                eventCharact := p_ec
        }
        
        group Situation_Templates {
            
            template Situation m_situation(
                template (value) DENM_PDU_Descriptions.CauseCode p_cause, 
                template (value) SubCauseCode p_subCause
                ) := {
                cause := p_cause,
                subCause := p_subCause
            }
            
            template Situation mw_situation(
                template (present) DENM_PDU_Descriptions.CauseCode p_cause, 
                template (present) SubCauseCode p_subCause
                ) := {
                cause := p_cause,
                subCause := p_subCause
            }
            
        } // end group Situation_Templates
        
        group EventCharact_Templates {
            
            //TODO check if depending on kind of ITS station
            template DecentralizedSituation.eventCharact m_eventCharact := {
                eventmobility := true,
                causeType := geographicalRegion,
                relevant := difficultDrivingConditions,
                timeCritacality := false
            }
            
        }
        
    } // end group DecentralizedSituation_Templates
    
    group DecentralizedSituationLocation_Templates {
        
        template DecentralizedSituationLocation m_denmSitLoc(
            template (value) DecentralizedSituationLocation.eventPosition p_eventPosition,
            template (value) DecentralizedSituationLocation.locationRef p_locationRef
            ) := {
            eventPosition := p_eventPosition, 
            locationRef := p_locationRef
        }
        
        template DecentralizedSituationLocation mw_denmSitLoc (
            template (present) DecentralizedSituationLocation.eventPosition p_eventPosition,
            template (present) DecentralizedSituationLocation.locationRef p_locationRef
            ) := {
            eventPosition := p_eventPosition,
            locationRef := p_locationRef
        }
        
        group locationRef_Templates {
            
            template DecentralizedSituationLocation.locationRef m_locationRef := {
                trace := {
                    traceID := 0,
                    waypoints := {}
                }
            }
            
        } // end group locationRef_Templates
        
    } // end group DecentralizedSituationLocation
    
} // end LibItsDenm_Templates
 No newline at end of file
+106 −0
Original line number Diff line number Diff line
/**
 *  @author     ETSI / STF405
 *  @version    $URL$
 *              $Id$
 *  @desc       Module containing type and value definitions for DENM
 *
 */
module LibItsDenm_TypesAndValues {

    //LibIts
    import from DENM_PDU_Descriptions language "ASN.1:1997" all;

    group actionTypes {
        
        type enumerated Trigger {
            e_ets(0),
            e_iut(1)
        }
        
    } // end group actionTypes
    
    group denmConstants {
        
        const DecentralizedSituationManagement.protocolVersion c_protocolVersion_DENM := 0;
        
        //TODO check which value or value handling should be applied
        const MessageID c_messageId := 0;
        
        const DataVersion c_dataVersionCancellation := 255;
        
        group trafficFlowEffects {
            
            const TrafficFlowEffect c_tfeTrafficFlowUnknown := 1; 
            const TrafficFlowEffect c_tfeFreeTrafficFlow := 2; 
            const TrafficFlowEffect c_tfeSlowTraffic := 3; 
            const TrafficFlowEffect c_tfeHeavyTraffic := 4; 
            const TrafficFlowEffect c_tfeQueuingTraffic := 5; 
            const TrafficFlowEffect c_tfeStationaryTraffic := 6; 
            const TrafficFlowEffect c_tfeNoTrafficFlow := 7; 
            
        } // end group causeCodes
        
        group causeCodes {
            
            //TODO check this values for final release
            const CauseCode c_causeReserved := 0; 
            const CauseCode c_causeTrafficJam := 1;
            const CauseCode c_causeAccident := 2;
            const CauseCode c_causeRoadWork := 3;
            const CauseCode c_causeHazardousDrivingCondition := 25;
            const CauseCode c_causeWrongWayDriving := 35;
            const CauseCode c_causeRescueOnTheWay := 36;
            const CauseCode c_causeExtremWeatherCondition := 42;
            const CauseCode c_causeVisibilityReduced := 43;
            const CauseCode c_causePrecipitation := 45;
            const CauseCode c_causeSlowVehicle := 62;
            const CauseCode c_causeDangerousDriving := 101; 
            const CauseCode c_causeIntersectionViolation := 102; 
            const CauseCode c_causeVehicleProblem := 103; 
            const CauseCode c_causeIntersectionCollision := 104; 
            const CauseCode c_causeHazardousLocation := 105; 
            
        } // end group causeCodes
        
        group subCauseCodes {
            
            //TODO check this values for final release
            const SubCauseCode c_subCauseUnknown := 0; 
            
            const SubCauseCode c_subCauseHardBrakeVehicle := 1; 

            const SubCauseCode c_subCauseStopSignViolation := 1; 
            const SubCauseCode c_subCauseTrafficLightViolation := 2; 
            const SubCauseCode c_subCauseTurningRegulationViolation := 3; 

            const SubCauseCode c_subCauseBrakeDownVehicle := 1; 
            const SubCauseCode c_subCauseVehicleSpeedReducedWithSafetyLightsOn := 2; 

            const SubCauseCode c_subCauseLeftTurnCollisionRisk := 1; 
            const SubCauseCode c_subCauseRightTurnCollisionRisk := 2; 
            const SubCauseCode c_subCauseCrossingCollisionRisk := 3; 
            const SubCauseCode c_subCauseMergingCollisionRisk := 4; 

            const SubCauseCode c_subCauseDangerousCurve := 1; 
            const SubCauseCode c_subCauseObstacleOnTheRoad := 2; 

            const SubCauseCode c_subCauseHeavyRain := 1; 
            const SubCauseCode c_subCauseHeavySnow := 2; 

            const SubCauseCode c_subCauseStrongSideWind := 1; 
            const SubCauseCode c_subCauseStrongWindFromBack := 2; 

            const SubCauseCode c_subCauseLowRoadAdhesion := 1; 
            const SubCauseCode c_subCauseBlackIce := 2; 

            const SubCauseCode c_subCauseBadVisibilityDueToFrost := 1; 
            const SubCauseCode c_subCauseBadVisibilityDueToStorm := 4; 

            const SubCauseCode c_subCauseEmergencyVehicle := 1; 
            const SubCauseCode c_subCauseMedicalAssistanceVahicle := 2; 
            
        } // end group subCauseCodes
        
    } // end group denmConstants
    
}
 No newline at end of file
+12 −0

File changed.

Preview size limit exceeded, changes collapsed.