ItsGeoNetworking_TestCases.ttcn 913 KB
Newer Older
filatov's avatar
filatov committed
                    f_poDefault();
                    
                } // end f_GEONW_PON_BCA_BV_08_nodeD
                
            } // end GEONW_PON_BCA_BV_08

        } // end geoGeoBroadcastCbfAlgorithm
        
        // 6.2.2.13
        group geoGeoBroadcastAdvAlgorithm {
            
            group GEONW_PON_BAA_BV_01 {
                
                /**
                 * @desc    Test that a received GeoBroadcast packet is discarded if received more than MAX_COUNTER 
                 *          times when IUT is inside of the destination area
                 * <pre>
                 * Pics Selection: PICS_GN_GEOBROADCAST_FORWARDING_ALGORITHM == 'ADVANCED'
                 * Config Id: CF06
                 * Initial conditions:
                 *  with {
                 *      the IUT being in the "initial state" and
                 *      the IUT having received Beacon information from ItsNodeB and
                 *      the IUT having received Beacon information from ItsNodeF and
                 *      the IUT having received a GeoBroadcast packet GBC1 from ItsNodeF
                 *          containing TrafficClass.SCF set to 1
                 *          containing GBC Extended Header
                 *              containing GeoBroadcast DestinationArea
                 *                  indicating AREA1
                 *      the IUT having saved the packet into CBF buffer
                 *      the IUT having received MAX_COUNTER - 1 times the GBC1 packet
                 *  }
                 * Expected behaviour:
                 *  ensure that {
                 *      when {
                 *          the IUT receives the same GeoBroadcast packet GBC1
                 *      }
                 *      then {
                 *          the IUT removes GBC1 from the CBF buffer
                 *          the IUT discards the new received GeoBroadcast packet
                 *      }
                 *  }
                 *  
                 * </pre>
                 *
                 * @see         ETSI TS 102 871-2 v1.3.1 TP/GEONW/PON/BAA/BV/01
filatov's avatar
filatov committed
                 * @reference   EN 302 636-4-1 [1], Annex E.4
                 */
                testcase TC_GEONW_PON_BAA_BV_01() runs on ItsMtc system ItsGeoNetworkingSystem {
                    
                    // Local variables
                    var ItsGeoNetworking v_nodeB;
                    var ItsGeoNetworking v_nodeF;
                    
                    // Test control
                    if (f_getGeoBroadcastForwardingAlgorithm() != e_advanced) {
                        log("*** " & testcasename() & ": PICS_GN_GEOBROADCAST_FORWARDING_ALGORITHM == e_advanced required for executing the TC ***");
                        setverdict(inconc);
                        stop;
                    }
                    
                    if (f_getGeoBroadcastCbfMinTime() < 300) {
                        log("*** " & testcasename() & ": PICS_GN_GEOBROADCAST_CBF_MIN_TIME >= 300 required for executing the TC ***");
                        setverdict(inconc);
                        stop;
                    }
                    
                    // Test component configuration
                    f_cf06Up();
                    
                    // Preamble
                    
                    // Start components
                    v_nodeB := f_getComponent(c_compNodeB);
                    v_nodeF := f_getComponent(c_compNodeF);
                    v_nodeB.start(f_GEONW_PON_BAA_BV_01_nodeB());
                    v_nodeF.start(f_GEONW_PON_BAA_BV_01_nodeF());
                    
                    // Synchronization
                    f_serverSync2ClientsAndStop({c_prDone, c_tbDone});
                    
                    // Cleanup
                    f_cf06Down();
                    
                } // end TC_GEONW_PON_BAA_BV_01
                
                /**
                 * @desc    Behavior function for NodeB (TC_GEONW_PON_BAA_BV_01)
                 */
                function f_GEONW_PON_BAA_BV_01_nodeB() runs on ItsGeoNetworking {
                    
                    // Local variables
                    
                    // 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(?))) {
                            tc_noac.stop;
                            log("*** " & testcasename() & ": FAIL: Message not discarded ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
filatov's avatar
filatov committed
                        }
                        [] tc_noac.timeout {
                            log("*** " & testcasename() & ": PASS: No message received ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
filatov's avatar
filatov committed
                        }
                    }
                    
                    // Postamble
                    f_poNeighbour();
                    
                } // end f_GEONW_PON_BAA_BV_01_nodeB
                
                /**
                 * @desc    Behavior function for NodeF (TC_GEONW_PON_BAA_BV_01)
                 */
                function f_GEONW_PON_BAA_BV_01_nodeF() runs on ItsGeoNetworking {
                    
                    // Local variables
                    var integer i;
                    var template (value) GeoNetworkingPdu v_gnPacket;
                    var LongPosVector v_longPosVectorNodeB := f_getPosition(c_compNodeB);
                    
                    // Preamble
                    f_prNeighbour();
                    v_gnPacket := m_geoNwPdu(m_geoNwBroadcastPacket(
                                            v_longPosVectorNodeB,
                                            vc_localSeqNumber,
                                            f_getGeoBroadcastArea(c_area1)
                                        )
                                    );
                    f_sendGeoNetMessage(m_geoNwReq_linkLayerBroadcast(v_gnPacket));
                    f_selfOrClientSyncAndVerdict(c_prDone, e_success);
filatov's avatar
filatov committed
                    
                    // Test Body
                    for(i:=1; i < f_getAdvancedGbcForwardingMaxCounter(); i:=i+1) {
                        f_sendGeoNetMessage(m_geoNwReq_linkLayerBroadcast(v_gnPacket));
                        f_sleepIgnoreDef(0.5);
                    }
                    tc_noac.start;
                    alt {
                        [] geoNetworkingPort.receive(mw_geoNwInd(mw_geoNwPdu(?))) {
                            tc_noac.stop;
                            log("*** " & testcasename() & ": FAIL: Message not discarded ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
filatov's avatar
filatov committed
                        }
                        [] tc_noac.timeout {
                            log("*** " & testcasename() & ": PASS: No message received ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
filatov's avatar
filatov committed
                        }
                    }
                    
                    // Postamble
                    f_poNeighbour();
                    
                } // end f_GEONW_PON_BAA_BV_01_nodeF
                
            } // end GEONW_PON_BAA_BV_01
            
            group GEONW_PON_BAA_BV_02 {
                
                /**
                 * @desc    Test that a received GeoBroadcast packet is discarded if received more than 1 times when IUT 
                 *          is inside of the destination area and inside the sectorial area of the GeoBroadcast packet Sender
                 * <pre>
                 * Pics Selection: PICS_GN_GEOBROADCAST_FORWARDING_ALGORITHM == 'ADVANCED'
                 * Config Id: CF05
                 * Initial conditions:
                 *  with {
                 *      the IUT being in the "initial state" and
                 *      the IUT having received Beacon information from ItsNodeB and
                 *      the IUT having received Beacon information from ItsNodeE and
                 *      the IUT having received a GeoBroadcast packet GBC1 from ItsNodeB
                 *          containing TrafficClass.SCF set to 1
                 *          containing GBC Extended Header
                 *              containing GeoBroadcast DestinationArea
                 *                  indicating AREA1
                 *      the IUT having saved the packet into CBF buffer
                 *  }
                 * Expected behaviour:
                 *  ensure that {
                 *      when {
                 *          the IUT receives the same GeoBroadcast packet GBC1 from ItsNodeE
                 *          the IUT is inside the sectorial area of ItsNodeB
                 *      }
                 *      then {
                 *          the IUT removes GBC1 from the CBF buffer
                 *          the IUT discards the new received GeoBroadcast packet
                 *      }
                 *  }
                 *  
                 * </pre>
                 *
                 * @see         ETSI TS 102 871-2 v1.3.1 TP/GEONW/PON/BAA/BV/02
filatov's avatar
filatov committed
                 * @reference   EN 302 636-4-1 [1], Annex E.4
                 */
                testcase TC_GEONW_PON_BAA_BV_02() runs on ItsMtc system ItsGeoNetworkingSystem {
                    
                    // Local variables
                    var ItsGeoNetworking v_nodeB;
                    var ItsGeoNetworking v_nodeE;
                                                    
                    // Test control
                    if (f_getGeoBroadcastForwardingAlgorithm() != e_advanced) {
                        log("*** " & testcasename() & ": PICS_GN_GEOBROADCAST_FORWARDING_ALGORITHM == e_advanced required for executing the TC ***");
                        setverdict(inconc);
                        stop;
                    }
                    
                    if (f_getGeoBroadcastCbfMinTime() < 300) {
                        log("*** " & testcasename() & ": PICS_GN_GEOBROADCAST_CBF_MIN_TIME >= 300 required for executing the TC ***");
                        setverdict(inconc);
                        stop;
                    }
                    
                    // Test component configuration
                    f_cf05Up();
                    
                    // Preamble
                                    
                    // Start components
                    v_nodeB := f_getComponent(c_compNodeB);
                    v_nodeE := f_getComponent(c_compNodeE);
                    v_nodeB.start(f_GEONW_PON_BAA_BV_02_nodeB());
                    v_nodeE.start(f_GEONW_PON_BAA_BV_02_nodeE());
                    
                    // Synchronization
                    f_serverSync2ClientsAndStop({c_prDone, c_tbDone});
                    
                    // Cleanup
                    f_cf05Down();
                    
                } // end TC_GEONW_PON_BAA_BV_02
                
                /**
                 * @desc    Behavior function for NodeB (TC_GEONW_PON_BAA_BV_02)
                 */
                function f_GEONW_PON_BAA_BV_02_nodeB() runs on ItsGeoNetworking {
                    
                    // Local variables
                    var LongPosVector v_longPosVectorNodeB := f_getPosition(c_compNodeB);
                    
                    // Preamble
                    f_prNeighbour();
                    f_sendGeoNetMessage(m_geoNwReq_linkLayerBroadcast(
                        m_geoNwPdu(m_geoNwBroadcastPacket(
                                v_longPosVectorNodeB,
                                0,
                                f_getGeoBroadcastArea(c_area1)
                            )
                        )
                    ));
                    f_selfOrClientSyncAndVerdict(c_prDone, e_success);
filatov's avatar
filatov committed
                    
                    // Test Body
                    tc_noac.start;
                    alt {
                        [] geoNetworkingPort.receive(mw_geoNwInd(mw_geoNwPdu(?))) {
                            tc_noac.stop;
                            log("*** " & testcasename() & ": FAIL: Message not discarded ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
filatov's avatar
filatov committed
                        }
                        [] tc_noac.timeout {
                            log("*** " & testcasename() & ": PASS: No message received ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
filatov's avatar
filatov committed
                        }
                    }
                    
                    // Postamble
                    f_poNeighbour();
                    
                } // end f_GEONW_PON_BAA_BV_02_nodeB
                
                /**
                 * @desc    Behavior function for NodeE (TC_GEONW_PON_BAA_BV_02)
                 */
                function f_GEONW_PON_BAA_BV_02_nodeE() 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
                    f_sendGeoNetMessage(m_geoNwReq_linkLayerBroadcast(
                        m_geoNwPdu(m_geoNwBroadcastPacket(
                                v_longPosVectorNodeB,
                                0,
                                f_getGeoBroadcastArea(c_area1)
                            )
                        )
                    ));
                    tc_noac.start;
                    alt {
                        [] geoNetworkingPort.receive (mw_geoNwInd(mw_geoNwPdu(?))){
                            tc_noac.stop;
                            log("*** " & testcasename() & ": FAIL: Message not discarded ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
filatov's avatar
filatov committed
                        }
                        [] tc_noac.timeout {
                            log("*** " & testcasename() & ": PASS: No message received ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
filatov's avatar
filatov committed
                        }
                    }
                    
                    // Postamble
                    f_poNeighbour();
                    
                } // end f_GEONW_PON_BAA_BV_02_nodeE
                
            } // end GEONW_PON_BAA_BV_02
            
            group GEONW_PON_BAA_BV_03 {
                
                /**
                 * @desc    Test that a received GeoBroadcast packet is triggering contention if received more than 1 times when the IUT
                 *          is inside of the destination area and outside the sectorial area of the GeoBroadcast packet Sender (Angle_FSR > Angle_TH)
filatov's avatar
filatov committed
                 * <pre>
                 * Pics Selection: PICS_GN_GEOBROADCAST_FORWARDING_ALGORITHM == 'ADVANCED'
                 * Config Id: CF06
                 * Initial conditions:
                 *  with {
                 *      the IUT being in the "initial state" and
                 *      the IUT having received Beacon information from ItsNodeB and
                 *      the IUT having received Beacon information from ItsNodeF and
                 *      the IUT having received a GeoBroadcast packet GBC1 from ItsNodeB
                 *          containing TrafficClass.SCF set to 1
                 *          containing GBC Extended Header
                 *              containing GeoBroadcast DestinationArea
                 *                  indicating AREA1
                 *      the IUT having saved the packet into CBF buffer
                 *  }
                 * Expected behaviour:
                 *  ensure that {
                 *      when {
                 *          the IUT receives the same GeoBroadcast packet GBC1 from ItsNodeF
                 *          the IUT is outside the sectorial area of ItsNodeB
                 *      }
                 *      then {
                 *          the IUT saves the GeoBroadcast packet GBC1 from ItsNodeF and
                 *          the IUT starts the contention timer and
                 *          the IUT re-broadcasts the received GeoBroadcast packet
                 *              upon expiry of the contention timer
filatov's avatar
filatov committed
                 *      }
                 *  }
                 *  
                 *  Note: In this configuration IUT is outside sectorial area of ItsNodeB to the angle FSR
                 * </pre>
                 *
                 * @see         ETSI TS 102 871-2 v1.3.1 TP/GEONW/PON/BAA/BV/03
filatov's avatar
filatov committed
                 * @reference   EN 302 636-4-1 [1], Annex E.4
                 */
                testcase TC_GEONW_PON_BAA_BV_03() runs on ItsMtc system ItsGeoNetworkingSystem {
                    
                    // Local variables
                    var ItsGeoNetworking v_nodeB;
                    var ItsGeoNetworking v_nodeF;
                        
                    // Test control
                    if (f_getGeoBroadcastForwardingAlgorithm() != e_advanced) {
                        log("*** " & testcasename() & ": PICS_GN_GEOBROADCAST_FORWARDING_ALGORITHM == e_advanced required for executing the TC ***");
                        setverdict(inconc);
                        stop;
                    }
                    
                    if (f_getGeoBroadcastCbfMinTime() < 300) {
                        log("*** " & testcasename() & ": PICS_GN_GEOBROADCAST_CBF_MIN_TIME >= 300 required for executing the TC ***");
                        setverdict(inconc);
                        stop;
                    }
                    
                    // Test component configuration
                    f_cf06Up();
                    
                    // Preamble
                                    
                    // Start components
                    v_nodeB := f_getComponent(c_compNodeB);
                    v_nodeF := f_getComponent(c_compNodeF);
                    v_nodeB.start(f_GEONW_PON_BAA_BV_03_nodeB());
                    v_nodeF.start(f_GEONW_PON_BAA_BV_03_nodeF());
                    
                    // Synchronization
                    f_serverSync2ClientsAndStop({c_prDone, c_tbDone});
                    
                    // Cleanup
                    f_cf06Down();
                    
                } // end TC_GEONW_PON_BAA_BV_03
                
                /**
                 * @desc    Behavior function for NodeB (TC_GEONW_PON_BAA_BV_03)
                 */
                function f_GEONW_PON_BAA_BV_03_nodeB() runs on ItsGeoNetworking {
                    
                    // Local variables
                    var LongPosVector v_longPosVectorNodeB := f_getPosition(c_compNodeB);
                    
                    // Preamble
                    f_prNeighbour();
                    f_sendGeoNetMessage(m_geoNwReq_linkLayerBroadcast(
                        m_geoNwPdu(m_geoNwBroadcastPacket(
                                v_longPosVectorNodeB,
                                0,
                                f_getGeoBroadcastArea(c_area1)
                            )
                        )
                    ));
                    f_selfOrClientSyncAndVerdict(c_prDone, e_success);
filatov's avatar
filatov committed
                    
                    // Test Body                 
                    tc_ac.start;
                    alt {
                        [] geoNetworkingPort.receive(mw_geoNwInd(mw_geoNwPdu(mw_geoNwBroadcastPacketWithArea(
                                mw_longPosVectorPosition(v_longPosVectorNodeB),
                                ?,
                                f_getGeoBroadcastArea(c_area1)
                            )))) {
                            tc_ac.stop;
	                        log("*** " & testcasename() & ": PASS: GeoBroadcast message received ***");
	                        f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
filatov's avatar
filatov committed
                        }
                        [] tc_ac.timeout {
                            log("*** " & testcasename() & ": FAIL: GeoBroadcast message not received ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
filatov's avatar
filatov committed
                        }
                    }
                    
                    // Postamble
                    f_poNeighbour();
                    
                } // end f_GEONW_PON_BAA_BV_03_nodeB
                
                /**
                 * @desc    Behavior function for NodeF (TC_GEONW_PON_BAA_BV_03)
                 */
                function f_GEONW_PON_BAA_BV_03_nodeF() runs on ItsGeoNetworking {
                    
                    // Local variables
                    var LongPosVector v_longPosVectorNodeB := f_getPosition(c_compNodeB);
                    var LongPosVector v_longPosVectorNodeF := f_getPosition(c_compNodeF);                    
                    var LongPosVector v_longPosVectorIut := f_getPosition(c_compIut);
                    timer t_toCbf := (int2float(f_getGeoBroadcastCbfMaxTime())
                        + (
                            int2float(f_getGeoBroadcastCbfMinTime() - f_getGeoBroadcastCbfMaxTime())
                            / int2float(f_getCbfMaxCommunicationRange())
                        ) * f_distance(v_longPosVectorNodeF, v_longPosVectorIut)) * 0.95 / 1000.0;
                    
                    // Preamble
                    f_prNeighbour();
                    f_selfOrClientSyncAndVerdict(c_prDone, e_success);
filatov's avatar
filatov committed
                    
                    // Test Body
                    f_sendGeoNetMessage(m_geoNwReq_linkLayerBroadcast(
                        m_geoNwPdu(m_geoNwBroadcastPacket(
                                v_longPosVectorNodeB,
                                0,
                                f_getGeoBroadcastArea(c_area1)
                            )
                        )
                    ));
                    t_toCbf.start;                    
                    tc_ac.start;
                    alt {
                        [] geoNetworkingPort.receive(mw_geoNwInd(mw_geoNwPdu(mw_geoNwBroadcastPacketWithArea(
                                mw_longPosVectorPosition(v_longPosVectorNodeB),
                                ?,
                                f_getGeoBroadcastArea(c_area1)
                            )))) {
                            tc_ac.stop;                           
                            
                            if(t_toCbf.running) {                            	
                                t_toCbf.stop;
                                log("*** " & testcasename() & ": FAIL: GBC retransmitted before CBF timer expiration ***");
                                f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
filatov's avatar
filatov committed
                            }
                            else {
                                log("*** " & testcasename() & ": PASS: GeoBroadcast message received ***");
                                f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
filatov's avatar
filatov committed
                            }
                        }
                        [] t_toCbf.timeout {
                            log("*** " & testcasename() & ": INFO: CBF timer elapsed ***");
                            repeat;
                        }
                        [] tc_ac.timeout {
                            log("*** " & testcasename() & ": FAIL: GeoBroadcast message not received ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
filatov's avatar
filatov committed
                        }
                    }
                    
                    // Postamble
                    f_poNeighbour();
                    
                } // end f_GEONW_PON_BAA_BV_03_nodeF
                
            } // end GEONW_PON_BAA_BV_03
            
            group GEONW_PON_BAA_BV_04 {
                
                /**
                 * @desc    Test that a received GeoBroadcast packet with Unicast MAC destination is triggering line 
                 *          forwarding if received for the first time when IUT is inside the destination area
                 * <pre>
                 * Pics Selection: PICS_GN_GEOBROADCAST_FORWARDING_ALGORITHM == 'ADVANCED'
                 * Config Id: CF05
                 * Initial conditions:
                 *  with {
                 *      the IUT being in the "initial state" and
                 *      the IUT having received Beacon information from ItsNodeB and
                 *      the IUT having received Beacon information from ItsNodeE and
                 *  }
                 * Expected behaviour:
                 *  ensure that {
                 *      when {
                 *          the IUT receives a GeoBroadcast packet from ItsNodeE
                 *              addressed to IUT's link-layer address
                 *              containing TrafficClass.SCF set to 1 
                 *              containing GBC Extended Header
                 *                  containing GeoBroadcast DestinationArea
                 *                      indicating AREA1
                 *      }
                 *      then {
                 *          the IUT selects ItsNodeB as the next hop ITS station and
                 *          the IUT forwards the GeoBroadcast packet
                 *      }
                 *  }
                 *  
                 * </pre>
                 *
                 * @see         ETSI TS 102 871-2 v1.3.1 TP/GEONW/PON/BAA/BV/04
filatov's avatar
filatov committed
                 * @reference   EN 302 636-4-1 [1], Annex E.4
                 */
                testcase TC_GEONW_PON_BAA_BV_04() runs on ItsMtc system ItsGeoNetworkingSystem {
                    
                    // Local variables
                    var ItsGeoNetworking v_nodeB;
                    var ItsGeoNetworking v_nodeE;
                    
                    // Test control
                    if (f_getGeoBroadcastForwardingAlgorithm() != e_advanced) {
                        log("*** " & testcasename() & ": PICS_GN_GEOBROADCAST_FORWARDING_ALGORITHM == e_advanced required for executing the TC ***");
                        setverdict(inconc);
                        stop;
                    }
                    
                    if (f_getGeoBroadcastCbfMinTime() < 300) {
                        log("*** " & testcasename() & ": PICS_GN_GEOBROADCAST_CBF_MIN_TIME >= 300 required for executing the TC ***");
                        setverdict(inconc);
                        stop;
                    }
                    
                    // Test component configuration
                    f_cf05Up();
                    
                    // Preamble
                    
                    // Start components
                    v_nodeB := f_getComponent(c_compNodeB);
                    v_nodeE := f_getComponent(c_compNodeE);
                    v_nodeB.start(f_GEONW_PON_BAA_BV_04_nodeB());
                    v_nodeE.start(f_GEONW_PON_BAA_BV_04_nodeE());
                    
                    // Synchronization
                    f_serverSync2ClientsAndStop({c_prDone, c_tbDone});
                    
                    // Cleanup
                    f_cf05Down();
                    
                } // end TC_GEONW_PON_BAA_BV_04
                
                /**
                 * @desc    Behavior function for NodeB (TC_GEONW_PON_BAA_BV_04)
                 */
                function f_GEONW_PON_BAA_BV_04_nodeB() runs on ItsGeoNetworking {
                    
                    // Local variables
                    var LongPosVector v_longPosVectorNodeA := f_getPosition(c_compNodeA);
                    
                    // Preamble
                    f_prNeighbour();
                    f_selfOrClientSyncAndVerdict(c_prDone, e_success);
filatov's avatar
filatov committed
                    
                    // Test Body
                    tc_ac.start;
                    alt {                    	
                    	[] geoNetworkingPort.receive(mw_geoNwInd(mw_geoNwPdu(mw_geoNwBroadcastPacketWithArea(
                                mw_longPosVectorPosition(v_longPosVectorNodeA),
                                ?,
                                f_getGeoBroadcastArea(c_area1)
                            )))) {
                            tc_ac.stop;
                            log("*** " & testcasename() & ": PASS: packet correctly forwarded ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
filatov's avatar
filatov committed
                        }
                        [] tc_ac.timeout {
                            log("*** " & testcasename() & ": FAIL: Expected message not received ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
filatov's avatar
filatov committed
                        }
                    }
                    
                    // Postamble
                    f_poNeighbour();
                    
                } // end f_GEONW_PON_BAA_BV_04_nodeB
                
                /**
                 * @desc    Behavior function for NodeE (TC_GEONW_PON_BAA_BV_04)
                 */
                function f_GEONW_PON_BAA_BV_04_nodeE() runs on ItsGeoNetworking {
                    
                    // Local variables
                    var LongPosVector v_longPosVectorNodeA := f_getPosition(c_compNodeA);
                    
                    // Preamble
                    f_prNeighbour();
                    f_selfOrClientSyncAndVerdict(c_prDone, e_success);
filatov's avatar
filatov committed
                    
                    // Test Body
                    f_sendGeoNetMessage(
	                    m_geoNwReq_withLinkLayerDestination(
	                        m_geoNwPdu(m_geoNwBroadcastPacket(
	                                v_longPosVectorNodeA,
	                                0,
	                                f_getGeoBroadcastArea(c_area1)
	                            )
	                        ),
	                        f_getIutMacAddress()
	                    )
                    );
                    f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
filatov's avatar
filatov committed
                    
                    // Postamble
                    f_poNeighbour();
                    
                } // end f_GEONW_PON_BAA_BV_04_nodeE
                
            } // end GEONW_PON_BAA_BV_04

            group GEONW_PON_BAA_BV_05 {
                
                /**
                 * @desc    Test that a received GeoBroadcast packet with Unicast MAC destination is triggering
                 * 			rebroadcast if received for the first time when IUT is inside the destination area.
                 * <pre>
                 * Pics Selection: PICS_GN_GEOBROADCAST_FORWARDING_ALGORITHM == 'ADVANCED'
                 * Config Id: CF05
                 * Initial conditions:
                 *  with {
                 *  	the IUT being in the "initial state" and
                 *  	the IUT having received Beacon information from ItsNodeB and
                 *  	the IUT having received Beacon information from ItsNodeE
                 *  }
                 * Expected behaviour:
                 *  ensure that {
                 *  	when {
                 *  		the IUT receives a GeoBroadcast packet from ItsNodeE addressed to IUT’s link-layer address
                 *  			containing TrafficClass.SCF set to 1
                 *  			containing GBC Extended Header
                 *  				containing GeoBroadcast DestinationArea
                 *  					indicating AREA1
                 *  	}
                 *  	then {
                 *  		the IUT saves the GeoBroadcast packet into the CBF buffer and
                 *  		the IUT starts the contention timer set to CBF_MAX and
                 *  		the IUT re-broadcasts the received GeoBroadcast packet
                 *  			upon expiry of the contention timer
                 *  	}
                 *  }
                 * </pre>
                 *
                 * @see         ETSI TS 102 871-2 v1.3.1 TP/GEONW/PON/BAA/BV/05
                 * @reference   EN 302 636-4-1 [1], Annex E.4
                 */
                testcase TC_GEONW_PON_BAA_BV_05() runs on ItsMtc system ItsGeoNetworkingSystem {
                    
                    // Local variables
                    var ItsGeoNetworking v_nodeB;
                    var ItsGeoNetworking v_nodeE;
                    
                    // Test control
                    if (f_getGeoBroadcastForwardingAlgorithm() != e_advanced) {
                        log("*** " & testcasename() & ": PICS_GN_GEOBROADCAST_FORWARDING_ALGORITHM == e_advanced required for executing the TC ***");
                        setverdict(inconc);
                        stop;
                    }
                    
                    if (f_getGeoBroadcastCbfMinTime() < 300) {
                        log("*** " & testcasename() & ": PICS_GN_GEOBROADCAST_CBF_MIN_TIME >= 300 required for executing the TC ***");
                        setverdict(inconc);
                        stop;
                    }
                    
                    // Test component configuration
                    f_cf05Up();
                    
                    // Preamble
                    
                    // Start components
                    v_nodeB := f_getComponent(c_compNodeB);
                    v_nodeE := f_getComponent(c_compNodeE);
                    v_nodeB.start(f_GEONW_PON_BAA_BV_05_nodeB());
                    v_nodeE.start(f_GEONW_PON_BAA_BV_05_nodeE());
                    
                    // Synchronization
                    f_serverSync2ClientsAndStop({c_prDone, c_tbDone});
                    
                    // Cleanup
                    f_cf05Down();
                    
                } // end TC_GEONW_PON_BAA_BV_05
                
                /**
                 * @desc    Behavior function for NodeB (TC_GEONW_PON_BAA_BV_05)
                 */
                function f_GEONW_PON_BAA_BV_05_nodeB() runs on ItsGeoNetworking {
                    
                    // Local variables
                    var LongPosVector v_longPosVectorNodeA := f_getPosition(c_compNodeA);
                    
                    // Preamble
                    f_prNeighbour();
                    f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                    
                    // Test Body
                    tc_ac.start;
                    alt {                    	
                        [] geoNetworkingPort.receive(mw_geoNwInd(mw_geoNwPdu(mw_geoNwBroadcastPacketWithArea(
                                mw_longPosVectorPosition(v_longPosVectorNodeA),
                                ?,
                                f_getGeoBroadcastArea(c_area1)
                            )))) {
                            tc_ac.stop;
                            log("*** " & testcasename() & ": PASS: packet correctly broadcasted ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                        }
                        [] tc_ac.timeout {
                            log("*** " & testcasename() & ": FAIL: Expected message not received ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                        }
                    }
                    
                    // Postamble
                    f_poNeighbour();
                    
                } // end f_GEONW_PON_BAA_BV_05_nodeB
                
                /**
                 * @desc    Behavior function for NodeE (TC_GEONW_PON_BAA_BV_05)
                 */
                function f_GEONW_PON_BAA_BV_05_nodeE() runs on ItsGeoNetworking {
                    
                    // Local variables
                    var LongPosVector v_longPosVectorNodeA := f_getPosition(c_compNodeA);
                    
                    // Preamble
                    f_prNeighbour();
                    f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                    
                    // Test Body
                    f_sendGeoNetMessage(
                        m_geoNwReq_withLinkLayerDestination(
                            m_geoNwPdu(m_geoNwBroadcastPacket(
                                    v_longPosVectorNodeA,
                                    0,
                                    f_getGeoBroadcastArea(c_area1)
                                )
                            ),
                            f_getIutMacAddress()
                        )
                    );
                    tc_ac.start;
                    alt {                    	
                        [] geoNetworkingPort.receive(mw_geoNwInd(mw_geoNwPdu(mw_geoNwBroadcastPacketWithArea(
                                mw_longPosVectorPosition(v_longPosVectorNodeA),
                                ?,
                                f_getGeoBroadcastArea(c_area1)
                            )))) {
                            tc_ac.stop;
                            log("*** " & testcasename() & ": PASS: packet correctly broadcasted ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                        }
                        [] tc_ac.timeout {
                            log("*** " & testcasename() & ": FAIL: Expected message not received ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                        }
                    }
                    
                    // Postamble
                    f_poNeighbour();
                    
                } // end f_GEONW_PON_BAA_BV_05_nodeE
                
            } // end GEONW_PON_BAA_BV_05
                        
filatov's avatar
filatov committed
            group GEONW_PON_BAA_BV_06 {
                
                /**
                 * @desc    Test that a received GeoBroadcast packet with Broadcast destination is triggering contention if 
                 *          received for the first time from known sender when IUT is inside the destination area
filatov's avatar
filatov committed
                 * <pre>
                 * Pics Selection: PICS_GN_GEOBROADCAST_FORWARDING_ALGORITHM == 'ADVANCED'
                 * Config Id: CF05
                 * Initial conditions:
                 *  with {
                 *      the IUT being in the "initial state" and
                 *      the IUT having received Beacon information from ItsNodeB and
                 *      the IUT having received Beacon information from ItsNodeE
                 *  }
                 * Expected behaviour:
                 *  ensure that {
                 *      when {
                 *          the IUT receives a GeoBroadcast packet from ItsNodeE
                 *              addressed to broadcast link-layer address
                 *              containing TrafficClass.SCF set to 1
                 *              containing GBC Extended Header
                 *                  containing GeoBroadcast DestinationArea
                 *                      indicating AREA1
                 *      }
                 *      then {
                 *          the IUT calculates and starts the contention timer and
                 *          the IUT re-broadcasts the received GeoBroadcast packet
                 *              upon expiry of the contention timer
                 * @see         ETSI TS 102 871-2 v1.3.1 TP/GEONW/PON/BAA/BV/06
filatov's avatar
filatov committed
                 * @reference   EN 302 636-4-1 [1], Annex E.4
                 */
                testcase TC_GEONW_PON_BAA_BV_06() runs on ItsMtc system ItsGeoNetworkingSystem {
                    
                    // Local variables
                    var ItsGeoNetworking v_nodeB;
                    var ItsGeoNetworking v_nodeE;
                                        
                    // Test control
                    if (f_getGeoBroadcastForwardingAlgorithm() != e_advanced) {
                        log("*** " & testcasename() & ": PICS_GN_GEOBROADCAST_FORWARDING_ALGORITHM == e_advanced required for executing the TC ***");
                        setverdict(inconc);
                        stop;
                    }
                    
                    if (f_getGeoBroadcastCbfMinTime() < 300) {
                        log("*** " & testcasename() & ": PICS_GN_GEOBROADCAST_CBF_MIN_TIME >= 300 required for executing the TC ***");
                        setverdict(inconc);
                        stop;
                    }
                    
                    // Test component configuration
                    f_cf05Up();
                    
                    // Preamble
                    
                    // Start components
                    v_nodeB := f_getComponent(c_compNodeB);
                    v_nodeE := f_getComponent(c_compNodeE);
                    v_nodeB.start(f_GEONW_PON_BAA_BV_06_nodeB());
                    v_nodeE.start(f_GEONW_PON_BAA_BV_06_nodeE());
                    
                    // Synchronization
                    f_serverSync2ClientsAndStop({c_prDone, c_tbDone});
                    
                    // Cleanup
                    f_cf05Down();
                    
                } // end TC_GEONW_PON_BAA_BV_06
                
                /**
                 * @desc    Behavior function for NodeB (TC_GEONW_PON_BAA_BV_06)
                 */
                function f_GEONW_PON_BAA_BV_06_nodeB() runs on ItsGeoNetworking {
                    
                    // Local variables
                    var LongPosVector v_longPosVectorNodeE := f_getPosition(c_compNodeE);
                    var LongPosVector v_longPosVectorIut := f_getPosition(c_compIut);
                    timer t_toCbf := (int2float(f_getGeoBroadcastCbfMaxTime())
                        + (
                            int2float(f_getGeoBroadcastCbfMinTime() - f_getGeoBroadcastCbfMaxTime())
                            / int2float(f_getCbfMaxCommunicationRange())
                        ) * f_distance(v_longPosVectorNodeE, v_longPosVectorIut)) * 0.95 / 1000.0;
                    
                    // Preamble
                    f_prNeighbour();
                    f_selfOrClientSyncAndVerdict(c_prDone, e_success);
filatov's avatar
filatov committed
                    
                    // Test Body
                    t_toCbf.start;
                    tc_ac.start;
                    alt {                        
                        [] geoNetworkingPort.receive(mw_geoNwInd(mw_geoNwPdu(mw_geoNwBroadcastPacketWithArea(
                                mw_longPosVectorPosition(v_longPosVectorNodeE),
                                ?,
                                f_getGeoBroadcastArea(c_area1)
                            )))) {
                            tc_ac.stop;
                            
                            if(t_toCbf.running) {
                                t_toCbf.stop;  
                                log("*** " & testcasename() & ": FAIL: GBC retransmitted before CBF timer expiration ***");                              
                                f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
filatov's avatar
filatov committed
                            }
                            else {
                                log("*** " & testcasename() & ": PASS: GeoBroadcast message received ***");
                                f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
filatov's avatar
filatov committed
                            }
                        }
                        [] t_toCbf.timeout {
                            log("*** " & testcasename() & ": INFO: CBF timer elapsed ***");
                            repeat;
                        }
                        [] tc_ac.timeout {
                            log("*** " & testcasename() & ": FAIL: Expected message not received ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
filatov's avatar
filatov committed
                        }
                    }
                    
                    // Postamble
                    f_poNeighbour();
                    
                } // end f_GEONW_PON_BAA_BV_06_nodeB
                
                /**
                 * @desc    Behavior function for NodeE (TC_GEONW_PON_BAA_BV_06)
                 */
                function f_GEONW_PON_BAA_BV_06_nodeE() runs on ItsGeoNetworking {
                    
                    // Local variables
                    var LongPosVector v_longPosVectorNodeE := f_getPosition(c_compNodeE);
                    var LongPosVector v_longPosVectorIut := f_getPosition(c_compIut);
                    timer t_toCbf := (int2float(f_getGeoBroadcastCbfMaxTime())
                        + (
                            int2float(f_getGeoBroadcastCbfMinTime() - f_getGeoBroadcastCbfMaxTime())
                            / int2float(f_getCbfMaxCommunicationRange())
                        ) * f_distance(v_longPosVectorNodeE, v_longPosVectorIut)) * 0.95 / 1000.0;
                    
                    // Preamble
                    f_prNeighbour();
                    f_selfOrClientSyncAndVerdict(c_prDone, e_success);
filatov's avatar
filatov committed
                    
                    // Test Body
                    f_sendGeoNetMessage(
                        m_geoNwReq_linkLayerBroadcast(
                            m_geoNwPdu(m_geoNwBroadcastPacket(
                                    v_longPosVectorNodeE,
                                    0,
                                    f_getGeoBroadcastArea(c_area1)
                                )
                            )
                        )
                    );
                    
                    t_toCbf.start;
                    tc_ac.start;
                    alt {                        
                        [] geoNetworkingPort.receive(mw_geoNwInd(mw_geoNwPdu(mw_geoNwBroadcastPacketWithArea(
                                mw_longPosVectorPosition(v_longPosVectorNodeE),
                                ?,
                                f_getGeoBroadcastArea(c_area1)
                            )))) {
                            tc_ac.stop;
                            
                            if(t_toCbf.running) {
                                t_toCbf.stop;
                                log("*** " & testcasename() & ": FAIL: GBC retransmitted before CBF timer expiration ***");
                                f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
filatov's avatar
filatov committed
                            }
                            else {
                                log("*** " & testcasename() & ": PASS: GeoBroadcast message received ***");
                                f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
filatov's avatar
filatov committed
                            }
                        }
                        [] t_toCbf.timeout {
                            log("*** " & testcasename() & ": INFO: CBF timer elapsed ***");
                            repeat;
                        }
                        [] tc_ac.timeout {
                            log("*** " & testcasename() & ": FAIL: Expected message not received ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
filatov's avatar
filatov committed
                        }
                    }
                    
                    // Postamble
                    f_poNeighbour();
                    
                } // end f_GEONW_PON_BAA_BV_06_nodeE
                
            } // end GEONW_PON_BAA_BV_06
            
            group GEONW_PON_BAA_BV_07 {
                
                /**
                 * @desc    Test that a received GeoBroadcast packet from outside the destination area is triggering line 
                 *          forwarding if received for the first time from known sender when IUT is outside the destination area