Commit a4a2b2a2 authored by filatov's avatar filatov
Browse files

AtsCAM, AtsDENM: add SSP tests (some TODOs are important)

parent fc696cf3
Loading
Loading
Loading
Loading
+214 −1
Original line number Diff line number Diff line
@@ -2178,6 +2178,111 @@ module ItsCam_TestCases {

        } // end group camLowerLayerParameters        

		group camGenerationSSP {
			
            /**
             * @desc Check that the IUT does not send a CAM
             * 		 when its content is not permitted by signing certificate
             * <pre>
             * Pics Selection: PICS_CAM_GENERATION AND PICS_IS_IUT_SECURED
             * Initial conditions: 
             *		with {                                                                   
             *			the IUT being in the "initial state"                                 	
             *      	the IUT is authorized to sign CAMs with the certificate
             *      		containing CAM SSP
             *      			indicating bit at position '1' set to 0
             *      }                                                                        
             * Expected behaviour:
             *  ensure that {
             *      when {
             *          the IUT generates a CAM
             *          	containing CenDsrcTollingZone
             *      }
             *      then {
             *          the IUT does not send this CAM
             *      }
             *  } 
             * </pre>
             * 
             * @see       ETSI TS 102 868-2 TP/CAM/MSD/SSP/BO-01
             * @reference ETSI EN 302 637-2 , clause 6.2.2.1
             */
			testcase TC_CAM_MSD_SSP_BO_01() runs on ItsCam system ItsCamSystem {
            
				f_CAM_MSD_SSP_BO_01();
            
			} // end TC_CAM_MSD_SSP_BO_01                        

            /**
             * @desc Check that the IUT does not send a CAM
             * 		 when its content is not permitted by signing certificate
             * <pre>
             * Pics Selection: PICS_CAM_GENERATION AND PICS_IS_IUT_SECURED
             *                 AND PICS_SPECIALVEHICLECONTAINER AND PICS_PUBLICTRANS
             * Initial conditions: 
             *		with {                                                                   
             *			the IUT being in the "initial state"                                 	
             *      	the IUT is authorized to sign CAMs with the certificate
             *      		containing CAM SSP
             *      			indicating bit at position '2' set to 0
             *      }                                                                        
             * Expected behaviour:
             *  ensure that {
             *      when {
             *          the IUT generates a CAM
             *          	containing publicTransportContainer
             *      }
             *      then {
             *          the IUT does not send this CAM
             *      }
             *  } 
             * </pre>
             * 
             * @see       ETSI TS 102 868-2 TP/CAM/MSD/SSP/BO-02
             * @reference ETSI EN 302 637-2 , clause 6.2.2.1
             */
			testcase TC_CAM_MSD_SSP_BO_02() runs on ItsCam system ItsCamSystem {
            
				f_CAM_MSD_SSP_BO_02();
            
			} // end TC_CAM_MSD_SSP_BO_02                        

            /**
             * @desc Check that the IUT does not send a CAM
             * 		 when its content is not permitted by signing certificate
             * <pre>
             * Pics Selection: PICS_CAM_GENERATION AND PICS_IS_IUT_SECURED
             *                 AND PICS_SPECIALVEHICLECONTAINER AND PICS_SPECIALTRANS
             * Initial conditions: 
             *		with {                                                                   
             *			the IUT being in the "initial state"                                 	
             *      	the IUT is authorized to sign CAMs with the certificate
             *      		containing CAM SSP
             *      			indicating bit at position '3' set to 0
             *      }                                                                        
             * Expected behaviour:
             *  ensure that {
             *      when {
             *          the IUT generates a CAM
             *          	containing specialTransportContainer
             *      }
             *      then {
             *          the IUT does not send this CAM
             *      }
             *  } 
             * </pre>
             * 
             * @see       ETSI TS 102 868-2 TP/CAM/MSD/SSP/BO-03
             * @reference ETSI EN 302 637-2 , clause 6.2.2.1
             */
            testcase TC_CAM_MSD_SSP_BO_03() runs on ItsCam system ItsCamSystem {
            
                f_CAM_MSD_SSP_BO_03();
            
            } // end TC_CAM_MSD_SSP_BO_03   
                                 
        } // end group camGenerationSSP        
        
    } // end group camMessageDissemination
      
    group camMessageProcessing {
@@ -2212,6 +2317,114 @@ module ItsCam_TestCases {
            
        } // end TC_CAM_MSP_BV_01
        
		group camProcessingSSP {
            /**
             * @desc Check that IUT discards CAM if SSP value of the signing certificate 
             *       is not consistent with the provided containers.
             * <pre>
             * Pics Selection: PICS_CAM_RECEPTION AND PICS_IS_IUT_SECURED
             * Initial conditions: 
             *     with {
             *         the IUT being in the "initial state"
             *     }
             * Expected behaviour:
             *     ensure that {
             *     	   when {
             * 		       the IUT receives a secured CAM
             * 			       containing CenDsrcTollingZone/ProtectedCommunicationZonesRSU
             * 			       signed with certificate
             * 				       containing CAM SSP bit at position 0
             * 	                       indicating 0
             * 	       }
             * 	       then {
             * 		       the IUT discards the CAM
             * 		       and the IUT does not forward the CAM content to upper layers
             * 		       and the IUT does not forward the CAM content to other facilities
             * 	       }
             *     }
             * </pre>
             * 
             * @see       ETSI TS 102 868-2 TP/CAM/MSP/SSP/BV-01-01
             * @reference ETSI EN 302 637-2 , clause 6.2.2.1
             */
            testcase TC_CAM_MSP_SSP_BV_01() runs on ItsCam system ItsCamSystem {
                
                f_CAM_MSP_SSP_BV_01();
    
            } // end TC_CAM_MSP_BV_01
    
            /**
             * @desc Check that IUT discards CAM if SSP value of the signing certificate 
             *       is not consistent with the provided containers.
             * <pre>
             * Pics Selection: PICS_CAM_RECEPTION AND PICS_IS_IUT_SECURED 
             * Initial conditions: 
             * 		with {
             *			the IUT being in the "initial state"
             *		}
             * Expected behaviour:
             *		ensure that {
             *			when {
             *				the IUT receives a secured CAM
             *					containing publicTransportContainer
             *					and signed with certificate
             *						containing CAM SSP bit at position 1
             *							indicating 0
             * 	       }
             * 	       then {
             * 		       the IUT discards the CAM
             * 		       and the IUT does not forward the CAM content to upper layers
             * 		       and the IUT does not forward the CAM content to other facilities
             * 	       }
             *     }
             * </pre>
             * 
             * @see       ETSI TS 102 868-2 TP/CAM/MSP/SSP/BV-01-02
             * @reference ETSI EN 302 637-2 , clause 6.2.2.1
             */
            testcase TC_CAM_MSP_SSP_BV_02() runs on ItsCam system ItsCamSystem {
                
    			f_CAM_MSP_SSP_BV_02();
                
            } // end TC_CAM_MSP_BV_02
            
            /**
             * @desc Check that IUT discards CAM if SSP value of the signing certificate 
             *       is not consistent with the provided containers.
             * <pre>
             * Pics Selection: PICS_CAM_RECEPTION AND PICS_IS_IUT_SECURED 
             * Initial conditions: 
             * 		with {
             *			the IUT being in the "initial state"
             *		}
             * Expected behaviour:
             *		ensure that {
             *			when {
             *				the IUT receives a secured CAM
             *					containing specialTransportContainer
             *					and signed with certificate
             *						containing CAM SSP bit at position 2
             *							indicating 0
             * 	       }
             * 	       then {
             * 		       the IUT discards the CAM
             * 		       and the IUT does not forward the CAM content to upper layers
             * 		       and the IUT does not forward the CAM content to other facilities
             * 	       }
             *     }
             * </pre>
             * 
             * @see       ETSI TS 102 868-2 TP/CAM/MSP/SSP/BV-01-03
             * @reference ETSI EN 302 637-2 , clause 6.2.2.1
             */
            testcase TC_CAM_MSP_SSP_BV_03() runs on ItsCam system ItsCamSystem {
                
                f_CAM_MSP_SSP_BV_03();
                
            } // end TC_CAM_MSP_BV_03
		
		}// end group camProcessingSSP
		
    } // end group camMessageProcessing
    
} // end ItsCam_TestCases
+13 −0
Original line number Diff line number Diff line
@@ -94,10 +94,23 @@ module ItsCam_TestControl {
            execute(TC_CAM_MSD_PAR_BV_02());
            execute(TC_CAM_MSD_PAR_BV_03());
            
            if (PICS_IS_IUT_SECURED) {
                if (PICS_PUBLICTRANS) {
                    execute(TC_CAM_MSD_SSP_BO_02());
                }
                if (PICS_SPECIALTRANS) {
                    execute(TC_CAM_MSD_SSP_BO_02());
                }
            }
   		}
        
        if(PICS_CAM_RECEPTION) {
        	execute(TC_CAM_MSP_BV_01());
        	
            if (PICS_IS_IUT_SECURED) {
                execute(TC_CAM_MSP_SSP_BV_02());
                execute(TC_CAM_MSP_SSP_BV_03());
            }
        }
        
    }
