Commit 5131b454 authored by TEPELMANND's avatar TEPELMANND
Browse files

Taken changes from ETSI.

Further fixes based on validation.
parent 386b15ce
Loading
Loading
Loading
Loading
+134 −29
Original line number Diff line number Diff line
/**
 *    @author   ETSI / STF405 / STF449
 *    @author   ETSI / STF405 / STF449 / STF484 / STF517
 *    @version  $URL$
 *              $Id$
 *    @desc     Module containing common functions for ITS CAM
 *    @copyright   ETSI Copyright Notification
 *                 No part may be reproduced except as authorized by written permission.
 *                 The copyright and the foregoing restriction extend to reproduction in all media.
 *                 All rights reserved.
 *
 */
module LibItsCam_Functions {
@@ -13,16 +17,22 @@ module LibItsCam_Functions {
    import from LibCommon_Sync all;
    
    // LibIts
    import from LibItsCam_TestSystem all;
    import from LibItsCam_Templates all;
    import from LibItsCam_TypesAndValues all;
    import from ITS_Container 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;    
    
    // LibItsCommon
    import from LibItsCommon_Pixits all;
    import from LibItsCommon_Templates all;
    import from LibItsCommon_Functions all;
    import from LibItsCommon_TypesAndValues all;
    import from ITS_Container 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;    
    
    // LibItsCam
    import from LibItsCam_TestSystem all;
    import from LibItsCam_Templates all;
    import from LibItsCam_TypesAndValues all;
    import from LibItsCam_Pics all;
    import from LibItsCam_Pixits all;
    
    group utFuntions { 
            
@@ -117,6 +127,59 @@ module LibItsCam_Functions {
    
    group adapterControl {
        
        /**
         * @desc Initialise secure mode if required
         */
        function f_initialiseSecuredMode(
                                         in charstring p_certificateId := PX_CERT_FOR_TS
        ) runs on ItsCam {
            
            if (PICS_IS_IUT_SECURED == true) {
                
                if(e_success != f_acTriggerSecEvent(m_acEnableSecurity(p_certificateId))) { 
                    log("*** INFO: TEST CASE NOW STOPPING ITSELF! ***");
                    stop;
                }
            }
            
        } // End of function f_initialiseSecuredMode()
        
        function f_uninitialiseSecuredMode() runs on ItsCam {
            
            if (PICS_IS_IUT_SECURED == true) {
                f_acTriggerSecEvent(m_acDisableSecurity);
            }
            
        } // End of function f_initialiseSecuredMode()
        
        /**
         * @desc    Triggers event in the test system adaptation.
         * @param   p_event The event to trigger
         * @return  FncRetCode
         */
        function f_acTriggerSecEvent(template (value) AcSecPrimitive p_event) runs on ItsCam return FncRetCode {
            var FncRetCode v_ret := e_success;
            
            acPort.send(p_event);
            tc_ac.start;
            alt {
                [] acPort.receive(m_acSecResponseSuccess) {
                    tc_ac.stop;
                }
                [] acPort.receive {
                    tc_ac.stop;
                    log("*** " & __SCOPE__ & ": ERROR: Received unexpected message ***");
                    f_selfOrClientSyncAndVerdict("error", e_error);
                }
                [] tc_ac.timeout {
                    log("*** " & __SCOPE__ & ": ERROR: Timeout while waiting for adapter control event result ***");
                    f_selfOrClientSyncAndVerdict("error", e_timeout);
                }
            }
            
            return v_ret;
        }
        
        /**
         * @desc    Triggers event in the test system adaptation.
         * @param   p_event The event to trigger
@@ -155,7 +218,7 @@ module LibItsCam_Functions {
            if (PICS_GNSS_SCENARIO_SUPPORT==true) {
                f_acTriggerGnssEvent(m_loadScenario(p_scenario));
            }
        } // end f_acLoadScenario
        } // End of function f_acLoadScenario
        
        /**
         * @desc    Starts a loaded scenario
@@ -166,7 +229,7 @@ module LibItsCam_Functions {
                f_acTriggerGnssEvent(m_startScenario);
                vc_scenarioStarted := true;
            }
        } // end f_acStartScenario
        } // End of function f_acStartScenario
        
        /**
         * @desc    Stops a loaded scenario
@@ -177,7 +240,7 @@ module LibItsCam_Functions {
                f_acTriggerGnssEvent(m_stopScenario);
                vc_scenarioStarted := false;
            }
        } // end f_acStopScenario
        } // End of function f_acStopScenario
        
        function f_acAwaitDistanceCovered(float p_distanceToCover) runs on ItsCam return FncRetCode {
            var FncRetCode v_ret := e_success;
@@ -185,7 +248,7 @@ module LibItsCam_Functions {
            if (PICS_GNSS_SCENARIO_SUPPORT==true and vc_scenarioStarted==true) {
                f_acTriggerGnssEvent(m_distanceToCover(p_distanceToCover));
                
                tc_ac.start;
                tc_ac.start(PX_T_GNSS_AWAIT_DISTANCE_COVERED);
                alt {
                    [] acPort.receive(m_acGnssDistanceCovered) {
                        tc_ac.stop;
@@ -203,21 +266,47 @@ module LibItsCam_Functions {
                
            }
            return v_ret;
        } // end f_acAwaitDistanceCovered
        } // End of function f_acAwaitDistanceCovered
        
        function f_acAwaitSpeed(float p_speed) runs on ItsCam return FncRetCode {
            var FncRetCode v_ret := e_success;
            
            if (PICS_GNSS_SCENARIO_SUPPORT==true and vc_scenarioStarted==true) {
                f_acTriggerGnssEvent(m_awaitSpeed(p_speed));
                
                tc_ac.start(PX_T_GNSS_AWAIT_DISTANCE_COVERED);
                alt {
                    [] acPort.receive(m_acGnssSpeedReached) {
                        tc_ac.stop;
                    }
                    [] acPort.receive {
                        tc_ac.stop;
                        log("*** " & __SCOPE__ & ": ERROR: Received unexpected message ***");
                        f_selfOrClientSyncAndVerdict("error", e_error);
                    }
                    [] tc_ac.timeout {
                        log("*** " & __SCOPE__ & ": ERROR: Timeout while waiting for covered distance indication ***");
                        f_selfOrClientSyncAndVerdict("error", e_timeout);
                    }
                }
                
            }
            return v_ret;
        } // End of function f_acAwaitSpeed
        
        function f_acChangeSpeed(SpeedValue p_deltaSpeedValue) runs on ItsCam {
            
            if (PICS_GNSS_SCENARIO_SUPPORT==true and vc_scenarioStarted==true) {
                f_acTriggerGnssEvent(m_changeScenarioSpeed(p_deltaSpeedValue));
            }
        } // end f_acChangeSpeed
        } // End of function f_acChangeSpeed
        
        function f_acChangeHeading(HeadingValue p_deltaHeadingValue) runs on ItsCam {
            
            if (PICS_GNSS_SCENARIO_SUPPORT==true and vc_scenarioStarted==true) {
                f_acTriggerGnssEvent(m_changeScenarioHeading(p_deltaHeadingValue));
            }
        } // end f_acChangeHeading
        } // End of function f_acChangeHeading
        
        function f_acAwaitTimeInRunningScenario(integer p_time) runs on ItsCam return FncRetCode {
            var FncRetCode v_ret := e_success;
@@ -251,27 +340,36 @@ module LibItsCam_Functions {
        
        /**
         * @desc    Setups default configuration   
         * @param   p_certificateId The certificate identifier the TA shall use in case of secured IUT
         */
        function f_cfUp() runs on ItsCam system ItsCamSystem {
        function f_cfUp(
                        in charstring p_certificateId := PX_CERT_FOR_TS
        ) runs on ItsCam system ItsCamSystem {
            
            map(self:utPort, system:utPort);
            map(self:acPort, system:acPort);
            map(self:camPort, system:camPort);
            f_connect4SelfOrClientSync();
            
        } // end f_cfUp
            // Initialise secured mode
            f_initialiseSecuredMode(p_certificateId); 
            
        } // End of function f_cfUp
        
        /**
         * @desc    Deletes default configuration 
         */
        function f_cfDown() runs on ItsCam system ItsCamSystem {
            
            // Initialise secured mode
            f_uninitialiseSecuredMode();
            
            unmap(self:utPort, system:utPort);
            unmap(self:acPort, system:acPort);
            unmap(self:camPort, system:camPort);
            f_disconnect4SelfOrClientSync();
            
        } // end f_cfDown
        } // End of function f_cfDown
        
    } // end of camConfigurationFunctions
    
@@ -335,9 +433,14 @@ module LibItsCam_Functions {
         * @desc    Initialize the IUT
         * @remark  No specific actions specified in the base standard
         */    
        function f_prInitialState(Scenario p_scenario := e_staticPosition, boolean p_awaitInitialCAM := true) runs on ItsCam {
        function f_prInitialState(
                                  in Scenario p_scenario := e_staticPosition,
                                  in boolean p_awaitInitialCAM := true,
                                  in template (value) UtInitialize p_camInitialize := m_camInitialize,
                                  in boolean p_awaitTimeInRunningScenario := true
        ) runs on ItsCam {
            
            f_utInitializeIut(m_camInitialize);
            f_utInitializeIut(p_camInitialize);
            
            f_prDefault();
            
@@ -349,7 +452,9 @@ module LibItsCam_Functions {
            camPort.clear;
            
            f_acStartScenario();
            if (p_awaitTimeInRunningScenario) {
                f_acAwaitTimeInRunningScenario(f_getTimeForGpsFix());
            }
            
            if (p_awaitInitialCAM) {
                tc_ac.start;
@@ -362,10 +467,10 @@ module LibItsCam_Functions {
                        log("*** " & testcasename() & ": INCONC: Initial CAM not received ***");
                        f_selfOrClientSyncAndVerdictPreamble("error", e_timeout);
                    }
                }
                } // End of 'alt' statement
            }
        
        } // end f_prInitialState
        } // End of function f_prInitialState
    
    } // end of preambles

+30 −18
Original line number Diff line number Diff line
/**
 *    @author   ETSI / STF405 / STF449
 *    @author   ETSI / STF405 / STF449 / STF484 / STF517
 *    @version  $URL$
 *              $Id$
 *    @desc     CAM PICS
 *    @copyright   ETSI Copyright Notification
 *                 No part may be reproduced except as authorized by written permission.
 *                 The copyright and the foregoing restriction extend to reproduction in all media.
 *                 All rights reserved.
 *
 */
module LibItsCam_Pics {
@@ -12,65 +16,77 @@ module LibItsCam_Pics {
    
    group camPics {
        
        /**
         * @desc Is the IUT RSU?
         * @see  ETSI TS 102 868-1 Table A.1
         */
        modulepar boolean PICS_RSU := false;
        
        /**
         * @desc Is the IUT running in secured mode?
         * @see  ETSI TS 102 868-1 Table A.1
         */
        modulepar boolean PICS_IS_IUT_SECURED := false;
        
        /**
         * @desc Is IUT a public transport vehicle 
         * @see  ETSI TS 102 868-2 Table 3
         * @see  ETSI TS 102 868-1 Table A.2
         */
        modulepar boolean PICS_PUBLICTRANS := false;
        
        /**
         * @desc Is IUT a special transport vehicle 
         * @see  ETSI TS 102 868-2 Table 3
         * @see  ETSI TS 102 868-1 Table A.2
         */
        modulepar boolean PICS_SPECIALTRANS := false;
        
        /**
         * @desc Is IUT a dangerous goods vehicle 
         * @see  ETSI TS 102 868-2 Table 3
         * @see  ETSI TS 102 868-1 Table A.2
         */
        modulepar boolean PICS_DANGEROUSGOODS := false;
        
        /**
         * @desc Is IUT a road works vehicle 
         * @see  ETSI TS 102 868-2 Table 3
         * @see  ETSI TS 102 868-1 Table A.2
         */
        modulepar boolean PICS_ROADWORKS := false;
        
        /**
         * @desc Is IUT a rescue vehicle 
         * @see  ETSI TS 102 868-2 Table 3
         * @see  ETSI TS 102 868-1 Table A.2
         */
        modulepar boolean PICS_RESCUE := false;
        
        /**
         * @desc Is IUT an emergency vehicle 
         * @see  ETSI TS 102 868-2 Table 3
         * @see  ETSI TS 102 868-1 Table A.2
         */
        modulepar boolean PICS_EMERGENCY := false;
        
        /**
         * @desc Is IUT a safety car vehicle 
         * @see  ETSI TS 102 868-2 Table 3
         * @see  ETSI TS 102 868-1 Table A.2
         */
        modulepar boolean PICS_SAFETY_CAR := false;
        
        /**
         * @desc Does IUT support 'specialVehicleContainer' in CamParameters?
         * @see  ETSI TS 102 868-2 Table 3
         * @see  ETSI TS 102 868-1 Table A.2
         */
        modulepar boolean PICS_SPECIALVEHICLECONTAINER := true;
        
        /**
         * @desc Maximum time interval between CAM generations (in seconds).
         *       Default value, as per base standard: 1.0s 
         * @see  ETSI TS 102 868-2 Table 3
         * @see  ETSI TS 102 868-1 Table A.5
         */
        modulepar float PICS_T_GENCAMMAX := 1.000;
        
        /**
         * @desc Minimum time interval between CAM generations (in seconds).
         *       Default value, as per base standard: 0.1s 
         * @see  ETSI TS 102 868-2 Table 3
         * @see  ETSI TS 102 868-1 Table A.5
         */
        modulepar float PICS_T_GENCAMMIN := 0.100;
        
@@ -79,26 +95,22 @@ module LibItsCam_Pics {
         *       according to the requirements of the 
         *       Decentralized Congestion Control(DCC).
         *       Default value, as per base standard: 0.1s 
         * @see  ETSI TS 102 868-2 Table 3
         * @see  ETSI TS 102 868-1 Table A.5
         */
        modulepar float PICS_T_GENCAMDCC := 0.100;
        
        /**
         * @desc Support for CAM generation
         * @see  ETSI TS 102 868-2 Table 3
         * @see  ETSI TS 102 868-1 Table A.3
         */
        modulepar boolean PICS_CAM_GENERATION := true;

        /**
         * @desc Support for CAM reception
         * @see  ETSI TS 102 868-2 Table 3
         * @see  ETSI TS 102 868-1 Table A.3
         */
        modulepar boolean PICS_CAM_RECEPTION := true;
        
        /**
         * @desc Is the IUT RSU?
         */
        modulepar boolean PICS_RSU := false;
    } // end camPics
    
} // end LibItsCam_Pics
+21 −0
Original line number Diff line number Diff line
/**
 *  @author   ETSI / STF405 / STF449 / STF484 / STF517
 *  @version  $URL$
 *            $Id$
 *  @desc     Module containing Pixits for CAM
 *  @copyright   ETSI Copyright Notification
 *               No part may be reproduced except as authorized by written permission.
 *               The copyright and the foregoing restriction extend to reproduction in all media.
 *               All rights reserved.
 *
 */
module LibItsCam_Pixits {
    
    // LibCommon
    import from LibCommon_BasicTypesAndValues all;
    import from LibCommon_DataStrings all;
    
    // LibItsSecurity
    import from LibItsSecurity_TypesAndValues all;
    
} // End of module LibItsSecurity_Pixits
 No newline at end of file
+75 −10
Original line number Diff line number Diff line
/**
 *    @author   ETSI / STF405 / STF449
 *    @author   ETSI / STF405 / STF449 / STF484 / STF517
 *    @version  $URL$
 *              $Id$
 *    @desc     Module containing base template definitions for CAM
 *    @copyright   ETSI Copyright Notification
 *                 No part may be reproduced except as authorized by written permission.
 *                 The copyright and the foregoing restriction extend to reproduction in all media.
 *                 All rights reserved.
 *
 */
module LibItsCam_Templates {
    
    // LibCommon
    import from LibCommon_BasicTypesAndValues all;
    import from LibCommon_DataStrings all;
    
    // LibIts
    import from ITS_Container language "ASN.1:1997" all;
@@ -39,7 +44,9 @@ module LibItsCam_Templates {
            gnLifetime          := *,
            gnTrafficClass      := *,
            btpDestinationPort  := *,
            btpInfo := * 
            btpInfo             := *,
            ssp                 := *,
            its_aid             := *
        };
        
        /**
@@ -66,6 +73,21 @@ module LibItsCam_Templates {
            gnTrafficClass := p_gnTrafficClass    
        };
        
        /**
         * @desc    Receive template for CA Message (DenmPort Primitive)
         * @param   p_caMsg     The expected CA Message
         * @param   p_ssp       SSP security parameter
         * @param   p_its_aid   ITS-AID value
         */
        template CamInd mw_camIndWithSecurityParameters(
                                                          template (present) CAM p_camMsg,
                                                          template Bit256 p_ssp := *,
                                                          template UInt32 p_its_aid := c_its_aid_CAM
        ) modifies mw_camInd := { 
            ssp             := p_ssp,
            its_aid         := p_its_aid
        };
        
        /**
         * @desc    Receive template for CAM Message (CamPort Primitive)
         * @param   p_camMsg                Expected CAM Message
@@ -422,7 +444,7 @@ module LibItsCam_Templates {
         * @param p_extLights The exterior lights
         */
        template(present) BasicVehicleContainerLowFrequency mw_LF_BV_extLights(
            in template ExteriorLights p_extLights
                                                                               in template (present) ExteriorLights p_extLights
        ) modifies mw_LF_BV_any := 
        {
            exteriorLights := p_extLights
@@ -605,6 +627,49 @@ module LibItsCam_Templates {
            }
        };
        
        template (value) CAM m_camMsg_publicTransport(
            StationID p_stationId,
            GenerationDeltaTime p_generationTime,
            template (value) ReferencePosition p_referencePosition
        ) modifies m_camMsg_vehicle := {
            cam := {
                camParameters := {
                    lowFrequencyContainer := {
                        basicVehicleContainerLowFrequency := {
                            vehicleRole := publicTransport
                        }
                    },
                    specialVehicleContainer := {
			            publicTransportContainer := {
							embarkationStatus := true,
							ptActivation := omit
            			}
                    }
                }
            }
        };

        template (value) CAM m_camMsg_specialTransport(
            StationID p_stationId,
            GenerationDeltaTime p_generationTime,
            template (value) ReferencePosition p_referencePosition
        ) modifies m_camMsg_vehicle := {
            cam := {
                camParameters := {
                    lowFrequencyContainer := {
                        basicVehicleContainerLowFrequency := {
                            vehicleRole := specialTransport
                        }
                    },
                    specialVehicleContainer := {
						specialTransportContainer := {
							specialTransportType := '1000'B/* length(4)*/, // heavyLoad
							lightBarSirenInUse := '11'B/* length(2)*/ // siren and lightBar
            			}
                    }
                }
            }
        };
    } // end camAnyVehicle
    
    group camAccelerationControlTemplates {
+19 −12
Original line number Diff line number Diff line
/**
 *    @author   ETSI / STF405 / STF449
 *    @author   ETSI / STF405 / STF449 / STF484 / STF517
 *    @version  $URL$
 *              $Id$
 *    @desc     Test System module for ITS CAM
 *    @copyright   ETSI Copyright Notification
 *                 No part may be reproduced except as authorized by written permission.
 *                 The copyright and the foregoing restriction extend to reproduction in all media.
 *                 All rights reserved.
 *
 */
module LibItsCam_TestSystem {
@@ -11,6 +15,7 @@ module LibItsCam_TestSystem {
    import from LibCommon_Time {modulepar all};
    import from LibCommon_Sync all;
    import from LibCommon_BasicTypesAndValues all;
    import from LibCommon_DataStrings all;
    
    // LibIts
    import from CAM_PDU_Descriptions language "ASN.1:1997" all;
@@ -30,9 +35,9 @@ module LibItsCam_TestSystem {
         */
        type port AdapterControlPort message {
            out
                AcGnssPrimitive;
                AcGnssPrimitive, AcSecPrimitive;
            in
                AcGnssResponse, AcGnssDistanceCovered, AcGnssTimeReached;
                AcGnssResponse, AcGnssDistanceCovered, AcGnssSpeedReached, AcGnssTimeReached, AcSecResponse;
        } // end AdapterControlPort
        
        /**
@@ -127,7 +132,9 @@ module LibItsCam_TestSystem {
                UInt32      gnLifetime optional,
                UInt8       gnTrafficClass optional,
                UInt16      btpDestinationPort optional,
                UInt16  btpInfo optional
                UInt16      btpInfo optional,
                Bit256      ssp optional,
                UInt32      its_aid optional
            }
            with {
                encode (msgIn) "LibItsCam_asn1"
Loading