Commit 74d85e67 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 a4f22f40
Loading
Loading
Loading
Loading
+11 −13
Original line number Diff line number Diff line
@@ -7,7 +7,7 @@ DEFINITIONS AUTOMATIC TAGS ::=
BEGIN

IMPORTS 
    ProfileParameters, StationID 
    Latitude, Longitude, ProfileParameters, StationID 
FROM CAM-PDU-Descriptions { itu-t (0) identified-organization (4) etsi (0) itsDomain (5) wg1 (1) ts (102637) cam (2) version1 (1) };

--STF405: doubled defined, renamed
@@ -32,7 +32,7 @@ DecentralizedSituationManagement::= SEQUENCE {
	-- STF405: changed inline definition to explicit
	-- dataVersion	INTEGER(0..255),
	dataVersion	DataVersion,  	-- 1 byte
	-- time when the DENM is deleted from the DEN management and the inforamtion related to the event is set as invalid.. If it is not provided, it indicates that the expiry time is unkown by the originator ITS station	
	-- time when the DENM is deleted from the DEN management and the information related to the event is set as invalid.. If it is not provided, it indicates that the expiry time is unkown by the originator ITS station	
	expiryTime	TimeStamp  	OPTIONAL, 	-- 6 byte
	frequency	INTEGER (0..255)	OPTIONAL, 	--1 byte
	-- probability of the detected event to  be true, varies  from 0 to 100, with maximum value as full reliability
@@ -137,7 +137,15 @@ Frenquency ::= INTEGER (0..255)

--STF405: removed OPTIONAL, as it is syntactically incorrect
--TrafficFlowEffect ::= 	INTEGER(0..7)	OPTIONAL
TrafficFlowEffect ::= 	INTEGER(0..7)
TrafficFlowEffect ::= 	INTEGER {
    trafficFlowUnknown(1), 
    freeTrafficFlow(2),
    slowTraffic(3),
    heavyTraffic(4),
    queuingTraffic(5),
    stationaryTraffic(6),
    noTrafficFlow(7)
} (0..7)

Situation ::= SEQUENCE {
	cause 		CauseCode, 	-- 1 byte
@@ -221,16 +229,6 @@ RefPosition ::= SEQUENCE {
	direction	Direction	OPTIONAL	-- 2 bytes
}

Latitude ::= SEQUENCE {
	isSouth 	BOOLEAN,              	-- true if on southern hemisphere (sign flag)
	degree  	INTEGER (0..900000000) 	-- multiples of 0.1 microdegree
} 

Longitude ::= SEQUENCE {
	isEast 	BOOLEAN,                 -- true if east of 0-meridian (sign flag)
  	degree 	 INTEGER (0..1800000000) -- multiples of 0.1 microdegree
}

Altitude ::= INTEGER (-10000..16767215) 	-- multiples of 0.1 m

PositionAccuracy ::= OCTET STRING (SIZE(4))	
+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

File added.

Preview size limit exceeded, changes collapsed.

+12 −0
Original line number Diff line number Diff line
@@ -10,6 +10,7 @@ module LibIts_Interface {
    // LibIts
    import from LibItsCam_Pixits all;
    import from LibItsGeoNetworking_TypesAndValues all;
    import from DENM_PDU_Descriptions language "ASN.1:1997" all;
    
    // LibCommon
    import from LibCommon_Time {modulepar all};
@@ -78,11 +79,18 @@ module LibIts_Interface {
            // FA2 ports
            port CooperPort cooperPort;
            
            //default
            var default vc_default := null;
            
            // timers
            timer tc_wait := PX_TWAIT;
            timer tc_ac := PX_TAC;
            timer tc_minTransInterval := PX_CAM_MIN_TRANSMISSION_INTERVAL;
            timer tc_maxTransInterval := PX_CAM_MAX_TRANSMISSION_INTERVAL;
            
            //global variables
            var SequenceNo vc_sequenceNo := 0;
            
        } // end ItsFa

        /**
@@ -302,6 +310,8 @@ module LibIts_Interface {

				/**
				 * @desc FA1 DENM Indication Primitive 
                 * 
                 * @member denmMsg
				 */
				type record DenmInd {
				    DecentralizedEnvironmentalNotificationMessage msgIn
@@ -309,6 +319,8 @@ module LibIts_Interface {
				
				/**
				 * @desc FA1 DENM Request Primitive 
				 * 
				 * @member denmMsg
				 */
				type record DenmReq {
				    DecentralizedEnvironmentalNotificationMessage msgOut