ItsMapSpat_TestCases.ttcn 45.8 KB
Newer Older
            tc_ac.start;
            alt {
            	[]	mapSpatPort.receive ( mw_spatInd ( mw_spatPdu ( mw_itsPduHeaderSpat , mw_spatSubId0 ) ) ) -> value v_message { 
                	tc_ac.stop;
                    if ( fx_checkUperEncoding ( v_message.msgIn.rawData ) ) {
                        log("*** " & testcasename() & ": PASS: Successfully received SPAT correctly ASN 1 UPER encoded. ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                    }
                    else {
                        log("*** " & testcasename() & ": FAIL: Received a SPAT message incorrectly ASN 1 UPER encoded. ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                    }
                }
            	[]	mapSpatPort.receive ( mw_spatInd ( mw_spatPdu ( mw_itsPduHeaderSpat , mw_anySpat ) ) ) { 
                    tc_ac.stop;
                    log("*** " & testcasename() & ": FAIL: Received an incorrect MAP message. ***");
                    f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                }
                []	tc_ac.timeout {
                    log("*** " & testcasename() & ": INCONC: Timeout while awaiting the reception of a message. ***");
                    f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
                }
            }
                
            // Postamble
            f_poDefault();
            f_cfDown();
                
		} // end TC_MAP_SPAT_MSD_BV-14

		/**
		* @desc Verify that when sending a MapData message, the IUT encapsulates the message into a GN SHB message.
		* <pre>
		* Pics Selection: PICS_RSU
		* Initial conditions: 
		*	with {
		*		the IUT being in the "initial state"
		*	}
		* Expected behaviour:
		*	ensure that {
		*		when { 
		*			a MapData message is generated
		*		}
		*		then {
		*			the IUT sends a valid MapData message encapsulated into a GN SHB message
		*		}
		*	}
		* </pre>
		*
		* @version	 0.0.1
		* @see		 ETSI TS 103 191-2 V0.0.1 TP/MAP-SPAT/MSD//BV-15
		* @reference No clause – Implicit to use in ITS
		*/
		testcase TC_MAP_SPAT_MSD_BV_15 () runs on ItsMapSpat system ItsMapSpatSystem {
                
        	// Local variables
        	var MapInd		v_message;
                
            // Test component configuration
            f_cfUp();
                
            // Preamble
            f_prInitialState();
            f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                
			// Test Body
            tc_ac.start;
            alt {
            	[]	mapSpatPort.receive ( mw_mapInd ( mw_mapPdu ( mw_itsPduHeader , mw_mapWellFormatted ) ) ) -> value v_message { 
                    tc_ac.stop;
                    if ( v_message.msgIn.msg.header.messageID == c_mapMessageId ) {
                        log("*** " & testcasename() & ": PASS: Successfully received MAP. ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                    }
                    else {
                        log("*** " & testcasename() & ": FAIL: Received an incorrect MAP message. ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                    }
                }
            	[]	mapSpatPort.receive ( mw_mapInd ( mw_mapPdu ( mw_itsPduHeaderMap , mw_anyMap ) ) ) { 
                    tc_ac.stop;
                    log("*** " & testcasename() & ": FAIL: Received an incorrect MAP message. ***");
                    f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                }
                []	tc_ac.timeout {
                    log("*** " & testcasename() & ": INCONC: Timeout while awaiting the reception of a message. ***");
                    f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
                }
            }
                
            // Postamble
            f_poDefault();
            f_cfDown();
                
		} // end TC_MAP_SPAT_MSD_BV-15

		/**
		* @desc Verify that when sending a SPAT message, the IUT encapsulates the message into a GN SHB message.
		* <pre>
		* Pics Selection: PICS_RSU
		* Initial conditions: 
		*	with {
		*		the IUT being in the "initial state"
		*	}
		* Expected behaviour:
		*	ensure that {
		*		when { 
		*			a SPAT message is generated
		*		}
		*		then {
		*			the IUT sends a valid SPAT message encapsulated into a GN SHB message
		*		}
		*	}
		* </pre>
		*
		* @version	 0.0.1
		* @see		 ETSI TS 103 191-2 V0.0.1 TP/MAP-SPAT/MSD//BV-16
		* @reference No clause – Implicit to use in ITS
		*/
		testcase TC_MAP_SPAT_MSD_BV_16 () runs on ItsMapSpat system ItsMapSpatSystem {
                
        	// Local variables
        	var MsgCount	v_msgCount;
        	var SpatInd		v_message;
                
            // Test component configuration
            f_cfUp();
                
            // Preamble
            f_prInitialState();
            f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                
			// Test Body
            v_msgCount := f_utTriggerEvent ( m_utTriggerEvent ( spatMsg ) );
            
            tc_ac.start;
            alt {
            	[]	mapSpatPort.receive ( mw_spatInd ( mw_spatPdu ( mw_itsPduHeader , mw_spatSubId0 ) ) ) -> value v_message { 
                	tc_ac.stop;
                    if ( v_message.msgIn.msg.header.messageID == c_spatMessageId ) {
                        log("*** " & testcasename() & ": PASS: Successfully received SPAT. ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                    }
                    else {
                        log("*** " & testcasename() & ": FAIL: Received an incorrect SPAT message. ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                    }
                }
            	[]	mapSpatPort.receive ( mw_spatInd ( mw_spatPdu ( mw_itsPduHeaderSpat , mw_anySpat ) ) ) { 
                    tc_ac.stop;
                    log("*** " & testcasename() & ": FAIL: Received an incorrect MAP message. ***");
                    f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                }
                []	tc_ac.timeout {
                    log("*** " & testcasename() & ": INCONC: Timeout while awaiting the reception of a message. ***");
                    f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
                }
            }
                
            // Postamble
            f_poDefault();
            f_cfDown();
                
		} // end TC_MAP_SPAT_MSD_BV-16

    } // end group MapSpatMessageDissemination

    group MapSpatMessageProcessing { 

		/**
		* @desc Verify  that: when the IUT receives a GN SHB message encapsulating a MapData message, it pass the message to the application layer.
		* <pre>
		* Pics Selection: PICS_VEHICLE
		* Initial conditions: 
		*	with {
		*		the IUT being in the "initial state"
		*	}
		* Expected behaviour:
		*	ensure that {
		*		when { 
		*			the IUT receives a valid MapData message encapsulated into a GN SHB message
			*	}
		*		then {
		*			the IUT forwards the MapData message content to upper layers
		*		}
		*	}
		* </pre>
		*
		* @version   0.0.1
		* @see	     ETSI TS 103 191-2 V0.0.1 TP/MAP-SPAT/MSP//BV-01
		* @reference No clause – Implicit to use in ITS
		*/
		testcase TC_MAP_SPAT_MSP_BV_01 () runs on ItsMapSpat system ItsMapSpatSystem {
                
        	// Local variables
        	var MsgCount	v_msgCount;
        	var MapReq		v_mapReq;
            var integer		i;
                
            // Test component configuration
            f_cfUp();
                
            // Preamble
            f_prInitialState();
            f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                
			// Test Body
            v_mapReq := valueof (  m_mapReq ( m_mapPdu ( m_map ) ) );
            mapSpatPort.send( v_mapReq ) ;
            
            f_sleep(PX_TAC);
            for ( i:=0 ; i < lengthof ( vc_utMapEvents ) and not match ( v_mapReq, vc_utMapEvents[i].mapMsg ) ; i := i+1 ) {
                // empty on purpose 
            }
            if ( i < lengthof ( vc_utMapEvents ) ) {
                log("*** " & testcasename() & ": PASS: MAP was transmitted to upper layer ***");
                f_clientSyncAndVerdict(c_tbDone, e_success);
            }
            else {
                log("*** " & testcasename() & ": FAIL: MAP was not transmitted to upper layer ***");
                f_clientSyncAndVerdict(c_tbDone, e_error);
            }
                
            // Postamble
            f_poDefault();
            f_cfDown();
                
		} // end TC_MAP_SPAT_MSP_BV_01

		/**
		* @desc Verify  that: when the IUT receives a GN SHB message encapsulating a SPAT message, it pass the message to the application layer.
		* <pre>
		* Pics Selection: PICS_VEHICLE
		* Initial conditions: 
		*	with {
		*		the IUT being in the "initial state"
		*	}
		* Expected behaviour:
		*	ensure that {
		*		when { 
		*			the IUT receives a valid SPAT message encapsulated into a GN SHB message
			*	}
		*		then {
		*			the IUT forwards the SPAT message content to upper layers
		*		}
		*	}
		* </pre>
		*
		* @version   0.0.1
		* @see	     ETSI TS 103 191-2 V0.0.1 TP/MAP-SPAT/MSP//BV-02
		* @reference No clause – Implicit to use in ITS
		*/
		testcase TC_MAP_SPAT_MSP_BV_02 () runs on ItsMapSpat system ItsMapSpatSystem {
                
        	// Local variables
        	var SpatReq		v_spatReq;
            var integer		i;
                
            // Test component configuration
            f_cfUp();
                
            // Preamble
            f_prInitialState();
            f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
                
			// Test Body
            v_spatReq := valueof (  m_spatReq ( m_spatPdu ( m_spat ) ) );
            mapSpatPort.send ( v_spatReq ) ;
            
            f_sleep(PX_TAC);
            for ( i:=0 ; i < lengthof ( vc_utSpatEvents ) and not match ( v_spatReq , vc_utSpatEvents[i].spatMsg ) ; i:=i+1 ) {
                // empty on purpose 
            }
            if ( i < lengthof ( vc_utSpatEvents ) ) {
                log("*** " & testcasename() & ": PASS: SPAT was transmitted to upper layer ***");
                f_clientSyncAndVerdict(c_tbDone, e_success);
            }
            else {
                log("*** " & testcasename() & ": FAIL: SPAT was not transmitted to upper layer ***");
                f_clientSyncAndVerdict(c_tbDone, e_error);
            }
                
            // Postamble
            f_poDefault();
            f_cfDown();
                
		} // end TC_MAP_SPAT_MSP_BV_02

	} // end group MapSpatMessageProcessing
    
} // end ItsMapSpat_TestCases