Commit c51f6b09 authored by Yann Garcia's avatar Yann Garcia
Browse files

Create send/receive TTCN-3 templates for all CDD types to be re-used in all ATSs

parent f651103b
Loading
Loading
Loading
Loading
+37 −35
Original line number Diff line number Diff line
@@ -30,6 +30,7 @@ module ItsDenm_TpFunctions {
    import from LibItsCommon_Templates all;
    import from LibItsCommon_Functions all;
    import from LibItsCommon_ASN1_NamedNumbers all;
    import from LibItsCommon_CddTemplates all;
    
    // LibItsDenm
    import from LibItsDenm_TestSystem all;
@@ -81,7 +82,7 @@ module ItsDenm_TpFunctions {
                      mw_denmInd(
                          mw_denmPdu(
                              mw_denm,
                              mw_anyStationId, 
                              ?, 
                              LibItsCommon_ASN1_NamedNumbers.ItsPduHeader_protocolVersion_currentVersion_, 
                              LibItsCommon_ASN1_NamedNumbers.ItsPduHeader_messageId_denm_
                          )
@@ -208,7 +209,7 @@ module ItsDenm_TpFunctions {
                  [] denmPort.receive(
                      mw_denmInd(
                          mw_anyDenmPdu(
                              mw_itsPduHeader,
                              mw_its_pdu_header(-, -, LibItsCommon_ASN1_NamedNumbers.ItsPduHeader_messageId_denm_),
                              mw_denm (mw_anyDenmMgmtCon)
                          )
                      ) 
@@ -563,7 +564,7 @@ module ItsDenm_TpFunctions {
                          mw_denmPdu(
                              mw_denm(
                                  mw_denmMgmtConWithActionId(
                                      mw_actionId(-, f_increaseSequenceNumber(v_sequenceNumber))
                                      mw_action_id(-, f_increaseSequenceNumber(v_sequenceNumber))
                                  )
                              )
                          )
@@ -694,7 +695,7 @@ module ItsDenm_TpFunctions {
                  [] denmPort.receive(
                      mw_denmInd(
                          mw_anyDenmPdu(
                              mw_itsPduHeader,
                              mw_its_pdu_header(-, -, LibItsCommon_ASN1_NamedNumbers.ItsPduHeader_messageId_denm_),
                              mw_denm (mw_anyDenmMgmtCon)
                          )
                      )
@@ -758,7 +759,7 @@ module ItsDenm_TpFunctions {
                  [] denmPort.receive(
                      mw_denmInd(
                          mw_anyDenmPdu(
                              mw_itsPduHeader,
                              mw_its_pdu_header(-, -, LibItsCommon_ASN1_NamedNumbers.ItsPduHeader_messageId_denm_),
                              mw_denm (
                                  mw_denmMgmtConWithActionId(
                                      v_actionId
@@ -834,7 +835,7 @@ module ItsDenm_TpFunctions {
                  [] denmPort.receive(
                      mw_denmInd(
                          mw_anyDenmPdu(
                              mw_itsPduHeader,
                              mw_its_pdu_header(-, -, LibItsCommon_ASN1_NamedNumbers.ItsPduHeader_messageId_denm_),
                              mw_denm (
                                  mw_denmMgmtCon(
                                      v_actionId
@@ -905,19 +906,19 @@ module ItsDenm_TpFunctions {
              
              // Test Body
              v_situation := m_situation(CauseCodeChoice: { vehicleBreakdown91 := LibItsCommon_ASN1_NamedNumbers.VehicleBreakdownSubCauseCode_engineProblem_ });
              f_utUpdateEvent(m_utUpdateEvent(m_actionId(f_increaseSequenceNumber(v_actionId.sequenceNumber), f_getIutStationId()), v_situation));
              f_utUpdateEvent(m_utUpdateEvent(m_action_id(f_increaseSequenceNumber(v_actionId.sequenceNumber), f_getIutStationId()), v_situation));
              
              tc_noac.start;
              alt {
                  [] denmPort.receive(
                      mw_denmInd(
                          mw_anyDenmPdu(
                              mw_itsPduHeader,
                              mw_its_pdu_header(-, -, LibItsCommon_ASN1_NamedNumbers.ItsPduHeader_messageId_denm_),
                              mw_denm (
                                  mw_denmMgmtCon(
                                      m_actionId(
                                          f_increaseSequenceNumber(v_actionId.sequenceNumber),
                                          f_getIutStationId()
                                      m_action_id(
                                          f_getIutStationId(),
                                          f_increaseSequenceNumber(v_actionId.sequenceNumber)
                                      )
                                  )
                              )
@@ -1276,12 +1277,12 @@ module ItsDenm_TpFunctions {
              f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
              
              // Test Body
              v_unknownActionId := valueof(m_actionId(
              v_unknownActionId := valueof(m_action_id(
                                                      v_actionIds[lengthof(v_actionIds) - 1].originatingStationId,
                                                      f_increaseSequenceNumber(
                                                                               v_actionIds[lengthof(v_actionIds) - 1].sequenceNumber
                                        ),
                                        v_actionIds[lengthof(v_actionIds) - 1].originatingStationId
                                    ));
                                                      
                                           )));
              f_utTerminateEvent(m_utEventCancellation(v_unknownActionId));
              
              tc_noac.start;
@@ -1289,7 +1290,7 @@ module ItsDenm_TpFunctions {
                  [] denmPort.receive(
                      mw_denmInd(
                          mw_anyDenmPdu(
                              mw_itsPduHeader,
                              mw_its_pdu_header(-, -, LibItsCommon_ASN1_NamedNumbers.ItsPduHeader_messageId_denm_),
                              mw_denm (
                                  mw_denmMgmtCon(v_unknownActionId)
                              )
@@ -1360,7 +1361,7 @@ module ItsDenm_TpFunctions {
              f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
              
              // Test Body
              v_unknownActionId := valueof(m_actionId(
              v_unknownActionId := valueof(m_action_id(
                                        f_increaseSequenceNumber(
                                            v_actionIds[lengthof(v_actionIds) - 1].sequenceNumber
                                        ),
@@ -1371,7 +1372,7 @@ module ItsDenm_TpFunctions {
              
              tc_noac.start;
              alt {
                  [] denmPort.receive( mw_denmInd( mw_anyDenmPdu( mw_itsPduHeader, mw_denm ( mw_denmMgmtCon(v_unknownActionId) ) ) ) ) -> value v_denmInd {
                  [] denmPort.receive( mw_denmInd( mw_anyDenmPdu( mw_its_pdu_header, mw_denm ( mw_denmMgmtCon(v_unknownActionId) ) ) ) ) -> value v_denmInd {
                      tc_noac.stop;
                      log("*** " & testcasename() & ": FAIL: Received termination DENM for the unknown actionId. ***");
                      f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
@@ -1484,7 +1485,7 @@ module ItsDenm_TpFunctions {
              // Local variables
              var template (value)    SituationContainer v_situation := m_situation(CauseCodeChoice: { vehicleBreakdown91 := LibItsCommon_ASN1_NamedNumbers.VehicleBreakdownSubCauseCode_unavailable_ } );
              var template (present) DenmInd v_expectedDenmInd := 
                                          mw_denmInd ( mw_denmPdu ( mw_denm ( mw_denmMgmtCon ( mw_actionId, -, -, c_validityDuration ) ) ) ); 
                                          mw_denmInd ( mw_denmPdu ( mw_denm ( mw_denmMgmtCon ( mw_action_id, -, -, c_validityDuration ) ) ) ); 
              var ActionId v_actionId;
              var DenmInd v_denmInd;
              // Local timers
@@ -1555,7 +1556,7 @@ module ItsDenm_TpFunctions {
              const float c_upperRepetitionInterval := int2float(c_repetitionInterval)*1.05;
              // Local variables
              var template (value) SituationContainer v_situation := m_situation(CauseCodeChoice: { vehicleBreakdown91 := LibItsCommon_ASN1_NamedNumbers.VehicleBreakdownSubCauseCode_unavailable_ });
              var template (present) DenmInd v_expectedDenmInd := mw_denmInd(mw_denmPdu(mw_denm( mw_denmMgmtCon( mw_actionId, -, -, c_validityDuration)))); 
              var template (present) DenmInd v_expectedDenmInd := mw_denmInd(mw_denmPdu(mw_denm( mw_denmMgmtCon( mw_action_id, -, -, c_validityDuration)))); 
              var ActionId v_actionId;
              var DenmInd v_denmInd;
              // Local timers
@@ -1632,7 +1633,7 @@ module ItsDenm_TpFunctions {
              // Local variables
              var template (value) SituationContainer v_situation := m_situation(CauseCodeChoice: { vehicleBreakdown91 := LibItsCommon_ASN1_NamedNumbers.VehicleBreakdownSubCauseCode_unavailable_ });
              var template (present) DenmInd v_expectedDenmInd :=
                                                  mw_denmInd(mw_denmPdu(mw_denm(mw_denmMgmtCon(mw_actionId, -, -, c_validityDuration)))); 
                                                  mw_denmInd(mw_denmPdu(mw_denm(mw_denmMgmtCon(mw_action_id, -, -, c_validityDuration)))); 
              var ActionId v_actionId;
              var DenmInd v_denmInd;
              var integer i;
@@ -1699,7 +1700,7 @@ module ItsDenm_TpFunctions {
              const ValidityDuration c_repetitionDuration := c_duration_5sec;
              // Local variables
              var template (value) SituationContainer v_situation := m_situation(CauseCodeChoice: { vehicleBreakdown91 := LibItsCommon_ASN1_NamedNumbers.VehicleBreakdownSubCauseCode_unavailable_ });
              var template (present) DenmInd v_expectedDenmInd := mw_denmInd(mw_denmPdu(mw_denm(mw_denmMgmtCon(mw_actionId, -, -, c_validityDuration)))); 
              var template (present) DenmInd v_expectedDenmInd := mw_denmInd(mw_denmPdu(mw_denm(mw_denmMgmtCon(mw_action_id, -, -, c_validityDuration)))); 
              var ActionId v_actionId;
              var DenmInd v_denmInd;
              var integer i;
@@ -1769,7 +1770,7 @@ module ItsDenm_TpFunctions {
                                                                      mw_denmPdu(
                                                                          mw_denm(
                                                                              mw_denmMgmtCon(
                                                                                  mw_actionId,
                                                                                  mw_action_id,
                                                                                  -,
                                                                                  -,
                                                                                  -,
@@ -1850,7 +1851,7 @@ module ItsDenm_TpFunctions {
                                                                      mw_denmPdu(
                                                                          mw_denm(
                                                                              mw_denmMgmtCon(
                                                                                  mw_actionId,
                                                                                  mw_action_id,
                                                                                  -,
                                                                                  -,
                                                                                  c_validityDuration                                                                                  
@@ -1928,7 +1929,7 @@ module ItsDenm_TpFunctions {
              // Local variables
              var template (value) SituationContainer v_situation := m_situation(CauseCodeChoice: { vehicleBreakdown91 := LibItsCommon_ASN1_NamedNumbers.VehicleBreakdownSubCauseCode_unavailable_ } );
              var template (present) DenmInd v_expectedDenmInd :=
                                                  mw_denmInd ( mw_denmPdu ( mw_denm ( mw_denmMgmtCon ( mw_actionId, -, -, c_duration2 ) ) ) ); 
                                                  mw_denmInd ( mw_denmPdu ( mw_denm ( mw_denmMgmtCon ( mw_action_id, -, -, c_duration2 ) ) ) ); 
              var ActionId v_actionId;
              var DenmInd v_denmInd;
              
@@ -1998,7 +1999,7 @@ module ItsDenm_TpFunctions {
              // Local variables
              var template (value) SituationContainer v_situation := m_situation(CauseCodeChoice: { vehicleBreakdown91 := LibItsCommon_ASN1_NamedNumbers.VehicleBreakdownSubCauseCode_unavailable_ });
              var template (present) DenmInd v_expectedDenmInd :=
                                                  mw_denmInd(mw_denmPdu(mw_denm( mw_denmMgmtCon( mw_actionId, -, -, c_duration2)))); 
                                                  mw_denmInd(mw_denmPdu(mw_denm( mw_denmMgmtCon( mw_action_id, -, -, c_duration2)))); 
              var ActionId v_actionId;
              var DenmInd v_denmInd;
              // Local timers
@@ -2059,7 +2060,7 @@ module ItsDenm_TpFunctions {
              const float c_upperTransmissionInterval := int2float(c_interval1)*1.05;
              // Local variables
              var template (value) SituationContainer v_situation := m_situation(CauseCodeChoice: { vehicleBreakdown91 := LibItsCommon_ASN1_NamedNumbers.VehicleBreakdownSubCauseCode_unavailable_ });
              var template (present) DenmInd v_expected := mw_denmInd(mw_denmPdu(mw_denm( mw_denmMgmtCon( mw_actionId, -, -, c_duration2 )))); 
              var template (present) DenmInd v_expected := mw_denmInd(mw_denmPdu(mw_denm( mw_denmMgmtCon( mw_action_id, -, -, c_duration2 )))); 
              var ActionId v_actionId;
              var DenmInd v_denmInd;
              var TimestampIts v_referenceTime;
@@ -2121,7 +2122,7 @@ module ItsDenm_TpFunctions {
              const TransmissionInterval c_interval1 := c_interval_10sec;
              // Local variables
              var template (value) SituationContainer v_situation := m_situation(CauseCodeChoice: { vehicleBreakdown91 := LibItsCommon_ASN1_NamedNumbers.VehicleBreakdownSubCauseCode_unavailable_ });
              var template (present) DenmInd v_expected := mw_denmInd(mw_denmPdu(mw_denm( mw_denmMgmtCon( mw_actionId, -, -, c_duration2 ifpresent)))); 
              var template (present) DenmInd v_expected := mw_denmInd(mw_denmPdu(mw_denm( mw_denmMgmtCon( mw_action_id, -, -, c_duration2 ifpresent)))); 
              var ActionId v_actionId;
              var DenmInd v_denmInd;
              var TimestampIts v_referenceTime;
@@ -2639,8 +2640,9 @@ module ItsDenm_TpFunctions {
            v_actionIdIut := f_sendDenMessage(
                m_denm(
                    m_denmMgmtConTermination(
                        m_actionId(
                            f_increaseSequenceNumber(v_actionId.sequenceNumber)
                        m_action_id(
                            f_increaseSequenceNumber(v_actionId.sequenceNumber),
                            f_getIutStationId()
                        ),
                        -,
                        -,
@@ -3102,13 +3104,13 @@ module ItsDenm_TpFunctions {
            
            tc_ac.start;
            alt {
                [] denmPort.receive ( mw_denmInd ( mw_denmPdu ( mw_denm ( mw_denmMgmtCon ( mw_actionId ( f_getTsStationId() ) ), v_situation, mw_anyDenmLocation, 
                [] denmPort.receive ( mw_denmInd ( mw_denmPdu ( mw_denm ( mw_denmMgmtCon ( mw_action_id ( f_getTsStationId() ) ), v_situation, mw_anyDenmLocation, 
                                                                                                         mw_alacarteConImpactReduction ) ) ) ) {
                    tc_ac.stop;
                    log("*** " & testcasename() & ": PASS: DENM with correct alacarte container ***");
                    f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                }
                [] denmPort.receive ( mw_denmInd ( mw_denmPdu ( mw_denm ( mw_denmMgmtCon ( mw_actionId ( f_getTsStationId() ) ) ) ) ) ) {
                [] denmPort.receive ( mw_denmInd ( mw_denmPdu ( mw_denm ( mw_denmMgmtCon ( mw_action_id ( f_getTsStationId() ) ) ) ) ) ) {
                    tc_ac.stop;
                    log("*** " & testcasename() & ": FAIL: DENM with incorrect containers ***");
                    f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
@@ -3476,7 +3478,7 @@ module ItsDenm_TpFunctions {
                            mw_denm(
                                mw_denmMgmtCon(v_actionId)
                            ),
                            mw_anyStationId
                            ?
                        )
                    ) 
                ) {
+9 −93
Original line number Diff line number Diff line
@@ -27,6 +27,7 @@ module LibItsDenm_Templates {
    import from LibItsCommon_Functions all;
    import from LibItsCommon_Pixits all;
    import from LibItsCommon_ASN1_NamedNumbers all;
    import from LibItsCommon_CddTemplates all;
    
    // LibItsDenm
    import from LibItsDenm_TypesAndValues all;
@@ -252,7 +253,11 @@ module LibItsDenm_Templates {
        template (value) DENM m_denmPdu(
            template (value) DenmPayload p_denm
        ) := {
            header := m_itsPduHeader,
            header := m_its_pdu_header(
                                       f_getTsStationId(),
                                       -,
                                       LibItsCommon_ASN1_NamedNumbers.ItsPduHeader_messageId_denm_
                                       ),
            denm := p_denm
        }
        
@@ -282,53 +287,12 @@ module LibItsDenm_Templates {
            template (present) ItsPduHeader.protocolVersion p_protocolVersion := LibItsCommon_ASN1_NamedNumbers.ItsPduHeader_protocolVersion_currentVersion_,
            template (present) ItsPduHeader.messageId p_messageId := LibItsCommon_ASN1_NamedNumbers.ItsPduHeader_messageId_denm_
        ) := {
            header := mw_itsPduHeader(p_stationId, p_protocolVersion, p_messageId),
            header := mw_its_pdu_header(p_stationId, p_protocolVersion, p_messageId),
            denm := p_denm
        }
        
    } // end denmPduTemplates
    
    group headerTemplates {
        
        /**
         * @desc    Default send template for ITS PDU header
         * @param   p_stationId         The source station ID (Default: test system station id)
         * @param   p_protocolVersion   The protocol version (Default: current DEN protocol version)
         * @param   p_messageId         The message Id (Default: DEN message id)
         */
        template (value) ItsPduHeader m_itsPduHeader(
            template (value) StationId p_stationId := f_getTsStationId(),
            template (value) ItsPduHeader.protocolVersion p_protocolVersion := LibItsCommon_ASN1_NamedNumbers.ItsPduHeader_protocolVersion_currentVersion_,
            template (value) ItsPduHeader.messageId p_messageId := LibItsCommon_ASN1_NamedNumbers.ItsPduHeader_messageId_denm_
        ) := {
            protocolVersion := p_protocolVersion,
            messageId := p_messageId,
            stationId := p_stationId
        }
        
        /**
         * @desc    Default receive template for ITS PDU header
         * @param   p_stationId         The expected station id (Default: any)
         * @param   p_protocolVersion   The expected protocol version (Default: current DEN protocol version)
         * @param   p_messageId         The expected message id (Default: DEN message id)
         */
        template (present) ItsPduHeader mw_itsPduHeader(
            template (present) StationId p_stationId := ?,
            template (present) ItsPduHeader.protocolVersion p_protocolVersion := LibItsCommon_ASN1_NamedNumbers.ItsPduHeader_protocolVersion_currentVersion_,
            template (present) ItsPduHeader.messageId p_messageId := LibItsCommon_ASN1_NamedNumbers.ItsPduHeader_messageId_denm_
        ) := {
            protocolVersion := p_protocolVersion,
            messageId := p_messageId,
            stationId := p_stationId
        }
        
        /**
         * @desc    Default receive template for the station id
         */
        template (present) StationId mw_anyStationId := ?;
        
    } // end headerTemplates
    
    group timeTemplates {
        
        /**
@@ -392,19 +356,6 @@ module LibItsDenm_Templates {
            semiMajorAxisOrientation := p_semiMajorAxisOrientation
        }

        /**
         * @desc    Send template for altitude
         * @param   p_altitudeValue        The altitude (Default: Sea level)
         * @param   p_altitudeConfidence   The confidence of the elevation (Default: within one meter)
         */
        template (value) Altitude m_altitude(
            template (value) AltitudeValue p_altitudeValue := LibItsCommon_ASN1_NamedNumbers.AltitudeValue_referenceEllipsoidSurface_,
            template (value) AltitudeConfidence p_altitudeConfidence := alt_000_01
        ) := {
            altitudeValue := p_altitudeValue,
            altitudeConfidence := p_altitudeConfidence
        }
        
    } // end positionTemplates
    
    group decentralizedEnvironmentalNotificationMessageTemplates {
@@ -622,37 +573,6 @@ module LibItsDenm_Templates {
            referenceTime := p_referenceTime
        }
        
        /**
         * @desc    Send template for ActionId
         * @param   p_sequenceNumber        The sequence number
         * @param   p_originatorStationId   The originator station id (Default: IUT's station id)
         */
        template (value) ActionId m_actionId(
            template (value) SequenceNumber p_sequenceNumber,
            template (value) ETSI_ITS_CDD.StationId p_originatorStationId := f_getIutStationId()
        ) := {
            originatingStationId := p_originatorStationId,
            sequenceNumber := p_sequenceNumber
        }
        
        /**
         * @desc    Receive template for ActionId
         * @param   p_originatorStationId   The expected originator station id (Default: any)
         * @param   p_sequenceNumber        The expected sequence number (Default: any)
         */
        template (present) ActionId mw_actionId(
            template (present) ETSI_ITS_CDD.StationId p_originatorStationId := ?,
            template (present) SequenceNumber p_sequenceNumber := ?
        ) := {
            originatingStationId := p_originatorStationId,
            sequenceNumber := p_sequenceNumber
        }
        
        /**
         * @desc    Default receive template for any ActionId
         */
        template (present) ActionId mw_anyActionId := ?;
        
    } // end group decentralizedManagementTemplates
    
    group decentralizedSituationTemplates {
@@ -670,9 +590,7 @@ module LibItsDenm_Templates {
                                                            template (value) InformationQuality p_informationQuality := 0
            ) := {
                informationQuality := p_informationQuality,
                eventType := {
                    ccAndScc := p_cause
                },
                eventType := m_cause_code_v2(p_cause),
                linkedCause := omit,
                eventZone   := omit,
                linkedDenms := omit,
@@ -690,9 +608,7 @@ module LibItsDenm_Templates {
                template (present) InformationQuality p_informationQuality := ?
            ) := {
                informationQuality := p_informationQuality,
                eventType := {
                    ccAndScc := p_cause
                },
                eventType := mw_cause_code_v2(p_cause),
                linkedCause := *,
                eventZone   := *,
                linkedDenms := *,