ItsGeoNetworking_TestCases.ttcn 913 KB
Newer Older
filatov's avatar
filatov committed
/**
 *  @author     ETSI / STF405 / STF449
 *  @version    $URL$
 *              $Id$
 *  @desc       GeoNetworking Testcases (TP version: 0.0.11)
 *
 */
module ItsGeoNetworking_TestCases {
    
    // Libcommon
    import from LibCommon_BasicTypesAndValues all;
    import from LibCommon_Time all;
    import from LibCommon_VerdictControl all;
    import from LibCommon_Sync all;
    
    // LibIts
    import from LibItsCommon_Functions all;
    import from LibItsGeoNetworking_TestSystem all;
    import from LibItsGeoNetworking_Functions all;
    import from LibItsGeoNetworking_Templates all;
    import from LibItsGeoNetworking_TypesAndValues all;
    import from LibItsGeoNetworking_Pics all;

    // 6.2.1
    group geoFormatingAndDataValidity {
        
        // 6.2.1.1
        group geoFdvBasicHeader {
            
            /**
             * @desc    Testing defined values of default Gn parameters in the basic header
             * <pre>
             * Pics Selection: none
             * Config Id: CF01
             * Initial conditions:
             *  with {
             *      the IUT being in the "initial state"
             *  }
             * Expected behaviour:
             *  ensure that {
             *      when {
             *          the IUT is requested to send a GeoUnicast packet
             *      }
             *      then {
             *          the IUT sends a GeoUnicast packet
             *              containing a correctly formatted Basic Header
             *                  containing version field
             *                      set to itsGnProtocolVersion MIB parameter
             *                  containing RHL field
             *                      set to itsGnDefaultHopLimit MIB parameter
             *      }
             *  }
             * </pre>
             *
             * @see         ETSI TS 102 871-2 v1.3.1 TP/GEONW/FDV/BAH/BV/01
filatov's avatar
filatov committed
             * @reference   EN 302 636-4-1 [1], clauses 9.3.2 , 8.6.2 and Annex G
             */
            testcase TC_GEONW_FDV_BAH_BV_01() runs on ItsGeoNetworking system ItsGeoNetworkingSystem {
                
                // Local variables
                var LongPosVector v_longPosVectorNodeB;
                
                // Test control
                
                // Test component configuration
                f_cf01Up();
                v_longPosVectorNodeB := f_getPosition(vc_componentName);
                
                // Test adapter configuration
                
                // Preamble
                f_prNeighbour();
                f_selfOrClientSyncAndVerdict(c_prDone, e_success);
filatov's avatar
filatov committed
                
                // Test Body
                if ( not f_utTriggerEvent(m_generateGeoUnicastMessage(v_longPosVectorNodeB.gnAddr)) ) {
                    log("*** " & testcasename() & ": INCONC: Trigger failed ***");
                    f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
filatov's avatar
filatov committed
                }
                tc_ac.start;
                alt {
                    [] geoNetworkingPort.receive(mw_geoNwInd(mw_geoNwPdu(mw_geoNwUnicastPacket(?, ?), -, f_getDefaultHopLimit()))) {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": PASS: Basic Header correctly formatted ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
filatov's avatar
filatov committed
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: Expected message not received ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
filatov's avatar
filatov committed
                    }
                }
                
                // Postamble
                f_poNeighbour();
                f_cf01Down();
                
            } // end TC_GEONW_FDV_BAH_BV_01
            
            /**
             * @desc    Testing discard of packet having incorrect version
             * <pre>
             * Pics Selection: none
             * Config Id: CF01
             * Initial conditions:
             *  with {
             *      the IUT being in the "initial state"
             *  }
             * Expected behaviour:
             *  ensure that {
             *      when {
             *          the IUT receives the SHB packet from ItsNodeB
             *              containing a correctly formatted Basic Header
             *                  containing version field
             *                      set to value not equal to itsGnProtocolVersion MIB parameter
             *      }
             *      then {
             *          the IUT discards the received SHB packet
             *      }
             *  }
             * </pre>
             *
             * @see         ETSI TS 102 871-2 v1.3.1 TP/GEONW/FDV/BAH/BV/02
filatov's avatar
filatov committed
             * @reference   EN 302 636-4-1 [1], clauses 9.3.3
             */
            testcase TC_GEONW_FDV_BAH_BV_02() runs on ItsGeoNetworking system ItsGeoNetworkingSystem {
                // Local variables
                var LongPosVector v_longPosVectorNodeB;
                var template (value) GeoNetworkingPdu v_gnPacket;
                var integer i;
                
                // Test control
                
                // Test component configuration
                f_cf01Up();
                v_longPosVectorNodeB := f_getPosition(c_compNodeB);
                
                // Test adapter configuration
                
                // Preamble
                f_prNeighbour();
                f_selfOrClientSyncAndVerdict(c_prDone, e_success);
filatov's avatar
filatov committed
                
                // Test Body
                v_gnPacket := m_geoNwPdu(m_geoNwShbPacket(v_longPosVectorNodeB));
                v_gnPacket.basicHeader.version := valueof(v_gnPacket.basicHeader.version) + 1;
filatov's avatar
filatov committed
                
                f_sendGeoNetMessage(m_geoNwReq_linkLayerBroadcast(v_gnPacket));
                
                f_sleep(PX_TAC);
                for(i:=0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_gnPacket.gnPacket.packet.payload.rawPayload); i:=i+1) {
                    // empty on purpose 
                }
                if(i < lengthof(vc_utInds)) {
                    log("*** " & testcasename() & ": FAIL: GN was transmitted to upper layer ***");
                    f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
filatov's avatar
filatov committed
                }
                else {
                    log("*** " & testcasename() & ": PASS: GN was discarded and not transmitted to upper layer ***");
                    f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
filatov's avatar
filatov committed
                }
                
                // Postamble
                f_poNeighbour();
                f_cf01Down();
                
            } // end TC_GEONW_FDV_BAH_BV_02
            
        } // end geoFdvBasicHeader
        
