ItsGeoNetworking_TestCases.ttcn 913 KB
Newer Older
filatov's avatar
filatov committed
                    
                    // Postamble
                    f_poNeighbour();
                    
                } // end f_GEONW_PON_FPB_BV_01_nodeB
                
                /**
                 * @desc    Behavior function for NodeC (TC_GEONW_PON_FPB_BV_01)
                 */
                function f_GEONW_PON_FPB_BV_01_nodeC() runs on ItsGeoNetworking {
                    
                    // Local variables
                    var LongPosVector v_longPosVectorNodeA := f_getPosition(c_compNodeA);
                    var LongPosVector v_longPosVectorIut := f_getPosition(c_compIut);
                    
                    // Preamble
                    f_prNeighbour();
                    
                    // Make sure IUT has LocE for NodeA by sending unsolicited LS_REPLY
                    f_sendGeoNetMessage(m_geoNwReq_linkLayerBroadcast(m_geoNwPdu(
                        m_geoNwLsReplyPacket(
                            v_longPosVectorNodeA,
                            f_longPosVector2ShortPosVector(v_longPosVectorIut),
                            vc_localSeqNumber
                        )
                    )));
                    
                    f_selfOrClientSyncAndVerdict(c_prDone, e_success);
filatov's avatar
filatov committed
                    
                    // Test Body
                    // /!\ This pre-condition has impact on test body
	                if ( not f_utTriggerEvent(m_generateGeoUnicastMessage(v_longPosVectorNodeA.gnAddr)) ) {
	                    log("*** " & testcasename() & ": INCONC: Trigger failed ***");
	                    f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
filatov's avatar
filatov committed
	                }
                    tc_noac.start;
                    alt {
                        [] geoNetworkingPort.receive(mw_geoNwInd(mw_geoNwPdu(?))) {
                            tc_noac.stop;
                            log("*** " & testcasename() & ": FAIL: GeoUnicast packet received ***");
                            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_FPB_BV_01_nodeC
                
            } // end GEONW_PON_FPB_BV_01
            
            group GEONW_PON_FPB_BV_02 {
                
                /**
                 * @desc    Test of Forwarder packet buffering into UC forwarding buffer for unreachable Unicast destinations
                 *          (absence of a suitable next hop candidate)
                 * <pre>
                 * Pics Selection: none
                 * Config Id: CF03
                 * Initial conditions:
                 *  with {
                 *      the IUT being in the "initial state" and
                 *      the IUT not having received any Beacon information from ItsNodeB and
                 *      the IUT having received GeoUnicast packets addressed to ItsNodeA from ItsNodeC
                 *          containing TrafficClass.SCF set to 1
                 *          containing Basic Header
                 *              containing LT field
                 *                  indicating LT1
                 *              containing RHL field
                 *                  indicating value greater than 1
                 *          containing GUC Extended Header
                 *              containing SN field
                 *                  indicating value SN1
                 *  }
                 * Expected behaviour:
                 *  ensure that {
                 *      when {
                 *          the IUT receives a Beacon packet from ItsNodeB
                 *      }
                 *      then {
                 *          the IUT selects the ItsNodeB as the next hop and
                 *          the IUT forwards the buffered GeoUnicast packet
                 *              containing Basic Header
                 *                  containing RHL field
                 *                      indicating value decreased by 1
                 *              containing GUC Extended Header
                 *                  containing SN field
                 *                      indicating value SN1
                 *      }
                 *   }
                 * </pre>
                 *
                 * @see         ETSI TS 102 871-2 v1.3.1 TP/GEONW/PON/FPB/BV/02
filatov's avatar
filatov committed
                 * @reference   EN 302 636-4-1 [1], clauses 9.3.8.3, 7.5.3, 9.3.6.3
                 */
                testcase TC_GEONW_PON_FPB_BV_02() runs on ItsMtc system ItsGeoNetworkingSystem {
                    
                    // Local variables
                    var ItsGeoNetworking v_nodeB;
                    var ItsGeoNetworking v_nodeC;
                    const UInt16 c_sequenceNumberC := f_getInitialSequenceNumber();
                    
                    // Test control
                    
                    // Test component configuration
                    f_cf03Up();
                    
                    // Preamble
                    
                    // Start components
                    v_nodeB := f_getComponent(c_compNodeB);
                    v_nodeC := f_getComponent(c_compNodeC);
                    v_nodeB.start(f_GEONW_PON_FPB_BV_02_nodeB(c_sequenceNumberC));
                    v_nodeC.start(f_GEONW_PON_FPB_BV_02_nodeC(c_sequenceNumberC));
                    
                    // Synchronization
                    f_serverSync2ClientsAndStop({c_prDone, c_tbDone});
                    
                    // Cleanup
                    f_cf03Down();
                    
                } // end TC_GEONW_PON_FPB_BV_02
                
                /**
                 * @desc    Behavior function for NodeB (TC_GEONW_PON_FPB_BV_02)
                 */
                function f_GEONW_PON_FPB_BV_02_nodeB(in UInt16 p_sequenceNumberC) runs on ItsGeoNetworking {
                    
                    // Local variables
                    var LongPosVector v_longPosVectorNodeA := f_getPosition(c_compNodeA);
                    var LongPosVector v_longPosVectorIut := f_getPosition(c_compIut);
                    
                    // Preamble
                    f_prDefault(); // NodeB is not yet a neighbour
                    vc_localSeqNumber := p_sequenceNumberC;
                    f_selfOrClientSyncAndVerdict(c_prDone, e_success);
filatov's avatar
filatov committed
                    
                    // Test Body
                    f_sleep(1.0);
                    f_startBeingNeighbour();
                    
                    tc_ac.start;
                    alt {
                        [] geoNetworkingPort.receive(
                            mw_geoNwInd(
                                mw_geoNwPdu(
                                    mw_geoNwUnicastPacket(
                                        mw_shortPosVectorPosition(f_longPosVector2ShortPosVector(v_longPosVectorNodeA)),
                                        vc_localSeqNumber
                                    ),
                                    -,
                                    c_defaultHopLimit - 1
                                )
                            )
                        ) {
                            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_FPB_BV_02_nodeB
                
                /**
                 * @desc    Behavior function for NodeC (TC_GEONW_PON_FPB_BV_02)
                 */
                function f_GEONW_PON_FPB_BV_02_nodeC(in UInt16 p_sequenceNumberC) runs on ItsGeoNetworking {
                    
                    // Local variables
                    var LongPosVector v_longPosVectorNodeA := f_getPosition(c_compNodeA);
                    var LongPosVector v_longPosVectorNodeC := f_getPosition(c_compNodeC);
                    
                    // Preamble
                    f_prNeighbour();
                    vc_localSeqNumber := p_sequenceNumberC;
                    
                    f_sendGeoNetMessage(
                        m_geoNwReq_linkLayerBroadcast(
                            m_geoNwPdu(
                                m_geoNwUnicastPacket(
                                    v_longPosVectorNodeC,
                                    f_longPosVector2ShortPosVector(v_longPosVectorNodeA),
                                    vc_localSeqNumber
                                ),
                                -,
                                c_defaultHopLimit
                            )
                        )
                    );
                    
                    f_selfOrClientSyncAndVerdict(c_prDone, e_success);
filatov's avatar
filatov committed
                    
                    // Test Body
                    f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
filatov's avatar
filatov committed
                    
                    // Postamble
                    f_poNeighbour();
                    
                } // end f_GEONW_PON_FPB_BV_02_nodeC
                
            } // end GEONW_PON_FPB_BV_02
            
            group GEONW_PON_FPB_BV_03 {
                
                /**
                 * @desc    Test of UC forwarding buffer characteristics: FIFO type
                 * <pre>
                 * Pics Selection: none
                 * Config Id: CF03
                 * Initial conditions:
                 *  with {
                 *      the IUT being in the "initial state" and
                 *      the IUT not having received any Beacon information from ItsNodeB and
                 *      the IUT having received a GeoUnicast (GEOUNI1) packet addressed to ItsNodeA from ItsNodeC
                 *          containing TrafficClass.SCF set to 1
                 *          containing Basic Header
                 *              containing LT field
                 *                  indicating value LT1 and
                 *              containing RHL field
                 *                  indicating value greater than 1
                 *          containing GUC Extended Header
                 *              containing SN field
                 *                  indicating value SN1
                 *      the IUT having received a second GeoUnicast (GEOUNI2) packet addressed to ItsNodeA from ItsNodeC
                 *          containing TrafficClass.SCF set to 1 
                 *          containing Basic Header
                 *              containing LT field
                 *                  indicating LT2
                 *              containing RHL field
                 *                  indicating value greater than 1
                 *          containing GUC Extended Header
                 *              containing SN field
                 *                  indicating value SN2
                 *  }
                 * Expected behaviour:
                 *  ensure that {
                 *      when {
                 *          the IUT receives a Beacon packet from ItsNodeB
                 *          before expiry of LT1 and LT2
                 *      }
                 *      then {
                 *          the IUT selects ItsNodeB as the next hop and
                 *          the IUT forwards the GEOUNI1 buffered packet
                 *              containing GUC Extended Header
                 *                  containing SN field
                 *                      indicating value SN1
                 *          the IUT forwards the GEOUNI2 buffered packet
                 *              containing GUC Extended Header
                 *                  containing SN field
                 *                      indicating value SN2
                 *      }
                 *   }
                 * </pre>
                 *
                 * @see         ETSI TS 102 871-2 v1.3.1 TP/GEONW/PON/FPB/BV/03
filatov's avatar
filatov committed
                 * @reference   EN 302 636-4-1 [1], clauses 7.5.3, 9.3.6.3 and 9.3.8.3
                 */
                testcase TC_GEONW_PON_FPB_BV_03() runs on ItsMtc system ItsGeoNetworkingSystem {
                    
                    // Local variables
                    var ItsGeoNetworking v_nodeB;
                    var ItsGeoNetworking v_nodeC;
                    const UInt16 c_sequenceNumberC := f_getInitialSequenceNumber();
                    const integer c_messageCount := 2;
                    
                    // Test control
                    
                    // Test component configuration
                    f_cf03Up();
                    
                    // Preamble
                    
                    // Start components
                    v_nodeB := f_getComponent(c_compNodeB);
                    v_nodeC := f_getComponent(c_compNodeC);
                    v_nodeB.start(f_GEONW_PON_FPB_BV_03_nodeB(c_sequenceNumberC, c_messageCount));
                    v_nodeC.start(f_GEONW_PON_FPB_BV_03_nodeC(c_sequenceNumberC, c_messageCount));
                    
                    // Synchronization
                    f_serverSync2ClientsAndStop({c_prDone, c_tbDone});
                    
                    // Cleanup
                    f_cf03Down();
                    
                } // end TC_GEONW_PON_FPB_BV_03
                
                /**
                 * @desc    Behavior function for NodeB (TC_GEONW_PON_FPB_BV_03)
                 */
                function f_GEONW_PON_FPB_BV_03_nodeB(in UInt16 p_sequenceNumberC, in integer p_messageCount) runs on ItsGeoNetworking {
                    
                    // Local variables
                    var LongPosVector v_longPosVectorNodeA := f_getPosition(c_compNodeA);
                    var LongPosVector v_longPosVectorIut := f_getPosition(c_compIut);
                    var GeoNetworkingInd v_geoNetInd;
                    var UInt16 v_expectedSequenceNumber := p_sequenceNumberC;
                    var integer v_nbReceivedPackets := 0;
                    
                    // Preamble
                    f_prDefault(); // NodeB is not yet a neighbour
                    vc_multipleMessagesCount := p_messageCount;
                    f_selfOrClientSyncAndVerdict(c_prDone, e_success);
filatov's avatar
filatov committed
                    
                    // Test Body
                    f_sleep(1.0);
                    f_startBeingNeighbour();
                    
                    tc_ac.start;
                    alt {
                        [] a_receiveGeoUnicast(
                            mw_shortPosVectorPosition(f_longPosVector2ShortPosVector(v_longPosVectorNodeA)),
                            v_expectedSequenceNumber) {
                            tc_ac.stop;
                            v_nbReceivedPackets := v_nbReceivedPackets + 1;
                            if(v_nbReceivedPackets >= vc_multipleMessagesCount) {
                                log("*** " & testcasename() & ": PASS: GeoUnicast packets received in correct order ***");
                                f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
filatov's avatar
filatov committed
                            }
                            else {
                                v_expectedSequenceNumber := v_expectedSequenceNumber + 1;
                                tc_ac.start;
                                repeat;
                            }
                        }
                        [] a_receiveGeoUnicast(
                            mw_shortPosVectorPosition(f_longPosVector2ShortPosVector(v_longPosVectorNodeA)),
                            ?) {
                            tc_ac.stop;
                            log("*** " & testcasename() & ": FAIL: GeoUnicast packet received in incorrect order ***");
                            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();
                    
                } // end f_GEONW_PON_FPB_BV_03_nodeB
                
                /**
                 * @desc    Behavior function for NodeC (TC_GEONW_PON_FPB_BV_03)
                 */
                function f_GEONW_PON_FPB_BV_03_nodeC(in UInt16 p_sequenceNumberC, in integer p_messageCount) runs on ItsGeoNetworking {
                    
                    // Local variables
                    var LongPosVector v_longPosVectorNodeA := f_getPosition(c_compNodeA);
                    var LongPosVector v_longPosVectorNodeC := f_getPosition(c_compNodeC);
                    var integer i := 0;
                    
                    // Preamble
                    f_prNeighbour();
                    vc_localSeqNumber := p_sequenceNumberC;
                    vc_multipleMessagesCount := p_messageCount;
                    
                    for(i:=0; i < vc_multipleMessagesCount; i:=i+1) {
                        f_sendGeoNetMessage(
                            m_geoNwReq_linkLayerBroadcast(
                                m_geoNwPdu(
                                    m_geoNwUnicastPacket(
                                        v_longPosVectorNodeC,
                                        f_longPosVector2ShortPosVector(v_longPosVectorNodeA),
                                        vc_localSeqNumber
                                    )
                                )
                            )
                        );
                    }
                    
                    f_selfOrClientSyncAndVerdict(c_prDone, e_success);
filatov's avatar
filatov committed
                    
                    // Test Body
                    f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
filatov's avatar
filatov committed
                    
                    // Postamble
                    f_poNeighbour();
                    
                } // end f_GEONW_PON_FPB_BV_03_nodeC
                
            } // end GEONW_PON_FPB_BV_03
            
            group GEONW_PON_FPB_BV_04 {
                
                /**
                 * @desc    Test of UC forwarding buffer characteristics: discarding upon LT expiration
                 * <pre>
                 * Pics Selection: none
                 * Config Id: CF03
                 * Initial conditions:
                 *  with {
                 *      the IUT being in the "initial state" and
                 *      the IUT not having received any Beacon information from ItsNodeB and
                 *      the IUT having received a GeoUnicast packet addressed to ItsNodeA from ItsNodeC
                 *          containing TrafficClass.SCF set to 1
                 *          containing Basic Header
                 *              containing LT field
                 *                  indicating LT1
                 *              containing RHL field
                 *                  indicating value greater than 1
                 *  }
                 * Expected behaviour:
                 *  ensure that {
                 *      when {
                 *          the IUT receives a Beacon packet from ItsNodeB
                 *          after expiry of LT1
                 *      }
                 *      then {
                 *          the IUT does not forward the buffered GeoUnicast packet addressed to ItsNodeA
                 *      }
                 *   }
                 * </pre>
                 *
                 * @see         ETSI TS 102 871-2 v1.3.1 TP/GEONW/PON/FPB/BV/03
filatov's avatar
filatov committed
                 * @reference   EN 302 636-4-1 [1], clauses 7.5.3, 9.3.6.3 and 9.3.8.3
                 */
                testcase TC_GEONW_PON_FPB_BV_04() runs on ItsMtc system ItsGeoNetworkingSystem {
                    
                    // Local variables
                    var ItsGeoNetworking v_nodeB;
                    var ItsGeoNetworking v_nodeC;
                    const UInt6 c_packetLifetime := 10; // 10s
                    
                    // Test control
                    
                    // Test component configuration
                    f_cf03Up();
                    
                    // Preamble
                    
                    // Start components
                    v_nodeB := f_getComponent(c_compNodeB);
                    v_nodeC := f_getComponent(c_compNodeC);
                    v_nodeB.start(f_GEONW_PON_FPB_BV_04_nodeB(c_packetLifetime));
                    v_nodeC.start(f_GEONW_PON_FPB_BV_04_nodeC(c_packetLifetime));
                    
                    // Synchronization
                    f_serverSync2ClientsAndStop({c_prDone, c_tbDone});
                    
                    // Cleanup
                    f_cf03Down();
                    
                } // end TC_GEONW_PON_FPB_BV_04
                
                /**
                 * @desc    Behavior function for NodeB (TC_GEONW_PON_FPB_BV_04)
                 */
                function f_GEONW_PON_FPB_BV_04_nodeB(in UInt6 p_packetLifetime) runs on ItsGeoNetworking {
                    
                    // Local variables
                    var LongPosVector v_longPosVectorNodeA := f_getPosition(c_compNodeA);
                    var LongPosVector v_longPosVectorIut := f_getPosition(c_compIut);
                    var GeoNetworkingInd v_geoNetInd;
                    var integer v_nbReceivedPackets := 0;
                    
                    // Preamble
                    f_prDefault(); // NodeB is not yet a neighbour
                    f_selfOrClientSyncAndVerdict(c_prDone, e_success);
filatov's avatar
filatov committed
                    
                    // Test Body
                    f_sleep(int2float(p_packetLifetime + 1));
                    f_startBeingNeighbour();
                    
                    tc_noac.start;
                    alt {                        
                        [] a_receiveGeoUnicast(
                            mw_shortPosVectorPosition(f_longPosVector2ShortPosVector(v_longPosVectorNodeA)),
                            ?) {
                            tc_noac.stop;
                            log("*** " & testcasename() & ": FAIL: GeoUnicast packet received ***");
                            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_FPB_BV_04_nodeB
                
                /**
                 * @desc    Behavior function for NodeC (TC_GEONW_PON_FPB_BV_04)
                 */
                function f_GEONW_PON_FPB_BV_04_nodeC(in UInt6 p_packetLifetime) runs on ItsGeoNetworking {
                    
                    // Local variables
                    var LongPosVector v_longPosVectorNodeA := f_getPosition(c_compNodeA);
                    var LongPosVector v_longPosVectorNodeC := f_getPosition(c_compNodeC);
                    
                    // Preamble
                    f_prNeighbour();
                    
                    f_sendGeoNetMessage(
                        m_geoNwReq_linkLayerBroadcast(
                            m_geoNwPdu(
                                m_geoNwUnicastPacket(
                                    v_longPosVectorNodeC,
                                    f_longPosVector2ShortPosVector(v_longPosVectorNodeA),
                                    vc_localSeqNumber
                                ),
                                m_lifetimeBase1s(p_packetLifetime),
                                c_defaultHopLimit
                            )
                        )
                    );
                    
                    f_selfOrClientSyncAndVerdict(c_prDone, e_success);
filatov's avatar
filatov committed
                    
                    // Test Body
                    f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
filatov's avatar
filatov committed
                    
                    // Postamble
                    f_poNeighbour();
                    
                } // end f_GEONW_PON_FPB_BV_04_nodeC
                
            } // end GEONW_PON_FPB_BV_04
           
            group GEONW_PON_FPB_BV_06 {
                
                /**
                 * @desc    Test of Source packet buffering into BC forwarding buffer for no recipients
filatov's avatar
filatov committed
                 * <pre>
                 * Pics Selection: none
                 * Config Id: CF02
                 * Initial conditions:
                 *  with {
                 *      the IUT being in the "initial state" and
                 *      the IUT not having received Beacon information from ItsNodeD and
                 *      the IUT not having received Beacon information from ItsNodeB and
                 *      the IUT having been requested to send a TSB packet
filatov's avatar
filatov committed
                 *          containing TrafficClass.SCF set to 1
                 *  }
                 * Expected behaviour:
                 *  ensure that {
                 *      when {
                 *          the IUT receives a Beacon packet from either ItsNodeB or ItsNodeD
                 *      }
                 *      then {
                 *          the IUT broadcasts the buffered TSB packet
                 * @see         ETSI TS 102 871-2 v1.3.1 TP/GEONW/PON/FPB/BV/06
filatov's avatar
filatov committed
                 * @reference   EN 302 636-4-1 [1], clauses 9.3.5, 7.5.3, 9.3.6.3 and 9.3.11.2
                 */
                 testcase TC_GEONW_PON_FPB_BV_06() 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_PON_FPB_BV_06_nodeB());
                    v_nodeD.start(f_GEONW_PON_FPB_BV_06_nodeD());
                    
                    // Synchronization
                    f_serverSync2ClientsAndStop({c_prDone, c_tbDone});
                    
                    // Cleanup
                    f_cf02Down();
                    
                } // end TC_GEONW_PON_FPB_BV_06
                
                /**
                 * @desc    Behavior function for NodeB (TC_GEONW_PON_FPB_BV_06)
                 */
                function f_GEONW_PON_FPB_BV_06_nodeB() runs on ItsGeoNetworking {
                    
                    // Local variables
                    var LongPosVector v_longPosVectorIut := f_getPosition(c_compIut);
                    var GeoNetworkingInd v_geoNetInd;
                    
                    // Preamble
                    f_prDefault();
                    if (not f_utTriggerEvent(m_generateTsbMessage)) {
filatov's avatar
filatov committed
                        log("*** " & testcasename() & ": INCONC: Trigger failed ***");
                        f_selfOrClientSyncAndVerdict(c_prDone, e_timeout);
                    f_selfOrClientSyncAndVerdict(c_prDone, e_success);
filatov's avatar
filatov committed
                    
                    // Test Body
                    f_sleep(1.0);
                    f_startBeingNeighbour();
                    tc_ac.start;
                    alt {
                        [] geoNetworkingPort.receive(mw_geoNwInd(mw_geoNwPdu(mw_geoNwTsbPacket(?, 
                            mw_longPosVectorPosition_withDelta(v_longPosVectorIut))))) -> value v_geoNetInd {
filatov's avatar
filatov committed
                            tc_ac.stop;
                            log("*** " & testcasename() & ": PASS: GeoBroadcast packet received correctly ***");
                            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_FPB_BV_06_nodeB
                
                /**
                 * @desc    Behavior function for NodeD (TC_GEONW_PON_FPB_BV_06)
                 */
                function f_GEONW_PON_FPB_BV_06_nodeD() runs on ItsGeoNetworking {
                    
                    // Local variables
                    var LongPosVector v_longPosVectorIut := f_getPosition(c_compIut);
                    var GeoNetworkingInd v_geoNetInd;
                    
                    // Preamble
                    f_prDefault();
                    f_selfOrClientSyncAndVerdict(c_prDone, e_success);
filatov's avatar
filatov committed
                    
                    // Test Body
                    tc_ac.start;
                    alt {
                        [] geoNetworkingPort.receive(mw_geoNwInd(mw_geoNwPdu(mw_geoNwTsbPacket(?,
                            mw_longPosVectorPosition_withDelta(v_longPosVectorIut))))) -> value v_geoNetInd {
filatov's avatar
filatov committed
                            tc_ac.stop;
                            log("*** " & testcasename() & ": PASS: GeoBroadcast packet received correctly ***");
                            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_poDefault();
                    
                } // end f_GEONW_PON_FPB_BV_06_nodeD
                
            } // end GEONW_PON_FPB_BV_06
            
            group GEONW_PON_FPB_BV_07 {
                
                /**
                 * @desc    Test of BC forwarding buffer characteristics: FIFO type
                 * <pre>
                 * Pics Selection: none
                 * Config Id: CF02
                 * Initial conditions:
                 *  with {
                 *      the IUT being in the "initial state" and
                 *      the IUT not having received Beacon information from ItsNodeD and
                 *      the IUT not having received Beacon information from ItsNodeB and
                 *      the IUT having been requested to send a TSB (TSB1) packet
filatov's avatar
filatov committed
                 *          containing TrafficClass.SCF set to 1
                 *          containing Basic Header
                 *              containing LT field
                 *                  indicating LT1
                 *          containing TSB Extended Header
filatov's avatar
filatov committed
                 *              containing SN field
                 *                  indicating value SN1
                 *      the IUT having been requested to send a TSB (TSB2) packet
filatov's avatar
filatov committed
                 *          containing TrafficClass.SCF set to 1
                 *          containing Basic Header
                 *              containing LT field
                 *                  indicating LT2
                 *          containing TSB Extended Header
filatov's avatar
filatov committed
                 *              containing SN field
                 *                  indicating value SN2
                 *  }
                 * Expected behaviour:
                 *  ensure that {
                 *      when {
                 *          the IUT receives a Beacon packet from either ItsNodeD or ItsNodeB
                 *          before expiry of LT1 and LT2
                 *      }
                 *      then {
                 *          the IUT broadcasts TSB1 packet
                 *              containing TSB Extended Header
filatov's avatar
filatov committed
                 *                  containing SN field
                 *                      indicating value SN1
                 *          the IUT broadcasts TSB2 packet
                 *              containing TSB Extended Header
filatov's avatar
filatov committed
                 *                  containing SN field
                 *                      indicating value SN2
                 *      }
                 *   }
                 * </pre>
                 *
                 * @see         ETSI TS 102 871-2 v1.3.1 TP/GEONW/PON/FPB/BV/07
filatov's avatar
filatov committed
                 * @reference   EN 302 636-4-1 [1], clauses 7.5.3, 9.3.6.3 and 9.3.11.2
                 */
                testcase TC_GEONW_PON_FPB_BV_07() runs on ItsMtc system ItsGeoNetworkingSystem {
                    
                    // Local variables
                    var ItsGeoNetworking v_nodeB;
                    var ItsGeoNetworking v_nodeD;
                    const integer v_messageCount := 2;
                    
                    // 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_PON_FPB_BV_07_nodeB(v_messageCount));
                    v_nodeD.start(f_GEONW_PON_FPB_BV_07_nodeD(v_messageCount));
                    
                    // Synchronization
                    f_serverSync2ClientsAndStop({c_prDone, c_tbDone});
                    
                    // Cleanup
                    f_cf02Down();
                    
                } // end TC_GEONW_PON_FPB_BV_07
                
                /**
                 * @desc    Behavior function for NodeB (TC_GEONW_PON_FPB_BV_07)
                 */
                function f_GEONW_PON_FPB_BV_07_nodeB(in integer p_messageCount) runs on ItsGeoNetworking {
                    
                    // Local variables
                    var LongPosVector v_longPosVectorIut := f_getPosition(c_compIut);
                    var GeoNetworkingInd v_geoNetInd;
                    var template (present) UInt16 v_expectedSequenceNumber := ?;
                    var integer v_nbReceivedPackets := 0;
                    var integer i := 0;
                    
                    // Preamble
                    f_prDefault();
                    vc_multipleMessagesCount := p_messageCount;
                    for(i:=0; i < vc_multipleMessagesCount; i:=i+1) {
	                    if(not f_utTriggerEvent(m_generateTsbMessage)) {
filatov's avatar
filatov committed
	                        log("*** " & testcasename() & ": INCONC: Trigger failed ***");
	                        f_selfOrClientSyncAndVerdict(c_prDone, e_timeout);
filatov's avatar
filatov committed
	                    }
                    }

                    tc_ac.start(1.0);
                    alt {
                        [] geoNetworkingPort.receive(mw_geoNwInd(mw_geoNwPdu(mw_geoNwTsbPacket(?,
                            mw_longPosVectorPosition_withDelta(v_longPosVectorIut))))) {
filatov's avatar
filatov committed
                            tc_ac.stop;
                            log("*** " & testcasename() & ": INCONC: GeoBroadcast packet not buffered ***");
                            f_selfOrClientSyncAndVerdict(c_prDone, e_error);
filatov's avatar
filatov committed
                        }
                        [] tc_ac.timeout {
                            log("*** " & testcasename() & ": PASS: GeoBroadcast packet buffered ***");
                            f_selfOrClientSyncAndVerdict(c_prDone, e_success);
filatov's avatar
filatov committed
                        }
                    }                    
                    
                    // Test Body
                    f_startBeingNeighbour();
                    tc_ac.start;
                    alt {
                        [] geoNetworkingPort.receive(mw_geoNwInd(mw_geoNwPdu(mw_geoNwTsbPacket(
                        	v_expectedSequenceNumber,
                            mw_longPosVectorPosition_withDelta(v_longPosVectorIut))))) -> value v_geoNetInd {
filatov's avatar
filatov committed
                            tc_ac.stop;
                            v_nbReceivedPackets := v_nbReceivedPackets + 1;
                            if(v_nbReceivedPackets >= vc_multipleMessagesCount) {
                                log("*** " & testcasename() & ": PASS: TSB packets received in correct order ***");
                                f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                                v_expectedSequenceNumber := v_geoNetInd.msgIn.gnPacket.packet.extendedHeader.tsbHeader.seqNumber + 1;
filatov's avatar
filatov committed
                                tc_ac.start;
                                repeat;
                            }
                        }
                        [] geoNetworkingPort.receive(mw_geoNwInd(mw_geoNwPdu(mw_geoNwTsbPacket(?,
                            mw_longPosVectorPosition_withDelta(v_longPosVectorIut))))) {
filatov's avatar
filatov committed
                            tc_ac.stop;
                            log("*** " & testcasename() & ": FAIL: TSB packet received in incorrect order ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
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_FPB_BV_07_nodeB
                
                /**
                 * @desc    Behavior function for NodeD (TC_GEONW_PON_FPB_BV_07)
                 */
                function f_GEONW_PON_FPB_BV_07_nodeD(in integer p_messageCount) runs on ItsGeoNetworking {
                    
                    // Local variables
                    var LongPosVector v_longPosVectorIut := f_getPosition(c_compIut);
                    var GeoNetworkingInd v_geoNetInd;
                    var template (present) UInt16 v_expectedSequenceNumber := ?;
                    var integer v_nbReceivedPackets := 0;
                    var integer i := 0;
                    
                    // Preamble
                    f_prDefault();
                    vc_multipleMessagesCount := p_messageCount;
                    f_selfOrClientSyncAndVerdict(c_prDone, e_success);
filatov's avatar
filatov committed
                    
                    // Test Body
                    tc_ac.start;
                    alt {
                        [] geoNetworkingPort.receive(mw_geoNwInd(mw_geoNwPdu(mw_geoNwTsbPacket(v_expectedSequenceNumber,
                            mw_longPosVectorPosition_withDelta(v_longPosVectorIut))))) -> value v_geoNetInd  {
filatov's avatar
filatov committed
                            tc_ac.stop;
                            v_nbReceivedPackets := v_nbReceivedPackets + 1;
                            if(v_nbReceivedPackets >= vc_multipleMessagesCount) {
                                log("*** " & testcasename() & ": PASS: TSB packets received in correct order ***");
                                f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                                v_expectedSequenceNumber := v_geoNetInd.msgIn.gnPacket.packet.extendedHeader.tsbHeader.seqNumber + 1;
filatov's avatar
filatov committed
                                tc_ac.start;
                                repeat;
                            }
                        }
                        [] geoNetworkingPort.receive(mw_geoNwInd(mw_geoNwPdu(mw_geoNwTsbPacket(?,
                            mw_longPosVectorPosition_withDelta(v_longPosVectorIut))))) {
filatov's avatar
filatov committed
                            tc_ac.stop;
                            log("*** " & testcasename() & ": FAIL: TSB packet received in incorrect order ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
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_poDefault();
                    
                } // end f_GEONW_PON_FPB_BV_07_nodeD
                
            } // end GEONW_PON_FPB_BV_07
            
            group GEONW_PON_FPB_BV_08 {
                
                /**
                 * @desc    Test of BC forwarding buffer characteristics: discarding upon LT expiration
                 * <pre>
                 * Pics Selection: none
                 * Config Id: CF02
                 * Initial conditions:
                 *  with {
                 *      the IUT being in the "initial state" and
                 *      the IUT not having received Beacon information from ItsNodeD and
                 *      the IUT not having received Beacon information from ItsNodeB and
                 *      the IUT having been requested to send a TSB (TSB1) packet
filatov's avatar
filatov committed
                 *          containing TrafficClass.SCF set to 1
                 *          containing Basic Header
                 *              containing LT field
                 *                  indicating LT1
                 *      the IUT having been requested to send a TSB (TSB2) packet
filatov's avatar
filatov committed
                 *          containing TrafficClass.SCF set to 1
                 *          containing Basic Header
                 *              containing LT field
                 *                  indicating LT2
                 *  }
                 * Expected behaviour:
                 *  ensure that {
                 *      when {
                 *          the IUT receives a Beacon packet from either ItsNodeB or ItsNodeD
                 *          after expiry of LT1 and LT2
                 *      }
                 *      then {
                 *          the IUT does not broadcast any of the buffered TSB1 and TSB2
                 * @see         ETSI TS 102 871-2 v1.3.1 TP/GEONW/PON/FPB/BV/08
filatov's avatar
filatov committed
                 * @reference   EN 302 636-4-1 [1], clauses 7.5.3, 9.3.6.3 and 9.3.11.2
                 */
                 testcase TC_GEONW_PON_FPB_BV_08() 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_PON_FPB_BV_08_nodeB());
                    v_nodeD.start(f_GEONW_PON_FPB_BV_08_nodeD());
                    
                    // Synchronization
                    f_serverSync2ClientsAndStop({c_prDone, c_tbDone});
                    
                    // Cleanup
                    f_cf02Down();
                    
                } // end TC_GEONW_PON_FPB_BV_08
                 
                /**
                 * @desc    Behavior function for NodeB (TC_GEONW_PON_FPB_BV_08)
                 */
                function f_GEONW_PON_FPB_BV_08_nodeB() runs on ItsGeoNetworking {
                    
                    // Local variables
                    var LongPosVector v_longPosVectorIut := f_getPosition(c_compIut);
                    var GeoNetworkingInd v_geoNetInd;
                    
                    // Preamble
                    f_prDefault();
                    if(not f_utTriggerEvent(m_generateTsbMessageWithLifetime(c_lifetime))) {
filatov's avatar
filatov committed
                        log("*** " & testcasename() & ": INCONC: Trigger failed ***");
                        f_selfOrClientSyncAndVerdict(c_prDone, e_timeout);
                    if(not f_utTriggerEvent(m_generateTsbMessageWithLifetime(c_lifetime))) {
filatov's avatar
filatov committed
                        log("*** " & testcasename() & ": INCONC: Trigger failed ***");
                        f_selfOrClientSyncAndVerdict(c_prDone, e_timeout);
                    f_selfOrClientSyncAndVerdict(c_prDone, e_success);
filatov's avatar
filatov committed
                    
                    // Test Body
                    f_sleep(int2float(c_defaultLifetime + 1));
                    f_startBeingNeighbour();
                    
                    tc_noac.start;
                    alt {
                        
                        [] geoNetworkingPort.receive(mw_geoNwInd(mw_geoNwPdu(mw_geoNwTsbPacket(?,
                            mw_longPosVectorPosition_withDelta(v_longPosVectorIut))))) {
filatov's avatar
filatov committed
                            tc_noac.stop;
                            log("*** " & testcasename() & ": FAIL: GeoBroadcast packet received ***");
                            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_FPB_BV_08_nodeB
                
                /**
                 * @desc    Behavior function for NodeD (TC_GEONW_PON_FPB_BV_08)
                 */
                function f_GEONW_PON_FPB_BV_08_nodeD() runs on ItsGeoNetworking {
                    
                    // Local variables
                    var LongPosVector v_longPosVectorIut := f_getPosition(c_compIut);
                    var GeoNetworkingInd v_geoNetInd;
                    
                    // Preamble
                    f_prDefault();
                    f_selfOrClientSyncAndVerdict(c_prDone, e_success);
filatov's avatar
filatov committed
                    
                    // Test Body
                    f_sleep(int2float(c_defaultLifetime + 1));
                    f_startBeingNeighbour();
                    
                    tc_noac.start;
                    alt {
                        
                        [] geoNetworkingPort.receive(mw_geoNwInd(mw_geoNwPdu(mw_geoNwTsbPacket(?, 
                            mw_longPosVectorPosition_withDelta(v_longPosVectorIut))))) {
filatov's avatar
filatov committed
                            tc_noac.stop;