+201 −8
Original line number Diff line number Diff line
@@ -15,6 +15,8 @@ module ItsCam_TpFunctions {
    import from LibCommon_VerdictControl all;
    import from LibCommon_Time all;
    import from LibCommon_BasicTypesAndValues all;
    import from LibCommon_DataStrings all;
    
    
    // LibItsCommon
    import from LibItsCommon_Pixits all;
@@ -25,7 +27,8 @@ module ItsCam_TpFunctions {
    import from LibItsCam_Functions all;
    import from LibItsCam_Templates all;
    import from LibItsCam_TypesAndValues all;
    import from LibItsCam_Pics {modulepar all};
	import from LibItsCam_Pics {modulepar all;}
    import from LibItsCam_Pixits {modulepar all;}
    // ASN.1
    import from ITS_Container language "ASN.1:1997" all;
    import from CAM_PDU_Descriptions language "ASN.1:1997" all;
@@ -53,7 +56,6 @@ module ItsCam_TpFunctions {
                f_cfUp();
                
                // Test adapter configuration
                
				// Preamble
				f_prInitialState();
                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
@@ -2988,10 +2990,105 @@ module ItsCam_TpFunctions {
                f_cfDown();
                
            } // end f_CAM_MSD_PAR_BV_03
    
        } // end group camLowerLayerParameters

    } // end group camMessageDissemination
        group camGenerationSSP{
            function f_CAM_MSD_SSP_BO_XX(
            				in Oct8 p_certHashedId8,
            				in template(value) UtCamTrigger p_utEvent,
            				in template(present) CAM pmw_CamMsg  
            ) runs on ItsCam {
                
                // Local variables
                
                // Test control
				if (not PICS_CAM_GENERATION) {
					log("*** " & testcasename() & ": PICS_CAM_GENERATION required for executing the TC ***");
					setverdict(inconc);
					stop;
				}              
                
            	if (not PICS_IS_IUT_SECURED) {
                	log("*** " & testcasename() & ": PICS_IS_IUT_SECURED required for executing the TC ***");
	                setverdict(inconc);
    	            stop;
        	    }
        	                  
                // Test component configuration
                f_cfUp();
                
                // Test adapter configuration
                
                // Preamble
                // TODO: initialize IUT with given certificate
                f_prInitialState( e_staticPosition, true, {
					hashedId8 := p_certHashedId8
				});
					
                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                
                // execute UT Command
                f_utTriggerEvent(p_utEvent);
                
                // Test Body
                tc_ac.start;
                alt {
                    [] camPort.receive(mw_camInd (  pmw_CamMsg )) { 
                        tc_ac.stop;
                        log("*** " & testcasename() & ": FAIL: Expected CAM message received ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_error);  
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": PASS: CAM message not received ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                    }
                }
                
                // Postamble
                f_poDefault();
                f_cfDown();
                
            } // end f_CAM_MSD_SSP_BO_XX
                          
    
			function f_CAM_MSD_SSP_BO_01() runs on ItsCam {
				
            	// TODO: make template for tolling
	            log("*** " & testcasename() & ": This TC is not implemented yet ***");
    	        setverdict(inconc);
        	    stop;
            
			} // end f_CAM_MSD_SSP_BO_01

            function f_CAM_MSD_SSP_BO_02() runs on ItsCam {

                if (not PICS_SPECIALVEHICLECONTAINER and not PICS_PUBLICTRANS) {
                    testcase.stop(testcasename() 
                        & ": PICS_SPECIALVEHICLECONTAINER and PICS_PUBLICTRANS need to be set to true");
                }

				f_CAM_MSD_SSP_BO_XX(PX_CERT_IUT_CAM_02,
									m_setVehicleRole(c_vehicleRole_publicTransport),
									mw_camMsg_SVC ( mw_publicTransport_any )
				);

            } // end f_CAM_MSD_SSP_BO_02

            function f_CAM_MSD_SSP_BO_03() runs on ItsCam {

				if (not PICS_SPECIALVEHICLECONTAINER and not PICS_SPECIALTRANS) {
					testcase.stop(testcasename() 
						& ": PICS_SPECIALVEHICLECONTAINER and PICS_SPECIALTRANS need to be set to true");
				}

				f_CAM_MSD_SSP_BO_XX(PX_CERT_IUT_CAM_03,
									m_setVehicleRole(c_vehicleRole_specialTransport),
									mw_camMsg_SVC ( mw_specialTransport_any )
				);
            } // end f_CAM_MSD_SSP_BO_03
        }
                    
    } // end group camSSP
      
    group camMessageProcessing {
        
@@ -3051,6 +3148,102 @@ module ItsCam_TpFunctions {
            
        } // end f_CAM_MSP_BV_01
        
        group camProcessingSSP{
        	
            /**
             * @desc    TP Function for TC_CAM_MSP_SSP_BV_XX
             * @param p_certName Certificate to be used to sign the CAM message
             * @param p_camMsg   CAM value template to be sent to IUT 
             */
            function f_CAM_MSP_SSP_BV_XX(
            	in charstring p_certName,
            	in template (value) CAM p_camMsg
            ) runs on ItsCam {
                
                // Local variables
                var CamReq v_camReq;
                var integer i;
                
                // Test control
    			if (not PICS_CAM_RECEPTION) {
    				log("*** " & testcasename() & ": PICS_CAM_RECEPTION required for executing the TC ***");
    				setverdict(inconc);
    				stop;
    			}              
                
                if (not PICS_IS_IUT_SECURED) {
                    log("*** " & testcasename() & ": PICS_IS_IUT_SECURED required for executing the TC ***");
                    setverdict(inconc);
                    stop;
                }              
                
                // Test component configuration
                f_cfUp();
                
                // Test adapter configuration
                // TODO: instruct adapter to use certName to sign the message 
                
                // Preamble
                f_prInitialState();
                f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                
                // Test Body
                v_camReq := valueof(
                                m_camReq(
    								p_camMsg
                                )
                            );
                camPort.send( v_camReq ) ;
                
                f_sleep(PX_TNOAC);
                for(i:=0; i < lengthof(vc_utEvents) and not match(v_camReq.msgOut, vc_utEvents[i].camMsg); i:=i+1) {
                    // empty on purpose 
                }
                if(i < lengthof(vc_utEvents)) {
                    log("*** " & testcasename() & ": FAIL: CAM was not transmitted to upper layer ***");
                    f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                }
                else {
                    log("*** " & testcasename() & ": PASS: CAM was transmitted to upper layer ***");
                    f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                }
                
                // Postamble
                f_poDefault();
                f_cfDown();
                
            } // end f_CAM_MSP_SSP_BV_XX
    
            function f_CAM_MSP_SSP_BV_01() runs on ItsCam {
            	
                // TODO: make template for tolling
                log("*** " & testcasename() & ": This TC is not implemented yet ***");
                setverdict(inconc);
                stop;
            } // end f_CAM_MSP_SSP_BV_01
    
            function f_CAM_MSP_SSP_BV_02() runs on ItsCam {
    
    			f_CAM_MSP_SSP_BV_XX("CERT_TS_CAM_02",
    							m_camMsg_publicTransport(
    								f_getTsStationId(),
    								f_getCurrentTime() mod 65536, // See ETSI EN 302 637-2 V1.3.0 - Clause B.3 generationDelatTime
    								m_tsPosition
    							)
                );
            } // end f_CAM_MSP_SSP_BV_03
            
            function f_CAM_MSP_SSP_BV_03() runs on ItsCam {
    
    			f_CAM_MSP_SSP_BV_XX("CERT_TS_CAM_03",
    							m_camMsg_specialTransport(
    								f_getTsStationId(),
    								f_getCurrentTime() mod 65536, // See ETSI EN 302 637-2 V1.3.0 - Clause B.3 generationDelatTime
    								m_tsPosition
    							)
                );
            } // end f_CAM_MSP_SSP_BV_03
        }// end group camProcessingSSP
    } // end group camMessageProcessing
    
} // end ItsCam_TpFunctions
+267 −1

File changed.

Preview size limit exceeded, changes collapsed.

+13 −1
Original line number Diff line number Diff line
@@ -8,7 +8,7 @@
module ItsDenm_TestControl {
    
    // ATS DENM
    import from ItsDenm_TestCases {testcase all};
    import from ItsDenm_TestCases {testcase all;}
    
    // LibIts
    import from LibItsDenm_Pics all;
@@ -71,6 +71,11 @@ module ItsDenm_TestControl {
            execute(TC_DEN_PAR_BV_02());
        }
        
        if(PICS_IS_IUT_SECURED) {
			execute(TC_DEN_SSP_BV_01());
			execute(TC_DEN_SSP_BV_02());
        }
        
        if(PICS_DENM_RECEPTION) {
            execute(TC_DEN_MSRV_BV_01());
            execute(TC_DEN_MSRV_BV_02());
@@ -80,6 +85,13 @@ module ItsDenm_TestControl {
            execute(TC_DEN_MSRV_BO_06());
            execute(TC_DEN_MSRV_BV_07());
            
            if(PICS_IS_IUT_SECURED) {
				execute(TC_DEN_MSRV_BO_08_01());
				execute(TC_DEN_MSRV_BO_08_02());

				execute(TC_DEN_MSRV_BO_09_01());
                execute(TC_DEN_MSRV_BO_09_02());
            }
            if(PICS_IMPACT_REDUCTION) {
                execute(TC_DEN_MSRV_BV_10());
            }
Loading