        // 6.2.1.2
        group geoFdvCommonHeader {
            
            /**
             * @desc    Common GeoNetworking header validity test (PL field)
             * <pre>
             * Pics Selection: none
             * Config Id: CF01
             * Initial conditions:
             *  with {
             *      the IUT being in the "initial state"
             *  }
             * Expected behaviour:
             *  ensure that {
             *      when {
             *          the IUT generates a Beacon message
             *      }
             *      then {
             *          the IUT sends a GeoNetworking message
             *              containing a correctly formatted Common Header
             *                  containing HT field
             *                      set to '1' (BEACON)
             *                  containing HST field
             *                      set to '0' (UNSPECIFIED)
             *                  containing PL field
             *                      set to '0'
             *      }
             *  }
             * </pre>
             *
             * @see         ETSI TS 102 871-2 v1.3.1 TP/GEONW/FDV/COH/BV/01
filatov's avatar
filatov committed
             * @reference   EN 302 636-4-1 [1], clauses 8.7.2, 8.7.4, 8.8.6 and 9.3.6
             */
            testcase TC_GEONW_FDV_COH_BV_01() runs on ItsGeoNetworking system ItsGeoNetworkingSystem {
                
                // Local variables
                var LongPosVector v_longPosVectorIut;
                
                // Test control
                
                // Test component configuration
                f_cf01Up();
                v_longPosVectorIut := f_getPosition(c_compIut);
                
                // Test adapter configuration
                
                // Preamble
                f_prNeighbour();
                f_acTriggerEvent(m_startPassBeaconing(m_beaconHeader(v_longPosVectorIut).beaconHeader));
                f_selfOrClientSyncAndVerdict(c_prDone, e_success);
filatov's avatar
filatov committed
                
                // Test Body
                tc_ac.start;
                alt {
                    [] geoNetworkingPort.receive(mw_geoNwInd(mw_geoNwPdu(mw_geoNwBeaconPacket(?))))  {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": PASS: Common Header correclty formatted ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
filatov's avatar
filatov committed
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: Expected message not received ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
filatov's avatar
filatov committed
                    }
                }
                
                f_acTriggerEvent(m_stopPassBeaconing);
                
                // Postamble
                f_poNeighbour();
                f_cf01Down();
                
            } // end TC_GEONW_FDV_COH_BV_01
            
            /**
             * @desc    Common GeoNetworking header validity test (PL field)
             * <pre>
             * Pics Selection: none
             * Config Id: CF01
             * Initial conditions:
             *  with {
             *      the IUT being in the "initial state"
             *  }
             * Expected behaviour:
             *  ensure that {
             *      when {
             *          the IUT is requested to send a SHB packet
             *      }
             *      then {
             *          the IUT sends a GeoNetworking packet
             *              containing a correctly formatted Common Header
             *                  containing HT field
             *                      set to '5' (TSB)
             *                  containing HST field
             *                      set to '0' (SINGLE_HOP)
             *                  containing MHL field
             *                      set to '1'
             *                  containing PL field
             *                      set to the length of the included payload
             *              containing a payload
             *      }
             *  }
             * </pre>
             *
             * @see         ETSI TS 102 871-2 v1.3.1 TP/GEONW/FDV/COH/BV/02
filatov's avatar
filatov committed
             * @reference   EN 302 636-4-1 [1], clauses 8.7.2, 8.7.4, 8.8.4, 9.3.4 and 9.3.10
             */
            testcase TC_GEONW_FDV_COH_BV_02() runs on ItsGeoNetworking system ItsGeoNetworkingSystem {
                
                // Local variables
                var GeoNetworkingInd v_geoNwInd;
                var octetstring v_payload := char2oct("PAYLOAD");
                
                // Test control
                
                // Test component configuration
                f_cf01Up();
                
                // Test adapter configuration
                
                // Preamble
                f_prNeighbour();
                if ( not f_utTriggerEvent(m_generateShbMessageWithPayload(v_payload)) ) {
                	log("*** " & testcasename() & ": INCONC: Trigger failed ***");
                	f_selfOrClientSyncAndVerdict(c_prDone, e_timeout);
                f_selfOrClientSyncAndVerdict(c_prDone, e_success);
filatov's avatar
filatov committed
                
                // Test Body
                tc_ac.start;
                alt {
                    [] geoNetworkingPort.receive(mw_geoNwInd(mw_geoNwPdu(mw_geoNwShbPacket))) -> value v_geoNwInd {
                        tc_ac.stop;
                        if(ispresent(v_geoNwInd.msgIn.gnPacket.packet.payload)) {
                            if(v_geoNwInd.msgIn.gnPacket.packet.commonHeader.plLength == lengthof(v_geoNwInd.msgIn.gnPacket.packet.payload.rawPayload)) {
                                log("*** " & testcasename() & ": PASS: PL field correctly indicates payload size ***");
                                f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
filatov's avatar
filatov committed
                            }
                            else {
                                log("*** " & testcasename() & ": FAIL: PL does correctly not indicate payload size ("
                                    & int2str(v_geoNwInd.msgIn.gnPacket.packet.commonHeader.plLength)
                                    & " != "
                                    & int2str(lengthof(v_geoNwInd.msgIn.gnPacket.packet.payload.rawPayload))
                                    & ")***");
                                f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
filatov's avatar
filatov committed
                            }
                        }
                        else {
                            if(v_geoNwInd.msgIn.gnPacket.packet.commonHeader.plLength == 0) {
                                log("*** " & testcasename() & ": PASS: PL field correctly indicates empty payload ***");
                                f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
filatov's avatar
filatov committed
                            }
                            else {
                                log("*** " & testcasename() & ": FAIL: PL does not indicate empty payload ***");
                                f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
filatov's avatar
filatov committed
                            }
                        }
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: Expected message not received ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
filatov's avatar
filatov committed
                    }
                }
                
                // Postamble
                f_poNeighbour();
                f_cf01Down();
                
            } // end TC_GEONW_FDV_COH_BV_02
            
            /**
             * @desc    Testing defined values of default Gn parameters in the common header
             * <pre>
             * Pics Selection: none
             * Config Id: CF01
             * Initial conditions:
             *  with {
             *       the IUT being in the "initial state"
             *  }
             * Expected behaviour:
             *  ensure that {
             *      when {
             *          the IUT is requested to send a GeoUnicast packet
             *      }
             *      then {
             *          the IUT sends a GeoUnicast packet
             *              containing a correctly formatted Common Header
             *                  containing Flags field
             *                      indicating value equalling the itsGnIsMobile MIB parameter
             *                  containing MHL field
             *                      set to itsGnDefaultHopLimit MIB parameter
             *     }
             *  }
             * </pre>
             *
             * @version 0.0.11
             * @see         ETSI TS 102 871-2 v1.3.1 TP/GEONW/FDV/COH/BV/03
filatov's avatar
filatov committed
             * @reference   EN 302 636-4-1 [1], clauses 8.7.2, 8.8.2, 9.3.4 and Annex G
             */
            testcase TC_GEONW_FDV_COH_BV_03() runs on ItsGeoNetworking system ItsGeoNetworkingSystem {
                
                // Local variables
                var LongPosVector v_longPosVectorNodeB;
                
                // Test control
                
                // Test component configuration
                f_cf01Up();
                v_longPosVectorNodeB := f_getPosition(vc_componentName);
                
                // Test adapter configuration
                
                // Preamble
                f_prNeighbour();
                f_selfOrClientSyncAndVerdict(c_prDone, e_success);
filatov's avatar
filatov committed
                
                // Test Body
                if ( not f_utTriggerEvent(m_generateGeoUnicastMessage(v_longPosVectorNodeB.gnAddr)) ) {
                    log("*** " & testcasename() & ": INCONC: Trigger failed ***");
                    f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
filatov's avatar
filatov committed
                }
                 
                tc_ac.start;
                alt {
                    [] geoNetworkingPort.receive(mw_geoNwInd(mw_geoNwPdu(
                            mw_geoNwUnicastPacketWithHlAndFlags(?, ?, f_getDefaultHopLimit(), f_isMobile())))) {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": PASS: Correct GeoNetworking Common Header received ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
filatov's avatar
filatov committed
                    }
                    [] a_receiveAnyGeoUnicast() {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": FAIL: Incorrect GeoNetworking Common Header received ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
filatov's avatar
filatov committed
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: Expected message not received ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
filatov's avatar
filatov committed
                    }
                }
                
                // Postamble
                f_poNeighbour();
                f_cf01Down();
                
            } // end TC_GEONW_FDV_COH_BV_03
            
            group GEONW_FDV_COH_BV_04 {
                
                /**
                 * @desc    Test that a received TSB packet is discarded if received with RHL > MHL
                 * <pre>
                 * Pics Selection: none
                 * Config Id: CF02
                 * Initial conditions:
                 *  with {
                 *       the IUT being in the "initial state" and
                 *       the IUT having received Beacon information from ItsNodeD and
                 *       the IUT having received Beacon information from ItsNodeB
                 *  }
                 * Expected behaviour:
                 *  ensure that {
                 *      when {
                 *          the IUT receives a TSB packet
                 *              containing Basic Header
                 *                  containing RHL field
                 *                      indicating HL1 higher than MHL1
                 *              containing Common Header
                 *                  containing MHL field
                 *                      indicating MHL1
                 *      }
                 *      then {
                 *          the IUT discards the TSB packet
                 *     }
                 *  }
                 * </pre>
                 *
                 * @version 0.0.11
                 * @see         ETSI TS 102 871-2 v1.3.1 TP/GEONW/FDV/COH/BV/04
filatov's avatar
filatov committed
                 * @reference   EN 302 636-4-1 [1], clauses 9.3.5
                 */
                testcase TC_GEONW_FDV_COH_BV_04() runs on ItsMtc system ItsGeoNetworkingSystem {
                    
                    // Local variables
                    var ItsGeoNetworking v_nodeB;
                    var ItsGeoNetworking v_nodeD;
                    
                    // Test control
                    
                    // Test component configuration
                    f_cf02Up();
                    
                    // Preamble
                    
                    // Start components
                    v_nodeB := f_getComponent(c_compNodeB);
                    v_nodeD := f_getComponent(c_compNodeD);
                    v_nodeB.start(f_GEONW_FDV_COH_BV_04_nodeB());
                    v_nodeD.start(f_GEONW_FDV_COH_BV_04_nodeD());
                    
                    // Synchronization
                    f_serverSync2ClientsAndStop({c_prDone, c_tbDone});
                    
                    // Cleanup
                    f_cf02Down();
                    
                } // end TC_GEONW_FDV_COH_BV_04
                
                /**
                 * @desc    Behavior function for NodeB (TC_GEONW_FDV_COH_BV_04)
                 */
                function f_GEONW_FDV_COH_BV_04_nodeB() runs on ItsGeoNetworking {
                    
                    // Local variables
                    var LongPosVector v_longPosVectorNodeB := f_getPosition(c_compNodeB);
                    var UInt8 v_hopLimit := f_getDefaultHopLimit();
                    
                    // Preamble
                    f_prNeighbour();
                    f_selfOrClientSyncAndVerdict(c_prDone, e_success);
filatov's avatar
filatov committed
                    
                    // Test Body
                    f_sendGeoNetMessage(
                        m_geoNwReq_linkLayerBroadcast(
                            m_geoNwPdu(
                                m_geoNwTsbPacket(
                                    vc_localSeqNumber,
                                    v_longPosVectorNodeB,
                                    v_hopLimit-1
                                ),
                                -,
                                v_hopLimit
                            )
                        )
                    );
                    
                    tc_noac.start;
                    alt {
                        [] geoNetworkingPort.receive(
                                mw_geoNwInd(
                                    mw_geoNwPdu(
                                        mw_geoNwTsbPacket(
                                            ?,
                                            mw_longPosVectorPosition(v_longPosVectorNodeB)
                                        )
                                    )
                                )
                            ) {
                            tc_noac.stop;
                            log("*** " & testcasename() & ": FAIL: TSB packet was not discarded  ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
filatov's avatar
filatov committed
                        }
                        [] tc_noac.timeout {
                            log("*** " & testcasename() & ": PASS: TSB was correctly discarded ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
filatov's avatar
filatov committed
                        }
                    }
                    
                    // Postamble
                    f_poNeighbour();
                    
                } // end f_GEONW_FDV_COH_BV_04_nodeB
                
                /**
                 * @desc    Behavior function for NodeD (TC_GEONW_FDV_COH_BV_04)
                 */
                function f_GEONW_FDV_COH_BV_04_nodeD() runs on ItsGeoNetworking {
                    
                    // Local variables
                    var LongPosVector v_longPosVectorNodeB := f_getPosition(c_compNodeB);
                    
                    // Preamble
                    f_prNeighbour();
                    f_selfOrClientSyncAndVerdict(c_prDone, e_success);
filatov's avatar
filatov committed
                    
                    // Test Body
                    tc_noac.start;
                    alt {
                        [] geoNetworkingPort.receive(
                                mw_geoNwInd(
                                    mw_geoNwPdu(
                                        mw_geoNwTsbPacket(
                                            ?,
                                            mw_longPosVectorPosition(v_longPosVectorNodeB)
                                        )
                                    )
                                )
                            ) {
                            tc_noac.stop;
                            log("*** " & testcasename() & ": FAIL: TSB packet was not discarded  ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
filatov's avatar
filatov committed
                        }
                        [] tc_noac.timeout {
                            log("*** " & testcasename() & ": PASS: TSB was correctly discarded ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
filatov's avatar
filatov committed
                        }
                    }
                    
                    // Postamble
                    f_poNeighbour();
                    
                } // end f_GEONW_FDV_COH_BV_04_nodeD
                
            } // end GEONW_FDV_COH_BV_04
            
        } // end geoFdvCommonHeader
        
        // 6.2.1.3
        group geoFdvBeacon {
            
            /**
             * @desc    Beacon header validity test
             * <pre>
             * Pics Selection: none
             * Config Id: CF01
             * Initial conditions:
             *  with {
             *      the IUT being in the "initial state"
             *  }
             * Expected behaviour:
             *  ensure that {
             *      when {
             *          the IUT generates a Beacon packet
             *      }
             *      then {
             *          the IUT sends a GeoNetworking packet
             *              containing a correctly formatted Common Header
             *                  containing HT field
             *                      set to '1' (BEACON)
             *                  containing HST field
             *                      set to '0' (UNSPECIFIED)
             *                  containing NH field
             *                      set to '0' (UNSPECIFIED)
             *              containing Extended Header
             *                  containing SOPV
             *                      indicating LPV of the IUT
             *      }
             *    }
             * </pre>
             *
             * @see         ETSI TS 102 871-2 v1.3.1 TP/GEONW/FDV/BEA/BV/01
filatov's avatar
filatov committed
             * @reference   EN 302 636-4-1 [1], clauses 8.7.2, 8.8.6 and 9.3.6
             */
            testcase TC_GEONW_FDV_BEA_BV_01() runs on ItsGeoNetworking system ItsGeoNetworkingSystem {
                
                // Local variables
                var LongPosVector v_longPosVectorIut;
                
                // Test control
                
                // Test component configuration
                f_cf01Up();
                v_longPosVectorIut := f_getPosition(c_compIut);
                
                // Test adapter configuration
                
                // Preamble
                f_prNeighbour();
                f_acTriggerEvent(m_startPassBeaconing(m_beaconHeader(v_longPosVectorIut).beaconHeader));
                f_selfOrClientSyncAndVerdict(c_prDone, e_success);
filatov's avatar
filatov committed
                
                // Test Body
                tc_ac.start;
                alt {
                    [] geoNetworkingPort.receive(mw_geoNwInd(mw_geoNwPdu(mw_geoNwBeaconPacket(mw_longPosVectorPosition(v_longPosVectorIut), e_any)))) {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": PASS: Common Header correclty formatted ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
filatov's avatar
filatov committed
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: Expected message not received ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
filatov's avatar
filatov committed
                    }
                }
                
                // Postamble
                f_poNeighbour();
                f_cf01Down();
                
            } // end TC_GEONW_FDV_BEA_BV_01
            
            /**
             * @desc    GeoNetworking address validity test
             * <pre>
             * Pics Selection: none
             * Config Id: CF01
             * Initial conditions:
             *  with {
             *    the IUT being in the "initial state"
             *  }
             * Expected behaviour:
             *  ensure that {
             *      when {
             *          the IUT generates a Beacon packet
             *      }
             *      then {
             *          the IUT sends a GeoNetworking packet
             *              containing SOPV field
             *                  containing GN_ADDR field
             *                      containing ST field
             *                          indicating the ITS Station type
             *                      containing SCC field
             *                          indicating the ITS Station country code
             *      }
             *  }
             *  NOTE: Correct Source GeoNetworking address value: itsGnLocalGnAddr MIB parameter value.
             *  
             * </pre>
             *
             * @see         ETSI TS 102 871-2 v1.3.1 TP/GEONW/FDV/BEA/BV/02
filatov's avatar
filatov committed
             * @reference   EN 302 636-4-1 [1], clauses 6.3 and 8.8.6.2
             */
            testcase TC_GEONW_FDV_BEA_BV_02() runs on ItsGeoNetworking system ItsGeoNetworkingSystem {
                
                // Local variables
                var LongPosVector v_longPosVectorIut;
                
                // Test control
                
                // Test component configuration
                f_cf01Up();
                v_longPosVectorIut := f_getPosition(c_compIut);
                
                // Test adapter configuration
                
                // Preamble
                f_prNeighbour();
                f_acTriggerEvent(m_startPassBeaconing(m_beaconHeader(v_longPosVectorIut).beaconHeader));
                f_selfOrClientSyncAndVerdict(c_prDone, e_success);
filatov's avatar
filatov committed
                
                // Test Body
                tc_ac.start;
                alt {
                    [] geoNetworkingPort.receive(mw_geoNwInd(mw_geoNwPdu(mw_geoNwBeaconPacket(
                            mw_longPosVectorAny(f_getIutGnLocalAddress()))))) {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": PASS: GN address correctly received ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
filatov's avatar
filatov committed
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: Expected message not received ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
filatov's avatar
filatov committed
                    }
                }
                
                // Postamble
                f_poNeighbour();
                f_cf01Down();
                
            } // end TC_GEONW_FDV_BEA_BV_02
            
            /**
             * @desc    Local Position Vector validity test, involving comparison against sensor input data
             * <pre>
             * Pics Selection: none
             * Config Id: CF01
             * Initial conditions:
             *  with {
             *      the IUT being in the "initial state"
             *  }
             * Expected behaviour:
             *  ensure that {
             *      when {
             *          the IUT generates a Beacon packet
             *      }
             *      then {
             *          the IUT sends a GeoNetworking packet
             *              containing a correct SOPV field
             *                  indicating the latest position of the IUT
             *      }
             *  }
             * </pre>
             *
             * @see         ETSI TS 102 871-2 v1.3.1 TP/GEONW/FDV/BEA/BV/03
filatov's avatar
filatov committed
             * @reference   EN 302 636-4-1 [1], clauses 8.5.2.2 and 8.8.6.2
             */
            testcase TC_GEONW_FDV_BEA_BV_03() runs on ItsGeoNetworking system ItsGeoNetworkingSystem {
                
                // Local variables
                var LongPosVector v_longPosVectorIut;
                
                // Test control
                
                // Test component configuration
                f_cf01Up();
                v_longPosVectorIut := f_getPosition(c_compIut);
                
                // Test adapter configuration
                
                // Preamble
                f_prNeighbour();
                f_acTriggerEvent(m_startPassBeaconing(m_beaconHeader(v_longPosVectorIut).beaconHeader));
                f_selfOrClientSyncAndVerdict(c_prDone, e_success);
filatov's avatar
filatov committed
                
                // Test Body
                tc_ac.start;
                alt {
                    [] geoNetworkingPort.receive(mw_geoNwInd(mw_geoNwPdu(mw_geoNwBeaconPacket(mw_longPosVectorPosition_withDelta(v_longPosVectorIut))))) {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": PASS: Position equaling GN-MNGT primitive value received ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
filatov's avatar
filatov committed
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: Expected message not received ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
filatov's avatar
filatov committed
                    }
                }
                
                // Postamble
                f_poNeighbour();
                f_cf01Down();
                
            } // end TC_GEONW_FDV_BEA_BV_03
            
            /**
             * @desc    Local Position Vector validity test, involving timestamp comparison against sensor input data
             * <pre>
             * Pics Selection: none
             * Config Id: CF01
             * Initial conditions:
             *  with {
             *      the IUT being in the "initial state"
             *  }
             * Expected behaviour:
             *  ensure that {
             *      when {
             *          the IUT generates a Beacon packet
             *      }
             *      then {
             *          the IUT sends a GeoNetworking packet
             *              containing a correct SOPV field
             *                  indicating the timestamp value corresponding to the sensor acquisition time of position data
             *      }
             *  }
             * </pre>
             *
             * @see         ETSI TS 102 871-2 v1.3.1 TP/GEONW/FDV/BEA/BV/04
filatov's avatar
filatov committed
             * @reference   EN 302 636-4-1 [1], clauses 8.5.2.2 and 8.8.6.2
             */
            testcase TC_GEONW_FDV_BEA_BV_04() runs on ItsGeoNetworking system ItsGeoNetworkingSystem {
                
                // Local variables
                var LongPosVector v_longPosVectorIut;
                
                // Test control
                
                // Test component configuration
                f_cf01Up();
                v_longPosVectorIut := f_getPosition(c_compIut);
                
                // Test adapter configuration
                
                // Preamble
                f_prNeighbour();
                f_acTriggerEvent(m_startPassBeaconing(m_beaconHeader(v_longPosVectorIut).beaconHeader));
                f_selfOrClientSyncAndVerdict(c_prDone, e_success);
filatov's avatar
filatov committed
                
                // Test Body
                tc_ac.start;
                alt {
                    [] geoNetworkingPort.receive(mw_geoNwInd(mw_geoNwPdu(mw_geoNwBeaconPacket(mw_longPosVectorPosition_withDelta(v_longPosVectorIut))))) {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": PASS: Timestamp equaling GN-MNGT primitive value received ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
filatov's avatar
filatov committed
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: Expected message not received ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
filatov's avatar
filatov committed
                    }
                }
                
                // Postamble
                f_poNeighbour();
                f_cf01Down();
                
            } // end TC_GEONW_FDV_BEA_BV_04
            
        } // end geoFdvBeacon
        
        // 6.2.1.4
        group geoFdvGeoUnicast {
            
            /**
             * @desc    GeoUnicast header validity
             * <pre>
             * Pics Selection: none
             * Config Id: CF01
             * Initial conditions:
             *  with {
             *      the IUT being in the "initial state" and
             *      the IUT having received Beacon information from ItsNodeB
             *  }
             * Expected behaviour:
             *  ensure that {
             *      when {
             *          the IUT is requested to send a GeoUnicast packet to ItsNodeB
             *      }
             *      then {
             *          the IUT sends a GeoNetworking packet
             *              containing a correctly formatted Common Header
             *                  containing HT field
             *                      set to '2' (GEOUNICAST)
             *                  containing HST field
             *                      set to '0' (UNSPECIFIED)
             *              containing GeoUnicast Extended Header
             *                  containing DEPV field
             *                      indicating position of the ItsNodeB
             *                  containing SOPV field
             *                      indicating position of the IUT
             *      }
             *  }
             * </pre>
             *
             * @see         ETSI TS 102 871-2 v1.3.1 TP/GEONW/FDV/GUC/BV/01
filatov's avatar
filatov committed
             * @reference   EN 302 636-4-1 [1], clauses 8.7.2, 8.8.2.2 and 9.3.8
             */
            testcase TC_GEONW_FDV_GUC_BV_01() runs on ItsGeoNetworking system ItsGeoNetworkingSystem {
                
                // Local variables
                var LongPosVector v_longPosVectorNodeB;
                var LongPosVector v_longPosVectorIut;
                
                // Test control
                
                // Test component configuration
                f_cf01Up();
                
                // Test adapter configuration
                
                // Preamble
                v_longPosVectorNodeB := f_getPosition(c_compNodeB);
                v_longPosVectorIut := f_getPosition(c_compIut);
                f_prNeighbour();
                f_selfOrClientSyncAndVerdict(c_prDone, e_success);
filatov's avatar
filatov committed
                
                // Test Body
                if ( not f_utTriggerEvent(m_generateGeoUnicastMessage(v_longPosVectorNodeB.gnAddr)) ) {
                    log("*** " & testcasename() & ": INCONC: Trigger failed ***");
                    f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
filatov's avatar
filatov committed
                }
                
                tc_ac.start;
                alt {
                    [] geoNetworkingPort.receive(
                            mw_geoNwInd(
                                mw_geoNwPdu(
                                    mw_geoNwUnicastPacketWithSourcePv(
                                        mw_shortPosVectorPosition_withDelta(f_longPosVector2ShortPosVector(v_longPosVectorNodeB)), // DEPV
                                        ?, // sequence number
                                        mw_longPosVectorPosition_withDelta(v_longPosVectorIut) //SOPV
                                    )
                                )
                            )
                        ) {
                        tc_ac.stop;
                        
                        log("*** " & testcasename() & ": PASS: Fields of the received GeoUnicast message correctly set ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
filatov's avatar
filatov committed
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: GeoUnicast message not received ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
filatov's avatar
filatov committed
                    }
                }
                
                // Postamble
                f_poNeighbour();
                f_cf01Down();
                
            } // end TC_GEONW_FDV_GUC_BV_01
            
        } // end geoFdvGeoUnicast
        
        // 6.2.1.5
        group geoFdvGeoBroadcast {
            
            /**
             * @desc    GeoBroadcast header validity
             * <pre>
             * Pics Selection: none
             * Config Id: CF01
             * Initial conditions:
             *  with {
             *      the IUT being in the "initial state" and
             *      the IUT having received Beacon information from the ItsNodeB
             *  }
             * Expected behaviour:
             *  ensure that {
             *      when {
             *          the IUT is requested to send a GeoBroadcast packet
             *      }
             *      then {
             *          the IUT sends a GeoNetworking packet
             *              containing a correctly formatted Common Header
             *                  containing HT field
             *                      set to '4' (GEOBROADCAST)
             *              containing GeoBroadcast Extended Header
             *                  containing SOPV field
             *                      indicating position of the IUT
             *       }
             *  }
             * </pre>
             *
             * @see         ETSI TS 102 871-2 v1.3.1 TP/GEONW/FDV/GBC/BV/01
filatov's avatar
filatov committed
             * @reference   EN 302 636-4-1 [1], clauses 8.7.2, 8.7.4, 8.8.5.2 and 9.3.11
             */
            testcase TC_GEONW_FDV_GBC_BV_01() runs on ItsGeoNetworking system ItsGeoNetworkingSystem {
                
                // Local variables
                var LongPosVector v_longPosVectorNodeB;
                var LongPosVector v_longPosVectorIut;
                var octetstring v_payload := char2oct("PAYLOAD");
                
                // Test control
                
                // Test component configuration
                f_cf01Up();
                
                // Test adapter configuration
                
                // Preamble
                v_longPosVectorNodeB := f_getPosition(c_compNodeB);
                v_longPosVectorIut := f_getPosition(c_compIut);
                f_prNeighbour();
                f_selfOrClientSyncAndVerdict(c_prDone, e_success);
filatov's avatar
filatov committed
                
                // Test Body
                if ( not f_utTriggerEvent(m_generateGeoBroadcastMessageWithPayload(f_getArea(c_area1), v_payload)) ) {
                    log("*** " & testcasename() & ": INCONC: Trigger failed ***");
                    f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
filatov's avatar
filatov committed
                }
                tc_ac.start;