ItsGeoNetworking_TpFunctions.ttcn 806 KB
Newer Older
garciay's avatar
garciay committed
 *  @author     ETSI / STF405 / STF449 / STF484
 *  @version    $URL$
 *              $Id$
 *  @desc       GeoNetworking TP Functions
garciay's avatar
garciay committed
 *  @copyright   ETSI Copyright Notification
 *               No part may be reproduced except as authorized by written permission.
 *               The copyright and the foregoing restriction extend to reproduction in all media.
 *               All rights reserved.
 *
 */
module ItsGeoNetworking_TpFunctions {
    
    // Libcommon
    import from LibCommon_BasicTypesAndValues all;
    import from LibCommon_DataStrings all;
    import from LibCommon_Time all;
    import from LibCommon_VerdictControl all;
    import from LibCommon_Sync all;
    
garciay's avatar
garciay committed
    // LibItsCommon
    import from LibItsCommon_Functions all;
garciay's avatar
garciay committed
    
    // LibItsGeoNetworking    
    import from LibItsGeoNetworking_TestSystem all;
    import from LibItsGeoNetworking_Functions all;
    import from LibItsGeoNetworking_Templates all;
    import from LibItsGeoNetworking_TypesAndValues all;
    import from LibItsGeoNetworking_Pics all;
	import from LibItsGeoNetworking_Pixits all;

    // 6.2.1
    group geoFormatingAndDataValidity {
        
        // 6.2.1.1
        group geoFdvBasicHeader {
            
            /**
             * @desc    TP Function for TC_GEONW_FDV_BAH_BV_01
             */
            function f_GEONW_FDV_BAH_BV_01() runs on ItsGeoNetworking {
                
                // Local variables
                var LongPosVector v_longPosVectorNodeB;
                
                // Test control
                if (not PICS_GN_BASIC_HEADER) {
                    log("*** " & testcasename() & ": PICS_GN_BASIC_HEADER required for executing the TC ***");
                    setverdict(inconc);
                    stop;
                }
                
                // Test component configuration
                f_cf01Up();
                v_longPosVectorNodeB := f_getPosition(vc_componentName);
                
                // Test adapter configuration
                
                // Preamble
                f_prNeighbour();
                f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                
                // Test Body
                if(not f_utTriggerEvent(m_generateGeoBroadcastMessage(f_getArea(c_area1)))) {
                    log("*** " & testcasename() & ": INCONC: Trigger failed ***");
                    f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
                }
                tc_ac.start;
                alt {
                    [] geoNetworkingPort.receive(mw_geoNwInd(mw_geoNwPdu(mw_geoNwBroadcastPacket(?, ?), -, f_getDefaultHopLimit()))) {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": PASS: Basic Header correctly formatted ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: Expected message not received ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
                    }
                }
                
                // Postamble
                f_poNeighbour();
                f_cf01Down();
                
            } // end f_GEONW_FDV_BAH_BV_01
            
            /**
             * @desc    TP Function for TC_GEONW_FDV_BAH_BI_02
             */
            function f_GEONW_FDV_BAH_BI_02() runs on ItsGeoNetworking {
                // Local variables
                var LongPosVector v_longPosVectorNodeB;
                var template (value) GeoNetworkingPdu v_gnPacket;
                var integer i;
                var GnRawPayload v_sentRawPayload;
                
                // Test control
                if (not PICS_GN_BASIC_HEADER) {
                    log("*** " & testcasename() & ": PICS_GN_BASIC_HEADER required for executing the TC ***");
                    setverdict(inconc);
                    stop;
                }
                                
                // Test component configuration
                f_cf01Up();
                v_longPosVectorNodeB := f_getPosition(c_compNodeB);
                
                // Test adapter configuration
                
                // Preamble
                f_prNeighbour();
                v_gnPacket := m_geoNwPdu(m_geoNwShbPacket(v_longPosVectorNodeB));
                
                f_sendGeoNetMessage(m_geoNwReq_linkLayerBroadcast(v_gnPacket));
                
                f_sleep(PX_TAC);
                
                if(0 < lengthof(vc_utInds)) {
                    log("*** " & testcasename() & ": PASS: GN was transmitted to upper layer ***");
                    //flush received upper indications 
                    vc_utInds := {};
                    f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                }
                else {
                    log("*** " & testcasename() & ": INCONC: GN was not transmitted to upper layer ***");
                    f_selfOrClientSyncAndVerdict(c_prDone, e_error);
                }
                
                // Test Body
                v_gnPacket.basicHeader.version := valueof(v_gnPacket.basicHeader.version) + 1;
                
                f_sendGeoNetMessage(m_geoNwReq_linkLayerBroadcast(v_gnPacket));
                
                f_sleep(PX_TAC);
                
                if(0 != lengthof(vc_utInds)) {
                    log("*** " & testcasename() & ": FAIL: GN was transmitted to upper layer ***");
                    f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                }
                else {
                    log("*** " & testcasename() & ": PASS: GN was discarded and not transmitted to upper layer ***");
                    f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                }
                
                // Postamble
                f_poNeighbour();
                f_cf01Down();
                
            } // end f_GEONW_FDV_BAH_BI_02
            
        } // end geoFdvBasicHeader
        
        // 6.2.1.2
        group geoFdvCommonHeader {
            
            /**
             * @desc    TP Function for TC_GEONW_FDV_COH_BV_01
             */
            function f_GEONW_FDV_COH_BV_01() runs on ItsGeoNetworking {
                
                // Local variables
                var LongPosVector v_longPosVectorIut;
                
                // Test control
                if (not PICS_GN_COMMON_HEADER) {
                    log("*** " & testcasename() & ": PICS_GN_COMMON_HEADER required for executing the TC ***");
                    setverdict(inconc);
                    stop;
                }
                                
                // Test component configuration
                f_cf01Up();
                v_longPosVectorIut := f_getPosition(c_compIut);
                
                // Test adapter configuration
                
                // Preamble
                f_prNeighbour();
                f_acTriggerEvent(m_startPassBeaconing(m_beaconHeader(v_longPosVectorIut).beaconHeader));
                f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                
                // Test Body
                tc_ac.start;
                alt {
                    [] geoNetworkingPort.receive(mw_geoNwInd(mw_geoNwPdu(mw_geoNwBeaconPacket(?))))  {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": PASS: Common Header correclty formatted ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: Expected message not received ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
                    }
                }
                
                f_acTriggerEvent(m_stopPassBeaconing);
                
                // Postamble
                f_poNeighbour();
                f_cf01Down();
                
            } // end f_GEONW_FDV_COH_BV_01
            
            /**
             * @desc    TP Function for TC_GEONW_FDV_COH_BV_02
             */
            function f_GEONW_FDV_COH_BV_02() runs on ItsGeoNetworking {
                
                // Local variables
                var GeoNetworkingInd v_geoNwInd;
                var octetstring v_payload := char2oct("PAYLOAD");
                
                // Test control
                if (not PICS_GN_COMMON_HEADER) {
                    log("*** " & testcasename() & ": PICS_GN_COMMON_HEADER required for executing the TC ***");
                    setverdict(inconc);
                    stop;
                }
                
                // Test component configuration
                f_cf01Up();
                
                // Test adapter configuration
                
                // Preamble
                f_prNeighbour();
                if ( not f_utTriggerEvent(m_generateShbMessageWithPayload(v_payload)) ) {
                	log("*** " & testcasename() & ": INCONC: Trigger failed ***");
                	f_selfOrClientSyncAndVerdict(c_prDone, e_timeout);
                }
                f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                
                // Test Body
                tc_ac.start;
                alt {
                    [] geoNetworkingPort.receive(mw_geoNwInd(mw_geoNwPdu(mw_geoNwShbPacket))) -> value v_geoNwInd {
                        tc_ac.stop;
                        if(ispresent(v_geoNwInd.msgIn.gnPacket.packet.payload)) {
                            if(v_geoNwInd.msgIn.gnPacket.packet.commonHeader.plLength == lengthof(v_geoNwInd.msgIn.gnPacket.packet.payload.rawPayload)) {
                                log("*** " & testcasename() & ": PASS: PL field correctly indicates payload size ***");
                                f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                            }
                            else {
                                log("*** " & testcasename() & ": FAIL: PL does correctly not indicate payload size ("
                                    & int2str(v_geoNwInd.msgIn.gnPacket.packet.commonHeader.plLength)
                                    & " != "
                                    & int2str(lengthof(v_geoNwInd.msgIn.gnPacket.packet.payload.rawPayload))
                                    & ")***");
                                f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                            }
                        }
                        else {
                            if(v_geoNwInd.msgIn.gnPacket.packet.commonHeader.plLength == 0) {
                                log("*** " & testcasename() & ": PASS: PL field correctly indicates empty payload ***");
                                f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                            }
                            else {
                                log("*** " & testcasename() & ": FAIL: PL does not indicate empty payload ***");
                                f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                            }
                        }
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: Expected message not received ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
                    }
                }
                
                // Postamble
                f_poNeighbour();
                f_cf01Down();
                
            } // end f_GEONW_FDV_COH_BV_02
            
            /**
             * @desc    TP Function for TC_GEONW_FDV_COH_BV_03
             */
            function f_GEONW_FDV_COH_BV_03(
                                           in template (present) UInt8 p_hopLimit := f_getDefaultHopLimit(),
                                           in template (present) Bit8 p_flags := f_isMobile()
            ) runs on ItsGeoNetworking {
                
                // Local variables
                var LongPosVector v_longPosVectorIut;
                
                // Test control
                if (not PICS_GN_COMMON_HEADER) {
                    log("*** " & testcasename() & ": PICS_GN_COMMON_HEADER required for executing the TC ***");
                    setverdict(inconc);
                    stop;
                }
                
                // Test component configuration
                f_cf01Up();
                v_longPosVectorIut := f_getPosition(c_compIut);
                
                // Test adapter configuration
                
                // Preamble
                f_prNeighbour();
                f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                
                // Test Body
                if(not f_utTriggerEvent(m_generateGeoBroadcastMessage(f_getArea(c_area1)))) {
                    log("*** " & testcasename() & ": INCONC: Trigger failed ***");
                    f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
                }
                 
                tc_ac.start;
                alt {
                    
garciay's avatar
garciay committed
                    [] geoNetworkingPort.receive(mw_geoNwInd(mw_geoNwPdu(mw_geoNwBroadcastPacketWithHlAndFlags(mw_longPosVectorPosition(v_longPosVectorIut), ?, p_hopLimit, p_flags)))) {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": PASS: Correct GeoNetworking Common Header received ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                    }
garciay's avatar
garciay committed
                    [] a_receiveGeoBroadcast(mw_longPosVectorPosition(v_longPosVectorIut), ?) {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": FAIL: Incorrect GeoNetworking Common Header received ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                    }
                    
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: Expected message not received ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
                    }
                }
                
                // Postamble
                f_poNeighbour();
                f_cf01Down();
                
            } // end f_GEONW_FDV_COH_BV_03
            
            group GEONW_FDV_COH_BO_04 {
                
                /**
                 * @desc    TP Function for TC_GEONW_FDV_COH_BO_04
                 */
                function f_GEONW_FDV_COH_BO_04() runs on ItsMtc {
                    
                    // Local variables
                    var ItsGeoNetworking v_nodeB;
                    var ItsGeoNetworking v_nodeD;
                    
                    // Test control
                    if (not PICS_GN_COMMON_HEADER) {
                        log("*** " & testcasename() & ": PICS_GN_COMMON_HEADER required for executing the TC ***");
                        setverdict(inconc);
                        stop;
                    }
                    
                    // Test component configuration
                    f_cf02Up();
                    
                    // Preamble
                    
                    // Start components
                    v_nodeB := f_getComponent(c_compNodeB);
                    v_nodeD := f_getComponent(c_compNodeD);
                    v_nodeB.start(f_GEONW_FDV_COH_BO_04_nodeB());
                    v_nodeD.start(f_GEONW_FDV_COH_BO_04_nodeD());
                    
                    // Synchronization
                    f_serverSync2ClientsAndStop({c_prDone, c_tbDone});
                    
                    // Cleanup
                    f_cf02Down();
                    
                } // end f_GEONW_FDV_COH_BV_04
                
                /**
                 * @desc    Behavior function for NodeB (TC_GEONW_FDV_COH_BV_04)
                 */
                function f_GEONW_FDV_COH_BO_04_nodeB() runs on ItsGeoNetworking {
                    
                    // Local variables
                    var LongPosVector v_longPosVectorNodeB := f_getPosition(c_compNodeB);
                    var UInt8 v_hopLimit := f_getDefaultHopLimit();
                    
                    // Preamble
                    f_prNeighbour();
                    f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                    
                    // Test Body
                    f_sendGeoNetMessage(
                        m_geoNwReq_linkLayerBroadcast(
                            m_geoNwPdu(
                                m_geoNwTsbPacket(
                                    vc_localSeqNumber,
                                    v_longPosVectorNodeB,
                                    v_hopLimit-1
                                ),
                                -,
                                v_hopLimit
                            )
                        )
                    );
                    
                    tc_noac.start;
                    alt {
                        [] geoNetworkingPort.receive(
                                mw_geoNwInd(
                                    mw_geoNwPdu(
                                        mw_geoNwTsbPacket(
                                            ?,
                                            mw_longPosVectorPosition(v_longPosVectorNodeB)
                                        )
                                    )
                                )
                            ) {
                            tc_noac.stop;
                            log("*** " & testcasename() & ": FAIL: TSB packet was not discarded  ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                        }
                        [] tc_noac.timeout {
                            log("*** " & testcasename() & ": PASS: TSB was correctly discarded ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                        }
                    }
                    
                    // Postamble
                    f_poNeighbour();
                    
                } // end f_GEONW_FDV_COH_BO_04_nodeB
                
                /**
                 * @desc    Behavior function for NodeD (TC_GEONW_FDV_COH_BV_04)
                 */
                function f_GEONW_FDV_COH_BO_04_nodeD() runs on ItsGeoNetworking {
                    
                    // Local variables
                    var LongPosVector v_longPosVectorNodeB := f_getPosition(c_compNodeB);
                    
                    // Preamble
                    f_prNeighbour();
                    f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                    
                    // Test Body
                    tc_noac.start;
                    alt {
                        [] geoNetworkingPort.receive(
                                mw_geoNwInd(
                                    mw_geoNwPdu(
                                        mw_geoNwTsbPacket(
                                            ?,
                                            mw_longPosVectorPosition(v_longPosVectorNodeB)
                                        )
                                    )
                                )
                            ) {
                            tc_noac.stop;
                            log("*** " & testcasename() & ": FAIL: TSB packet was not discarded  ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                        }
                        [] tc_noac.timeout {
                            log("*** " & testcasename() & ": PASS: TSB was correctly discarded ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                        }
                    }
                    
                    // Postamble
                    f_poNeighbour();
                    
                } // end f_GEONW_FDV_COH_BO_04_nodeD
                
            } // end GEONW_FDV_COH_BO_04
            
        } // end geoFdvCommonHeader
        
        // 6.2.1.3
        group geoFdvBeacon {
            
            /**
             * @desc    TP Function for TC_GEONW_FDV_BEA_BV_01
             */
            function f_GEONW_FDV_BEA_BV_01() runs on ItsGeoNetworking {
                
                // Local variables
                var LongPosVector v_longPosVectorIut;
                
                // Test control
                if (not PICS_GN_BEACON_SRC) {
                    log("*** " & testcasename() & ": PICS_GN_BEACON_SRC required for executing the TC ***");
                    setverdict(inconc);
                    stop;
                }
                
                // Test component configuration
                f_cf01Up();
                v_longPosVectorIut := f_getPosition(c_compIut);
                
                // Test adapter configuration
                
                // Preamble
                f_prNeighbour();
                f_acTriggerEvent(m_startPassBeaconing(m_beaconHeader(v_longPosVectorIut).beaconHeader));
                f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                
                // Test Body
                tc_ac.start;
                alt {
                    [] geoNetworkingPort.receive(mw_geoNwInd(mw_geoNwPdu(mw_geoNwBeaconPacket(mw_longPosVectorPosition(v_longPosVectorIut), e_any)))) {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": PASS: Common Header correclty formatted ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: Expected message not received ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
                    }
                }
                
                // Postamble
                f_poNeighbour();
                f_cf01Down();
                
            } // end f_GEONW_FDV_BEA_BV_01
            
            /**
             * @desc    TP Function for TC_GEONW_FDV_BEA_BV_02
             */
            function f_GEONW_FDV_BEA_BV_02() runs on ItsGeoNetworking {
                
                // Local variables
                var LongPosVector v_longPosVectorIut;
                
                // Test control
                if (not PICS_GN_BEACON_SRC) {
                    log("*** " & testcasename() & ": PICS_GN_BEACON_SRC required for executing the TC ***");
                    setverdict(inconc);
                    stop;
                }
                
                // Test component configuration
                f_cf01Up();
                v_longPosVectorIut := f_getPosition(c_compIut);
                
                // Test adapter configuration
                
                // Preamble
                f_prNeighbour();
                f_acTriggerEvent(m_startPassBeaconing(m_beaconHeader(v_longPosVectorIut).beaconHeader));
                f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                
                // Test Body
                tc_ac.start;
                alt {
                    [] geoNetworkingPort.receive(mw_geoNwInd(mw_geoNwPdu(mw_geoNwBeaconPacket(
                            mw_longPosVectorAny(f_getIutGnLocalAddress()))))) {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": PASS: GN address correctly received ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: Expected message not received ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
                    }
                }
                
                // Postamble
                f_poNeighbour();
                f_cf01Down();
                
            } // end f_GEONW_FDV_BEA_BV_02
            
            /**
             * @desc    TP Function for TC_GEONW_FDV_BEA_BV_03
             */
            function f_GEONW_FDV_BEA_BV_03() runs on ItsGeoNetworking {
                
                // Local variables
                var LongPosVector v_longPosVectorIut;
                
                // Test control
                if (not PICS_GN_BEACON_SRC) {
                    log("*** " & testcasename() & ": PICS_GN_BEACON_SRC required for executing the TC ***");
                    setverdict(inconc);
                    stop;
                }
                
                // Test component configuration
                f_cf01Up();
                v_longPosVectorIut := f_getPosition(c_compIut);
                
                // Test adapter configuration
                
                // Preamble
                f_prNeighbour();
                f_acTriggerEvent(m_startPassBeaconing(m_beaconHeader(v_longPosVectorIut).beaconHeader));
                f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                
                // Test Body
                tc_ac.start;
                alt {
garciay's avatar
garciay committed
                    [] geoNetworkingPort.receive(mw_geoNwInd(mw_geoNwPdu(mw_geoNwBeaconPacket(mw_longPosVectorPosition(v_longPosVectorIut))))) {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": PASS: Position equaling GN-MNGT primitive value received ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: Expected message not received ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
                    }
                }
                
                // Postamble
                f_poNeighbour();
                f_cf01Down();
                
            } // end f_GEONW_FDV_BEA_BV_03
            
            /**
             * @desc    TP Function for TC_GEONW_FDV_BEA_BV_04
             */
            function f_GEONW_FDV_BEA_BV_04() runs on ItsGeoNetworking {
                
                // Local variables
                var LongPosVector v_longPosVectorIut;
                
                // Test control
                if (not PICS_GN_BEACON_SRC) {
                    log("*** " & testcasename() & ": PICS_GN_BEACON_SRC required for executing the TC ***");
                    setverdict(inconc);
                    stop;
                }
                
                // Test component configuration
                f_cf01Up();
                v_longPosVectorIut := f_getPosition(c_compIut);
                
                // Test adapter configuration
                
                // Preamble
                f_prNeighbour();
                f_acTriggerEvent(m_startPassBeaconing(m_beaconHeader(v_longPosVectorIut).beaconHeader));
                f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                
                // Test Body
                tc_ac.start;
                alt {
garciay's avatar
garciay committed
                    [] geoNetworkingPort.receive(mw_geoNwInd(mw_geoNwPdu(mw_geoNwBeaconPacket(mw_longPosVectorPosition(v_longPosVectorIut))))) {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": PASS: Timestamp equaling GN-MNGT primitive value received ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: Expected message not received ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
                    }
                }
                
                // Postamble
                f_poNeighbour();
                f_cf01Down();
                
            } // end f_GEONW_FDV_BEA_BV_04
            
        } // end geoFdvBeacon
        
        // 6.2.1.4
        group geoFdvGeoUnicast {
            
            /**
             * @desc    TP Function for TC_GEONW_FDV_GUC_BV_01
             */
            function f_GEONW_FDV_GUC_BV_01() runs on ItsGeoNetworking {
                
                // Local variables
                var LongPosVector v_longPosVectorNodeB;
                var LongPosVector v_longPosVectorIut;
                
                // Test control
                if (not PICS_GN_GUC_SRC) {
                    log("*** " & testcasename() & ": PICS_GN_GUC_SRC required for executing the TC ***");
                    setverdict(inconc);
                    stop;
                }
                
                // Test component configuration
                f_cf01Up();
                
                // Test adapter configuration
                
                // Preamble
                v_longPosVectorNodeB := f_getPosition(c_compNodeB);
                v_longPosVectorIut := f_getPosition(c_compIut);
                f_prNeighbour();
                f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                
                // Test Body
                if ( not f_utTriggerEvent(m_generateGeoUnicastMessage(v_longPosVectorNodeB.gnAddr)) ) {
                    log("*** " & testcasename() & ": INCONC: Trigger failed ***");
                    f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
                }
                
                tc_ac.start;
                alt {
                    [] geoNetworkingPort.receive(
                            mw_geoNwInd(
                                mw_geoNwPdu(
                                    mw_geoNwUnicastPacketWithSourcePv(
garciay's avatar
garciay committed
                                        mw_shortPosVectorPosition(f_longPosVector2ShortPosVector(v_longPosVectorNodeB)), // DEPV
                                        ?, // sequence number
garciay's avatar
garciay committed
                                        mw_longPosVectorPosition(v_longPosVectorIut) //SOPV
                                    )
                                )
                            )
                        ) {
                        tc_ac.stop;
                        
                        log("*** " & testcasename() & ": PASS: Fields of the received GUC message correctly set ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: GUC message not received ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
                    }
                }
                
                // Postamble
                f_poNeighbour();
                f_cf01Down();
                
            } // end f_GEONW_FDV_GUC_BV_01
            
        } // end geoFdvGeoUnicast
        
        // 6.2.1.5
        group geoFdvGeoBroadcast {
            
            /**
             * @desc    TP Function for TC_GEONW_FDV_GBC_BV_01
             */
            function f_GEONW_FDV_GBC_BV_01() runs on ItsGeoNetworking {
                
                // Local variables
                var LongPosVector v_longPosVectorNodeB;
                var LongPosVector v_longPosVectorIut;
                var octetstring v_payload := char2oct("PAYLOAD");
                
                // Test control
                if (not PICS_GN_GBC_SRC) {
                    log("*** " & testcasename() & ": PICS_GN_GBC_SRC required for executing the TC ***");
                    setverdict(inconc);
                    stop;
                }
                
                // Test component configuration
                f_cf01Up();
                
                // Test adapter configuration
                
                // Preamble
                v_longPosVectorNodeB := f_getPosition(c_compNodeB);
                v_longPosVectorIut := f_getPosition(c_compIut);
                f_prNeighbour();
                f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                
                // Test Body
                if ( not f_utTriggerEvent(m_generateGeoBroadcastMessageWithPayload(f_getArea(c_area1), v_payload)) ) {
                    log("*** " & testcasename() & ": INCONC: Trigger failed ***");
                    f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
                }
                tc_ac.start;
                alt {
                    [] geoNetworkingPort.receive(
                        f_receiveGeoNetMessageWithPayload(
                            mw_geoNwInd(
                                mw_geoNwPdu(
                                    mw_geoNwBroadcastPacket(
garciay's avatar
garciay committed
                                        mw_longPosVectorPosition(v_longPosVectorIut), // SOPV
                                        ? // sequence number
                                    )
                                )
                            ),
                            ?
                        )
                    ) {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": PASS: Fields of the received GBC message correctly set ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": FAIL: GBC message not received ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
                    }
                }
                
                // Postamble
                f_poNeighbour();
                f_cf01Down();
                
            } // end f_GEONW_FDV_GBC_BV_01
            
        } // end geoFdvGeoBroadcast
        
        // 6.2.1.6
        group geoFdvGeoAnycast {
            
            /**
             * @desc    TP Function for TC_GEONW_FDV_GAC_BV_01
             */
            function f_GEONW_FDV_GAC_BV_01() runs on ItsGeoNetworking {
                
                // Local variables
                var LongPosVector v_longPosVectorIut;
                var octetstring v_payload := char2oct("PAYLOAD");
                
                // Test control
                if (not PICS_GN_GAC_SRC) {
                    log("*** " & testcasename() & ": PICS_GN_GAC_SRC required for executing the TC ***");
                    setverdict(inconc);
                    stop;
                }
                
                // Test component configuration
                f_cf01Up();
                
                // Test adapter configuration
                
                // Preamble
                v_longPosVectorIut := f_getPosition(c_compIut);
                f_prNeighbour();
                f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                
                // Test Body
                if ( not f_utTriggerEvent(m_generateGeoAnycastMessageWithPayload(f_getArea(c_area1), v_payload)) ) {
                    log("*** " & testcasename() & ": INCONC: Trigger failed ***");
                    f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
                }
                tc_ac.start;
                alt {
                    [] geoNetworkingPort.receive(
                        f_receiveGeoNetMessageWithPayload(
                            mw_geoNwInd(
                                mw_geoNwPdu(
                                    mw_geoNwAnycastPacket(
garciay's avatar
garciay committed
                                        mw_longPosVectorPosition(v_longPosVectorIut), // SOPV
                                        ? // sequence number
                                    )
                                )
                            ),
                            ?
                        )
                    ) {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": PASS: Fields of the received GAC message correctly set ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: GAC message not received ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
                    }
                }
                
                // Postamble
                f_poNeighbour();
                f_cf01Down();
                
            } // end f_GEONW_FDV_GAC_BV_01
            
        } // end geoFdvGeoAnycast
        
        // 6.2.1.7
        group geoFdvSingleHopBroadcast {
            
            /**
             * @desc    TP Function for TC_GEONW_FDV_SHB_BV_01
             */
            function f_GEONW_FDV_SHB_BV_01() runs on ItsGeoNetworking {
                
                // Local variables
                var LongPosVector v_longPosVectorIut;
                
                // Test control
                if (not PICS_GN_SHB_SRC) {
                    log("*** " & testcasename() & ": PICS_GN_SHB_SRC required for executing the TC ***");
                    setverdict(inconc);
                    stop;
                }
                
                // Test component configuration
                f_cf01Up();
                
                // Test adapter configuration
                
                // Preamble
                v_longPosVectorIut := f_getPosition(c_compIut);
                f_prNeighbour();
                f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                
                // Test Body
                if ( not f_utTriggerEvent(m_generateShbMessage) ) {
                    log("*** " & testcasename() & ": INCONC: Trigger failed ***");
                    f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
                }
                tc_ac.start;
                alt {
                    [] geoNetworkingPort.receive(
                            mw_geoNwInd(
                                mw_geoNwPdu(
                                    mw_geoNwShbPacket(
garciay's avatar
garciay committed
                                      mw_longPosVectorPosition(v_longPosVectorIut), // SOPV
                                      1 //MHL
                                    )
                                )
                            )
                        ) {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": PASS: Fields of the received SHB message correctly set ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: SHB message not received ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
                    }
                }
                
                // Postamble
                f_poNeighbour();
                f_cf01Down();
                
            } // end f_GEONW_FDV_SHB_BV_01
            
        } // end geoFdvSingleHopBroadcast
        
        // 6.2.1.8
        group geoFdvTopologicallyScopedBroadcast {
            
            /**
             * @desc    TP Function for TC_GEONW_FDV_TSB_BV_01
             */
            function f_GEONW_FDV_TSB_BV_01() runs on ItsGeoNetworking {
                
                // Local variables
                var LongPosVector v_longPosVectorIut;
                
                // Test control
                if (not PICS_GN_TSB_SRC) {
                    log("*** " & testcasename() & ": PICS_GN_TSB_SRC required for executing the TC ***");
                    setverdict(inconc);
                    stop;
                }
                
                // Test component configuration
                f_cf01Up();
                
                // Test adapter configuration
                
                // Preamble
                v_longPosVectorIut := f_getPosition(c_compIut);
                f_prNeighbour();
                f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                
                // Test Body
                if ( not f_utTriggerEvent(m_generateTsbMessage) ) {
                    log("*** " & testcasename() & ": INCONC: Trigger failed ***");
                    f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
                }
                tc_ac.start;
                alt {
                    [] geoNetworkingPort.receive(
                           mw_geoNwInd(
                                mw_geoNwPdu(
                                    mw_geoNwTsbPacket(
                                        ?, // sequence number
garciay's avatar
garciay committed
                                        mw_longPosVectorPosition(v_longPosVectorIut) // SOPV
                                    )
                                )
                            )
                        ) {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": PASS: message received with correct common and extended headers ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: TSB message not received ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
                    }
                }
                
                // Postamble
                f_poNeighbour();
                f_cf01Down();
                
            } // end f_GEONW_FDV_TSB_BV_01
            
        } // end geoFdvTopologicallyScopedBroadcast
        
    } // end geoFormatingAndDataValidity
    
    // 6.2.2
    group geoProtocolOperation {
        
        // 6.2.2.1
        group geoLocationTable {
            
            /**
             * @desc    TP Function for TC_GEONW_PON_LOT_BV_01
             */
            function f_GEONW_PON_LOT_BV_01() runs on ItsGeoNetworking {
                
                // Local variables
                var LongPosVector v_longPosVectorNodeB;
                
                // Test control
                if (not PICS_GN_GUC_SRC or not PICS_GN_BEACON_DST) {
                    log("*** " & testcasename() & ": PICS_GN_GUC_SRC and PICS_GN_BEACON_DST required for executing the TC ***");
                    setverdict(inconc);
                    stop;
                }
                
                // Test component configuration
                f_cf01Up();
                v_longPosVectorNodeB := f_getPosition(c_compNodeB);
                
                // Test adapter configuration
                
                // Preamble
                f_prNeighbour();
                f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                
                // Test Body
                if ( not f_utTriggerEvent(m_generateGeoUnicastMessage(v_longPosVectorNodeB.gnAddr)) ) {
                    log("*** " & testcasename() & ": INCONC: Trigger failed ***");
                    f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
                }
                
                tc_ac.start;
                alt {
                    [] a_receiveGeoUnicastWithDestination(mw_shortPosVectorPosition(f_longPosVector2ShortPosVector(v_longPosVectorNodeB))) {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": PASS: GUC packet received correctly ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                    }
                    [] a_receiveGeoUnicastWithDestination(?) {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": FAIL: GUC packet has some inconsistence ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                    }
                    [] a_receiveAnyLsRequest() {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": FAIL: Received Location Service Request ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": TIMEOUT: Expected message not received ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
                    }
                }
                    
                // Postamble
                f_poNeighbour();
                f_cf01Down();
                
            } // end f_GEONW_PON_LOT_BV_01
            
            /**
             * @desc    TP Function for TC_GEONW_PON_LOT_BV_02
             */
            function f_GEONW_PON_LOT_BV_02() runs on ItsGeoNetworking {
                
                // Local variables
                var LongPosVector v_longPosVectorNodeA;
                var LongPosVector v_longPosVectorNodeB;
                var LongPosVector v_longPosVectorIut;
                var GN_Address v_gnAddressNodeA;
                var boolean v_lsRequestReceived := false;
                
                // Test control
                if (not PICS_GN_LS_REQ_SRC or not PICS_GN_LS_REP_DST) {
                    log("*** " & testcasename() & ": PICS_GN_LS_REQ_SRC AND PICS_GN_LS_REP_DST required for executing the TC ***");
                    setverdict(inconc);
                    stop;
                }
                
                // Test component configuration
                f_cf01Up();
                v_longPosVectorNodeA := f_getPosition(c_compNodeA);
                v_longPosVectorNodeB := f_getPosition(c_compNodeB);
                v_gnAddressNodeA := v_longPosVectorNodeA.gnAddr;
                
                // Test adapter configuration
                
                // Preamble
                f_prNeighbour();
                
                if ( not  f_utTriggerEvent(m_generateGeoUnicastMessage(v_longPosVectorNodeA.gnAddr)) ) {
                    log("*** " & testcasename() & ": INCONC: Trigger failed ***");
                    f_selfOrClientSyncAndVerdict(c_prDone, e_timeout);
                }
                tc_ac.start;
                alt {
                    [] a_receiveLsRequestAndReply(
                            ?, v_gnAddressNodeA.mid,
                            v_longPosVectorNodeA, v_longPosVectorNodeB
                        ) {
                        v_lsRequestReceived := true;
                        log("*** " & testcasename() & ": Pre-conditions: Received and answered Location Service Request ***");
                        repeat;
                    }
                    [] a_receiveGeoUnicastWithDestination(mw_shortPosVectorPosition(f_longPosVector2ShortPosVector(v_longPosVectorNodeA))) {
                        tc_ac.stop;
                        if(v_lsRequestReceived == true) {
                            log("*** " & testcasename() & ": Pre-conditions: First GUC message received correctly ***");
                        }
                        else {
                            log("*** " & testcasename() & ": Pre-conditions: GUC packet received without LS Request ***");
                            f_selfOrClientSyncAndVerdict(c_prDone, e_error);
                        }
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": Pre-conditions: Initial conditions not satisfied. ***");
                        f_selfOrClientSyncAndVerdict(c_prDone, e_timeout);
                    }
                }
                f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                
                // Test Body
                if ( not  f_utTriggerEvent(m_generateGeoUnicastMessage(v_longPosVectorNodeA.gnAddr)) ) {
                    log("*** " & testcasename() & ": INCONC: Trigger failed ***");
                    f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
                }
                tc_ac.start;
                alt {
                    [] a_receiveLsRequest(?, v_gnAddressNodeA.mid, v_longPosVectorIut) {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": FAIL: Received Location Service Request ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                    }
                    [] a_receiveGeoUnicastWithDestination(mw_shortPosVectorPosition(f_longPosVector2ShortPosVector(v_longPosVectorNodeA))) {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": PASS: Received second GUC packet without LS Request ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                        
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: Expected message not received ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
                    }
                }
                
                // Postamble
                f_poNeighbour();
                f_cf01Down();
                
            } // end f_GEONW_PON_LOT_BV_02
            
            group GEONW_PON_LOT_BV_03 {
                
                /**
                 * @desc    TP Function for TC_GEONW_PON_LOT_BV_03_01
                 */
                function f_GEONW_PON_LOT_BV_03_01() runs on ItsGeoNetworking {
                    
                    // Local variables
                    var LongPosVector v_longPosVectorNode := f_TP_GEONW_PON_LOT_BV_03_pre_1(c_compNodeB);

                    // Test control
                    if (not PICS_GN_BEACON_DST) {
                        log("*** " & testcasename() & ": PICS_GN_BEACON_DST required for executing the TC ***");
                        setverdict(inconc);
                        stop;
                    }
                       
                    f_TP_GEONW_PON_LOT_BV_03_pre_2(
                        m_geoNwBeaconPacket(
                    f_TP_GEONW_PON_LOT_BV_03_main(v_longPosVectorNode);
                    
                } // end f_GEONW_PON_LOT_BV_03_01
                
                /**
                 * @desc    TP Function for TC_GEONW_PON_LOT_BV_03_02
                 */
                function f_GEONW_PON_LOT_BV_03_02() runs on ItsGeoNetworking {
                    
                    // Local variables
                    var LongPosVector v_longPosVectorNode := f_TP_GEONW_PON_LOT_BV_03_pre_1(c_compNodeA);

                    // Test control
                    if (not PICS_GN_GUC_DST) {
                        log("*** " & testcasename() & ": PICS_GN_GUC_DST required for executing the TC ***");
                        setverdict(inconc);
                        stop;
                    }
                    
                    f_TP_GEONW_PON_LOT_BV_03_pre_2(
                        m_geoNwUnicastPacket(
                            f_getIutShortPosVector(),
                            vc_localSeqNumber
                        )
                    );
                    
                    f_TP_GEONW_PON_LOT_BV_03_main(v_longPosVectorNode);
                    
                } // end f_GEONW_PON_LOT_BV_03_02
                
                /**
                 * @desc    TP Function for TC_GEONW_PON_LOT_BV_03_03
                 */
                function f_GEONW_PON_LOT_BV_03_03() runs on ItsGeoNetworking {
                    
                    // Local variables
                    var LongPosVector v_longPosVectorNode := f_TP_GEONW_PON_LOT_BV_03_pre_1(c_compNodeA);

                    // Test control
                    if (not PICS_GN_GAC_DST) {
                        log("*** " & testcasename() & ": PICS_GN_GAC_DST required for executing the TC ***");
                        setverdict(inconc);
                        stop;
                    }
                    
                    f_TP_GEONW_PON_LOT_BV_03_pre_2(
                        m_geoNwAnycastPacket(
                            vc_localSeqNumber,
                            f_getGeoAnycastArea(c_area1)
                        )
                    );
                    
                    f_TP_GEONW_PON_LOT_BV_03_main(v_longPosVectorNode);
                    
                } // end f_GEONW_PON_LOT_BV_03_03
                
                /**
                 * @desc    TP Function for TC_GEONW_PON_LOT_BV_03_04
                 */
                function f_GEONW_PON_LOT_BV_03_04() runs on ItsGeoNetworking {
                    
                    // Local variables
                    var LongPosVector v_longPosVectorNode := f_TP_GEONW_PON_LOT_BV_03_pre_1(c_compNodeA);

                    // Test control
                    if (not PICS_GN_GBC_DST) {
                        log("*** " & testcasename() & ": PICS_GN_GBC_DST required for executing the TC ***");
                        setverdict(inconc);
                        stop;
                    }
                    
                    f_TP_GEONW_PON_LOT_BV_03_pre_2(
                        m_geoNwBroadcastPacket(
                            vc_localSeqNumber,
                            f_getGeoBroadcastArea(c_area1)
                        )
                    );
                    
                    f_TP_GEONW_PON_LOT_BV_03_main(v_longPosVectorNode);
                    
                } // end f_GEONW_PON_LOT_BV_03_04
                
                /**
                 * @desc    TP Function for TC_GEONW_PON_LOT_BV_03_05
                 */
                function f_GEONW_PON_LOT_BV_03_05() runs on ItsGeoNetworking {
                    
                    // Local variables
                    var LongPosVector v_longPosVectorNode := f_TP_GEONW_PON_LOT_BV_03_pre_1(c_compNodeA);

                    // Test control
                    if (not PICS_GN_TSB_DST) {
                        log("*** " & testcasename() & ": PICS_GN_TSB_DST required for executing the TC ***");
                        setverdict(inconc);
                        stop;
                    }
                     
                    f_TP_GEONW_PON_LOT_BV_03_pre_2(
                        m_geoNwTsbPacket(
                            vc_localSeqNumber,
                    f_TP_GEONW_PON_LOT_BV_03_main(v_longPosVectorNode);
                    
                } // end f_GEONW_PON_LOT_BV_03_05
                
                /**
                 * @desc    TP Function for TC_GEONW_PON_LOT_BV_03_06
                 */
                function f_GEONW_PON_LOT_BV_03_06() runs on ItsGeoNetworking {
                    
                    // Local variables
                    var LongPosVector v_longPosVectorNode := f_TP_GEONW_PON_LOT_BV_03_pre_1(c_compNodeB);

                    // Test control
                    if (not PICS_GN_SHB_DST) {
                        log("*** " & testcasename() & ": PICS_GN_SHB_DST required for executing the TC ***");
                        setverdict(inconc);
                        stop;
                    }
                    
                    f_TP_GEONW_PON_LOT_BV_03_pre_2(
                        m_geoNwShbPacket(
                    f_TP_GEONW_PON_LOT_BV_03_main(v_longPosVectorNode);
                    
                } // end f_GEONW_PON_LOT_BV_03_06
                
                /**
                 * @desc    TP Function for TC_GEONW_PON_LOT_BV_03_07
                 */
                function f_GEONW_PON_LOT_BV_03_07() runs on ItsGeoNetworking {
                    
                    // Local variables
                    var LongPosVector v_longPosVectorNode := f_TP_GEONW_PON_LOT_BV_03_pre_1(c_compNodeA);

                    // Test control
                    if (not PICS_GN_LS_REQ_DST) {
                        log("*** " & testcasename() & ": PICS_GN_LS_REQ_DST required for executing the TC ***");
                        setverdict(inconc);
                        stop;
                    }
                    
                    activate(a_receiveAnyLsReply());
                    
                    f_TP_GEONW_PON_LOT_BV_03_pre_2(
                        m_geoNwLsRequestPacket(
                            vc_localSeqNumber,
                            f_getIutGnLocalAddress()
                        )
                    );
                    
                    f_TP_GEONW_PON_LOT_BV_03_main(v_longPosVectorNode);
                    
                } // end f_GEONW_PON_LOT_BV_03_07
                
                /**
                 * @desc    TP Function for TC_GEONW_PON_LOT_BV_03_08
                 */
                function f_GEONW_PON_LOT_BV_03_08() runs on ItsGeoNetworking {
                    
                    // Local variables
                    var LongPosVector v_longPosVectorNode := f_TP_GEONW_PON_LOT_BV_03_pre_1(c_compNodeA);

                    // Test control
                    if (not PICS_GN_LS_REP_DST) {
                        log("*** " & testcasename() & ": PICS_GN_LS_REP_DST required for executing the TC ***");
                        setverdict(inconc);
                        stop;
                    }
                                        
                    f_TP_GEONW_PON_LOT_BV_03_pre_2(
                        m_geoNwLsReplyPacket(
                            f_getIutShortPosVector(),
                            vc_localSeqNumber
                        )
                    );
                    
                    f_TP_GEONW_PON_LOT_BV_03_main(v_longPosVectorNode);
                    
                } // end f_GEONW_PON_LOT_BV_03_08
                
                /**
                 * @desc    Function including first preamble part (TC_GEONW_PON_LOT_BV_03)
                 */
                function f_TP_GEONW_PON_LOT_BV_03_pre_1(in charstring p_nodeName) runs on ItsGeoNetworking return LongPosVector {
                    var LongPosVector v_longPosVectorNode;
                    
                    // Test control
                    
                    // Test component configuration
                    f_cf01Up();
                    v_longPosVectorNode := f_getPosition(p_nodeName);
                    
                    // Test adapter configuration
                    
                    // Preamble part I
                    if(p_nodeName == c_compNodeA) {
                        f_prNeighbour();
                    }
                    else {
						f_prNonNeighbour();
                    }
                    return v_longPosVectorNode;
                } // end f_TP_GEONW_PON_LOT_BV_03_pre_1
                
                /**
                 * @desc    Function including second preamble part (TC_GEONW_PON_LOT_BV_03)
                 */
                function f_TP_GEONW_PON_LOT_BV_03_pre_2(in template (value) GnNonSecuredPacket p_packet) runs on ItsGeoNetworking {
                    
                    //preamble part II
                    f_sendGeoNetMessage(
                        m_geoNwReq_linkLayerBroadcast(m_geoNwPdu(p_packet, -, c_hopLimit1))
                    );
                    f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                } // end f_TP_GEONW_PON_LOT_BV_03_pre_2
                
                /**
                 * @desc    Function including test body and postamble part (TC_GEONW_PON_LOT_BV_03)
                 */
                function f_TP_GEONW_PON_LOT_BV_03_main(in template (value) LongPosVector p_longPosVectorNode) runs on ItsGeoNetworking {
                    if ( not  f_utTriggerEvent(m_generateGeoUnicastMessage(valueof(p_longPosVectorNode.gnAddr))) ) {
                        log("*** " & testcasename() & ": INCONC: Trigger failed ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
                    }
                    
                    tc_ac.start;
                    alt {
                        [] a_receiveAnyLsRequest() {
                            tc_ac.stop;
                            log("*** " & testcasename() & ": FAIL: Received Location Service Request ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                        }
                        [] a_receiveGeoUnicastWithDestination(mw_shortPosVectorPosition(f_longPosVector2ShortPosVector(valueof(p_longPosVectorNode)))) {
                            tc_ac.stop;
                            log("*** " & testcasename() & ": PASS: GUC packet received correctly ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                        }
                        [] tc_ac.timeout {
                            log("*** " & testcasename() & ": INCONC: Expected message not received ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
                        }
                    }
                        
                    // Postamble
                    f_poNeighbour();
                    f_cf01Down();
                    
                } // end f_TP_GEONW_PON_LOT_BV_03_main
                
            } //end GEONW_PON_LOT_BV_03
            
            /**
             * @desc    TP Function for TC_GEONW_PON_LOT_BV_04
             */
            function f_GEONW_PON_LOT_BV_04() runs on ItsGeoNetworking {
                
                // Local variables
                var LongPosVector v_longPosVectorNodeB;
                var LongPosVector v_longPosVectorIut;
                
                // Test control
                if (not PICS_GN_LS_REQ_SRC) {
                    log("*** " & testcasename() & ": PICS_GN_LS_REQ_SRC required for executing the TC ***");
                    setverdict(inconc);
                    stop;
                }
                 
                // Test component configuration
                f_cf01Up();
                v_longPosVectorNodeB := f_getPosition(c_compNodeB);
                
                // Preamble
                f_prDefault(); // NodeB will send Beacon only once
                f_sendGeoNetMessage(m_geoNwReq_linkLayerBroadcast(m_geoNwPdu(m_geoNwBeaconPacket(f_getPosition(c_compNodeB)), -, c_hopLimit1)));
                f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                
                // Test Body
                f_sleep(f_getLifetimeLocTableEntry() + PX_T_DELTA);
                if ( not  f_utTriggerEvent(m_generateGeoUnicastMessage(v_longPosVectorNodeB.gnAddr)) ) {
                    log("*** " & testcasename() & ": INCONC: Trigger failed ***");
                    f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
                }
                
                tc_ac.start;
                alt {
                    [] a_receiveLsRequest(?, v_longPosVectorNodeB.gnAddr.mid, v_longPosVectorIut ) {
                        log("*** " & testcasename() & ": PASS: LS Request received correctly ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: LS Request not received ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
                    }
                }
                
                // Postamble
                f_poDefault();
                f_cf01Down();
                
            } // end f_GEONW_PON_LOT_BV_04
            
            group GEONW_PON_LOT_BV_05 {
                
                /**
                 * @desc    TP Function for TC_GEONW_PON_LOT_BV_05_01
                 */
                function f_GEONW_PON_LOT_BV_05_01() runs on ItsGeoNetworking {
                    
                    // Local variables
                    var LongPosVector v_longPosVectorNodeB;
                    var LongPosVector v_obsoleteLongPosVectorNodeB;
                
                    // Test control
                    if (not PICS_GN_GUC_DST) {
                        log("*** " & testcasename() & ": PICS_GN_GUC_DST required for executing the TC ***");
                        setverdict(inconc);
                        stop;
                    }
                     
                    f_TP_GEONW_PON_LOT_BV_05_pre_1(v_longPosVectorNodeB, v_obsoleteLongPosVectorNodeB);
                    
                    f_TP_GEONW_PON_LOT_BV_05_pre_2(
                        m_geoNwUnicastPacket(
                            v_obsoleteLongPosVectorNodeB,
                            f_getIutShortPosVector(),
                            vc_localSeqNumber
                        )
                    );
                    
                    f_TP_GEONW_PON_LOT_BV_05_main(v_longPosVectorNodeB, v_obsoleteLongPosVectorNodeB);
                    
                } // end f_GEONW_PON_LOT_BV_05_01
                
                /**
                 * @desc    TP Function for TC_GEONW_PON_LOT_BV_05_02
                 */
                function f_GEONW_PON_LOT_BV_05_02() runs on ItsGeoNetworking {
                    
                    // Local variables
                    var LongPosVector v_longPosVectorNodeB;
                    var LongPosVector v_obsoleteLongPosVectorNodeB;
                
                    // Test control
                    if (not PICS_GN_GAC_DST) {
                        log("*** " & testcasename() & ": PICS_GN_GAC_DST required for executing the TC ***");
                        setverdict(inconc);
                        stop;
                    }
                    
                    f_TP_GEONW_PON_LOT_BV_05_pre_1(v_longPosVectorNodeB, v_obsoleteLongPosVectorNodeB);
                    
                    f_TP_GEONW_PON_LOT_BV_05_pre_2(
                        m_geoNwAnycastPacket(
                            v_obsoleteLongPosVectorNodeB,
                            vc_localSeqNumber,
                            f_getGeoAnycastArea(c_area1)
                        )
                    );
                    
                    f_TP_GEONW_PON_LOT_BV_05_main(v_longPosVectorNodeB, v_obsoleteLongPosVectorNodeB);
                    
                } // end f_GEONW_PON_LOT_BV_05_02
                
                /**
                 * @desc    TP Function for TC_GEONW_PON_LOT_BV_05_03
                 */
                function f_GEONW_PON_LOT_BV_05_03() runs on ItsGeoNetworking {
                    
                    // Local variables
                    var LongPosVector v_longPosVectorNodeB;
                    var LongPosVector v_obsoleteLongPosVectorNodeB;
                
                    // Test control
                    if (not PICS_GN_GBC_DST) {
                        log("*** " & testcasename() & ": PICS_GN_GBC_DST required for executing the TC ***");
                        setverdict(inconc);
                        stop;
                    }
                    
                    f_TP_GEONW_PON_LOT_BV_05_pre_1(v_longPosVectorNodeB, v_obsoleteLongPosVectorNodeB);
                    
                    f_TP_GEONW_PON_LOT_BV_05_pre_2(
                        m_geoNwBroadcastPacket(
                            v_obsoleteLongPosVectorNodeB,
                            vc_localSeqNumber,
                            f_getGeoBroadcastArea(c_area1)
                        )
                    );
                    
                    f_TP_GEONW_PON_LOT_BV_05_main(v_longPosVectorNodeB, v_obsoleteLongPosVectorNodeB);
                    
                } // end f_GEONW_PON_LOT_BV_05_03
                
                /**
                 * @desc    TP Function for TC_GEONW_PON_LOT_BV_05_04
                 */
                function f_GEONW_PON_LOT_BV_05_04() runs on ItsGeoNetworking {
                    
                    // Local variables
                    var LongPosVector v_longPosVectorNodeB;
                    var LongPosVector v_obsoleteLongPosVectorNodeB;
                
                    // Test control
                    if (not PICS_GN_TSB_DST) {
                        log("*** " & testcasename() & ": PICS_GN_TSB_DST required for executing the TC ***");
                        setverdict(inconc);
                        stop;
                    }
                    
                    f_TP_GEONW_PON_LOT_BV_05_pre_1(v_longPosVectorNodeB, v_obsoleteLongPosVectorNodeB);
                    
                    f_TP_GEONW_PON_LOT_BV_05_pre_2(
                        m_geoNwTsbPacket(
                            vc_localSeqNumber,
                            v_obsoleteLongPosVectorNodeB
                        )
                    );
                    
                    f_TP_GEONW_PON_LOT_BV_05_main(v_longPosVectorNodeB, v_obsoleteLongPosVectorNodeB);
                    
                } // end f_GEONW_PON_LOT_BV_05_04
                
                /**
                 * @desc    TP Function for TC_GEONW_PON_LOT_BV_05_05
                 */
                function f_GEONW_PON_LOT_BV_05_05() runs on ItsGeoNetworking {
                    
                    // Local variables
                    var LongPosVector v_longPosVectorNodeB;
                    var LongPosVector v_obsoleteLongPosVectorNodeB;
                
                    // Test control
                    if (not PICS_GN_SHB_DST) {
                        log("*** " & testcasename() & ": PICS_GN_SHB_DST required for executing the TC ***");
                        setverdict(inconc);
                        stop;
                    }
                    
                    f_TP_GEONW_PON_LOT_BV_05_pre_1(v_longPosVectorNodeB, v_obsoleteLongPosVectorNodeB);
                    
                    f_TP_GEONW_PON_LOT_BV_05_pre_2(
                        m_geoNwShbPacket(
                            v_obsoleteLongPosVectorNodeB
                        )
                    );
                    
                    f_TP_GEONW_PON_LOT_BV_05_main(v_longPosVectorNodeB, v_obsoleteLongPosVectorNodeB);
                    
                } // end f_GEONW_PON_LOT_BV_05_05
                
                /**
                 * @desc    TP Function for TC_GEONW_PON_LOT_BV_05_06
                 */
                function f_GEONW_PON_LOT_BV_05_06() runs on ItsGeoNetworking {
                    
                    // Local variables
                    var LongPosVector v_longPosVectorNodeB;
                    var LongPosVector v_obsoleteLongPosVectorNodeB;
                
                    // Test control
                    if (not PICS_GN_LS_REQ_DST) {
                        log("*** " & testcasename() & ": PICS_GN_LS_REQ_DST required for executing the TC ***");
                        setverdict(inconc);
                        stop;
                    }
                    
                    f_TP_GEONW_PON_LOT_BV_05_pre_1(v_longPosVectorNodeB, v_obsoleteLongPosVectorNodeB);
                    
                    activate(a_receiveAnyLsReply());
                    
                    f_TP_GEONW_PON_LOT_BV_05_pre_2(
                        m_geoNwLsRequestPacket(
                            v_obsoleteLongPosVectorNodeB,
                            vc_localSeqNumber,
                            f_getIutGnLocalAddress()
                        )
                    );
                    
                    f_TP_GEONW_PON_LOT_BV_05_main(v_longPosVectorNodeB, v_obsoleteLongPosVectorNodeB);
                    
                } // end f_GEONW_PON_LOT_BV_05_06
                
                /**
                 * @desc    TP Function for TC_GEONW_PON_LOT_BV_05_07
                 */
                function f_GEONW_PON_LOT_BV_05_07() runs on ItsGeoNetworking {
                    
                    // Local variables
                    var LongPosVector v_longPosVectorNodeB;
                    var LongPosVector v_obsoleteLongPosVectorNodeB;
                
                    // Test control
                    if (not PICS_GN_LS_REQ_DST) {
                        log("*** " & testcasename() & ": PICS_GN_LS_REQ_DST required for executing the TC ***");
                        setverdict(inconc);
                        stop;
                    }
                    
                    f_TP_GEONW_PON_LOT_BV_05_pre_1(v_longPosVectorNodeB, v_obsoleteLongPosVectorNodeB);
                    
                    f_TP_GEONW_PON_LOT_BV_05_pre_2(
                        m_geoNwLsReplyPacket(
                            v_obsoleteLongPosVectorNodeB,
                            f_getIutShortPosVector(),
                            vc_localSeqNumber
                        )
                    );
                    
                    f_TP_GEONW_PON_LOT_BV_05_main(v_longPosVectorNodeB, v_obsoleteLongPosVectorNodeB);
                    
                } // end f_GEONW_PON_LOT_BV_05_07
                
                /**
                 * @desc    Function including first preamble part (TC_GEONW_PON_LOT_BV_05)
                 */
                function f_TP_GEONW_PON_LOT_BV_05_pre_1(out LongPosVector p_longPosVectorNodeB, out LongPosVector p_obsoleteLongPosVectorNodeB) runs on ItsGeoNetworking {
                    
                    // Local variables
                    
                    // Test control
                    
                    // Test component configuration
                    f_cf01Up();
                    p_longPosVectorNodeB := f_getPosition(c_compNodeB);
                    p_obsoleteLongPosVectorNodeB := p_longPosVectorNodeB;
                    p_obsoleteLongPosVectorNodeB.timestamp_ := p_obsoleteLongPosVectorNodeB.timestamp_ - 1000;
                    p_obsoleteLongPosVectorNodeB.latitude := p_obsoleteLongPosVectorNodeB.latitude - 1;
                    
                    // Test adapter configuration
                    
                    // Preamble
                    f_prDefault();
                    
                    // Act as a neighbor and send one beacon
                    f_sendGeoNetMessage(m_geoNwReq_linkLayerBroadcast(m_geoNwPdu(m_geoNwBeaconPacket(f_getPosition(c_compNodeB)), -, c_hopLimit1)));
                } // end f_TP_GEONW_PON_LOT_BV_05_pre_1
                
                /**
                 * @desc    Function including second preamble part (TC_GEONW_PON_LOT_BV_05)
                 */
                function f_TP_GEONW_PON_LOT_BV_05_pre_2(in template (value) GnNonSecuredPacket p_packet) runs on ItsGeoNetworking {
                    
                    //preamble part II
                    f_sendGeoNetMessage(
                        m_geoNwReq_linkLayerBroadcast(m_geoNwPdu(p_packet))
                    );
                    f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                } // end f_TP_GEONW_PON_LOT_BV_05_pre_2
                
                /**
                 * @desc    Function including test body and postamble part (TC_GEONW_PON_LOT_BV_05)
                 */
                function f_TP_GEONW_PON_LOT_BV_05_main(in template (value) LongPosVector p_longPosVectorNodeB, in template (value) LongPosVector p_obsoleteLongPosVectorNodeB) runs on ItsGeoNetworking {
                    
                    // Test Body
                    if ( not  f_utTriggerEvent(m_generateGeoUnicastMessage(valueof(p_longPosVectorNodeB.gnAddr)))) {
                        log("*** " & testcasename() & ": INCONC: Trigger failed ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
                    }
                    
                    tc_ac.start;
                    alt {
                        [] a_receiveAnyLsRequest() {
                            tc_ac.stop;
                            log("*** " & testcasename() & ": FAIL: Received Location Service Request ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                        }
                        [] a_receiveGeoUnicastWithDestination(mw_shortPosVectorPosition(f_longPosVector2ShortPosVector(valueof(p_obsoleteLongPosVectorNodeB)))) {
                            tc_ac.stop;
                            log("*** " & testcasename() & ": FAIL: GN packet received with obsolete Destination Position Vector ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                        }
                        [] a_receiveGeoUnicastWithDestination(mw_shortPosVectorPosition(f_longPosVector2ShortPosVector(valueof(p_longPosVectorNodeB)))) {
                            tc_ac.stop;
                            log("*** " & testcasename() & ": PASS: GN packet packet received correctly ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                        }
                        [] tc_ac.timeout {
                            log("*** " & testcasename() & ": INCONC: Expected message not received ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
                        }
                    }
                    
                    // Postamble
                    f_poDefault();
                    f_cf01Down();
                    
                } // end f_TP_GEONW_PON_LOT_BV_05_main
                
            } // end group GEONW_PON_LOT_BV_05
            
        } // end geoLocationTable
        
        // 6.2.2.2
        group geoLocalPositionVector {
            
            /**
             * @desc    TP Function for TC_GEONW_PON_LPV_BV_01
             */
            function f_GEONW_PON_LPV_BV_01() runs on ItsGeoNetworking {
                
                // Local variables
                var LongPosVector v_longPosVectorIut;
                var template LongPosVector v_previouslongPosVectorIut;
                var GeoNetworkingInd v_geoNwInd;
                
                // Test control
                if (not PICS_GN_BEACON_SRC) {
                    log("*** " & testcasename() & ": PICS_GN_BEACON_SRC required for executing the TC ***");
                    setverdict(inconc);
                    stop;
                }
                
                // Test component configuration
                f_cf01Up();//FIXME ac change position, not used by C2C
                v_longPosVectorIut := f_getPosition(c_compIut);
                v_previouslongPosVectorIut := v_longPosVectorIut;
                v_previouslongPosVectorIut.timestamp_ := ?;
                
                // Test adapter configuration
                
                // Preamble
                f_prNeighbour();
                f_acTriggerEvent(m_startPassBeaconing(m_beaconHeader(v_longPosVectorIut).beaconHeader));
                tc_ac.start;
                alt {
                    [] geoNetworkingPort.receive(mw_geoNwInd(mw_geoNwPdu(
                            mw_geoNwBeaconPacket(
                                mw_longPosVectorAny(v_longPosVectorIut.gnAddr)
                            )
                        ))) -> value v_geoNwInd {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": Pre-conditions: Beacon received ***");
                        v_longPosVectorIut := v_geoNwInd.msgIn.gnPacket.packet.extendedHeader.beaconHeader.srcPosVector;
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": Pre-conditions: Expected message not received ***");
                        f_selfOrClientSyncAndVerdict(c_prDone, e_timeout);
                    }
                }
                f_utChangePosition();
                f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                
                // Test Body
                geoNetworkingPort.clear;
                tc_ac.start;
                alt {
                    [] geoNetworkingPort.receive(mw_geoNwInd(mw_geoNwPdu(
                            mw_geoNwBeaconPacket(
                                mw_longPosVectorAny(v_longPosVectorIut.gnAddr)
                            )
                        ))) -> value v_geoNwInd {
                        tc_ac.stop;
                        //check if the position vector has changed
                        if (match(v_geoNwInd.msgIn.gnPacket.packet.extendedHeader.beaconHeader.srcPosVector, v_previouslongPosVectorIut)) {
                            log("*** " & testcasename() & ": FAIL: Sender Postion Vector not correctly updated ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                        }
                        else {
                            log("*** " & testcasename() & ": PASS: Sender Postion Vector correctly updated ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                        }
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: Expected message not received ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
                    }
                }
                f_acTriggerEvent(m_stopPassBeaconing);
                
                // Postamble
                f_poNeighbour();
                f_cf01Down();
                
            } // end f_GEONW_PON_LPV_BV_01
            
        } // end geoLocalPositionVector
        
        // 6.2.2.3
        group geoSequenceNumber {
            
            /**
             * @desc    TP Function for TC_GEONW_PON_SQN_BV_01
             */
            function f_GEONW_PON_SQN_BV_01() runs on ItsGeoNetworking {
                
                // Local variables
                var UInt16 v_expectedSequenceNumber := 0;
                var LongPosVector v_longPosVectorIut;
                
                // Test control
                if (not PICS_GN_GBC_SRC) {
                    log("*** " & testcasename() & ": PICS_GN_GBC_SRC required for executing the TC ***");
                    setverdict(inconc);
                    stop;
                }
                
                // Test component configuration
                f_cf01Up();
                v_longPosVectorIut := f_getPosition(c_compIut);
                
                // Test adapter configuration
                
                // Preamble
                f_prNeighbour();
                f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                
                // Test Body
                if ( not  f_utTriggerEvent(m_generateGeoBroadcastMessage(f_getArea(c_area1))) ) {
                    log("*** " & testcasename() & ": INCONC: Trigger failed ***");
                    f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
                }
                
                tc_ac.start;
                alt {
                    [] a_receiveGeoBroadcast(
garciay's avatar
garciay committed
                        mw_longPosVectorPosition(v_longPosVectorIut),
                        v_expectedSequenceNumber) {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": PASS: GBC packet received correctly ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                    }
                    [] a_receiveGeoBroadcast(
garciay's avatar
garciay committed
                    mw_longPosVectorPosition(v_longPosVectorIut),
                    v_expectedSequenceNumber) {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": FAIL: GBC packet received with incorrect sequence number ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: Expected message not received ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
                    }
                }
                
                // Postamble
                f_poNeighbour();
                f_cf01Down();
                
            } // end f_GEONW_PON_SQN_BV_01
            
            /**
             * @desc    TP Function for TC_GEONW_PON_SQN_BV_02
             */
            function f_GEONW_PON_SQN_BV_02() runs on ItsGeoNetworking {
                
                // Local variables
                var UInt16 v_expectedSequenceNumber := 0;
                var integer v_nbReceivedPackets := 0;
                var GeoNetworkingInd v_geoNwInd;
                var LongPosVector v_longPosVectorIut;
                
                // Test control
                if (not PICS_GN_GBC_SRC) {
                    log("*** " & testcasename() & ": PICS_GN_GBC_SRC required for executing the TC ***");
                    setverdict(inconc);
                    stop;
                }
                
                // Test component configuration
                f_cf01Up();
                v_longPosVectorIut := f_getPosition(c_compIut);
                
                // Test adapter configuration
                
                // Preamble
                f_prNeighbour();
                f_sleep(10.0);
                // receive first packet
                if ( not  f_utTriggerEvent(m_generateGeoBroadcastMessage(f_getArea(c_area1))) ) {
                    log("*** " & testcasename() & ": INCONC: Trigger failed ***");
                    f_selfOrClientSyncAndVerdict(c_prDone, e_timeout);
                }
                tc_ac.start;
                alt {
                    
                    [] geoNetworkingPort.receive(mw_geoNwInd(mw_geoNwPdu(mw_geoNwBroadcastPacket(
garciay's avatar
garciay committed
                        mw_longPosVectorPosition(v_longPosVectorIut),
                        ?
                    )))) -> value v_geoNwInd {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": Pre-conditions: First GUC packet received  ***");
                        v_expectedSequenceNumber := v_geoNwInd.msgIn.gnPacket.packet.extendedHeader.geoBroadcastHeader.seqNumber + 1;
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": Pre-conditions: Expected message not received ***");
                        f_selfOrClientSyncAndVerdict(c_prDone, e_timeout);
                    }
                }
                f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                
                // Test Body
                if ( not  f_utTriggerEvent(m_generateGeoBroadcastMessage(f_getArea(c_area1))) ) {
                    log("*** " & testcasename() & ": INCONC: Trigger failed ***");
                    f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
                }
                tc_ac.start;
                alt {
                    [] a_receiveGeoBroadcast(
garciay's avatar
garciay committed
                        mw_longPosVectorPosition(v_longPosVectorIut),
                        v_expectedSequenceNumber) {
                        tc_ac.stop;
                        v_nbReceivedPackets := v_nbReceivedPackets + 1;
                        if(v_nbReceivedPackets >= vc_multipleMessagesCount) {
                            log("*** " & testcasename() & ": PASS: GBC packets received with correct sequence numbers ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                        }
                        else {
                            v_expectedSequenceNumber := v_expectedSequenceNumber + 1;
				            if ( not  f_utTriggerEvent(m_generateGeoBroadcastMessage(f_getArea(c_area1))) ) {
				                log("*** " & testcasename() & ": INCONC: Trigger failed ***");
				                f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
				            }
                            tc_ac.start;
                            repeat;
                        }
                    }
                    [] a_receiveGeoBroadcast(
garciay's avatar
garciay committed
                        mw_longPosVectorPosition(v_longPosVectorIut),
2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409
                        ?) {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": FAIL: GBC packet received with incorrect sequence number ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: Expected message not received ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
                    }
                }
                
                // Postamble
                f_poNeighbour();
                f_cf01Down();
                
            } // end f_GEONW_PON_SQN_BV_02
        
        } // end geoSequenceNumber
        
        // 6.2.2.4
        group geoLocationService {
            
            /**
             * @desc    TP Function for TC_GEONW_PON_LOS_BV_01
             */
            function f_GEONW_PON_LOS_BV_01() runs on ItsGeoNetworking {
                
                // Local variables
                var LongPosVector v_longPosVectorIut;
                var GN_Address v_gnAddressNodeA;
                
                // Test control
                if (not PICS_GN_LS_REQ_SRC) {
                    log("*** " & testcasename() & ": PICS_GN_LS_REQ_SRC required for executing the TC ***");
                    setverdict(inconc);
                    stop;
                }
                
                // Test component configuration
                f_cf01Up();
                v_gnAddressNodeA := f_getPosition(c_compNodeA).gnAddr;
                
                // Test adapter configuration
                
                // Preamble
                f_prNeighbour();
                f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                
                // Test Body
                if ( not  f_utTriggerEvent(m_generateGeoUnicastMessage(v_gnAddressNodeA)) ) {
                    log("*** " & testcasename() & ": INCONC: Trigger failed ***");
                    f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
                }
                
                tc_ac.start;
                alt {
                    [] a_receiveLsRequest(
                            ?,
                            v_gnAddressNodeA.mid,
                            v_longPosVectorIut
                        ) {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": PASS: LS Request received correctly ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                    }
                    [] a_receiveAnyLsRequest() {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": FAIL: LS Request does not contain GN Address of nodeA ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: Expected message not received ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
                    }
                }
                
                // Postamble
                f_poNeighbour();
                f_cf01Down();
                
            } // end f_GEONW_PON_LOS_BV_01
            
            /**
             * @desc    TP Function for TC_GEONW_PON_LOS_BV_02
             */
            function f_GEONW_PON_LOS_BV_02() runs on ItsGeoNetworking {
                
                // Local variables
                var LongPosVector v_longPosVectorIut;
                var GN_Address v_gnAddressNodeA;
                
                // Test control
                if (not PICS_GN_LS_REQ_SRC) {
                    log("*** " & testcasename() & ": PICS_GN_LS_REQ_SRC required for executing the TC ***");
                    setverdict(inconc);
                    stop;
                }
                
                // Test component configuration
                f_cf01Up();
                v_gnAddressNodeA := f_getPosition(c_compNodeA).gnAddr;
                
                // Test adapter configuration
                
                // Preamble
                f_prNeighbour();
                if ( not  f_utTriggerEvent(m_generateGeoUnicastMessage(v_gnAddressNodeA)) ) {
                    log("*** " & testcasename() & ": INCONC: Trigger failed ***");
                    f_selfOrClientSyncAndVerdict(c_prDone, e_timeout);
                }
                tc_ac.start;
                alt {
                    [] a_receiveLsRequest(?, v_gnAddressNodeA.mid, v_longPosVectorIut) {
                        tc_ac.stop;
                        //start retransmission timer
                        tc_ac.start(f_getLsRetransmitTimer() - f_getDeltaTimer());
                    }
                }
                f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                
                // Test Body
                 if ( not  f_utTriggerEvent(m_generateGeoUnicastMessage(v_gnAddressNodeA)) ) {
                    log("*** " & testcasename() & ": INCONC: Trigger failed ***");
                    f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
                }
                
                alt {                    
                    [] a_receiveLsRequest(?, v_gnAddressNodeA.mid, v_longPosVectorIut) {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": Second LS_REQUEST received ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": No second LS_REQUEST received ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                    }
                }
                
                // Postamble
                f_poNeighbour();
                f_cf01Down();
                
            } // end f_GEONW_PON_LOS_BV_02
            
            /**
             * @desc    TP Function for TC_GEONW_PON_LOS_BV_03
             */
            function f_GEONW_PON_LOS_BV_03() runs on ItsGeoNetworking {
                
                // Local variables
                var LongPosVector v_longPosVectorNodeA;
                var LongPosVector v_longPosVectorIut;
                var GeoNetworkingInd v_geoNetInd;
                
                // Test control
                if (not PICS_GN_LS_REQ_SRC or not PICS_GN_LS_REP_DST) {
                    log("*** " & testcasename() & ": PICS_GN_LS_REQ_SRC AND PICS_GN_LS_REP_DST required for executing the TC ***");
                    setverdict(inconc);
                    stop;
                }
                 
                // Test component configuration
                f_cf01Up();
                v_longPosVectorNodeA := f_getPosition(c_compNodeA);
                
                // Test adapter configuration
                
                // Preamble
                f_prNeighbour();
                 if ( not f_utTriggerEvent(m_generateGeoUnicastMessage(v_longPosVectorNodeA.gnAddr)) ) {
                    log("*** " & testcasename() & ": INCONC: Trigger failed ***");
                    f_selfOrClientSyncAndVerdict(c_prDone, e_timeout);
                }
                tc_ac.start;
                alt {
                    [] a_receiveLsRequest(?, v_longPosVectorNodeA.gnAddr.mid, v_longPosVectorIut) {
                        tc_ac.stop;
                    }
                }
                f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                
                // Test Body
                f_sendGeoNetMessage(
                    m_geoNwReq_linkLayerBroadcast(
                        m_geoNwPdu(
                            m_geoNwLsReplyPacket(
                                v_longPosVectorNodeA,
                                f_longPosVector2ShortPosVector(v_longPosVectorIut),
                                vc_localSeqNumber
                            )
                        )
                    )
                );
                
                tc_ac.start;
                alt {
                    
                    [] geoNetworkingPort.receive(
                            mw_geoNwInd(
                                mw_geoNwPdu(
                                    mw_geoNwUnicastPacket(
                                        mw_shortPosVectorPosition(f_longPosVector2ShortPosVector(v_longPosVectorNodeA)),
                                        ?
                                    )
                                )
                            )
                        ) -> value v_geoNetInd {
                        tc_ac.stop;
                        //we only check that the lifetime is less than the default lifetime due to
                        //we do not know exactly the time passed at IUT
                        if (f_getLifetimeValue(v_geoNetInd.msgIn.basicHeader.lifeTime)<f_getMaxPacketLifeTime()) {
                            log("*** " & testcasename() & ": Lifetime was handled properly ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                        }
                        else {
                            log("*** " & testcasename() & ": Lifetime was not handled properly ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                        }
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": Expected message not received ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
                    }
                    
                }
                
                // Postamble
                f_poNeighbour();
                f_cf01Down();
                
            } // end f_GEONW_PON_LOS_BV_03
            
            /**
             * @desc    TP Function for TC_GEONW_PON_LOS_BV_04
             */
            function f_GEONW_PON_LOS_BV_04() runs on ItsGeoNetworking {
                
                // Local variables
                var LongPosVector v_longPosVectorNodeA;
                var LongPosVector v_longPosVectorIut;
                var octetstring v_payload1 := char2oct("PAYLOAD_1");
                var octetstring v_payload2 := char2oct("PAYLOAD_2");
                var boolean v_msg1Received := false;
                var boolean v_msg2Received := false;
                var boolean v_firstLsRequestReceived := false;
                
                // Test control
                if (not PICS_GN_LS_REQ_SRC or not PICS_GN_LS_REP_DST) {
                    log("*** " & testcasename() & ": PICS_GN_LS_REQ_SRC AND PICS_GN_LS_REP_DST required for executing the TC ***");
                    setverdict(inconc);
                    stop;
                }
                   
                // Test component configuration
                f_cf01Up();
                v_longPosVectorNodeA := f_getPosition(c_compNodeA);
                
                // Test adapter configuration
                
                // Preamble
                f_prNeighbour();
                
                 if ( not f_utTriggerEvent(m_generateGeoUnicastMessageWithPayload(v_longPosVectorNodeA.gnAddr, v_payload1)) ) {
                    log("*** " & testcasename() & ": INCONC: Trigger failed ***");
                    f_selfOrClientSyncAndVerdict(c_prDone, e_timeout);
                }
                
                tc_ac.start;
                alt {
                    [] a_receiveLsRequest(?, v_longPosVectorNodeA.gnAddr.mid, v_longPosVectorIut) {
                        if ( v_firstLsRequestReceived == true ) {
                            log("*** " & testcasename() & ": Second LsRequest received ***");
                            tc_ac.stop;
                            f_sendGeoNetMessage ( m_geoNwReq_linkLayerBroadcast(
                                                    m_geoNwPdu (
                                                        m_geoNwLsReplyPacket(
                                                            v_longPosVectorNodeA,
                                                            f_longPosVector2ShortPosVector(v_longPosVectorIut),
                                                            vc_localSeqNumber ) ) ) );
                            f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                        }
                        else {
                            log("*** " & testcasename() & ": First LsRequest received ***");
                            v_firstLsRequestReceived := true;
                            if ( not f_utTriggerEvent(m_generateGeoUnicastMessageWithPayload(v_longPosVectorNodeA.gnAddr, v_payload2)) ) {
                                log("*** " & testcasename() & ": INCONC: Trigger failed ***");
                                f_selfOrClientSyncAndVerdict(c_prDone, e_timeout);
                            }
                            tc_ac.start;
                            repeat;
                        }
                    }
                    [] tc_ac.timeout{
                        log("*** " & testcasename() & ": Pre-conditions: Expected message not received ***");
                        f_selfOrClientSyncAndVerdict(c_prDone, e_timeout);
                    }
                }
                
                // Test Body
                tc_ac.start;
                alt {
                    [] geoNetworkingPort.receive(
                        f_receiveGeoNetMessageWithPayload(
                            mw_geoNwInd(
                                mw_geoNwPdu(
                                    mw_geoNwUnicastPacket(
                                        mw_shortPosVectorPosition(f_longPosVector2ShortPosVector(v_longPosVectorNodeA)),
                                        ?
                                    )
                                )
                            ),
                            f_adaptPayload_mw(v_payload1)
                        )
                    ) {
                        v_msg1Received := true;
                        if ( v_msg2Received ) {
                            log("*** " & testcasename() & ": FAIL: Messages received in incorrect order ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                        }
                        else {
                            log("*** " & testcasename() & ": First Message received ***");
                            repeat;
                        }
                    }
                    [] geoNetworkingPort.receive(
                        f_receiveGeoNetMessageWithPayload(
                            mw_geoNwInd(
                                mw_geoNwPdu(
                                    mw_geoNwUnicastPacket(
                                        mw_shortPosVectorPosition(f_longPosVector2ShortPosVector(v_longPosVectorNodeA)),
                                        ?
                                    )
                                )
                            ),
                            f_adaptPayload_mw(v_payload2)
                        )
                    ) {
                        v_msg2Received := true;
                        if ( v_msg1Received ) {
                            log("*** " & testcasename() & ": PASS: Messages received in correct order ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                        }
                        else {
                            log("*** " & testcasename() & ": Second Message received ***");
                            repeat;
                        }
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": Expected messages not received ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
                    }
                }
                
                // Postamble
                f_poNeighbour();
                f_cf01Down();
                
            } // end f_GEONW_PON_LOS_BV_04
            
            /**
             * @desc    TP Function for TC_GEONW_PON_LOS_BV_05
             */
            function f_GEONW_PON_LOS_BV_05() runs on ItsGeoNetworking {
                
                // Local variables
                var LongPosVector v_longPosVectorNodeA;
                var LongPosVector v_longPosVectorIut;
                var octetstring v_payload1 := char2oct("PAYLOAD_1");
                var octetstring v_payload2 := char2oct("PAYLOAD_2");
                
                // Test control
                if (not PICS_GN_LS_REQ_SRC) {
                    log("*** " & testcasename() & ": PICS_GN_LS_REQ_SRC required for executing the TC ***");
                    setverdict(inconc);
                    stop;
                }
                   
                // Test component configuration
                f_cf01Up();
                v_longPosVectorNodeA := f_getPosition(c_compNodeA);
                
                // Test adapter configuration
                
                // Preamble
                f_prNeighbour();
                
                 if ( not f_utTriggerEvent(m_generateGeoUnicastMessageWithPayload(v_longPosVectorNodeA.gnAddr, v_payload1)) ) {
                    log("*** " & testcasename() & ": INCONC: Trigger failed ***");
                    f_selfOrClientSyncAndVerdict(c_prDone, e_timeout);
                }
                 if ( not f_utTriggerEvent(m_generateGeoUnicastMessageWithPayload(v_longPosVectorNodeA.gnAddr, v_payload2)) ) {
                    log("*** " & testcasename() & ": INCONC: Trigger failed ***");
                    f_selfOrClientSyncAndVerdict(c_prDone, e_timeout);
                }
                
                tc_ac.start;
                alt {
                    [] a_receiveLsRequest(?, v_longPosVectorNodeA.gnAddr.mid, v_longPosVectorIut) {
                        tc_ac.stop;
                        f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                        //start retransmission timer
                        tc_ac.start(int2float(c_defaultLifetime) + f_getDeltaTimer());
2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735
                    }
                    [] tc_ac.timeout{
                        log("*** " & testcasename() & ": Pre-conditions: Expected message not received ***");
                        f_selfOrClientSyncAndVerdict(c_prDone, e_timeout);
                    }
                }
                
                // Test Body
                // Awaiting expiration of LT
                alt {
                    [] tc_ac.timeout {
                        // LT expired
                    }
                    [] a_receiveLsRequest(?, v_longPosVectorNodeA.gnAddr.mid, v_longPosVectorIut) {
                        // retransmitted LS_REQUEST
                        repeat;
                    }
                }
                
                f_sendGeoNetMessage(
                    m_geoNwReq_linkLayerBroadcast(
                        m_geoNwPdu(
                            m_geoNwLsReplyPacket(
                                v_longPosVectorNodeA,
                                f_longPosVector2ShortPosVector(v_longPosVectorIut),
                                vc_localSeqNumber
                            )
                        )
                    )
                );
                
                // Check for messages send to Tester
                tc_noac.start;
                alt {
                    [] geoNetworkingPort.receive (mw_geoNwInd(mw_geoNwPdu(?))){
                        tc_noac.stop;
                        log("*** " & testcasename() & ": Message received ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                    }
                    [] tc_noac.timeout {
                        log("*** " & testcasename() & ": No message received ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                    }
                }
                
                // Postamble
                f_poNeighbour();
                f_cf01Down();
                
            } // end f_GEONW_PON_LOS_BV_05
            
            /**
             * @desc    TP Function for TC_GEONW_PON_LOS_TI_06
             */
            function f_GEONW_PON_LOS_TI_06() runs on ItsGeoNetworking {
                
                // Local variables
                var LongPosVector v_longPosVectorNodeA;
                var LongPosVector v_longPosVectorIut;
                var integer v_maxNbrRetrans := f_getLsMaxRetrans();
                var integer v_rtc := 0;
                var boolean v_retransmitOk := false;
                timer t_minRetrans :=  f_getLsRetransmitTimer() - f_getDeltaTimer();
                
                // Test control
                if (not PICS_GN_LS_REQ_RETRANSMISSION) {
                    log("*** " & testcasename() & ": PICS_GN_LS_REQ_RETRANSMISSION required for executing the TC ***");
                    setverdict(inconc);
                    stop;
                }
                
                // Test component configuration
                f_cf01Up();
                v_longPosVectorNodeA := f_getPosition(c_compNodeA);
                
                // Test adapter configuration
                
                // Preamble
                f_prNeighbour();
                
                 if ( not f_utTriggerEvent(m_generateGeoUnicastMessageWithLifetime(v_longPosVectorNodeA.gnAddr, float2int(int2float(v_maxNbrRetrans + 2) * f_getLsRetransmitTimer() * 1000.0))) ) {
                    log("*** " & testcasename() & ": INCONC: Trigger failed ***");
                    f_selfOrClientSyncAndVerdict(c_prDone, e_timeout);
                }
                    
                tc_ac.start;
                alt {
                    [] a_receiveLsRequest(?, v_longPosVectorNodeA.gnAddr.mid, v_longPosVectorIut) {
                        tc_ac.stop;
                        f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                        //start retransmission timer
                        t_minRetrans.start;
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": Pre-conditions: Expected message not received ***");
                        f_selfOrClientSyncAndVerdict(c_prDone, e_timeout);
                    }
                }
                
                // Test Body
                tc_ac.start;
                alt {
                    [] t_minRetrans.timeout {
                        log("*** " & testcasename() & ": Ready for retransmission ***");
                        v_retransmitOk := true;
                        repeat;
                    }
                    [] a_receiveLsRequest(?, v_longPosVectorNodeA.gnAddr.mid, v_longPosVectorIut) {
                        tc_ac.stop;
                        if(v_retransmitOk == true) {
                            log("*** " & testcasename() & ": LS_REQUEST correctly retransmitted ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                        }
                        else {
                            log("*** " & testcasename() & ": LS_REQUEST retransmitted too early ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                        }
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": No LS_REQUEST retransmitted ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                    }
                }
                
                // Postamble
                f_poNeighbour();
                f_cf01Down();
                
            } // end f_GEONW_PON_LOS_TI_06
            
            /**
             * @desc    TP Function for TC_GEONW_PON_LOS_BV_07
             */
            function f_GEONW_PON_LOS_BV_07() runs on ItsGeoNetworking {
                
                // Local variables
                var LongPosVector v_longPosVectorNodeA;
                var LongPosVector v_longPosVectorIut;
                var integer v_maxNbrRetrans := f_getLsMaxRetrans();
                var integer v_nbLsReceived := 0;
                
                // Test control
                if (not PICS_GN_LS_REQ_RETRANSMISSION) {
                    log("*** " & testcasename() & ": PICS_GN_LS_REQ_RETRANSMISSION required for executing the TC ***");
                    setverdict(inconc);
                    stop;
                }
                
                // Test component configuration
                f_cf01Up();
                v_longPosVectorNodeA := f_getPosition(c_compNodeA);
                
                // Test adapter configuration
                
                // Preamble
                f_prNeighbour();
                 if ( not f_utTriggerEvent(m_generateGeoUnicastMessageWithLifetime(
                    v_longPosVectorNodeA.gnAddr,
			                    float2int(int2float(v_maxNbrRetrans + 2) * f_getLsRetransmitTimer() * 1000.0))) ) {
                    log("*** " & testcasename() & ": INCONC: Trigger failed ***");
                    f_selfOrClientSyncAndVerdict(c_prDone, e_timeout);
                }
                
                tc_ac.start;
                alt {
                    [] a_receiveLsRequest(?, v_longPosVectorNodeA.gnAddr.mid, v_longPosVectorIut) {
                        tc_ac.stop;
                        f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": Pre-conditions: Expected message not received ***");
                        f_selfOrClientSyncAndVerdict(c_prDone, e_timeout);
                    }
                }
                
                // Test Body
                tc_ac.start;
                alt {
                    [] a_receiveLsRequest(?, v_longPosVectorNodeA.gnAddr.mid, v_longPosVectorIut) {
                        tc_ac.stop;
                        v_nbLsReceived := v_nbLsReceived + 1;
                        if(v_nbLsReceived > v_maxNbrRetrans) {
                            //first LS request is not counted as a retransmission
                            log("*** " & testcasename() & ": LS_REQUEST retransmitted more than itsGnLocationServiceMaxRetrans times ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                        }
                        else {
                            tc_ac.start;
                            repeat;
                        }
                    }
                    [] tc_ac.timeout {
                        if(v_nbLsReceived == (v_maxNbrRetrans)) {
                            //first LS request is not counted as a retransmission
                            log("*** " & testcasename() & ": LS_REQUEST retransmitted itsGnLocationServiceMaxRetrans times ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                        }
                        else {
                            log("*** " & testcasename() & ": LS_REQUEST retransmitted less than itsGnLocationServiceMaxRetrans times ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                        }
                    }
                }
                
                // Postamble
                f_poNeighbour();
                f_cf01Down();
                
            } // end f_GEONW_PON_LOS_BV_07
            
            /**
             * @desc    TP Function for TC_GEONW_PON_LOS_BV_08
             */
            function f_GEONW_PON_LOS_BV_08() runs on ItsGeoNetworking {
                
                // Local variables
                var LongPosVector v_longPosVectorNodeA;
                var LongPosVector v_longPosVectorIut;
                var GN_Address v_iutGnAddress;
                var UInt16 v_seqNbr := vc_localSeqNumber;
                var FncRetCode v_ret := e_error;
                
                // Test control
                if (not PICS_GN_LS_REQ_DST) {
                    log("*** " & testcasename() & ": PICS_GN_LS_REQ_DST required for executing the TC ***");
                    setverdict(inconc);
                    stop;
                }
                
                // Test component configuration
                f_cf01Up();
                v_longPosVectorNodeA := f_getPosition(c_compNodeA);
                v_iutGnAddress := f_getPosition(c_compIut).gnAddr;
                
                // Test adapter configuration
                
                // Preamble
                f_prNeighbour();
                f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                
                // Test Body
                v_ret := f_processLocationService(v_longPosVectorNodeA, v_seqNbr, v_iutGnAddress, v_longPosVectorIut);
                if (v_ret == e_success) {
                    log("*** " & testcasename() & ": LS_REPLY packet received correctly ***");
                    f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                }
                else {
                    log("*** " & testcasename() & ": LS_REPLY packet not received correctly ***");
                    f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                }
                
                // Postamble
                f_poNeighbour();
                f_cf01Down();
                
            } // end f_GEONW_PON_LOS_BV_08
            
            group GEONW_PON_LOS_BO_09 {
                
                /**
                 * @desc    TP Function for TC_GEONW_PON_LOS_BO_09
                 */
                function f_GEONW_PON_LOS_BO_09() runs on ItsMtc {
                    
                    // Local variables
                    var ItsGeoNetworking v_nodeB;
                    var ItsGeoNetworking v_nodeD;
                    
                    // Test control
                    if (not PICS_GN_LS_REQ_DST) {
                        log("*** " & testcasename() & ": PICS_GN_LS_REQ_DST required for executing the TC ***");
                        setverdict(inconc);
                        stop;
                    }
                    
                    // 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_LOS_BO_09_nodeB());
                    v_nodeD.start(f_GEONW_PON_LOS_BO_09_nodeD());
                    
                    // Synchronization
                    f_serverSync2ClientsAndStop({c_prDone, c_tbDone});
                    
                    // Cleanup
                    f_cf02Down();
                    
                } // end f_GEONW_PON_LOS_BO_09
                
                /**
                 * @desc    Behavior function for NodeB (TC_GEONW_PON_LOS_BO_09)
                 */
                function f_GEONW_PON_LOS_BO_09_nodeB() runs on ItsGeoNetworking {
                    
                    // Local variables
                    var LongPosVector v_longPosVectorNodeB := f_getPosition(c_compNodeB);
                    var LongPosVector v_longPosVectorIut := f_getPosition(c_compIut);
                    var FncRetCode v_ret := e_error;
                    
                    // Preamble
                    f_prNeighbour();
                    v_ret := f_processLocationService(
                        v_longPosVectorNodeB,
                        vc_localSeqNumber,
                        v_longPosVectorIut.gnAddr,
                        v_longPosVectorIut);
                    if (v_ret == e_error) {
                        f_selfOrClientSyncAndVerdict(c_prDone, e_timeout);
                    }
                    else {
                        f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                    }
                    
                    // Test Body
                    tc_noac.start;
                    alt {
                        [] geoNetworkingPort.receive(
                                mw_geoNwInd(
                                    mw_geoNwPdu(
                                        mw_geoNwLsReplyPacket(
garciay's avatar
garciay committed
                                            mw_longPosVectorPosition(v_longPosVectorIut),
                                            mw_shortPosVectorPosition(f_longPosVector2ShortPosVector(v_longPosVectorNodeB))
                                        )
                                    )
                                )
                            ) {
                            tc_noac.stop;
                            log("*** " & testcasename() & ": FAIL: LS_REQUEST has not been discarded ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                        }
                        [] tc_noac.timeout {
                            log("*** " & testcasename() & ": PASS: LS_REQUEST discarded ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                        }
                    }
                    
                    // Postamble
                    f_poNeighbour();
                    
                } // end f_GEONW_PON_LOS_BO_09_nodeB
                
                /**
                 * @desc    Behavior function for NodeD (TC_GEONW_PON_LOS_BO_09)
                 */
                function f_GEONW_PON_LOS_BO_09_nodeD() runs on ItsGeoNetworking {
                    
                    // Local variables
                    var LongPosVector v_longPosVectorNodeB := f_getPosition(c_compNodeB);
                    var LongPosVector v_longPosVectorNodeD := f_getPosition(c_compNodeD);
                    var LongPosVector v_longPosVectorIut := f_getPosition(c_compIut);
                    var GN_Address v_iutGnAddress := f_getPosition(c_compIut).gnAddr;
                    
                    // Preamble
                    f_prNeighbour();
                    f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                    
                    // Test Body
                    f_sendGeoNetMessage(
                        m_geoNwReq_linkLayerBroadcast(
                            m_geoNwPdu(
                                m_geoNwLsRequestPacket(
                                    v_longPosVectorNodeB,
                                    vc_localSeqNumber,
                                    v_iutGnAddress
                                )
                            )
                        )
                    );
                    
                    tc_noac.start;
                    alt {
                        [] geoNetworkingPort.receive(
                                mw_geoNwInd(
                                    mw_geoNwPdu(
                                        mw_geoNwLsReplyPacket(
garciay's avatar
garciay committed
                                            mw_longPosVectorPosition(v_longPosVectorIut),
2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 3465 3466 3467 3468 3469 3470 3471 3472 3473 3474 3475 3476 3477 3478 3479 3480 3481 3482 3483 3484 3485 3486 3487 3488 3489 3490 3491 3492 3493 3494 3495 3496 3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 3538 3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3608 3609 3610 3611 3612 3613 3614 3615 3616 3617 3618 3619 3620 3621 3622 3623 3624 3625 3626 3627 3628 3629 3630 3631 3632 3633 3634 3635 3636 3637 3638 3639 3640 3641 3642 3643 3644 3645 3646 3647 3648 3649 3650 3651 3652 3653 3654 3655 3656 3657 3658 3659 3660 3661 3662 3663 3664 3665 3666 3667 3668 3669 3670 3671 3672 3673 3674 3675 3676 3677 3678 3679 3680 3681 3682 3683 3684 3685 3686 3687 3688 3689 3690 3691 3692 3693 3694 3695 3696 3697 3698 3699 3700 3701 3702 3703 3704 3705 3706 3707 3708 3709 3710 3711 3712 3713 3714 3715 3716 3717 3718 3719 3720 3721 3722 3723 3724 3725 3726 3727 3728 3729 3730 3731 3732 3733 3734 3735 3736 3737 3738 3739 3740 3741 3742 3743 3744 3745 3746 3747 3748 3749 3750 3751 3752 3753 3754 3755 3756 3757 3758 3759 3760 3761 3762 3763 3764 3765 3766 3767 3768 3769 3770 3771 3772 3773 3774 3775 3776 3777 3778 3779 3780 3781 3782 3783 3784 3785 3786 3787 3788 3789 3790 3791 3792 3793 3794 3795 3796 3797 3798 3799 3800 3801 3802 3803 3804 3805 3806 3807 3808 3809 3810 3811 3812 3813 3814 3815 3816 3817 3818 3819 3820 3821 3822 3823 3824 3825 3826 3827 3828 3829 3830 3831 3832 3833 3834 3835 3836 3837 3838 3839 3840 3841 3842 3843 3844 3845 3846 3847 3848 3849 3850 3851 3852 3853 3854 3855 3856 3857 3858 3859 3860 3861 3862 3863 3864 3865 3866 3867 3868 3869 3870 3871 3872 3873 3874 3875 3876 3877 3878 3879 3880 3881 3882 3883 3884 3885 3886 3887 3888 3889 3890 3891 3892 3893 3894 3895 3896 3897 3898 3899 3900 3901 3902 3903 3904 3905 3906 3907 3908 3909 3910 3911 3912 3913 3914 3915 3916 3917 3918 3919 3920 3921 3922 3923 3924 3925 3926 3927 3928 3929 3930 3931 3932 3933 3934 3935 3936 3937 3938 3939 3940 3941 3942 3943 3944 3945 3946 3947 3948 3949 3950 3951 3952 3953 3954 3955 3956 3957 3958 3959 3960 3961 3962 3963 3964 3965 3966 3967 3968 3969 3970 3971 3972 3973 3974 3975 3976 3977 3978 3979 3980 3981 3982 3983 3984 3985 3986 3987 3988 3989 3990 3991 3992 3993 3994 3995 3996 3997 3998 3999 4000 4001 4002 4003 4004 4005 4006 4007 4008 4009 4010 4011 4012 4013 4014 4015 4016 4017 4018 4019 4020 4021 4022 4023 4024 4025 4026 4027 4028 4029 4030 4031 4032 4033 4034 4035 4036 4037 4038 4039 4040 4041 4042 4043 4044 4045 4046 4047 4048 4049 4050 4051 4052 4053 4054 4055 4056 4057 4058 4059 4060 4061 4062 4063 4064 4065 4066 4067 4068 4069 4070 4071 4072 4073 4074 4075 4076 4077 4078 4079 4080 4081 4082 4083 4084 4085 4086 4087 4088 4089 4090 4091 4092 4093 4094 4095 4096 4097 4098 4099 4100 4101 4102 4103 4104 4105 4106 4107 4108 4109 4110 4111 4112 4113 4114 4115 4116 4117 4118 4119 4120 4121 4122 4123 4124 4125 4126 4127 4128 4129 4130 4131 4132 4133 4134 4135 4136 4137
                                            mw_shortPosVectorPosition(f_longPosVector2ShortPosVector(v_longPosVectorNodeB))
                                        )
                                    )
                                )
                            ) {
                            tc_noac.stop;
                            log("*** " & testcasename() & ": FAIL: LS_REQUEST has not been discarded ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                        }
                        [] tc_noac.timeout {
                            log("*** " & testcasename() & ": PASS: LS_REQUEST discarded ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                        }
                    }
                    
                    // Postamble
                    f_poNeighbour();
                    
                } // end f_GEONW_PON_LOS_BO_09_nodeD
                
            } // end GEONW_PON_LOS_BO_09
            
            group GEONW_PON_LOS_BV_10 {
                
                /**
                 * @desc    TP Function for TC_GEONW_PON_LOS_BV_10
                 */
                function f_GEONW_PON_LOS_BV_10() runs on ItsMtc {
                    
                    // Local variables
                    var ItsGeoNetworking v_nodeB;
                    var ItsGeoNetworking v_nodeC;
                    
                    // Test control
                    if (not PICS_GN_LS_FWD) {
                        log("*** " & testcasename() & ": PICS_GN_LS_FWD required for executing the TC ***");
                        setverdict(inconc);
                        stop;
                    }
                    
                    // 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_LOS_BV_10_nodeB());
                    v_nodeC.start(f_GEONW_PON_LOS_BV_10_nodeC());
                    
                    // Synchronization
                    f_serverSync2ClientsAndStop({c_prDone, c_tbDone});
                    
                    // Cleanup
                    f_cf03Down();
                    
                } // end f_GEONW_PON_LOS_BV_10
                
                /**
                 * @desc    Behavior function for NodeB (TC_GEONW_PON_LOS_BV_10)
                 */
                function f_GEONW_PON_LOS_BV_10_nodeB() runs on ItsGeoNetworking {
                    
                    // Local variables
                    var LongPosVector v_longPosVectorNodeB := f_getPosition(c_compNodeB);
                    
                    // Preamble
                    f_prNeighbour();
                    f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                    
                    // Test Body
                    tc_ac.start;
                     alt {
                         [] geoNetworkingPort.receive(
                             mw_geoNwInd(
                                 mw_geoNwPdu(
                                     mw_geoNwLsRequestPacket(
                                         ?,
                                         v_longPosVectorNodeB.gnAddr.mid
                                     ),
                                     -,
                                     c_defaultHopLimit - 1
                                 )
                             )
                         ) {
                             tc_ac.stop;
                             log("*** " & testcasename() & ": PASS: Re-broadcasted LS Request received with HL field decreased by 1 ***");
                             f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                         }
                         [] tc_ac.timeout {
                             log("*** " & testcasename() & ": FAIL: LS Request was not re-broadcasted ***");
                             f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                         }
                     }
                    
                    // Postamble
                    f_poNeighbour();
                    
                } // end f_GEONW_PON_LOS_BV_10_nodeB
                
                /**
                 * @desc    Behavior function for NodeC (TC_GEONW_PON_LOS_BV_10)
                 */
                function f_GEONW_PON_LOS_BV_10_nodeC() runs on ItsGeoNetworking {
                    
                    // Local variables
                    
                    // Preamble
                    f_prNeighbour();
                    f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                    
                    // Test Body
                    f_sendGeoNetMessage(
                        m_geoNwReq_linkLayerBroadcast(
                            m_geoNwPdu(
                                m_geoNwLsRequestPacket(
                                    f_getPosition(c_compNodeA),
                                    vc_localSeqNumber,
                                    f_getPosition(c_compNodeB).gnAddr
                                ),
                                -,
                                c_defaultHopLimit
                            )
                        )
                    );
                    f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                    
                    // Postamble
                    f_poNeighbour();
                    
                } // end f_GEONW_PON_LOS_BV_10_nodeC
                
            } // end GEONW_PON_LOS_BV_10
            
            group GEONW_PON_LOS_BV_11 {
                
                /**
                 * @desc    TP Function for TC_GEONW_PON_LOS_BV_11
                 */
                function f_GEONW_PON_LOS_BV_11() runs on ItsMtc {
                    
                    // Local variables
                    var ItsGeoNetworking v_nodeB;
                    var ItsGeoNetworking v_nodeC;
                    
                    // Test control
                    if (not PICS_GN_LS_FWD) {
                        log("*** " & testcasename() & ": PICS_GN_LS_FWD required for executing the TC ***");
                        setverdict(inconc);
                        stop;
                    }
                    
                    // 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_LOS_BV_11_nodeB());
                    v_nodeC.start(f_GEONW_PON_LOS_BV_11_nodeC());
                    
                    // Synchronization
                    f_serverSync2ClientsAndStop({c_prDone, c_tbDone});
                    
                    // Cleanup
                    f_cf03Down();
                    
                } // end f_GEONW_PON_LOS_BV_11
                
                /**
                 * @desc    Behavior function for NodeB (TC_GEONW_PON_LOS_BV_11)
                 */
                function f_GEONW_PON_LOS_BV_11_nodeB() runs on ItsGeoNetworking {
                    
                    // Local variables
                    var LongPosVector v_longPosVectorNodeA := f_getPosition(c_compNodeA);
                    var LongPosVector v_longPosVectorNodeB := f_getPosition(c_compNodeB);
                    
                    // Preamble
                    f_prNeighbour();
                    f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                    
                    // Test Body
                    tc_ac.start;
                    alt {
                        [] geoNetworkingPort.receive(
                            mw_geoNwInd(
                                mw_geoNwPdu(
                                    mw_geoNwLsReplyPacket(
                                        mw_longPosVectorPosition(v_longPosVectorNodeA),
                                        mw_shortPosVectorPosition(f_longPosVector2ShortPosVector(v_longPosVectorNodeB))
                                    ),
                                    -,
                                    c_defaultHopLimit - 1
                                )
                            )
                        ) {
                            log("*** " & testcasename() & ": PASS: Forwarded LS Reply received ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                        }
                        [] tc_ac.timeout {
                            log("*** " & testcasename() & ": FAIL: LS Reply was not forwarded ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                        }
                    }
                    
                    // Postamble
                    f_poNeighbour();
                    
                } // end f_GEONW_PON_LOS_BV_11_nodeB
                
                /**
                 * @desc    Behavior function for NodeC (TC_GEONW_PON_LOS_BV_11)
                 */
                function f_GEONW_PON_LOS_BV_11_nodeC() runs on ItsGeoNetworking {
                    
                    // Local variables
                    
                    // Preamble
                    f_prNeighbour();
                    
                    f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                    
                    // Test Body
                    f_sendGeoNetMessage(
                        m_geoNwReq_linkLayerBroadcast(
                            m_geoNwPdu(
                                m_geoNwLsReplyPacket(
                                    f_getPosition(c_compNodeA),
                                    f_longPosVector2ShortPosVector(f_getPosition(c_compNodeB)),
                                    vc_localSeqNumber
                                ),
                                -,
                                c_defaultHopLimit
                            )
                        )
                    );
                    f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                    
                    // Postamble
                    f_poNeighbour();
                    
                } // end f_GEONW_PON_LOS_BV_11_nodeC
                
            } // end GEONW_PON_LOS_BV_11
            
            /**
             * @desc    TP Function for TC_GEONW_PON_LOS_BV_12
             */
            function f_GEONW_PON_LOS_BV_12() runs on ItsGeoNetworking {
                
                // Local variables
                var LongPosVector v_longPosVectorNodeA;
                var LongPosVector v_longPosVectorIut;
                var UInt16 v_seqNbr := vc_localSeqNumber;
                
                // Test control
                if (not PICS_GN_LS_REQ_SRC) {
                    log("*** " & testcasename() & ": PICS_GN_LS_REQ_SRC required for executing the TC ***");
                    setverdict(inconc);
                    stop;
                }
                
                // Test component configuration
                f_cf01Up();
                v_longPosVectorNodeA := f_getPosition(c_compNodeA);
                
                // Test adapter configuration
                
                // Preamble
                f_prNeighbour();
                 if ( not f_utTriggerEvent(m_generateGeoUnicastMessage(v_longPosVectorNodeA.gnAddr)) ) {
                    log("*** " & testcasename() & ": INCONC: Trigger failed ***");
                    f_selfOrClientSyncAndVerdict(c_prDone, e_timeout);
                }
                tc_ac.start;
                alt {
                    [] a_receiveLsRequest(?, v_longPosVectorNodeA.gnAddr.mid, v_longPosVectorIut) {
                        tc_ac.stop;
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: Pre-conditions: LS Request not received ***");
                        f_selfOrClientSyncAndVerdict(c_prDone, e_timeout);
                    }
                }
                
                // Test Body
                f_sendGeoNetMessage(
                    m_geoNwReq_linkLayerBroadcast(
                        m_geoNwPdu(
                            m_geoNwUnicastPacket(
                                v_longPosVectorNodeA,
                                f_longPosVector2ShortPosVector(v_longPosVectorIut),
                                vc_localSeqNumber
                            )
                        )
                    )
                );
                
                tc_ac.start;
                alt {
                    [] a_receiveGeoUnicastWithDestination(mw_shortPosVectorPosition(f_longPosVector2ShortPosVector(v_longPosVectorNodeA))) {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": PASS: GUC packet received correctly ***");
                        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();
                f_cf01Down();
                
            } // end f_GEONW_PON_LOS_BV_12
            
            /**
             * @desc    TP Function for TC_GEONW_PON_LOS_BV_13
             */
            function f_GEONW_PON_LOS_BV_13() runs on ItsGeoNetworking {
                
                // Local variables
                var LongPosVector v_longPosVectorNodeA;
                var LongPosVector v_longPosVectorIut;
                var integer v_lt1 := f_getLsMaxRetrans()*float2int(f_getLsRetransmitTimer());
                var integer v_lt2 := float2int(int2float(v_lt1)/2.0);
                var octetstring v_payload1 := char2oct("PAYLOAD_1");
                var octetstring v_payload2 := char2oct("PAYLOAD_2");
                var boolean v_msg1Received := false;
                
                // Test control
                if (not PICS_GN_LS_REQ_SRC) {
                    log("*** " & testcasename() & ": PICS_GN_LS_REQ_SRC required for executing the TC ***");
                    setverdict(inconc);
                    stop;
                }
                
                // Test component configuration
                f_cf01Up();
                v_longPosVectorNodeA := f_getPosition(c_compNodeA);
                
                // Test adapter configuration
                
                // Preamble
                f_prNeighbour();
                
                 if ( not f_utTriggerEvent(m_generateGeoUnicastMessageWithLifetimeWithPayload(v_longPosVectorNodeA.gnAddr, v_lt2*1000, v_payload2)) ) {
                    log("*** " & testcasename() & ": INCONC: Trigger failed ***");
                    f_selfOrClientSyncAndVerdict(c_prDone, e_timeout);
                }
                 if ( not f_utTriggerEvent(m_generateGeoUnicastMessageWithLifetimeWithPayload(v_longPosVectorNodeA.gnAddr, v_lt1*1000, v_payload1)) ) {
                    log("*** " & testcasename() & ": INCONC: Trigger failed ***");
                    f_selfOrClientSyncAndVerdict(c_prDone, e_timeout);
                }
                
                tc_ac.start;
                alt {
                    [] a_receiveLsRequest(?, v_longPosVectorNodeA.gnAddr.mid, v_longPosVectorIut) {
                        tc_ac.stop;
                        f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                    }
                        
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: Pre-conditions: LS Request not received ***");
                        f_selfOrClientSyncAndVerdict(c_prDone, e_timeout);
                    }
                }
                f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                
                // Test Body
                //Send LS-REPLY after LT2 expiry
                f_sleepIgnoreDef(int2float(v_lt2));
                
                f_sendGeoNetMessage(
                    m_geoNwReq_linkLayerBroadcast(
                        m_geoNwPdu(
                            m_geoNwLsReplyPacket(
                                v_longPosVectorNodeA,
                                f_longPosVector2ShortPosVector(v_longPosVectorIut),
                                vc_localSeqNumber
                            )
                        )
                    )
                );
                
                tc_ac.start;
                alt {
                    [] a_receiveLsRequest(?, v_longPosVectorNodeA.gnAddr.mid, v_longPosVectorIut) {
                        log("*** " & testcasename() & ": INFO: LS Request retransmission ignored ***");
                        repeat;
                    }
                    [] geoNetworkingPort.receive(
                        f_receiveGeoNetMessageWithPayload(
                            mw_geoNwInd(
                                mw_geoNwPdu(
                                    mw_geoNwUnicastPacket(
                                        mw_shortPosVectorPosition(f_longPosVector2ShortPosVector(v_longPosVectorNodeA)),
                                        ?
                                    )
                                )
                            ),
                            f_adaptPayload_mw(v_payload1)
                        )
                    ) {
                        v_msg1Received := true;
                        repeat;
                    }
                    [] geoNetworkingPort.receive(
                        f_receiveGeoNetMessageWithPayload(
                            mw_geoNwInd(
                                mw_geoNwPdu(
                                    mw_geoNwUnicastPacket(
                                        mw_shortPosVectorPosition(f_longPosVector2ShortPosVector(v_longPosVectorNodeA)),
                                        ?
                                    )
                                )
                            ),
                            f_adaptPayload_mw(v_payload2)
                        )
                    ) {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": FAIL: message with elapsed lifetime received ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                    }
                    [] tc_ac.timeout {
                        if(v_msg1Received == true) {
                            log("*** " & testcasename() & ": PASS: message with running lifetime received ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                        }
                        else {
                            log("*** " & testcasename() & ": FAIL: message with running lifetime not received ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                        }
                    }
                }
                
                // Postamble
                f_poNeighbour();
                f_cf01Down();
                
            } // end f_GEONW_PON_LOS_BV_13
            
            /**
             * @desc    TP Function for TC_GEONW_PON_LOS_BV_13
             */
            function f_GEONW_PON_LOS_BV_14() runs on ItsGeoNetworking {
                
                // Local variables
                var LongPosVector v_longPosVectorNodeA;
                var LongPosVector v_longPosVectorIut;
                var integer v_maxNbrRetrans := f_getLsMaxRetrans();
                var integer v_nbLsReceived := 0;
                var UInt16 v_LT1;
                
                // Test control
                if (not PICS_GN_LS_REQ_SRC) {
                    log("*** " & testcasename() & ": PICS_GN_LS_REQ_SRC required for executing the TC ***");
                    setverdict(inconc);
                    stop;
                }
                
                // Test component configuration
                f_cf01Up();
                v_longPosVectorNodeA := f_getPosition(c_compNodeA);
                
                // Test adapter configuration
                
                // Preamble
                f_prNeighbour();
                v_LT1 := float2int(int2float(v_maxNbrRetrans + 2) * f_getLsRetransmitTimer() * 1000.0);
                 if ( not f_utTriggerEvent(m_generateGeoUnicastMessageWithLifetime(v_longPosVectorNodeA.gnAddr,v_LT1)) ) {
                    log("*** " & testcasename() & ": INCONC: Trigger failed ***");
                    f_selfOrClientSyncAndVerdict(c_prDone, e_timeout);
                }
                
                tc_wait.start(int2float(v_LT1));
                tc_ac.start;
                alt {
                    [] a_receiveLsRequest(?, v_longPosVectorNodeA.gnAddr.mid, v_longPosVectorIut) {
                        tc_ac.stop;
                        f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": Pre-conditions: Expected message not received ***");
                        f_selfOrClientSyncAndVerdict(c_prDone, e_timeout);
                    }
                }
                
                tc_ac.start;
                alt {
                    [] a_receiveLsRequest(?, v_longPosVectorNodeA.gnAddr.mid, v_longPosVectorIut) {
                        tc_ac.stop;
                        v_nbLsReceived := v_nbLsReceived + 1;
                        if(v_nbLsReceived > v_maxNbrRetrans) {
                            //first LS request is not counted as a retransmission
                            log("*** " & testcasename() & ": Pre-conditions: LS_REQUEST retransmitted more than itsGnLocationServiceMaxRetrans times ***");
                            f_selfOrClientSyncAndVerdict(c_prDone, e_error);
                        }
                        else {
                            tc_ac.start;
                            repeat;
                        }
                    }
                    [] tc_ac.timeout {
                        if(v_nbLsReceived == (v_maxNbrRetrans)) {
                            //first LS request is not counted as a retransmission
                            log("*** " & testcasename() & ": Pre-conditions: LS_REQUEST retransmitted itsGnLocationServiceMaxRetrans times ***");
                            f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                        }
                        else {
                            log("*** " & testcasename() & ": Pre-conditions: LS_REQUEST retransmitted less than itsGnLocationServiceMaxRetrans times ***");
                            f_selfOrClientSyncAndVerdict(c_prDone, e_error);
                        }
                    }
                }
                
                // Test Body
                if (tc_wait.running) {
                    f_sendGeoNetMessage(
                        m_geoNwReq_linkLayerBroadcast(
                            m_geoNwPdu(
                                m_geoNwUnicastPacket(
                                    v_longPosVectorNodeA,
                                    f_longPosVector2ShortPosVector(v_longPosVectorIut),
                                    vc_localSeqNumber
                                )
                            )
                        )
                    );
                    tc_wait.stop;
                    
                    tc_noac.start;
                    alt {
                        // no check for ItsNodeA address as no other trigger for messages exists
                        [] geoNetworkingPort.receive {
                            tc_noac.stop;
                            log("*** " & testcasename() & ": FAIL: Unexpected message received ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                        }
                        [] tc_noac.timeout {
                            log("*** " & testcasename() & ": PASS: No message was sent ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                        }
                    }
                }
                else {
                    log("*** " & testcasename() & ": FAIL: LT1 expired ***");
                    f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                }
                
                // Postamble
                f_poNeighbour();
                f_cf01Down();
                
            } // end f_GEONW_PON_LOS_BV_14

            /**
             * @desc    TP Function for TC_GEONW_PON_LOS_BV_15
             */
            function f_GEONW_PON_LOS_BV_15() runs on ItsGeoNetworking {
                
                // Local variables
                var LongPosVector v_longPosVectorNodeA;
                var LongPosVector v_longPosVectorNodeB;
                var LongPosVector v_longPosVectorIut;
                var UInt16 v_seqNbr := vc_localSeqNumber;
                
                // Test control
                if (not PICS_GN_LS_REQ_SRC) {
                    log("*** " & testcasename() & ": PICS_GN_LS_REQ_SRC required for executing the TC ***");
                    setverdict(inconc);
                    stop;
                }
                
                // Test component configuration
                f_cf01Up();
                v_longPosVectorNodeA := f_getPosition(c_compNodeA);
                v_longPosVectorNodeB := f_getPosition(c_compNodeB);
                
                // Test adapter configuration
                
                // Preamble
                f_prNeighbour();
                if ( not f_utTriggerEvent(m_generateGeoUnicastMessage(v_longPosVectorNodeA.gnAddr)) ) {
                    log("*** " & testcasename() & ": INCONC: Trigger failed ***");
                    f_selfOrClientSyncAndVerdict(c_prDone, e_timeout);
                }
                tc_ac.start;
                alt {
                    [] a_receiveLsRequest(?, v_longPosVectorNodeA.gnAddr.mid, v_longPosVectorIut) {
                        tc_ac.stop;
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: Pre-conditions: LS Request not received ***");
                        f_selfOrClientSyncAndVerdict(c_prDone, e_timeout);
                    }
                }
                
                // Test Body
                f_sendGeoNetMessage(
                    m_geoNwReq_linkLayerBroadcast(
                        m_geoNwPdu(
                            m_geoNwUnicastPacket(
                                v_longPosVectorNodeA,
                                f_longPosVector2ShortPosVector(v_longPosVectorNodeB),
                                vc_localSeqNumber
                            )
                        )
                    )
                );
                
                tc_ac.start;
                alt {
                    [] a_receiveGeoUnicastWithDestination(mw_shortPosVectorPosition(f_longPosVector2ShortPosVector(v_longPosVectorNodeA))) {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": PASS: GUC packet received correctly ***");
                        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();
                f_cf01Down();
                
            } // end f_GEONW_PON_LOS_BV_15

            /**
             * @desc    TP Function for TC_GEONW_PON_LOS_BV_16
             */
            function f_GEONW_PON_LOS_BV_16() runs on ItsGeoNetworking {
                
                // Local variables
                var LongPosVector v_longPosVectorNodeA;
                var LongPosVector v_longPosVectorNodeB;
                var LongPosVector v_longPosVectorIut;
                var UInt16 v_seqNbr := vc_localSeqNumber;
                
                // Test control
                if (not PICS_GN_LS_REQ_SRC) {
                    log("*** " & testcasename() & ": PICS_GN_LS_REQ_SRC required for executing the TC ***");
                    setverdict(inconc);
                    stop;
                }
                
                // Test component configuration
                f_cf01Up();
                v_longPosVectorNodeA := f_getPosition(c_compNodeA);
                v_longPosVectorNodeB := f_getPosition(c_compNodeB);
                
                // Test adapter configuration
                
                // Preamble
                f_prNeighbour();
                if ( not f_utTriggerEvent(m_generateGeoUnicastMessage(v_longPosVectorNodeA.gnAddr)) ) {
                    log("*** " & testcasename() & ": INCONC: Trigger failed ***");
                    f_selfOrClientSyncAndVerdict(c_prDone, e_timeout);
                }
                tc_ac.start;
                alt {
                    [] a_receiveLsRequest(?, v_longPosVectorNodeA.gnAddr.mid, v_longPosVectorIut) {
                        tc_ac.stop;
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: Pre-conditions: LS Request not received ***");
                        f_selfOrClientSyncAndVerdict(c_prDone, e_timeout);
                    }
                }
                
                // Test Body
                f_sendGeoNetMessage(
                    m_geoNwReq_linkLayerBroadcast(
                        m_geoNwPdu(
                            m_geoNwUnicastPacket(
                                v_longPosVectorNodeA,
                                f_longPosVector2ShortPosVector(v_longPosVectorIut),
                                vc_localSeqNumber
                            )
                        )
                    )
                );
                
                tc_noac.start;
                alt {
                    [] a_receiveLsRequest(?, v_longPosVectorNodeA.gnAddr.mid, v_longPosVectorIut) {
                        tc_noac.stop;
                        log("*** " & testcasename() & ": FAIL: LS Request retransmitted ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                    }
                    [] a_receiveGeoUnicastWithDestination(mw_shortPosVectorPosition(f_longPosVector2ShortPosVector(v_longPosVectorNodeA))) {
                        log("*** " & testcasename() & ": INFO: GUC packet received ***");
                        repeat;
                    }
                    [] tc_noac.timeout {
                        log("*** " & testcasename() & ": PASS: LS Request not retransmitted ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                    }
                }
                
                // Postamble
                f_poNeighbour();
                f_cf01Down();
                
            } // end f_GEONW_PON_LOS_BV_16

            /**
             * @desc    TP Function for TC_GEONW_PON_LOS_BV_17
             */
            function f_GEONW_PON_LOS_BV_17() runs on ItsGeoNetworking {
                
                // Local variables
                var LongPosVector v_longPosVectorNodeA;
                var LongPosVector v_longPosVectorNodeB;
                var LongPosVector v_longPosVectorIut;
                var UInt16 v_seqNbr := vc_localSeqNumber;
                
                // Test control
                if (not PICS_GN_LS_REQ_SRC) {
                    log("*** " & testcasename() & ": PICS_GN_LS_REQ_SRC required for executing the TC ***");
                    setverdict(inconc);
                    stop;
                }
                
                // Test component configuration
                f_cf01Up();
                v_longPosVectorNodeA := f_getPosition(c_compNodeA);
                v_longPosVectorNodeB := f_getPosition(c_compNodeB);
                
                // Test adapter configuration
                
                // Preamble
                f_prNeighbour();
                if ( not f_utTriggerEvent(m_generateGeoUnicastMessage(v_longPosVectorNodeA.gnAddr)) ) {
                    log("*** " & testcasename() & ": INCONC: Trigger failed ***");
                    f_selfOrClientSyncAndVerdict(c_prDone, e_timeout);
                }
                tc_ac.start;
                alt {
                    [] a_receiveLsRequest(?, v_longPosVectorNodeA.gnAddr.mid, v_longPosVectorIut) {
                        tc_ac.stop;
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: Pre-conditions: LS Request not received ***");
                        f_selfOrClientSyncAndVerdict(c_prDone, e_timeout);
                    }
                }
                
                // Test Body
                f_sendGeoNetMessage(
                    m_geoNwReq_linkLayerBroadcast(
                        m_geoNwPdu(
                            m_geoNwUnicastPacket(
                                v_longPosVectorNodeA,
                                f_longPosVector2ShortPosVector(v_longPosVectorNodeB),
                                vc_localSeqNumber
                            )
                        )
                    )
                );
                
                tc_noac.start;
                alt {
                    [] a_receiveLsRequest(?, v_longPosVectorNodeA.gnAddr.mid, v_longPosVectorIut) {
                        tc_noac.stop;
                        log("*** " & testcasename() & ": FAIL: LS Request retransmitted ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                    }
                    [] a_receiveGeoUnicastWithDestination(mw_shortPosVectorPosition(f_longPosVector2ShortPosVector(v_longPosVectorNodeA))) {
                        log("*** " & testcasename() & ": INFO: GUC packet received ***");
                        repeat;
                    }
                    [] tc_noac.timeout {
                        log("*** " & testcasename() & ": PASS: LS Request not retransmitted ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                    }
                }
                
                // Postamble
                f_poNeighbour();
                f_cf01Down();
                
            } // end f_GEONW_PON_LOS_BV_17
            
        } // end geoLocationService
        
        // 6.2.2.5
        group geoForwardingPacketBuffer {
            
            group GEONW_PON_FPB_BV_01 {
                
                /**
                 * @desc    TP Function for TC_GEONW_PON_FPB_BV_01
                 */
                function f_GEONW_PON_FPB_BV_01() runs on ItsMtc {
                    
                    // Local variables
                    var ItsGeoNetworking v_nodeB;
                    var ItsGeoNetworking v_nodeC;
                    
                    // Test control
                    if (not PICS_GN_GUC_SRC) {
                        log("*** " & testcasename() & ": PICS_GN_GUC_SRC required for executing the TC ***");
                        setverdict(inconc);
                        stop;
                    }
                    
                    // 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_01_nodeB());
                    v_nodeC.start(f_GEONW_PON_FPB_BV_01_nodeC());
                    
                    // Synchronization
                    f_serverSync2ClientsAndStop({c_prDone, c_tbDone});
                    
                    // Cleanup
                    f_cf03Down();
                    
                } // end f_GEONW_PON_FPB_BV_01
                
                /**
                 * @desc    Behavior function for NodeB (TC_GEONW_PON_FPB_BV_01)
                 */
                function f_GEONW_PON_FPB_BV_01_nodeB() 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
                    f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                    
                    // Test Body
                    f_sleepIgnoreDef(1.0);
                    f_startBeingNeighbour();
                    
                    tc_ac.start;
                    alt {
                        [] a_receiveAnyLsRequest() {
                            tc_ac.stop;
                            log("*** " & testcasename() & ": INCONC: Received Location Service Request ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
                        }
                        [] geoNetworkingPort.receive(mw_geoNwInd(mw_geoNwPdu(mw_geoNwUnicastPacket(
                            mw_shortPosVectorPosition(f_longPosVector2ShortPosVector(v_longPosVectorNodeA)),
                            ?)))) {
                            tc_ac.stop;
                            log("*** " & testcasename() & ": PASS: packet correctly forwarded ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                        }
                        [] tc_ac.timeout {
                            log("*** " & testcasename() & ": INCONC: Expected message not received ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
                        }
                    }
                    
                    // 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);
                    
                    // 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);
	                }
                    tc_noac.start;
                    alt {
                        [] geoNetworkingPort.receive(mw_geoNwInd(mw_geoNwPdu(?))) {
                            tc_noac.stop;
                            log("*** " & testcasename() & ": FAIL: GUC packet received ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                        }
                        [] tc_noac.timeout {
                            log("*** " & testcasename() & ": PASS: No message received ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                        }
                    }
                    
                    // Postamble
                    f_poNeighbour();
                    
                } // end f_GEONW_PON_FPB_BV_01_nodeC
                
            } // end GEONW_PON_FPB_BV_01
            
            group GEONW_PON_FPB_BV_02 {
                
                /**
                 * @desc    TP Function for TC_GEONW_PON_FPB_BV_02
                 */
                function f_GEONW_PON_FPB_BV_02() runs on ItsMtc {
                    
                    // Local variables
                    var ItsGeoNetworking v_nodeB;
                    var ItsGeoNetworking v_nodeC;
                    const UInt16 c_sequenceNumberC := f_getInitialSequenceNumber();
                    
                    // Test control
                    if (not PICS_GN_GUC_SRC) {
                        log("*** " & testcasename() & ": PICS_GN_GUC_SRC required for executing the TC ***");
                        setverdict(inconc);
                        stop;
                    }
                    
                    // 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 f_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);
                    
                    // 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);
                        }
                        [] tc_ac.timeout {
                            log("*** " & testcasename() & ": FAIL: Expected message not received ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                        }
                    }
                    
                    // 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);
                    
                    // Test Body
                    f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                    
                    // Postamble
                    f_poNeighbour();
                    
                } // end f_GEONW_PON_FPB_BV_02_nodeC
                
            } // end GEONW_PON_FPB_BV_02
            
            group GEONW_PON_FPB_BV_03 {
                
                /**
                 * @desc    TP Function for TC_GEONW_PON_FPB_BV_03
                 */
                function f_GEONW_PON_FPB_BV_03() runs on ItsMtc {
                    
                    // Local variables
                    var ItsGeoNetworking v_nodeB;
                    var ItsGeoNetworking v_nodeC;
                    const UInt16 c_sequenceNumberC := f_getInitialSequenceNumber();
                    const integer c_messageCount := 2;
                    
                    // Test control
                    if (not PICS_GN_GUC_SRC) {
                        log("*** " & testcasename() & ": PICS_GN_GUC_SRC required for executing the TC ***");
                        setverdict(inconc);
                        stop;
                    }
                    
                    // 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 f_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);
                    
                    // 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: GUC packets received in correct order ***");
                                f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                            }
                            else {
                                v_expectedSequenceNumber := v_expectedSequenceNumber + 1;
                                tc_ac.start;
                                repeat;
                            }
                        }
                        [] a_receiveGeoUnicast(
                            mw_shortPosVectorPosition(f_longPosVector2ShortPosVector(v_longPosVectorNodeA)),
                            ?) {
                            tc_ac.stop;
                            log("*** " & testcasename() & ": FAIL: GUC packet received in incorrect order ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                        }
                        [] tc_ac.timeout {
                            log("*** " & testcasename() & ": INCONC: Expected message not received ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
                        }
                    }
                    
                    // 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);
                    
                    // Test Body
                    f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                    
                    // Postamble
                    f_poNeighbour();
                    
                } // end f_GEONW_PON_FPB_BV_03_nodeC
                
            } // end GEONW_PON_FPB_BV_03
            
            group GEONW_PON_FPB_BV_04 {
                
                /**
                 * @desc    TP Function for TC_GEONW_PON_FPB_BV_04
                 */
                function f_GEONW_PON_FPB_BV_04() runs on ItsMtc {
                    
                    // Local variables
                    var ItsGeoNetworking v_nodeB;
                    var ItsGeoNetworking v_nodeC;
                    const UInt6 c_packetLifetime := 10; // 10s
                    
                    // Test control
                    if (not PICS_GN_GUC_SRC) {
                        log("*** " & testcasename() & ": PICS_GN_GUC_SRC required for executing the TC ***");
                        setverdict(inconc);
                        stop;
                    }
                    
                    // 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 f_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);
                    
                    // 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: GUC packet received ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                        }
                        [] tc_noac.timeout {
                            log("*** " & testcasename() & ": PASS: No message received ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                        }
                    }
                    
                    // 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);
                    
                    // Test Body
                    f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                    
                    // Postamble
                    f_poNeighbour();
                    
                } // end f_GEONW_PON_FPB_BV_04_nodeC
                
            } // end GEONW_PON_FPB_BV_04
           
            group GEONW_PON_FPB_BV_06 {
                
                /**
                 * @desc    TP Function for TC_GEONW_PON_FPB_BV_06
                 */
                 function f_GEONW_PON_FPB_BV_06() runs on ItsMtc {
                    
                    // 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 f_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_generateGeoBroadcastMessage(f_getArea(c_area1))) ) {
                        log("*** " & testcasename() & ": INCONC: Trigger failed ***");
                        f_selfOrClientSyncAndVerdict(c_prDone, e_timeout);
                    }
                    f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                    
                    // Test Body
                    f_sleep(1.0);
                    f_startBeingNeighbour();
                    tc_ac.start;
                    alt {
                        [] geoNetworkingPort.receive(mw_geoNwInd(mw_geoNwPdu(mw_geoNwBroadcastPacket(
garciay's avatar
garciay committed
                            mw_longPosVectorPosition(v_longPosVectorIut),
                            ?)))) -> value v_geoNetInd {
                            tc_ac.stop;
                            log("*** " & testcasename() & ": PASS: GBC packet received correctly ***");
                            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_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);
                    
                    // Test Body
                    tc_ac.start;
                    alt {
                        [] geoNetworkingPort.receive(mw_geoNwInd(mw_geoNwPdu(mw_geoNwBroadcastPacket(
garciay's avatar
garciay committed
                            mw_longPosVectorPosition(v_longPosVectorIut),
                            ?)))) -> value v_geoNetInd {
                            tc_ac.stop;
                            log("*** " & testcasename() & ": PASS: GBC packet received correctly ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                        }
                        [] tc_ac.timeout {
                            log("*** " & testcasename() & ": FAIL: Expected message not received ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                        }
                    }
                    
                    // Postamble
                    f_poDefault();
                    
                } // end f_GEONW_PON_FPB_BV_06_nodeD
                
            } // end GEONW_PON_FPB_BV_06
            
            group GEONW_PON_FPB_BV_07 {
                
                /**
                 * @desc    TP Function for TC_GEONW_PON_FPB_BV_07
                 */
                function f_GEONW_PON_FPB_BV_07() runs on ItsMtc {
                    
                    // 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 f_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_generateGeoBroadcastMessage(f_getArea(c_area1))) ) {
	                        log("*** " & testcasename() & ": INCONC: Trigger failed ***");
	                        f_selfOrClientSyncAndVerdict(c_prDone, e_timeout);
	                    }
                    }

                    tc_ac.start(1.0);
                    alt {
                        [] geoNetworkingPort.receive(mw_geoNwInd(mw_geoNwPdu(mw_geoNwBroadcastPacket(
garciay's avatar
garciay committed
                            mw_longPosVectorPosition(v_longPosVectorIut),
                            tc_ac.stop;
                            log("*** " & testcasename() & ": INCONC: GBC packet not buffered ***");
                            f_selfOrClientSyncAndVerdict(c_prDone, e_error);
                        }
                        [] tc_ac.timeout {
                            log("*** " & testcasename() & ": PASS: GBC packet buffered ***");
                            f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                        }
                    }                    
                    
                    // Test Body
                    f_startBeingNeighbour();
                    tc_ac.start;
                    alt {
                        [] geoNetworkingPort.receive(mw_geoNwInd(mw_geoNwPdu(mw_geoNwBroadcastPacket(
garciay's avatar
garciay committed
                            mw_longPosVectorPosition(v_longPosVectorIut),
                            v_expectedSequenceNumber)))) -> value v_geoNetInd {
                            tc_ac.stop;
                            v_nbReceivedPackets := v_nbReceivedPackets + 1;
                            if(v_nbReceivedPackets >= vc_multipleMessagesCount) {
                                log("*** " & testcasename() & ": PASS: GBC packets received in correct order ***");
                                f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                            }
                            else {
                                v_expectedSequenceNumber := v_geoNetInd.msgIn.gnPacket.packet.extendedHeader.geoBroadcastHeader.seqNumber + 1;
                        [] geoNetworkingPort.receive(mw_geoNwInd(mw_geoNwPdu(mw_geoNwBroadcastPacket(
garciay's avatar
garciay committed
                            mw_longPosVectorPosition(v_longPosVectorIut),
                            log("*** " & testcasename() & ": FAIL: GBC packet received in incorrect order ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                        }
                        [] tc_ac.timeout {
                            log("*** " & testcasename() & ": FAIL: Expected message not received ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                        }
                    }
                    
                    // 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);
                    
                    // Test Body
                    tc_ac.start;
                    alt {
                        [] geoNetworkingPort.receive(mw_geoNwInd(mw_geoNwPdu(mw_geoNwBroadcastPacket(
garciay's avatar
garciay committed
                            mw_longPosVectorPosition(v_longPosVectorIut),
                            v_expectedSequenceNumber)))) -> value v_geoNetInd  {
                            tc_ac.stop;
                            v_nbReceivedPackets := v_nbReceivedPackets + 1;
                            if(v_nbReceivedPackets >= vc_multipleMessagesCount) {
                                log("*** " & testcasename() & ": PASS: GBC packets received in correct order ***");
                                f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                            }
                            else {
                                v_expectedSequenceNumber := v_geoNetInd.msgIn.gnPacket.packet.extendedHeader.geoBroadcastHeader.seqNumber + 1;
                        [] geoNetworkingPort.receive(mw_geoNwInd(mw_geoNwPdu(mw_geoNwBroadcastPacket(
garciay's avatar
garciay committed
                            mw_longPosVectorPosition(v_longPosVectorIut),
                            log("*** " & testcasename() & ": FAIL: GBC packet received in incorrect order ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                        }
                        [] tc_ac.timeout {
                            log("*** " & testcasename() & ": FAIL: Expected message not received ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                        }
                    }
                    
                    // Postamble
                    f_poDefault();
                    
                } // end f_GEONW_PON_FPB_BV_07_nodeD
                
            } // end GEONW_PON_FPB_BV_07
            
            group GEONW_PON_FPB_BV_08 {
                
                /**
                 * @desc    TP Function for TC_GEONW_PON_FPB_BV_08
                 */
                 function f_GEONW_PON_FPB_BV_08() runs on ItsMtc {
                    
                    // 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 f_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_generateGeoBroadcastMessageWithLifetime(f_getArea(c_area1), c_lifetime )) ) {
                        log("*** " & testcasename() & ": INCONC: Trigger failed ***");
                        f_selfOrClientSyncAndVerdict(c_prDone, e_timeout);
                    }
                    if(not f_utTriggerEvent(m_generateGeoBroadcastMessageWithLifetime(f_getArea(c_area1), c_lifetime)) ) {
                        log("*** " & testcasename() & ": INCONC: Trigger failed ***");
                        f_selfOrClientSyncAndVerdict(c_prDone, e_timeout);
                    }
                    f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                    
                    // Test Body
                    f_sleep(int2float(c_defaultLifetime + 1));
                    f_startBeingNeighbour();
                    
                    tc_noac.start;
                    alt {
                        
                        [] geoNetworkingPort.receive(mw_geoNwInd(mw_geoNwPdu(mw_geoNwBroadcastPacket(
garciay's avatar
garciay committed
                            mw_longPosVectorPosition(v_longPosVectorIut),
                            tc_noac.stop;
                            log("*** " & testcasename() & ": FAIL: GBC packet received ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                        }
                        [] tc_noac.timeout {
                            log("*** " & testcasename() & ": PASS: No message received ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                        }
                    }
                    
                    // 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);
                    
                    // Test Body
                    f_sleep(int2float(c_defaultLifetime + 1));
                    f_startBeingNeighbour();
                    
                    tc_noac.start;
                    alt {
                        
                        [] geoNetworkingPort.receive(mw_geoNwInd(mw_geoNwPdu(mw_geoNwBroadcastPacket(
garciay's avatar
garciay committed
                            mw_longPosVectorPosition(v_longPosVectorIut),
                            tc_noac.stop;
                            log("*** " & testcasename() & ": FAIL: GBC packet received ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                        }
                        [] tc_noac.timeout {
                            log("*** " & testcasename() & ": PASS: No message received ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                        }
                    }
                    
                    // Postamble
                    f_poNeighbour();
                    
                } // end f_GEONW_PON_FPB_BV_08_nodeD
                
            } // end GEONW_PON_FPB_BV_08
            
            group GEONW_PON_FPB_BV_09 {
                 
                /**
                 * @desc    TP Function for TC_GEONW_PON_FPB_BV_09
                 */
                 function f_GEONW_PON_FPB_BV_09() runs on ItsMtc {
                    
                    // Local variables
                    var ItsGeoNetworking v_nodeB;
                    var ItsGeoNetworking v_nodeC;
                    
                    // Test control
                    if (not PICS_GN_GUC_SRC) {
                        log("*** " & testcasename() & ": PICS_GN_GUC_SRC required for executing the TC ***");
                        setverdict(inconc);
                        stop;
                    }
                    
                    // 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_09_nodeB());
                    v_nodeC.start(f_GEONW_PON_FPB_BV_09_nodeC());
                    
                    // Synchronization
                    f_serverSync2ClientsAndStop({c_prDone, c_tbDone});
                    
                    // Cleanup
                    f_cf03Down();
                    
                } // end f_GEONW_PON_FPB_BV_09
                
                /**
                 * @desc    Behavior function for NodeB (TC_GEONW_PON_FPB_BV_09)
                 */
                function f_GEONW_PON_FPB_BV_09_nodeB() runs on ItsGeoNetworking {
                    
                    // Local variables
                    var LongPosVector v_longPosVectorIut := f_getPosition(c_compIut);
                    var LongPosVector v_longPosVectorNodeA := f_getPosition(c_compNodeA);
                    var GeoNetworkingInd v_geoNetInd;
                    
                    // Preamble
                    f_prNonNeighbour();
                    f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                    
                    // 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)),
                            ?)))) -> value v_geoNetInd {
                            tc_ac.stop;
                            
                            //we only check that the lifetime is less than the default lifetime due to
                            //we do not know exactly the time passed at IUT
                            if (f_getLifetimeValue(v_geoNetInd.msgIn.basicHeader.lifeTime) < f_getMaxPacketLifeTime()) {
                                log("*** " & testcasename() & ": PASS: Lifetime was handled properly ***");
                                f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                            }
                            else {
                                log("*** " & testcasename() & ": FAIL: Lifetime was not handled properly ***");
                                f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                            }
                        }
                        [] tc_ac.timeout {
                            log("*** " & testcasename() & ": FAIL: Expected message not received ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                        }
                    }
                    
                    // Postamble
                    f_poNeighbour();
                    
                } // end f_GEONW_PON_FPB_BV_09_nodeB
                
                /**
                 * @desc    Behavior function for NodeC (TC_GEONW_PON_FPB_BV_09)
                 */
                function f_GEONW_PON_FPB_BV_09_nodeC() 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;
                    
                    // 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
                        )
                    )));
                    
                    if ( not f_utTriggerEvent(m_generateGeoUnicastMessage(v_longPosVectorNodeA.gnAddr)) ) {
                        log("*** " & testcasename() & ": INCONC: Trigger failed ***");
                        f_selfOrClientSyncAndVerdict(c_prDone, e_timeout);
                    }
                    f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                    
                    // Test Body
                    f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                    
                    // Postamble
                    f_poNeighbour();
                    
                } // end f_GEONW_PON_FPB_BV_09_nodeC
                 
            } // end GEONW_PON_FPB_BV_09
            
            group GEONW_PON_FPB_BV_10 {
                
                /**
                 * @desc    TP Function for TC_GEONW_PON_FPB_BV_10
                 */
                 function f_GEONW_PON_FPB_BV_10() runs on ItsMtc {
                    
                    // 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_10_nodeB());
                    v_nodeD.start(f_GEONW_PON_FPB_BV_10_nodeD());
                    
                    // Synchronization
                    f_serverSync2ClientsAndStop({c_prDone, c_tbDone});
                    
                    // Cleanup
                    f_cf02Down();
                    
                } // end f_GEONW_PON_FPB_BV_10
                
                /**
                 * @desc    Behavior function for NodeB (TC_GEONW_PON_FPB_BV_10)
                 */
                function f_GEONW_PON_FPB_BV_10_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_generateGeoBroadcastMessage(f_getArea(c_area1))) ) {
                        log("*** " & testcasename() & ": INCONC: Trigger failed ***");
                        f_selfOrClientSyncAndVerdict(c_prDone, e_timeout);
                    }
                    f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                    
                    // Test Body
                    f_sleep(1.0);
                    f_startBeingNeighbour();
                    tc_ac.start;
                    alt {
                        [] geoNetworkingPort.receive(mw_geoNwInd(mw_geoNwPdu(mw_geoNwBroadcastPacket(
garciay's avatar
garciay committed
                            mw_longPosVectorPosition(v_longPosVectorIut),
                            ?)))) -> value v_geoNetInd {
                            tc_ac.stop;
                            
                            //we only check that the lifetime is less than the default lifetime due to
                            //we do not know exactly the time passed at IUT
                            if (f_getLifetimeValue(v_geoNetInd.msgIn.basicHeader.lifeTime) < f_getMaxPacketLifeTime()) {
                                log("*** " & testcasename() & ": PASS: Lifetime was handled properly ***");
                                f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                            }
                            else {
                                log("*** " & testcasename() & ": FAIL: Lifetime was not handled properly ***");
                                f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                            }
                        }
                        [] tc_ac.timeout {
                            log("*** " & testcasename() & ": FAIL: Expected message not received ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                        }
                    }
                    
                    // Postamble
                    f_poNeighbour();
                    
                } // end f_GEONW_PON_FPB_BV_10_nodeB
                
                /**
                 * @desc    Behavior function for NodeD (TC_GEONW_PON_FPB_BV_10)
                 */
                function f_GEONW_PON_FPB_BV_10_nodeD() runs on ItsGeoNetworking {
                    
                    // Local variables
                    var LongPosVector v_longPosVectorIut := f_getPosition(c_compIut);
                    
                    // Preamble
                    f_prDefault();
                    f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                    
                    // Test Body
                    tc_ac.start;
                    alt {
                        [] geoNetworkingPort.receive(mw_geoNwInd(mw_geoNwPdu(mw_geoNwBroadcastPacket(
garciay's avatar
garciay committed
                            mw_longPosVectorPosition(v_longPosVectorIut),
                            tc_ac.stop;
                            log("*** " & testcasename() & ": PASS: GBC packet received correctly ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                        }
                        
                        [] tc_ac.timeout {
                            log("*** " & testcasename() & ": FAIL: Expected message not received ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                        }
                    }
                    
                    // Postamble
                    f_poDefault();
                    
                } // end f_GEONW_PON_FPB_BV_10_nodeD
                
            } // end GEONW_PON_FPB_BV_10
            
            group GEONW_PON_FPB_BV_11 {
                
                /**
                 * @desc    TP Function for TC_GEONW_PON_FPB_BV_11_01
                 */
                 function f_GEONW_PON_FPB_BV_11_01() runs on ItsMtc {
                    
                    // Local variables
                    var ItsGeoNetworking v_nodeB;
                    var ItsGeoNetworking v_nodeC;
                    
                    // Test control
                    if (not PICS_GN_GUC_SRC) {
                        log("*** " & testcasename() & ": PICS_GN_GUC_SRC required for executing the TC ***");
                        setverdict(inconc);
                        stop;
                    }
                    
                    // Test component configuration
                    f_cf03Up(c_compNodeC);
                    
                    // Preamble
                    
                    // Start components
                    v_nodeB := f_getComponent(c_compNodeB);
                    v_nodeC := f_getComponent(c_compNodeC);
                    v_nodeB.start(f_GEONW_PON_FPB_BV_11_01_nodeB());
                    v_nodeC.start(f_GEONW_PON_FPB_BV_11_01_nodeC());
                    
                    // Synchronization
                    f_serverSync2ClientsAndStop({c_prDone, c_tbDone});
                    
                    // Cleanup
                    f_cf03Down();
                    
                } // end f_GEONW_PON_FPB_BV_11_01

                /**
                 * @desc    Behavior function for NodeB (TC_GEONW_PON_FPB_BV_11_01)
                 */
                function f_GEONW_PON_FPB_BV_11_01_nodeB() runs on ItsGeoNetworking {
                    
                    // Local variablesa
                    var LongPosVector v_longPosVectorNodeA := f_getPosition(c_compNodeA);
                    
                    // Preamble
                    f_prNonNeighbour();
                    f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                    
                    // Test Body
                    tc_ac.start;
                    alt {
                        [] geoNetworkingPort.receive(
                                mw_geoNwInd(
                                    mw_geoNwPdu(
                                        mw_geoNwUnicastPacket(
                                            f_longPosVector2ShortPosVector(v_longPosVectorNodeA),
                                            ?
                                        )
                                    )
                                )
                            ) {
                            tc_ac.stop;
                            log("*** " & testcasename() & ": PASS: Pre-conditions: TSB correctly broadcasted ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                        }
                        [] tc_ac.timeout {
                            log("*** " & testcasename() & ": FAIL: Pre-conditions: TSB not broadcasted ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                        }
                    }
                    
                    // Postamble
                    f_poDefault();
                    
                } // end f_GEONW_PON_FPB_BV_11_01_nodeB
                
                /**
                 * @desc    Behavior function for NodeC (TC_GEONW_PON_FPB_BV_11_01)
                 */
                function f_GEONW_PON_FPB_BV_11_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_prNonNeighbour();
                    // 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);
                    
                    // Test Body
                    if(not f_utTriggerEvent(m_generateGeoUnicastMessageWithTrafficClass(
                            v_longPosVectorNodeA.gnAddr,
                            valueof(m_trafficClass(e_scfDisabled))))) {
                        log("*** " & testcasename() & ": INCONC: Trigger failed ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
                    }
                    tc_ac.start;
                    alt {
                        [] geoNetworkingPort.receive(
                                mw_geoNwInd(
                                    mw_geoNwPdu(
                                        mw_geoNwUnicastPacket(
                                            f_longPosVector2ShortPosVector(v_longPosVectorNodeA),
                                            ?
                                        )
                                    )
                                )
                            ) {
                            tc_ac.stop;
                            log("*** " & testcasename() & ": PASS: Pre-conditions: TSB correctly broadcasted ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                        }
                        [] tc_ac.timeout {
                            log("*** " & testcasename() & ": FAIL: Pre-conditions: TSB not broadcasted ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                        }
                    }
                    
                    // Postamble
                    f_poDefault();
                    
                } // end f_GEONW_PON_FPB_BV_11_01_nodeC

                /**
                 * @desc    TP Function for TC_GEONW_PON_FPB_BV_11_02
                 */
                 function f_GEONW_PON_FPB_BV_11_02() runs on ItsMtc {
                    
                    // Local variables
                    var ItsGeoNetworking v_nodeB;
                    var ItsGeoNetworking v_nodeC;
                    
                    // Test control
                    if (not PICS_GN_GAC_SRC) {
                        log("*** " & testcasename() & ": PICS_GN_GAC_SRC required for executing the TC ***");
                        setverdict(inconc);
                        stop;
                    }
                    
                    // Test component configuration
                    f_cf03Up(c_compNodeC);
                    
                    // Preamble
                    
                    // Start components
                    v_nodeB := f_getComponent(c_compNodeB);
                    v_nodeC := f_getComponent(c_compNodeC);
                    v_nodeB.start(f_GEONW_PON_FPB_BV_11_02_nodeB());
                    v_nodeC.start(f_GEONW_PON_FPB_BV_11_02_nodeC());
                    
                    // Synchronization
                    f_serverSync2ClientsAndStop({c_prDone, c_tbDone});
                    
                    // Cleanup
                    f_cf03Down();
                    
                } // end f_GEONW_PON_FPB_BV_11_02
                
                /**
                 * @desc    Behavior function for NodeB (TC_GEONW_PON_FPB_BV_11_02)
                 */
                function f_GEONW_PON_FPB_BV_11_02_nodeB() runs on ItsGeoNetworking {
                    
                    // Local variables
                    var LongPosVector v_longPosVectorIut := f_getPosition(c_compIut);
                    
                    // Preamble
                    f_prNonNeighbour();
                    f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                    
                    // Test Body
                    tc_ac.start;
                    alt {
                        [] geoNetworkingPort.receive(
                                mw_geoNwInd(
                                    mw_geoNwPdu(
                                        mw_geoNwAnycastPacket(
garciay's avatar
garciay committed
                                            mw_longPosVectorPosition(v_longPosVectorIut),
                                            ?
                                        )
                                    )
                                )
                            ) {
                            tc_ac.stop;
                            log("*** " & testcasename() & ": PASS: Pre-conditions: TSB correctly broadcasted ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                        }
                        [] tc_ac.timeout {
                            log("*** " & testcasename() & ": FAIL: Pre-conditions: TSB not broadcasted ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                        }
                    }
                    
                    // Postamble
                    f_poDefault();
                    
                } // end f_GEONW_PON_FPB_BV_11_02_nodeB
                
                /**
                 * @desc    Behavior function for NodeC (TC_GEONW_PON_FPB_BV_11_02)
                 */
                function f_GEONW_PON_FPB_BV_11_02_nodeC() runs on ItsGeoNetworking {
                    
                    // Local variables
                    var LongPosVector v_longPosVectorIut := f_getPosition(c_compIut);
                    
                    // Preamble
                    f_prNonNeighbour();
                    f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                    
                    // Test Body
                    if(not f_utTriggerEvent(m_generateGeoAnycastMessageWithTrafficClass(
                            f_getArea(c_area2),
                            valueof(m_trafficClass(e_scfDisabled))))) {
                        log("*** " & testcasename() & ": INCONC: Trigger failed ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
                    }
                    tc_ac.start;
                    alt {
                        [] geoNetworkingPort.receive(
                                mw_geoNwInd(
                                    mw_geoNwPdu(
                                        mw_geoNwAnycastPacket(
garciay's avatar
garciay committed
                                            mw_longPosVectorPosition(v_longPosVectorIut),
                                            ?
                                        )
                                    )
                                )
                            ) {
                            tc_ac.stop;
                            log("*** " & testcasename() & ": PASS: Pre-conditions: TSB correctly broadcasted ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                        }
                        [] tc_ac.timeout {
                            log("*** " & testcasename() & ": FAIL: Pre-conditions: TSB not broadcasted ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                        }
                    }
                    
                    // Postamble
                    f_poDefault();
                    
                } // end f_GEONW_PON_FPB_BV_11_02_nodeC
                
                /**
                 * @desc    TP Function for TC_GEONW_PON_FPB_BV_11_03
                 */
                 function f_GEONW_PON_FPB_BV_11_03() runs on ItsMtc {
                    
                    // Local variables
                    var ItsGeoNetworking v_nodeB;
                    var ItsGeoNetworking v_nodeC;
                    
                    // Test control
                    if (not PICS_GN_GBC_SRC) {
                        log("*** " & testcasename() & ": PICS_GN_GBC_SRC required for executing the TC ***");
                        setverdict(inconc);
                        stop;
                    }
                    
                    // Test component configuration
                    f_cf03Up(c_compNodeC);
                    
                    // Preamble
                    
                    // Start components
                    v_nodeB := f_getComponent(c_compNodeB);
                    v_nodeC := f_getComponent(c_compNodeC);
                    v_nodeB.start(f_GEONW_PON_FPB_BV_11_03_nodeB());
                    v_nodeC.start(f_GEONW_PON_FPB_BV_11_03_nodeC());
                    
                    // Synchronization
                    f_serverSync2ClientsAndStop({c_prDone, c_tbDone});
                    
                    // Cleanup
                    f_cf03Down();
                    
                } // end f_GEONW_PON_FPB_BV_11_03
                
                /**
                 * @desc    Behavior function for NodeB (TC_GEONW_PON_FPB_BV_11_03)
                 */
                function f_GEONW_PON_FPB_BV_11_03_nodeB() runs on ItsGeoNetworking {
                    
                    // Local variables
                    var LongPosVector v_longPosVectorIut := f_getPosition(c_compIut);
                    
                    // Preamble
                    f_prNonNeighbour();
                    f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                    
                    // Test Body
                    tc_ac.start;
                    alt {
                        [] geoNetworkingPort.receive(
                                mw_geoNwInd(
                                    mw_geoNwPdu(
                                        mw_geoNwBroadcastPacket(
garciay's avatar
garciay committed
                                            mw_longPosVectorPosition(v_longPosVectorIut),
                                            ?
                                        )
                                    )
                                )
                            ) {
                            tc_ac.stop;
                            log("*** " & testcasename() & ": PASS: Pre-conditions: TSB correctly broadcasted ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                        }
                        [] tc_ac.timeout {
                            log("*** " & testcasename() & ": FAIL: Pre-conditions: TSB not broadcasted ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                        }
                    }
                    
                    // Postamble
                    f_poDefault();
                    
                } // end f_GEONW_PON_FPB_BV_11_03_nodeB
                
                /**
                 * @desc    Behavior function for NodeC (TC_GEONW_PON_FPB_BV_11_03)
                 */
                function f_GEONW_PON_FPB_BV_11_03_nodeC() runs on ItsGeoNetworking {
                    
                    // Local variables
                    var LongPosVector v_longPosVectorIut := f_getPosition(c_compIut);
                    
                    // Preamble
                    f_prNonNeighbour();
                    f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                    
                    // Test Body
                    if(not f_utTriggerEvent(m_generateGeoBroadcastMessageWithTrafficClass(
                            f_getArea(c_area2),
                            valueof(m_trafficClass(e_scfDisabled))))) {
                        log("*** " & testcasename() & ": INCONC: Trigger failed ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
                    }
                    tc_ac.start;
                    alt {
                        [] geoNetworkingPort.receive(
                                mw_geoNwInd(
                                    mw_geoNwPdu(
                                        mw_geoNwBroadcastPacket(
garciay's avatar
garciay committed
                                            mw_longPosVectorPosition(v_longPosVectorIut),
                                            ?
                                        )
                                    )
                                )
                            ) {
                            tc_ac.stop;
                            log("*** " & testcasename() & ": PASS: Pre-conditions: TSB correctly broadcasted ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                        }
                        [] tc_ac.timeout {
                            log("*** " & testcasename() & ": FAIL: Pre-conditions: TSB not broadcasted ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                        }
                    }
                    
                    // Postamble
                    f_poDefault();
                    
                } // end f_GEONW_PON_FPB_BV_11_03_nodeC
                
                /**
                 * @desc    TP Function for TC_GEONW_PON_FPB_BV_11_04
                 */
                 function f_GEONW_PON_FPB_BV_11_04() runs on ItsMtc {
                    
                    // Local variables
                    var ItsGeoNetworking v_nodeB;
                    var ItsGeoNetworking v_nodeC;
                    
                    // Test control
                    if (not PICS_GN_TSB_SRC) {
                        log("*** " & testcasename() & ": PICS_GN_TSB_SRC required for executing the TC ***");
                        setverdict(inconc);
                        stop;
                    }
                    
                    // Test component configuration
                    f_cf03Up(c_compNodeC);
                    
                    // Preamble
                    
                    // Start components
                    v_nodeB := f_getComponent(c_compNodeB);
                    v_nodeC := f_getComponent(c_compNodeC);
                    v_nodeB.start(f_GEONW_PON_FPB_BV_11_04_nodeB());
                    v_nodeC.start(f_GEONW_PON_FPB_BV_11_04_nodeC());
                    
                    // Synchronization
                    f_serverSync2ClientsAndStop({c_prDone, c_tbDone});
                    
                    // Cleanup
                    f_cf03Down();
                    
                } // end f_GEONW_PON_FPB_BV_11_04                                                

                /**
                 * @desc    Behavior function for NodeB (TC_GEONW_PON_FPB_BV_11_04)
                 */
                function f_GEONW_PON_FPB_BV_11_04_nodeB() runs on ItsGeoNetworking {
                    
                    // Local variables
                    var LongPosVector v_longPosVectorIut := f_getPosition(c_compIut);
                    
                    // Preamble
                    f_prNonNeighbour();
                    f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                    
                    // Test Body
                    tc_ac.start;
                    alt {
                        [] geoNetworkingPort.receive(
                                mw_geoNwInd(
                                    mw_geoNwPdu(
                                        mw_geoNwTsbPacket(
                                            ?,
garciay's avatar
garciay committed
                                            mw_longPosVectorPosition(v_longPosVectorIut)
                                        )
                                    )
                                )
                            ) {
                            tc_ac.stop;
                            log("*** " & testcasename() & ": PASS: Pre-conditions: TSB correctly broadcasted ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                        }
                        [] tc_ac.timeout {
                            log("*** " & testcasename() & ": FAIL: Pre-conditions: TSB not broadcasted ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                        }
                    }
                    
                    // Postamble
                    f_poDefault();
                    
                } // end f_GEONW_PON_FPB_BV_11_04_nodeB
                
                /**
                 * @desc    Behavior function for NodeC (TC_GEONW_PON_FPB_BV_11_04)
                 */
                function f_GEONW_PON_FPB_BV_11_04_nodeC() runs on ItsGeoNetworking {
                    
                    // Local variables
                    var LongPosVector v_longPosVectorIut := f_getPosition(c_compIut);
                    
                    // Preamble
                    f_prNonNeighbour();
                    f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                    
                    // Test Body
                    if(not f_utTriggerEvent(valueof(m_generateTsbMessageWithTrafficClass(valueof(m_trafficClass(e_scfDisabled)))))) {
                        log("*** " & testcasename() & ": INCONC: Trigger failed ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
                    }
                    tc_ac.start;
                    alt {
                        [] geoNetworkingPort.receive(
                                mw_geoNwInd(
                                    mw_geoNwPdu(
                                        mw_geoNwTsbPacket(
                                            ?,
garciay's avatar
garciay committed
                                            mw_longPosVectorPosition(v_longPosVectorIut)
                                        )
                                    )
                                )
                            ) {
                            tc_ac.stop;
                            log("*** " & testcasename() & ": PASS: Pre-conditions: TSB correctly broadcasted ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                        }
                        [] tc_ac.timeout {
                            log("*** " & testcasename() & ": FAIL: Pre-conditions: TSB not broadcasted ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                        }
                    }
                    
                    // Postamble
                    f_poDefault();
                    
                } // end f_GEONW_PON_FPB_BV_11_04_nodeC
                
                /**
                 * @desc    TP Function for TC_GEONW_PON_FPB_BV_11_05
                 */
                 function f_GEONW_PON_FPB_BV_11_05() runs on ItsMtc {
                    
                    // Local variables
                    var ItsGeoNetworking v_nodeB;
                    var ItsGeoNetworking v_nodeC;
                    
                    // Test control
                    if (not PICS_GN_TSB_SRC) {
                        log("*** " & testcasename() & ": PICS_GN_TSB_SRC required for executing the TC ***");
                        setverdict(inconc);
                        stop;
                    }
                    
                    // Test component configuration
                    f_cf03Up(c_compNodeC);
                    
                    // Preamble
                    
                    // Start components
                    v_nodeB := f_getComponent(c_compNodeB);
                    v_nodeC := f_getComponent(c_compNodeC);
                    v_nodeB.start(f_GEONW_PON_FPB_BV_11_05_nodeB());
                    v_nodeC.start(f_GEONW_PON_FPB_BV_11_05_nodeC());
                    
                    // Synchronization
                    f_serverSync2ClientsAndStop({c_prDone, c_tbDone});
                    
                    // Cleanup
                    f_cf03Down();
                    
                } // end f_GEONW_PON_FPB_BV_11_05
                
                /**
                 * @desc    Behavior function for NodeB (TC_GEONW_PON_FPB_BV_11_05)
                 */
                function f_GEONW_PON_FPB_BV_11_05_nodeB() runs on ItsGeoNetworking {
                    
                    // Local variables
                    var LongPosVector v_longPosVectorIut := f_getPosition(c_compIut);
                    
                    // Preamble
                    f_prNonNeighbour();
                    f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                    
                    // Test Body
                    tc_ac.start;
                    alt {
                        [] geoNetworkingPort.receive(
                                mw_geoNwInd(
                                    mw_geoNwPdu(
                                        mw_geoNwShbPacket(
garciay's avatar
garciay committed
                                            mw_longPosVectorPosition(v_longPosVectorIut)
                                        )
                                    )
                                )
                            ) {
                            tc_ac.stop;
                            log("*** " & testcasename() & ": PASS: Pre-conditions: TSB correctly broadcasted ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                        }
                        [] tc_ac.timeout {
                            log("*** " & testcasename() & ": FAIL: Pre-conditions: TSB not broadcasted ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                        }
                    }
                    
                    // Postamble
                    f_poDefault();
                    
                } // end f_GEONW_PON_FPB_BV_11_05_nodeB
                
                /**
                 * @desc    Behavior function for NodeC (TC_GEONW_PON_FPB_BV_11_05)
                 */
                function f_GEONW_PON_FPB_BV_11_05_nodeC() runs on ItsGeoNetworking {
                    
                    // Local variables
                    var LongPosVector v_longPosVectorIut := f_getPosition(c_compIut);
                    
                    // Preamble
                    f_prNonNeighbour();
                    f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                    
                    // Test Body
                    if(not f_utTriggerEvent(valueof(m_generateShbMessageWithTrafficClass(valueof(m_trafficClass(e_scfDisabled)))))) {
                        log("*** " & testcasename() & ": INCONC: Trigger failed ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
                    }
                    tc_ac.start;
                    alt {
                        [] geoNetworkingPort.receive(
                                mw_geoNwInd(
                                    mw_geoNwPdu(
                                        mw_geoNwShbPacket(
garciay's avatar
garciay committed
                                            mw_longPosVectorPosition(v_longPosVectorIut)
                                        )
                                    )
                                )
                            ) {
                            tc_ac.stop;
                            log("*** " & testcasename() & ": PASS: Pre-conditions: TSB correctly broadcasted ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                        }
                        [] tc_ac.timeout {
                            log("*** " & testcasename() & ": FAIL: Pre-conditions: TSB not broadcasted ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                        }
                    }
                    
                    // Postamble
                    f_poDefault();
                    
                } // end f_GEONW_PON_FPB_BV_11_05_nodeC
                
            } // end GEONW_PON_FPB_BV_11
            
            group GEONW_PON_FPB_BV_12 {
                
                /**
                 * @desc    TP Function for TC_GEONW_PON_FPB_BV_12_01
                 */
                 function f_GEONW_PON_FPB_BV_12_01() runs on ItsMtc {
                    
                    // Local variables
                    var ItsGeoNetworking v_nodeB;
                    var ItsGeoNetworking v_nodeC;
                    
                    // Test control
                    if (not PICS_GN_GUC_SRC) {
                        log("*** " & testcasename() & ": PICS_GN_GUC_SRC required for executing the TC ***");
                        setverdict(inconc);
                        stop;
                    }
                    
                    // Test component configuration
                    f_cf03Up(c_compNodeC);
                    
                    // Preamble
                    
                    // Start components
                    v_nodeB := f_getComponent(c_compNodeB);
                    v_nodeC := f_getComponent(c_compNodeC);
                    v_nodeB.start(f_GEONW_PON_FPB_BV_12_01_nodeB());
                    v_nodeC.start(f_GEONW_PON_FPB_BV_12_01_nodeC());
                    
                    // Synchronization
                    f_serverSync2ClientsAndStop({c_prDone, c_tbDone});
                    
                    // Cleanup
                    f_cf03Down();
                    
                } // end f_GEONW_PON_FPB_BV_12_01

                /**
                 * @desc    Behavior function for NodeB (TC_GEONW_PON_FPB_BV_12_01)
                 */
                function f_GEONW_PON_FPB_BV_12_01_nodeB() runs on ItsGeoNetworking {
                    
                    // Local variablesa
                    var LongPosVector v_longPosVectorNodeA := f_getPosition(c_compNodeA);
                    
                    // Preamble
                    f_prNonNeighbour();
                    f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                    
                    // Test Body
                    tc_ac.start;
                    alt {
                        [] geoNetworkingPort.receive(
                                mw_geoNwInd(
                                    mw_geoNwPdu(
                                        mw_geoNwUnicastPacket(
                                            f_longPosVector2ShortPosVector(v_longPosVectorNodeA),
                                            ?
                                        )
                                    )
                                )
                            ) {
                            tc_ac.stop;
                            log("*** " & testcasename() & ": PASS: Pre-conditions: TSB correctly broadcasted ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                        }
                        [] tc_ac.timeout {
                            log("*** " & testcasename() & ": FAIL: Pre-conditions: TSB not broadcasted ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                        }
                    }
                    
                    // Postamble
                    f_poDefault();
                    
                } // end f_GEONW_PON_FPB_BV_12_01_nodeB
                
                /**
                 * @desc    Behavior function for NodeC (TC_GEONW_PON_FPB_BV_12_01)
                 */
                function f_GEONW_PON_FPB_BV_12_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_prNonNeighbour();
                    f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                    
                    // Test Body
                    f_sendGeoNetMessage(
                        m_geoNwReq_withLinkLayerDestination(
                            m_geoNwPdu(
                                m_geoNwUnicastPacket(
                                    f_getPosition(c_compNodeC),
                                    f_longPosVector2ShortPosVector(f_getPosition(c_compNodeA)),
                                    vc_localSeqNumber,
                                    -,
                                    m_trafficClass(e_scfDisabled)
                                ),
                                -,
                                c_defaultHopLimit
                            ),
5438 5439 5440 5441 5442 5443 5444 5445 5446 5447 5448 5449 5450 5451 5452 5453 5454 5455 5456 5457 5458 5459 5460 5461 5462 5463 5464 5465 5466 5467 5468 5469 5470 5471 5472 5473 5474 5475 5476 5477 5478 5479 5480 5481 5482 5483 5484 5485 5486 5487 5488 5489 5490 5491 5492 5493 5494 5495 5496 5497 5498 5499 5500 5501 5502 5503 5504 5505 5506 5507 5508 5509 5510 5511 5512 5513 5514 5515 5516 5517 5518 5519 5520 5521 5522 5523 5524 5525 5526 5527 5528 5529 5530 5531 5532 5533 5534 5535 5536 5537 5538 5539 5540 5541 5542 5543 5544 5545 5546 5547 5548 5549 5550 5551 5552 5553 5554 5555 5556 5557 5558 5559 5560 5561 5562 5563 5564 5565 5566 5567 5568 5569 5570 5571 5572 5573 5574 5575 5576 5577 5578 5579 5580 5581 5582 5583 5584 5585 5586 5587 5588 5589 5590 5591 5592 5593 5594 5595 5596 5597 5598 5599 5600 5601 5602 5603 5604 5605 5606 5607 5608 5609 5610 5611 5612 5613 5614 5615 5616 5617 5618 5619 5620 5621 5622 5623 5624 5625 5626 5627 5628 5629 5630 5631 5632 5633 5634 5635 5636 5637 5638 5639 5640 5641 5642 5643 5644 5645 5646 5647 5648 5649 5650 5651 5652 5653 5654 5655 5656 5657 5658 5659 5660 5661 5662 5663 5664 5665 5666 5667 5668 5669 5670 5671 5672 5673 5674 5675 5676 5677 5678 5679 5680 5681 5682 5683 5684 5685 5686 5687 5688 5689 5690 5691 5692 5693 5694 5695 5696 5697 5698 5699 5700 5701 5702 5703 5704 5705 5706 5707 5708 5709 5710 5711 5712 5713 5714 5715 5716 5717 5718 5719 5720 5721 5722 5723 5724 5725 5726 5727 5728 5729 5730 5731 5732 5733 5734 5735 5736 5737 5738 5739 5740 5741 5742 5743 5744 5745 5746 5747 5748 5749 5750 5751 5752 5753 5754 5755 5756 5757 5758 5759 5760 5761 5762 5763 5764 5765 5766 5767 5768 5769 5770 5771 5772 5773 5774 5775 5776 5777 5778 5779 5780 5781 5782 5783 5784 5785 5786 5787 5788 5789 5790 5791 5792 5793 5794 5795 5796 5797 5798 5799 5800 5801 5802 5803 5804 5805 5806 5807 5808 5809 5810 5811 5812 5813 5814 5815 5816 5817 5818 5819 5820 5821 5822 5823 5824 5825 5826 5827 5828 5829 5830 5831 5832 5833 5834 5835 5836 5837 5838 5839 5840 5841 5842 5843 5844 5845 5846 5847 5848 5849 5850 5851 5852 5853 5854 5855 5856 5857 5858 5859 5860 5861 5862 5863 5864 5865 5866 5867 5868 5869 5870 5871 5872 5873 5874 5875 5876 5877 5878 5879 5880 5881 5882 5883 5884 5885 5886 5887 5888 5889 5890 5891 5892 5893 5894 5895 5896 5897 5898 5899 5900 5901 5902 5903 5904 5905 5906 5907 5908 5909 5910 5911 5912 5913 5914 5915 5916 5917 5918 5919 5920 5921 5922 5923 5924 5925 5926 5927
                            f_getIutMacAddress()
                        )
                    );

                    tc_ac.start;
                    alt {
                        [] geoNetworkingPort.receive(
                                mw_geoNwInd(
                                    mw_geoNwPdu(
                                        mw_geoNwUnicastPacket(
                                            f_longPosVector2ShortPosVector(v_longPosVectorNodeA),
                                            ?
                                        )
                                    )
                                )
                            ) {
                            tc_ac.stop;
                            log("*** " & testcasename() & ": PASS: Pre-conditions: TSB correctly broadcasted ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                        }
                        [] tc_ac.timeout {
                            log("*** " & testcasename() & ": FAIL: Pre-conditions: TSB not broadcasted ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                        }
                    }
                    
                    // Postamble
                    f_poDefault();
                    
                } // end f_GEONW_PON_FPB_BV_12_01_nodeC

                /**
                 * @desc    TP Function for TC_GEONW_PON_FPB_BV_12_02
                 */
                 function f_GEONW_PON_FPB_BV_12_02() runs on ItsMtc {
                    
                    // Local variables
                    var ItsGeoNetworking v_nodeB;
                    var ItsGeoNetworking v_nodeC;
                    
                    // Test control
                    if (not PICS_GN_GAC_SRC) {
                        log("*** " & testcasename() & ": PICS_GN_GAC_SRC required for executing the TC ***");
                        setverdict(inconc);
                        stop;
                    }
                    
                    // Test component configuration
                    f_cf03Up(c_compNodeC);
                    
                    // Preamble
                    
                    // Start components
                    v_nodeB := f_getComponent(c_compNodeB);
                    v_nodeC := f_getComponent(c_compNodeC);
                    v_nodeB.start(f_GEONW_PON_FPB_BV_12_02_nodeB());
                    v_nodeC.start(f_GEONW_PON_FPB_BV_12_02_nodeC());
                    
                    // Synchronization
                    f_serverSync2ClientsAndStop({c_prDone, c_tbDone});
                    
                    // Cleanup
                    f_cf03Down();
                    
                } // end f_GEONW_PON_FPB_BV_12_02
                
                /**
                 * @desc    Behavior function for NodeB (TC_GEONW_PON_FPB_BV_12_02)
                 */
                function f_GEONW_PON_FPB_BV_12_02_nodeB() runs on ItsGeoNetworking {
                    
                    // Local variables
                    var LongPosVector v_longPosVectorNodeC := f_getPosition(c_compNodeC);
                    
                    // Preamble
                    f_prNonNeighbour();
                    f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                    
                    // Test Body
                    tc_ac.start;
                    alt {
                        [] geoNetworkingPort.receive(
                                mw_geoNwInd(
                                    mw_geoNwPdu(
                                        mw_geoNwAnycastPacket(
                                            mw_longPosVectorPosition(v_longPosVectorNodeC),
                                            ?
                                        )
                                    )
                                )
                            ) {
                            tc_ac.stop;
                            log("*** " & testcasename() & ": PASS: Pre-conditions: TSB correctly broadcasted ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                        }
                        [] tc_ac.timeout {
                            log("*** " & testcasename() & ": FAIL: Pre-conditions: TSB not broadcasted ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                        }
                    }
                    
                    // Postamble
                    f_poDefault();
                    
                } // end f_GEONW_PON_FPB_BV_11_02_nodeB
                
                /**
                 * @desc    Behavior function for NodeC (TC_GEONW_PON_FPB_BV_12_02)
                 */
                function f_GEONW_PON_FPB_BV_12_02_nodeC() runs on ItsGeoNetworking {
                    
                    // Local variables
                    var LongPosVector v_longPosVectorNodeC := f_getPosition(c_compNodeC);
                    
                    // Preamble
                    f_prNonNeighbour();
                    f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                    
                    // Test Body
                    f_sendGeoNetMessage(
                        m_geoNwReq_linkLayerBroadcast(
                            m_geoNwPdu(
                                m_geoNwAnycastPacket(
                                    v_longPosVectorNodeC,
                                    vc_localSeqNumber,
                                    f_getGeoAnycastArea(c_area2),
                                    -,
                                    m_trafficClass(e_scfDisabled)
                                )
                            )
                        )
                    );
                    
                    tc_ac.start;
                    alt {
                        [] geoNetworkingPort.receive(
                                mw_geoNwInd(
                                    mw_geoNwPdu(
                                        mw_geoNwAnycastPacket(
                                            mw_longPosVectorPosition(v_longPosVectorNodeC),
                                            ?
                                        )
                                    )
                                )
                            ) {
                            tc_ac.stop;
                            log("*** " & testcasename() & ": PASS: Pre-conditions: TSB correctly broadcasted ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                        }
                        [] tc_ac.timeout {
                            log("*** " & testcasename() & ": FAIL: Pre-conditions: TSB not broadcasted ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                        }
                    }
                    
                    // Postamble
                    f_poDefault();
                    
                } // end f_GEONW_PON_FPB_BV_12_02_nodeC
                
                /**
                 * @desc    TP Function for TC_GEONW_PON_FPB_BV_12_02
                 */
                 function f_GEONW_PON_FPB_BV_12_03() runs on ItsMtc {
                    
                    // Local variables
                    var ItsGeoNetworking v_nodeB;
                    var ItsGeoNetworking v_nodeC;
                    
                    // Test control
                    if (not PICS_GN_GBC_SRC) {
                        log("*** " & testcasename() & ": PICS_GN_GBC_SRC required for executing the TC ***");
                        setverdict(inconc);
                        stop;
                    }
                    
                    // Test component configuration
                    f_cf03Up(c_compNodeC);
                    
                    // Preamble
                    
                    // Start components
                    v_nodeB := f_getComponent(c_compNodeB);
                    v_nodeC := f_getComponent(c_compNodeC);
                    v_nodeB.start(f_GEONW_PON_FPB_BV_12_03_nodeB());
                    v_nodeC.start(f_GEONW_PON_FPB_BV_12_03_nodeC());
                    
                    // Synchronization
                    f_serverSync2ClientsAndStop({c_prDone, c_tbDone});
                    
                    // Cleanup
                    f_cf03Down();
                    
                } // end f_GEONW_PON_FPB_BV_12_03
                
                /**
                 * @desc    Behavior function for NodeB (TC_GEONW_PON_FPB_BV_12_03)
                 */
                function f_GEONW_PON_FPB_BV_12_03_nodeB() runs on ItsGeoNetworking {
                    
                    // Local variables
                    var LongPosVector v_longPosVectorNodeC := f_getPosition(c_compNodeC);
                    
                    // Preamble
                    f_prNonNeighbour();
                    f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                    
                    // Test Body
                    tc_ac.start;
                    alt {
                        [] geoNetworkingPort.receive(
                                mw_geoNwInd(
                                    mw_geoNwPdu(
                                        mw_geoNwBroadcastPacket(
                                            mw_longPosVectorPosition(v_longPosVectorNodeC),
                                            ?
                                        )
                                    )
                                )
                            ) {
                            tc_ac.stop;
                            log("*** " & testcasename() & ": PASS: Pre-conditions: TSB correctly broadcasted ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                        }
                        [] tc_ac.timeout {
                            log("*** " & testcasename() & ": FAIL: Pre-conditions: TSB not broadcasted ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                        }
                    }
                    
                    // Postamble
                    f_poDefault();
                    
                } // end f_GEONW_PON_FPB_BV_12_03_nodeB
                
                /**
                 * @desc    Behavior function for NodeC (TC_GEONW_PON_FPB_BV_12_03)
                 */
                function f_GEONW_PON_FPB_BV_12_03_nodeC() runs on ItsGeoNetworking {
                    
                    // Local variables
                    var LongPosVector v_longPosVectorNodeC := f_getPosition(c_compNodeC);
                    
                    // Preamble
                    f_prNonNeighbour();
                    f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                    
                    // Test Body
                    f_sendGeoNetMessage(
                        m_geoNwReq_linkLayerBroadcast(
                            m_geoNwPdu(
                                m_geoNwBroadcastPacket(
                                    v_longPosVectorNodeC,
                                    vc_localSeqNumber,
                                    f_getGeoBroadcastArea(c_area2),
                                    -,
                                    m_trafficClass(e_scfDisabled)
                                )
                            )
                        )
                    );
                    
                    tc_ac.start;
                    alt {
                        [] geoNetworkingPort.receive(
                                mw_geoNwInd(
                                    mw_geoNwPdu(
                                        mw_geoNwBroadcastPacket(
                                            mw_longPosVectorPosition(v_longPosVectorNodeC),
                                            ?
                                        )
                                    )
                                )
                            ) {
                            tc_ac.stop;
                            log("*** " & testcasename() & ": PASS: Pre-conditions: TSB correctly broadcasted ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                        }
                        [] tc_ac.timeout {
                            log("*** " & testcasename() & ": FAIL: Pre-conditions: TSB not broadcasted ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                        }
                    }
                    
                    // Postamble
                    f_poDefault();
                    
                } // end f_GEONW_PON_FPB_BV_11_03_nodeC
                
                /**
                 * @desc    TP Function for TC_GEONW_PON_FPB_BV_12_04
                 */
                 function f_GEONW_PON_FPB_BV_12_04() runs on ItsMtc {
                    
                    // Local variables
                    var ItsGeoNetworking v_nodeB;
                    var ItsGeoNetworking v_nodeC;
                    
                    // Test control
                    if (not PICS_GN_TSB_SRC) {
                        log("*** " & testcasename() & ": PICS_GN_TSB_SRC required for executing the TC ***");
                        setverdict(inconc);
                        stop;
                    }
                    
                    // Test component configuration
                    f_cf03Up(c_compNodeC);
                    
                    // Preamble
                    
                    // Start components
                    v_nodeB := f_getComponent(c_compNodeB);
                    v_nodeC := f_getComponent(c_compNodeC);
                    v_nodeB.start(f_GEONW_PON_FPB_BV_12_04_nodeB());
                    v_nodeC.start(f_GEONW_PON_FPB_BV_12_04_nodeC());
                    
                    // Synchronization
                    f_serverSync2ClientsAndStop({c_prDone, c_tbDone});
                    
                    // Cleanup
                    f_cf03Down();
                    
                } // end f_GEONW_PON_FPB_BV_11_04                                                

                /**
                 * @desc    Behavior function for NodeB (TC_GEONW_PON_FPB_BV_12_04)
                 */
                function f_GEONW_PON_FPB_BV_12_04_nodeB() runs on ItsGeoNetworking {
                    
                    // Local variables
                    var LongPosVector v_longPosVectorNodeC := f_getPosition(c_compNodeC);
                    
                    // Preamble
                    f_prNonNeighbour();
                    f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                    
                    // Test Body
                    tc_ac.start;
                    alt {
                        [] geoNetworkingPort.receive(
                                mw_geoNwInd(
                                    mw_geoNwPdu(
                                        mw_geoNwTsbPacket(
                                            ?,
                                            mw_longPosVectorPosition(v_longPosVectorNodeC)
                                        )
                                    )
                                )
                            ) {
                            tc_ac.stop;
                            log("*** " & testcasename() & ": PASS: Pre-conditions: TSB correctly broadcasted ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                        }
                        [] tc_ac.timeout {
                            log("*** " & testcasename() & ": FAIL: Pre-conditions: TSB not broadcasted ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                        }
                    }
                    
                    // Postamble
                    f_poDefault();
                    
                } // end f_GEONW_PON_FPB_BV_12_04_nodeB
                
                /**
                 * @desc    Behavior function for NodeC (TC_GEONW_PON_FPB_BV_12_04)
                 */
                function f_GEONW_PON_FPB_BV_12_04_nodeC() runs on ItsGeoNetworking {
                    
                    // Local variables
                    var LongPosVector v_longPosVectorNodeC := f_getPosition(c_compNodeC);
                    
                    // Preamble
                    f_prNonNeighbour();
                    f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                    
                    // Test Body
                    f_sendGeoNetMessage(
                        m_geoNwReq_linkLayerBroadcast(
                            m_geoNwPdu(
                                m_geoNwTsbPacket(
                                    vc_localSeqNumber,
                                    v_longPosVectorNodeC,
                                    c_defaultHopLimit,
                                    m_trafficClass(e_scfDisabled)
                                ),
                                -,
                                c_defaultHopLimit
                            )
                        )
                    );
                    
                    tc_ac.start;
                    alt {
                        [] geoNetworkingPort.receive(
                                mw_geoNwInd(
                                    mw_geoNwPdu(
                                        mw_geoNwTsbPacket(
                                            ?,
                                            mw_longPosVectorPosition(v_longPosVectorNodeC)
                                        )
                                    )
                                )
                            ) {
                            tc_ac.stop;
                            log("*** " & testcasename() & ": PASS: Pre-conditions: TSB correctly broadcasted ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                        }
                        [] tc_ac.timeout {
                            log("*** " & testcasename() & ": FAIL: Pre-conditions: TSB not broadcasted ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                        }
                    }
                    
                    // Postamble
                    f_poDefault();
                    
                } // end f_GEONW_PON_FPB_BV_12_04_nodeC
                                 
            } // end GEONW_PON_FPB_BV_12
            
        } // end geoForwardingPacketBuffer
        
        // 6.2.2.6
        group geoGeoNetworkingAddress {
            
            /**
             * @desc    TP Function for TC_GEONW_PON_GNA_BV_01
             */
            function f_GEONW_PON_GNA_BV_01() runs on ItsGeoNetworking {
                
                // Local variables
                var LongPosVector v_longPosVectorIut;
                
                // Test control
                if (not PICS_GN_ADDR_AUTO) {
                    log("*** " & testcasename() & ": PICS_GN_ADDR_AUTO required for executing the TC ***");
                    setverdict(inconc);
                    stop;
                }

                if(f_getIutGnLocalAddressConfigurationMethod() != e_auto) {
                    log("*** " & testcasename() & ": PICS_GN_LOCAL_ADDR_CONF_METHOD == e_auto required for executing the TC ***");
                    setverdict(inconc);
                    stop;
                }
                
                // Test component configuration
                f_cf01Up();
                v_longPosVectorIut := f_getPosition(c_compIut);
                
                // Test adapter configuration
                
                // Preamble
                f_prDefault();
                f_acTriggerEvent(m_startPassBeaconing(m_beaconHeader(v_longPosVectorIut).beaconHeader));
                f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                
                // Test Body
                tc_ac.start;
                alt {
                    [] geoNetworkingPort.receive(mw_geoNwInd(mw_geoNwPdu(
                            mw_geoNwBeaconPacket(
                                mw_longPosVectorAny(f_getIutGnLocalAddress())  // IUT's SOPV
                            )))) {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": GN address is correct ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                    }
                    [] geoNetworkingPort.receive(mw_geoNwInd(mw_geoNwPdu(
                            mw_geoNwBeaconPacket(
                                ?  // any SOPV
                            )))) {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": GN address is not correct ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": Expected message not received ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
                    }
                }
                
                // Postamble
                f_poDefault();
                f_cf01Down();
                
            } // end f_GEONW_PON_GNA_BV_01
            
            /**
             * @desc    TP Function for TC_GEONW_PON_GNA_BV_02
             */
            function f_GEONW_PON_GNA_BV_02() runs on ItsGeoNetworking {
                
                // Local variables
                var LongPosVector v_longPosVectorIut;
                var LongPosVector v_longPosVectorNodeB;
                var GeoNetworkingInd v_geoNetInd;
                var GN_Address v_iutGnAddress := valueof(m_dummyGnAddr);
                
                // Test control
                if (not PICS_GN_DAD) {
                    log("*** " & testcasename() & ": PICS_GN_DAD required for executing the TC ***");
                    setverdict(inconc);
                    stop;
                }
                
                // Test component configuration
                f_cf01Up();
                v_longPosVectorIut := f_getPosition(c_compIut);
                v_longPosVectorNodeB := f_getPosition(c_compNodeB);
                
                // Test adapter configuration
                
                // Preamble
                f_prDefault();
                f_prNeighbour();
                if ( not f_utTriggerEvent(m_generateShbMessage) ) {
                    log("*** " & testcasename() & ": INCONC: Trigger failed ***");
                    f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
                }
                
                tc_ac.start;
                alt {
                    [] geoNetworkingPort.receive(mw_geoNwInd(mw_geoNwPdu(
                                ? // SO PV
                            )))) -> value v_geoNetInd {
                        v_iutGnAddress := valueof(v_geoNetInd.msgIn.gnPacket.packet.extendedHeader.shbHeader.srcPosVector.gnAddr);
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": Expected message not received ***");
                        f_selfOrClientSyncAndVerdict(c_prDone, e_timeout);
                    }
                }
                f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                
                // Test Body
                v_longPosVectorNodeB.gnAddr := v_iutGnAddress;
                f_sendGeoNetMessage(m_geoNwReq_linkLayerBroadcast(m_geoNwPdu(m_geoNwShbPacket(v_longPosVectorNodeB), -, c_hopLimit1)));
                f_sleep(0.5);
                
                if ( not f_utTriggerEvent(m_generateShbMessage) ) {
                    log("*** " & testcasename() & ": INCONC: Trigger failed ***");
                    f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
                }
                tc_ac.start;
                alt {
                    [] geoNetworkingPort.receive(mw_geoNwInd(mw_geoNwPdu(
                                mw_longPosVectorAny(v_iutGnAddress) // SO PV
                            )))) {
                        log("*** " & testcasename() & ": IUT is still using old GN address. Waiting... ***");
                        repeat;
                    }
                    [] geoNetworkingPort.receive(mw_geoNwInd(mw_geoNwPdu(
                                ?  // SO PV
                            )))) {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": IUT used new GN address ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": Expected message not received ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
                    }
                }
                
                // Postamble
                f_poDefault();
                f_cf01Down();
                
            } // end f_GEONW_PON_GNA_BV_02
            
        } // end geoGeoNetworkingAddress
        
        // 6.2.2.7
        group geoBeaconing {
            
            /**
             * @desc    TP Function for TC_GEONW_PON_BEA_TI_01
             */
            function f_GEONW_PON_BEA_TI_01() runs on ItsGeoNetworking {
                
                // Local variables
                var LongPosVector v_longPosVectorIut;
                var boolean v_beaconReceived := false;
                timer t_minRetransTimer := f_getBsRetransmitTimer();
                timer t_maxRetransTimer := f_getBsRetransmitTimer() + f_getBsMaxJitter();
                
                // Test control
                if (not PICS_GN_BEACON_SRC) {
                    log("*** " & testcasename() & ": PICS_GN_BEACON_SRC required for executing the TC ***");
                    setverdict(inconc);
                    stop;
                }
                 
                // Test component configuration
                f_cf01Up();
                v_longPosVectorIut := f_getPosition(c_compIut);
                
                // Test adapter configuration
                
                // Preamble
                f_prDefault();
                f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                
                // Test Body
                f_acTriggerEvent(m_startPassBeaconing(m_beaconHeader(v_longPosVectorIut).beaconHeader));
                
                t_maxRetransTimer.start;
                alt {
                    [] geoNetworkingPort.receive(mw_geoNwInd(mw_geoNwPdu(mw_geoNwBeaconPacket(?)))) {
                        if (v_beaconReceived == false) {
                            v_beaconReceived := true;
                            t_minRetransTimer.start;
                            t_maxRetransTimer.start;
                            //after the first beacon received, check the retransmission
                            repeat;
                        }
                        if(t_minRetransTimer.running) {
                            log("*** " & testcasename() & ": Beacon not transmitted at prescribed periodicity (too early) ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                        }
                        else {
                            log("*** " & testcasename() & ": Beacon transmitted at prescribed periodicity ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                        }
                    }
                    [] t_minRetransTimer.timeout {
                        log("*** " & testcasename() & ": Ready for retransmission ***");
                        repeat;
                    }
                    [] t_maxRetransTimer.timeout {
                        log("*** " & testcasename() & ": Beacon not transmitted at prescribed periodicity (too late) ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                    }
                }
                f_acTriggerEvent(m_stopPassBeaconing);
                
                // Postamble
                f_poDefault();
                f_cf01Down();
                
            } // end f_GEONW_PON_BEA_TI_01
            
            /**
             * @desc    TP Function for TC_GEONW_PON_BEA_TI_02
             */
            function f_GEONW_PON_BEA_TI_02() runs on ItsGeoNetworking {
                
                // Local variables
                var LongPosVector v_longPosVectorNodeB;
                var LongPosVector v_longPosVectorIut;
                var boolean v_geoUnicastReceived := false;
                var boolean v_readyForRetransmission := false;
                timer t_minRetransTimer := f_getBsRetransmitTimer() - f_getDeltaTimer();
                timer t_maxRetransTimer := f_getBsRetransmitTimer() + f_getBsMaxJitter() + f_getDeltaTimer();
                
                // Test control
                if (not PICS_GN_BEACON_SRC) {
                    log("*** " & testcasename() & ": PICS_GN_BEACON_SRC required for executing the TC ***");
                    setverdict(inconc);
                    stop;
                }
                
                // Test component configuration
                f_cf01Up();
                v_longPosVectorNodeB := f_getPosition(c_compNodeB);
                v_longPosVectorIut := f_getPosition(c_compIut);
                
                // Test adapter configuration
                f_acTriggerEvent(m_startPassBeaconing(m_beaconHeader(v_longPosVectorIut).beaconHeader));
                
                // Preamble
                f_prNeighbour();
                f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                
                // Test Body
                if ( not f_utTriggerEvent(m_generateShbMessage) ) {
                    log("*** " & testcasename() & ": INCONC: Trigger failed ***");
                    f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
                }
                tc_ac.start;
                alt {
                    [] geoNetworkingPort.receive(mw_geoNwInd(mw_geoNwPdu(mw_geoNwShbPacket))) {
                        tc_ac.stop;
                        t_minRetransTimer.start;
                        t_maxRetransTimer.start;
                        v_geoUnicastReceived := true;
                        repeat;
                    }
                    [] geoNetworkingPort.receive(mw_geoNwInd(mw_geoNwPdu(mw_geoNwBeaconPacket))) {
                        if(not(v_geoUnicastReceived)) {
                            repeat;
                        }
                        if(not(v_readyForRetransmission)) {
                            log("*** " & testcasename() & ": Beacon not transmitted at prescribed periodicity (too early) ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                        }
                        else {
                            log("*** " & testcasename() & ": Beacon transmitted at prescribed periodicity ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                        }
                    }
                    [] t_minRetransTimer.timeout {
                        log("*** " & testcasename() & ": Ready for retransmission ***");
                        v_readyForRetransmission := true;
                        repeat;
                    }
                    [] t_maxRetransTimer.timeout {
                        log("*** " & testcasename() & ": Beacon not transmitted at prescribed periodicity (too late) ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": GUC not received ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
                    }
                }
                f_acTriggerEvent(m_stopPassBeaconing);
                
                // Postamble
                f_poNeighbour();
                f_cf01Down();
                
            } // end f_GEONW_PON_BEA_TI_02
            
        } // end geoBeaconing
        
        // 6.2.2.8
        group geoGeoUnicast {
            
berge's avatar
berge committed
			group gucAllForwardingAlgorithm {
				
                group GEONW_PON_GUC_ALL_BV_03 {
                    
                    /**
                     * @desc    TP Function for TC_GEONW_PON_GUC_ALL_BV_03
                     */
                    function f_GEONW_PON_GUC_ALL_BV_03() runs on ItsMtc {
                        
                        // Local variables
                        var ItsGeoNetworking v_nodeB;
                        var ItsGeoNetworking v_nodeC;
                        
                        // Test control
                        if (not PICS_GN_GUC_FWD) {
                            log("*** " & testcasename() & ": PICS_GN_GUC_FWD required for executing the TC ***");
                            setverdict(inconc);
                            stop;
                        }
                        
                        // 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_GUC_ALL_BV_03_nodeB());
                        v_nodeC.start(f_GEONW_PON_GUC_ALL_BV_03_nodeC());
                        
                        // Synchronization
                        f_serverSync2ClientsAndStop({c_prDone, c_tbDone});
                        
                        // Cleanup
                        f_cf03Down();
                        
                    } // end f_GEONW_PON_GUC_BV_03
                    
                    /**
                     * @desc    Behavior function for NodeB (TC_GEONW_PON_GUC_ALL_BV_03)
                     */
                    function f_GEONW_PON_GUC_ALL_BV_03_nodeB() runs on ItsGeoNetworking {
                        
                        // Local variables
                        var LongPosVector v_longPosVectorNodeA := f_getPosition(c_compNodeA);
                        
                        // Preamble
                        f_prNeighbour();
                        
                        f_sendGeoNetMessage(
                            m_geoNwReq_withLinkLayerDestination(
                                m_geoNwPdu(
                                    m_geoNwUnicastPacket(
                                        v_longPosVectorNodeA,
                                        f_longPosVector2ShortPosVector(f_getPosition(c_compIut)),
                                        vc_localSeqNumber
                                    )
                                ),
                                -,
                                f_getIutMacAddress()
                            )
                        );
                        f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                        
                        // Test Body
                        tc_ac.start;
                        alt {
                            [] geoNetworkingPort.receive(
                                mw_geoNwInd(
                                    mw_geoNwPdu(
                                        mw_geoNwUnicastPacketWithHl(
                                            mw_shortPosVectorPosition(f_longPosVector2ShortPosVector(v_longPosVectorNodeA)),
                                            ?,
                                            c_defaultHopLimit
                                        ),
                                        -,
                                        c_defaultHopLimit - 1
                                    )
                                )
                            ) {
                                tc_ac.stop;
                                log("*** " & testcasename() & ": PASS: Forwarded GUC received ***");
                                f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                            }
                            [] geoNetworkingPort.receive(
                                mw_geoNwInd(
                                    mw_geoNwPdu(
                                        mw_geoNwUnicastPacket(
                                            ?,
                                            ?
                                        )
berge's avatar
berge committed
                            ) {
                                tc_ac.stop;
                                log("*** " & testcasename() & ": FAIL: Fields not correctly updated ***");
                                f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                            }
                            [] tc_ac.timeout {
                                log("*** " & testcasename() & ": FAIL: GUC was not retransmitted ***");
                                f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                            }
                        }
                        
                        // Postamble
                        f_poNeighbour();
                        
                    } // end f_GEONW_PON_GUC_ALL_BV_03_nodeB
                    
                    /**
                     * @desc    Behavior function for NodeC (TC_GEONW_PON_GUC_ALL_BV_03)
                     */
                    function f_GEONW_PON_GUC_ALL_BV_03_nodeC() runs on ItsGeoNetworking {
                        
                        // Local variables
                        var LongPosVector v_obsoleteLongPosVectorNodeA := f_getPosition(c_compNodeA);
                        
                        // Preamble
                        f_prNeighbour();
                        v_obsoleteLongPosVectorNodeA.timestamp_ := v_obsoleteLongPosVectorNodeA.timestamp_ - 1000;
                        v_obsoleteLongPosVectorNodeA.latitude := v_obsoleteLongPosVectorNodeA.latitude - 1;
                        f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                        
                        // Test Body
                        f_sendGeoNetMessage(
                            m_geoNwReq_withLinkLayerDestination(
                                m_geoNwPdu(
                                    m_geoNwUnicastPacket(
                                        f_getPosition(c_compNodeC),
                                        f_longPosVector2ShortPosVector(v_obsoleteLongPosVectorNodeA),
                                        vc_localSeqNumber,
                                        c_defaultHopLimit
                                    ),
                                    -,
                                    c_defaultHopLimit
                                ),
                                -,
                                f_getIutMacAddress()
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
berge's avatar
berge committed
                        
                        // Postamble
                        f_poNeighbour();
                        
                    } // end f_GEONW_PON_GUC_ALL_BV_03_nodeC
                    
                } // end GEONW_PON_GUC_ALL_BV_03
                
                group GEONW_PON_GUC_ALL_BO_04 {
                    
                    /**
                     * @desc    TP Function for TC_GEONW_PON_GUC_ALL_BO_04
                     */
                    function f_GEONW_PON_GUC_ALL_BO_04() runs on ItsMtc {
                        
                        // Local variables
                        var ItsGeoNetworking v_nodeB;
                        var ItsGeoNetworking v_nodeC;
                        
                        // Test control
                        if (not PICS_GN_GUC_FWD) {
                            log("*** " & testcasename() & ": PICS_GN_GUC_FWD required for executing the TC ***");
                            setverdict(inconc);
                            stop;
                        }
                        
                        // 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_GUC_ALL_BO_04_nodeB());
                        v_nodeC.start(f_GEONW_PON_GUC_ALL_BO_04_nodeC());
                        
                        // Synchronization
                        f_serverSync2ClientsAndStop({c_prDone, c_tbDone});
                        
                        // Cleanup
                        f_cf03Down();
                        
                    } // end f_GEONW_PON_GUC_BO_04
                    
                    /**
                     * @desc    Behavior function for NodeB (TC_GEONW_PON_GUC_ALL_BO_04)
                     */
                    function f_GEONW_PON_GUC_ALL_BO_04_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_noac.start;
                        alt {
                            [] geoNetworkingPort.receive(
                                mw_geoNwInd(
                                    mw_geoNwPdu(
                                        mw_geoNwUnicastPacket(
                                            mw_shortPosVectorPosition(f_longPosVector2ShortPosVector(v_longPosVectorNodeA)),
                                            ?
                                        ),
                                        -,
berge's avatar
berge committed
                            ) {
                                tc_noac.stop;
                                log("*** " & testcasename() & ": FAIL: Retransmitted GUC received ***");
                                f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                            }
                            [] tc_noac.timeout {
                                log("*** " & testcasename() & ": PASS: GUC was not retransmitted ***");
                                f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                            }
                        }
                        
                        // Postamble
                        f_poNeighbour();
                             
                    } // end f_GEONW_PON_GUC_ALL_BO_04_nodeB
                    
                    /**
                     * @desc    Behavior function for NodeC (TC_GEONW_PON_GUC_ALL_BO_04)
                     */
                    function f_GEONW_PON_GUC_ALL_BO_04_nodeC() 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_geoNwUnicastPacket(
                                        f_getPosition(c_compNodeC),
                                        f_longPosVector2ShortPosVector(v_longPosVectorNodeA),
                                        vc_localSeqNumber
                                    ),
                                    -,
                                    1
                                ),
                                -,
                                f_getIutMacAddress()
berge's avatar
berge committed
                        );
                        
						tc_noac.start;
						alt {
							[] geoNetworkingPort.receive(
								mw_geoNwInd(
									mw_geoNwPdu(
										mw_geoNwUnicastPacket(
											mw_shortPosVectorPosition(f_longPosVector2ShortPosVector(v_longPosVectorNodeA)),
											?
										),
										-,
										?
									)
								)
							) {
								tc_noac.stop;
								log("*** " & testcasename() & ": FAIL: Retransmitted GUC received ***");
								f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
							}
							[] tc_noac.timeout {
								log("*** " & testcasename() & ": PASS: GUC was not retransmitted ***");
								f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
							}
						}
                        
                        // Postamble
                        f_poNeighbour();
                        
                    } // end f_GEONW_PON_GUC_ALL_BO_04_nodeC
                    
                } // end GEONW_PON_GUC_ALL_BO_04
berge's avatar
berge committed
                 * @desc    TP Function for TC_GEONW_PON_GUC_ALL_BV_05
berge's avatar
berge committed
                function f_GEONW_PON_GUC_ALL_BV_05() runs on ItsGeoNetworking {
berge's avatar
berge committed
                    var template (value) GeoNetworkingPdu v_gnPacket;
                    var integer i;
                    var GnRawPayload v_sentRawPayload;
berge's avatar
berge committed
                    if (not PICS_GN_GUC_DST) {
                        log("*** " & testcasename() & ": PICS_GN_GUC_DST required for executing the TC ***");
                        setverdict(inconc);
                        stop;
                    }
                    
                    // Test component configuration
berge's avatar
berge committed
                    f_cf01Up();
berge's avatar
berge committed
                    // Test adapter configuration
berge's avatar
berge committed
                    f_prDefault();
                    f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                    
                    // Test Body
berge's avatar
berge committed
                    v_gnPacket := m_geoNwPdu(
                                      m_geoNwUnicastPacket(
                                          f_getPosition(c_compNodeB),
                                          f_getIutShortPosVector(),
                                          vc_localSeqNumber
                                      )
                                  );
                    f_sendGeoNetMessage(m_geoNwReq_withLinkLayerDestination(v_gnPacket, -, f_getIutMacAddress()));
berge's avatar
berge committed
                    f_sleep(PX_TAC);
berge's avatar
berge committed
                    v_sentRawPayload := f_adaptPayloadForUtInd_m(v_gnPacket.gnPacket.packet.payload);
                    for(i:=0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i:=i+1) {
                        // empty on purpose 
                    }
                    if(i < lengthof(vc_utInds)) {
                        log("*** " & testcasename() & ": PASS: GN was transmitted to upper layer ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                    }
                    else {
                        log("*** " & testcasename() & ": FAIL: GN was not transmitted to upper layer ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                    }
berge's avatar
berge committed
                    // Postamble
                    f_poDefault();
                    f_cf01Down();
berge's avatar
berge committed
                } // end f_GEONW_PON_GUC_ALL_BV_05
                
				/**
				 * @desc    TP Function for TC_GEONW_PON_GUC_ALL_BV_06
				 */
				function f_GEONW_PON_GUC_ALL_BV_06() runs on ItsGeoNetworking {
                    
					// Local variables
					var LongPosVector v_longPosVectorNodeA := f_getPosition(c_compNodeA);
					var template (value) GeoNetworkingPdu v_gnPacket;
					var integer i;
					var GnRawPayload v_sentRawPayload;
                    
					// Test control
					if (not PICS_GN_GUC_FWD) {
						log("*** " & testcasename() & ": PICS_GN_GUC_FWD required for executing the TC ***");
						setverdict(inconc);
						stop;
					}
                    
					// Test component configuration
					f_cf01Up();
                    
					// Test adapter configuration
                    
					// Preamble
					f_prDefault();
					f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                    
					// Test Body
					v_gnPacket := m_geoNwPdu(
									  m_geoNwUnicastPacket(
										  f_getPosition(c_compNodeB),
					                      f_longPosVector2ShortPosVector(v_longPosVectorNodeA),
										  vc_localSeqNumber
									  )
								  );
					f_sendGeoNetMessage(m_geoNwReq_withLinkLayerDestination(v_gnPacket, -, f_getIutMacAddress()));
                    
					f_sleep(PX_TAC);
                    
					if(0 != lengthof(vc_utInds)) {
					    log("*** " & testcasename() & ": FAIL: GN was transmitted to upper layer ***");
					    f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
				    }
				    else {
					    log("*** " & testcasename() & ": PASS: GN was not transmitted to upper layer ***");
					    f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
				    }
                    
					// Postamble
					f_poDefault();
					f_cf01Down();
                    
				} // end f_GEONW_PON_GUC_ALL_BV_06
                
                group GEONW_PON_GUC_ALL_BO_08 {
                    
                    /**
                     * @desc    TP Function for TC_GEONW_PON_GUC_ALL_BO_08
                     */
                    function f_GEONW_PON_GUC_ALL_BO_08() runs on ItsMtc {
                        
                        // Local variables
                        var ItsGeoNetworking v_nodeB;
                        var ItsGeoNetworking v_nodeC;
                        
                        // Test control
                        if (not PICS_GN_GUC_DST) {
                            log("*** " & testcasename() & ": PICS_GN_GUC_DST required for executing the TC ***");
                            setverdict(inconc);
                            stop;
                        }
                        
                        // Test component configuration
                        f_cf03Up(c_compNodeB);
                        
                        // Preamble
                        
                        // Start components
                        v_nodeB := f_getComponent(c_compNodeB);
                        v_nodeC := f_getComponent(c_compNodeC);
                        v_nodeB.start(f_GEONW_PON_GUC_ALL_BO_08_nodeB());
                        v_nodeC.start(f_GEONW_PON_GUC_ALL_BO_08_nodeC());
                        
                        // Synchronization
                        f_serverSync2ClientsAndStop({c_prDone, c_tbDone});
                        
                        // Cleanup
                        f_cf03Down();
                        
                    } // end f_GEONW_PON_GUC_ALL_BO_08
berge's avatar
berge committed
                    /**
                     * @desc    Behavior function for NodeB (TC_GEONW_PON_GUC_ALL_BO_08)
                     */
                    function f_GEONW_PON_GUC_ALL_BO_08_nodeB() runs on ItsGeoNetworking {
                        
                        // Local variables
                        var LongPosVector v_longPosVectorIut := f_getPosition(c_compIut);
                        var integer i;
                        var template (present) GeoNetworkingPdu v_gnPacket := m_geoNwPdu(
                            m_geoNwUnicastPacket(
                                f_getPosition(c_compNodeC),
                                f_longPosVector2ShortPosVector(v_longPosVectorIut),
                                vc_localSeqNumber
berge's avatar
berge committed
                            c_defaultHopLimit - 1
                        );
                        var GnRawPayload v_sentRawPayload;
                        
                        // Preamble
                        f_prNeighbour();
                        f_sleep(PX_TAC);
                        v_sentRawPayload := f_adaptPayloadForUtInd_m(valueof(v_gnPacket.gnPacket.packet.payload));
                        for(i:=0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i:=i+1) {
                            // empty on purpose 
                        }
                        if(i < lengthof(vc_utInds)) {
                            log("*** " & testcasename() & ": PASS: GN was transmitted to upper layer ***");
                            //flush received upper indications 
                            vc_utInds := {};
                            f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                        }
                        else {
                            log("*** " & testcasename() & ": INCONC: GN was not transmitted to upper layer ***");
                            f_selfOrClientSyncAndVerdict(c_prDone, e_error);
                        }
                        
                        // Test Body
                        f_sendGeoNetMessage(m_geoNwReq_withLinkLayerDestination(valueof(v_gnPacket), -, f_getIutMacAddress()));
                       
                        f_sleep(PX_TAC);
                        
                        if(0 != lengthof(vc_utInds)) {
                            log("*** " & testcasename() & ": FAIL: GN was transmitted to upper layer ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                        }
                        else {
                            log("*** " & testcasename() & ": PASS: GN was not transmitted to upper layer ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                        }
                        
                        // Postamble
                        f_poNeighbour();
                        
                    } // end f_GEONW_PON_GUC_ALL_BO_08_nodeB
berge's avatar
berge committed
                    /**
                     * @desc    Behavior function for NodeC (TC_GEONW_PON_GUC_ALL_BO_08)
                     */
                    function f_GEONW_PON_GUC_ALL_BO_08_nodeC() runs on ItsGeoNetworking {
                        
                        // Local variables
                        var LongPosVector v_longPosVectorIut := f_getPosition(c_compIut);
                        
                        // Preamble
                        f_prNeighbour();
                        f_sendGeoNetMessage(
                            m_geoNwReq_withLinkLayerDestination(
                                m_geoNwPdu(
                                    m_geoNwUnicastPacket(
                                        f_getPosition(c_compNodeC),
                                        f_longPosVector2ShortPosVector(v_longPosVectorIut),
                                        vc_localSeqNumber
                                    ),
                                    -,
                                    c_defaultHopLimit
                                ),
                                -,
                                f_getIutMacAddress()
                            )
                        );
                        f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                        
                        // Test Body
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                        
                        // Postamble
                        f_poNeighbour();
                        
                    } // end f_GEONW_PON_GUC_ALL_BO_08_nodeC
berge's avatar
berge committed
                } // end GEONW_PON_GUC_ALL_BO_08
berge's avatar
berge committed
			} // end gucAllForwardingAlgorithm

			group gucGreedyForwarding {

berge's avatar
berge committed
                 * @desc    TP Function for TC_GEONW_PON_GUC_GRD_BV_01
berge's avatar
berge committed
                function f_GEONW_PON_GUC_GRD_BV_01() runs on ItsGeoNetworking {
berge's avatar
berge committed
                    var LongPosVector v_longPosVectorNodeB;
berge's avatar
berge committed
                    if (not PICS_GN_GUC_SRC) {
                        log("*** " & testcasename() & ": PICS_GN_GUC_SRC required for executing the TC ***");
berge's avatar
berge committed
                    if ((f_getNonAreaForwardingAlgorithm() != e_greedy) and (f_getNonAreaForwardingAlgorithm() != e_unspecified)) {
                        log("*** " & testcasename() & ": PICS_GN_NON_AREA_FORWARDING_ALGORITHM == (e_greedy  or e_unspecified) required for executing the TC ***");
                        setverdict(inconc);
                        stop;
                    }
                                    
                    // Test component configuration
berge's avatar
berge committed
                    f_cf01Up();
                    v_longPosVectorNodeB := f_getPosition(c_compNodeB);
berge's avatar
berge committed
                    // Test adapter configuration
                    
                    // Preamble
                    f_prNeighbour();
                    f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                    
                    // Test Body
berge's avatar
berge committed
                    if ( not f_utTriggerEvent(m_generateGeoUnicastMessage(v_longPosVectorNodeB.gnAddr)) ) {
                        log("*** " & testcasename() & ": INCONC: Trigger failed ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
                    }
                    tc_ac.start;
                    alt {
                        [] geoNetworkingPort.receive(
berge's avatar
berge committed
                                mw_geoNwInd(
                                    mw_geoNwPdu(
                                        mw_geoNwUnicastPacket(
                                            mw_shortPosVectorPosition(f_longPosVector2ShortPosVector(v_longPosVectorNodeB)),
                                            ?
                                        )
                                    )
berge's avatar
berge committed
                            log("*** " & testcasename() & ": DEPV of the received GUC message correctly set ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                        }
                        [] geoNetworkingPort.receive(
berge's avatar
berge committed
                                mw_geoNwInd(
                                    mw_geoNwPdu(
                                        mw_geoNwUnicastPacket(
                                            ?,
                                            ?
                                        )
berge's avatar
berge committed
                            log("*** " & testcasename() & ": DEPV of the received GUC message incorrectly set ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                        }
                        [] tc_ac.timeout {
berge's avatar
berge committed
                            log("*** " & testcasename() & ": Expected message not received ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
berge's avatar
berge committed
                    f_cf01Down();
berge's avatar
berge committed
                } // end f_GEONW_PON_GUC_GRD_BV_01

                group GEONW_PON_GUC_GRD_BV_02 {
berge's avatar
berge committed
                    /**
                     * @desc    TP Function for TC_GEONW_PON_GUC_GRD_BV_02
                     */
                    function f_GEONW_PON_GUC_GRD_BV_02() runs on ItsMtc {
                        
                        // Local variables
                        var ItsGeoNetworking v_nodeB;
                        var ItsGeoNetworking v_nodeC;
                        var ItsGeoNetworking v_nodeD;
                        
                        // Test control
                        if (not PICS_GN_GUC_FWD) {
                            log("*** " & testcasename() & ": PICS_GN_GUC_FWD required for executing the TC ***");
                            setverdict(inconc);
                            stop;
                        }
                        if ((f_getNonAreaForwardingAlgorithm() != e_greedy) and (f_getNonAreaForwardingAlgorithm() != e_unspecified)) {
                            log("*** " & testcasename() & ": PICS_GN_NON_AREA_FORWARDING_ALGORITHM == (e_greedy  or e_unspecified) required for executing the TC ***");
                            setverdict(inconc);
                            stop;
                        }
                        
                        // Test component configuration
                        f_cf04Up();
                        
                        // Preamble
                        
                        // Start components
                        v_nodeB := f_getComponent(c_compNodeB);
                        v_nodeC := f_getComponent(c_compNodeC);
                        v_nodeD := f_getComponent(c_compNodeD);
                        v_nodeB.start(f_GEONW_PON_GUC_GRD_BV_02_nodeB());
                        v_nodeC.start(f_GEONW_PON_GUC_GRD_BV_02_nodeC());
                        v_nodeD.start(f_GEONW_PON_GUC_GRD_BV_02_nodeD());
                        
                        // Synchronization
                        f_serverSync3ClientsAndStop({c_prDone, c_tbDone});
                        
                        // Cleanup
                        f_cf04Down();
                        
                    } // end f_GEONW_PON_GUC_GRD_BV_02
berge's avatar
berge committed
                    /**
                     * @desc    Behavior function for NodeB (TC_GEONW_PON_GUC_GRD_BV_02)
                     */
                    function f_GEONW_PON_GUC_GRD_BV_02_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_geoNwUnicastPacket(
                                            mw_shortPosVectorPosition(f_longPosVector2ShortPosVector(v_longPosVectorNodeA)),
                                            ?
                                        )
                                    )
                                )
                            ) {
                                tc_ac.stop;
                                log("*** " & testcasename() & ": PASS: Forwarded GUC received ***");
                                f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                            }
                            [] tc_ac.timeout {
                                log("*** " & testcasename() & ": FAIL: GUC was not forwarded ***");
                                f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                            }
                        }
                        
                        // Postamble
                        f_poNeighbour();
                        
                    } // end f_GEONW_PON_GUC_GRD_BV_02_nodeB
berge's avatar
berge committed
                    /**
                     * @desc    Behavior function for NodeC (TC_GEONW_PON_GUC_GRD_BV_02)
                     */
                    function f_GEONW_PON_GUC_GRD_BV_02_nodeC() runs on ItsGeoNetworking {
                        
                        // Local variables
                        
                        // Preamble
                        f_prNeighbour();
                        f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                        
                        // Test Body
                        f_sendGeoNetMessage(
                            m_geoNwReq_withLinkLayerDestination(
                                m_geoNwPdu(
                                    m_geoNwUnicastPacket(
                                        f_getPosition(c_compNodeC),
                                        f_longPosVector2ShortPosVector(f_getPosition(c_compNodeA)),
                                        vc_localSeqNumber
                                    ),
                                    -,
berge's avatar
berge committed
                                f_getIutMacAddress()
                            )
                        );
                        
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                        
                        // Postamble
                        f_poNeighbour();
                        
                    } // end f_GEONW_PON_GUC_GRD_BV_02_nodeC
berge's avatar
berge committed
                    /**
                     * @desc    Behavior function for NodeD (TC_GEONW_PON_GUC_GRD_BV_02)
                     */
                    function f_GEONW_PON_GUC_GRD_BV_02_nodeD() runs on ItsGeoNetworking {
                        
                        // Local variables
                        
                        // Preamble
                        f_prNeighbour();
                        f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                        
                        // Test Body
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                        
                        // Postamble
                        f_poNeighbour();
                        
                    } // end f_GEONW_PON_GUC_GRD_BV_02_nodeD
berge's avatar
berge committed
                } // end GEONW_PON_GUC_GRD_BV_02

                group GEONW_PON_GUC_GRD_BO_07 {
berge's avatar
berge committed
                    /**
                     * @desc    TP Function for TC_GEONW_PON_GUC_GRD_BO_07
                     */
                    function f_GEONW_PON_GUC_GRD_BO_07() runs on ItsMtc {
                        
                        // Local variables
                        var ItsGeoNetworking v_nodeB;
                        var ItsGeoNetworking v_nodeC;
                        
                        // Test control
                        if (not PICS_GN_GUC_FWD) {
                            log("*** " & testcasename() & ": PICS_GN_GUC_FWD required for executing the TC ***");
                            setverdict(inconc);
                            stop;
                        }
                        if ((f_getNonAreaForwardingAlgorithm() != e_greedy) and (f_getNonAreaForwardingAlgorithm() != e_unspecified)) {
                            log("*** " & testcasename() & ": PICS_GN_NON_AREA_FORWARDING_ALGORITHM == (e_greedy  or e_unspecified) required for executing the TC ***");
                            setverdict(inconc);
                            stop;
                        }
                        
                        // 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_GUC_GRD_BO_07_nodeB());
                        v_nodeC.start(f_GEONW_PON_GUC_GRD_BO_07_nodeC());
                        
                        // Synchronization
                        f_serverSync2ClientsAndStop({c_prDone, c_tbDone});
                        
                        // Cleanup
                        f_cf03Down();
                        
                    } // end f_GEONW_PON_GUC_GRD_BO_07
berge's avatar
berge committed
                    /**
                     * @desc    Behavior function for NodeB (TC_GEONW_PON_GUC_GRD_BO_07)
                     */
                    function f_GEONW_PON_GUC_GRD_BO_07_nodeB() runs on ItsGeoNetworking {
                        
                        // Local variables
                        var LongPosVector v_longPosVectorNodeA := f_getPosition(c_compNodeA);
                        
                        // Preamble
                        f_prNeighbour();
                        tc_ac.start;
                        alt {
                            [] geoNetworkingPort.receive(
                                mw_geoNwInd(
                                    mw_geoNwPdu(
                                        mw_geoNwUnicastPacket(
                                            mw_shortPosVectorPosition(f_longPosVector2ShortPosVector(v_longPosVectorNodeA)),
                                            ?
                                        )
                                    )
                                )
                            ) {
                                tc_ac.stop;
                                log("*** " & testcasename() & ": INFO: First GUC forwarded ***");
                                f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                            }
                            [] tc_ac.timeout {
                                log("*** " & testcasename() & ": INCONC: First GUC was not forwarded ***");
                                f_selfOrClientSyncAndVerdict(c_prDone, e_timeout);
                            }
                        }
                        
                        // Test Body
                        f_sendGeoNetMessage(
                            m_geoNwReq_withLinkLayerDestination(
                                m_geoNwPdu(
                                    m_geoNwUnicastPacket(
                                        f_getPosition(c_compNodeC),
                                        f_longPosVector2ShortPosVector(v_longPosVectorNodeA),
                                        vc_localSeqNumber
berge's avatar
berge committed
                                    c_defaultHopLimit - 1
                                ),
                                -,
                                f_getIutMacAddress()
                            )
                        );
                        
                        tc_noac.start;
                        alt {
                            [] geoNetworkingPort.receive(
                                mw_geoNwInd(
                                    mw_geoNwPdu(
                                        mw_geoNwUnicastPacket(
                                            mw_shortPosVectorPosition(f_longPosVector2ShortPosVector(v_longPosVectorNodeA)),
                                            ?
                                        )
                                    )
berge's avatar
berge committed
                            ) {
                                tc_noac.stop;
                                log("*** " & testcasename() & ": FAIL: Duplicate GUC was forwarded ***");
                                f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                            }
                            [] tc_noac.timeout {
                                log("*** " & testcasename() & ": PASS: Duplicate GUC not forwarded ***");
                                f_selfOrClientSyncAndVerdict(c_tbDone, e_success);                            
                            }
                        }
                        
                        // Postamble
                        f_poNeighbour();
                        
                    } // end f_GEONW_PON_GUC_GRD_BO_07_nodeB
                    
                    /**
                     * @desc    Behavior function for NodeC (TC_GEONW_PON_GUC_GRD_BO_07)
                     */
                    function f_GEONW_PON_GUC_GRD_BO_07_nodeC() runs on ItsGeoNetworking {
                        
                        // Local variables
                        var LongPosVector v_longPosVectorNodeA := f_getPosition(c_compNodeA);
                        
                        // Preamble
                        f_prNeighbour();
                        f_sendGeoNetMessage(
                            m_geoNwReq_withLinkLayerDestination(
                                m_geoNwPdu(
                                    m_geoNwUnicastPacket(
                                        f_getPosition(c_compNodeC),
                                        f_longPosVector2ShortPosVector(v_longPosVectorNodeA),
                                        vc_localSeqNumber
                                    ),
                                    -,
                                    c_defaultHopLimit
                                ),
                                -,
                                f_getIutMacAddress()
berge's avatar
berge committed
                        );
                        f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                        
                        // Test Body
                        tc_noac.start;
                        alt {
                            [] geoNetworkingPort.receive(
                                mw_geoNwInd(
                                    mw_geoNwPdu(
                                        mw_geoNwUnicastPacket(
                                            mw_shortPosVectorPosition(f_longPosVector2ShortPosVector(v_longPosVectorNodeA)),
                                            ?
                                        )
                                    )
                                )
                            ) {
                                tc_noac.stop;
                                log("*** " & testcasename() & ": FAIL: Duplicate GUC was forwarded ***");
                                f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                            }
                            [] tc_noac.timeout {
                                log("*** " & testcasename() & ": PASS: Duplicate GUC not forwarded ***");
                                f_selfOrClientSyncAndVerdict(c_tbDone, e_success);                            
                            }
berge's avatar
berge committed
                        
                        // Postamble
                        f_poNeighbour();
                        
                    } // end f_GEONW_PON_GUC_GRD_BO_07_nodeC
                    
                } // end GEONW_PON_GUC_GRD_BO_07

			} // end gucGreedyForwarding

			group gucContentionBasedForwarding {
				
                group GEONW_PON_GUC_CBF_BV_01 {
                    
                    /**
                     * @desc    TP Function for TC_GEONW_PON_GUC_CBF_BV_01
                     */
                    function f_GEONW_PON_GUC_CBF_BV_01() runs on ItsMtc {
                        
                        // Local variables
                        var ItsGeoNetworking v_nodeB;
                        var ItsGeoNetworking v_nodeC;
                        
                        // Test control
                        if (not PICS_GN_GUC_SRC) {
                            log("*** " & testcasename() & ": PICS_GN_GUC_SRC required for executing the TC ***");
                            setverdict(inconc);
                            stop;
berge's avatar
berge committed
                        if (f_getNonAreaForwardingAlgorithm() != e_cbf) {
                            log("*** " & testcasename() & ": PICS_GN_NON_AREA_FORWARDING_ALGORITHM == e_cbf required for executing the TC ***");
                            setverdict(inconc);
                            stop;
                        }
                        
                        // 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_GUC_CBF_BV_01_nodeB());
                        v_nodeC.start(f_GEONW_PON_GUC_CBF_BV_01_nodeC());
                        
                        // Synchronization
                        f_serverSync2ClientsAndStop({c_prDone, c_tbDone});
                        
                        // Cleanup
                        f_cf03Down();
                        
                    } // end f_GEONW_PON_GUC_CBF_BV_01
berge's avatar
berge committed
                    /**
                     * @desc    Behavior function for NodeB (TC_GEONW_PON_GUC_CBF_BV_01)
                     */
                    function f_GEONW_PON_GUC_CBF_BV_01_nodeB() runs on ItsGeoNetworking {
                        
                        // Local variables
                        var LongPosVector v_longPosVectorNodeB := f_getPosition(c_compNodeB);
                        
                        // Preamble
                        f_prNeighbour();
                        f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                        
                        // Test Body
                        if(not f_utTriggerEvent(m_generateGeoUnicastMessage(v_longPosVectorNodeB.gnAddr))) {
                            log("*** " & testcasename() & ": INCONC: Trigger failed ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
                        }
                        tc_ac.start;
                        alt {
                            [] geoNetworkingPort.receive(
                                mw_geoNwInd(
                                    mw_geoNwPdu(
                                        mw_geoNwUnicastPacket(
                                            mw_shortPosVectorPosition(f_longPosVector2ShortPosVector(v_longPosVectorNodeB)),
                                            ?
                                        )
                                    )
                                )
                            ) {
                                tc_ac.stop;
                                log("*** " & testcasename() & ": PASS: GUC received ***");
                                f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                            }
                            [] tc_ac.timeout {
                                log("*** " & testcasename() & ": FAIL: GUC was not received ***");
                                f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                            }
                        }
                        
                        // Postamble
                        f_poNeighbour();
                        
                    } // end f_GEONW_PON_GUC_CBF_BV_01_nodeB
berge's avatar
berge committed
                    /**
                     * @desc    Behavior function for NodeC (TC_GEONW_PON_GUC_CBF_BV_01)
                     */
                    function f_GEONW_PON_GUC_CBF_BV_01_nodeC() runs on ItsGeoNetworking {
                        
                        // Local variables
                        var LongPosVector v_longPosVectorNodeB := f_getPosition(c_compNodeB);
                        
                        // Preamble
                        f_prNeighbour();
                        f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                        
                        // Test Body
                        tc_ac.start;
                        alt {
                            [] geoNetworkingPort.receive(
                                mw_geoNwInd(
                                    mw_geoNwPdu(
                                        mw_geoNwUnicastPacket(
                                            mw_shortPosVectorPosition(f_longPosVector2ShortPosVector(v_longPosVectorNodeB)),
                                            ?
                                        )
                                    )
                                )
                            ) {
                                tc_ac.stop;
                                log("*** " & testcasename() & ": PASS: broadcasted GUC received ***");
                                f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                            }
                            [] tc_ac.timeout {
                                log("*** " & testcasename() & ": FAIL: GUC was not broadcasted ***");
                                f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                            }
                        }
                        
                        // Postamble
                        f_poNeighbour();
                        
                    } // end f_GEONW_PON_GUC_CBF_BV_01_nodeC
                                    
                } // end GEONW_PON_GUC_CBF_BV_01

                group GEONW_PON_GUC_CBF_BV_02 {
berge's avatar
berge committed
                    /**
                     * @desc    TP Function for TC_GEONW_PON_GUC_CBF_BV_02
                     */
                    function f_GEONW_PON_GUC_CBF_BV_02() runs on ItsMtc {
                        
                        // Local variables
                        var ItsGeoNetworking v_nodeB;
                        var ItsGeoNetworking v_nodeC;
                        var float v_distance := int2float(f_getCbfMaxCommunicationRange() - 10);
                        var LongPosVector v_longPosVectorIut, v_longPosVectorNodeA;
                        
                        // Test control
                        if (not PICS_GN_GUC_FWD) {
                            log("*** " & testcasename() & ": PICS_GN_GUC_FWD required for executing the TC ***");
                            setverdict(inconc);
                            stop;
                        }
                        if (f_getNonAreaForwardingAlgorithm() != e_cbf) {
                            log("*** " & testcasename() & ": PICS_GN_NON_AREA_FORWARDING_ALGORITHM == e_cbf required for executing the TC ***");
                            setverdict(inconc);
                            stop;
                        }
                        
                        // Test component configuration
                        f_cf03Up();
                        // re-compute NodeA's position.
                        v_longPosVectorIut := f_getIutLongPosVector();
                        v_longPosVectorNodeA := f_computePositionUsingDistance(v_longPosVectorIut, v_distance, 0);
                        v_longPosVectorNodeA.gnAddr := f_getTsGnLocalAddress(c_compNodeA);
                        
                        // Preamble
                        
                        // Start components
                        v_nodeB := f_getComponent(c_compNodeB);
                        v_nodeC := f_getComponent(c_compNodeC);
                        v_nodeB.start(f_GEONW_PON_GUC_CBF_BV_02_nodeB(v_distance, v_longPosVectorNodeA));
                        v_nodeC.start(f_GEONW_PON_GUC_CBF_BV_02_nodeC(v_longPosVectorNodeA));
                        
                        // Synchronization
                        f_serverSync2ClientsAndStop({c_prDone, c_msgSent, c_tbDone});
                        
                        // Cleanup
                        f_cf03Down();
                        
                    } // end f_GEONW_PON_GUC_CBF_BV_02
                    
                    /**
                     * @desc    Behavior function for NodeB (TC_GEONW_PON_GUC_CBF_BV_02)
                     * @param   p_distanceToNodeA       Distance between IUT and NodeA
                     * @param   p_longPosVectorNodeA    Position vector of NodeA
                     */
                    function f_GEONW_PON_GUC_CBF_BV_02_nodeB(in float p_distanceToNodeA, in LongPosVector p_longPosVectorNodeA) runs on ItsGeoNetworking {
                        
                        // Local variables
                        timer t_toCbf := (int2float(f_getCbfMaxTime())
                            + (
                                int2float(f_getCbfMinTime() - f_getCbfMaxTime())
                                / int2float(f_getCbfMaxCommunicationRange())
                            ) * p_distanceToNodeA) * 0.95 / 1000.0;
                        
                        // Preamble
                        f_prNeighbour();
                        f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                        
                        // Test Body
                        log("*** " & testcasename() & ": INFO: Message sent ***");
                        f_selfOrClientSyncAndVerdict(c_msgSent, e_success);
                        
                        tc_ac.start;
                        t_toCbf.start;
                        alt {
                            [] geoNetworkingPort.receive(
                                mw_geoNwInd(
                                    mw_geoNwPdu(
                                        mw_geoNwUnicastPacket(
                                            mw_shortPosVectorPosition(f_longPosVector2ShortPosVector(p_longPosVectorNodeA)),
                                            ?
                                        )
                                    )
                                )
                            ) {
                                tc_ac.stop;
                                if(t_toCbf.running) {
                                    t_toCbf.stop;
                                    log("*** " & testcasename() & ": FAIL: IUT re-broadcasted the packet too early ***");
                                    f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                                }
                                else {
                                    log("*** " & testcasename() & ": PASS: Forwarded GUC received ***");
                                    f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                                }
                            }
                            [] t_toCbf.timeout {
                                log("*** " & testcasename() & ": INFO: Ready for receiving re-broadcasting ***");
                                repeat;
                            }
                            [] tc_ac.timeout {
                                log("*** " & testcasename() & ": FAIL: GUC was not forwarded ***");
                                f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                            }
                        }
                        
                        // Postamble
                        f_poNeighbour();
                        
                    } // end f_GEONW_PON_GUC_CBF_BV_02_nodeB
berge's avatar
berge committed
                    /**
                     * @desc    Behavior function for NodeC (TC_GEONW_PON_GUC_CBF_BV_02)
                     * @param   p_longPosVectorNodeA    Position vector of NodeA
                     */
                    function f_GEONW_PON_GUC_CBF_BV_02_nodeC(in LongPosVector p_longPosVectorNodeA) runs on ItsGeoNetworking {
                        
                        // Local variables
                        
                        // Preamble
                        f_prNeighbour();
                        f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                        
                        // Test Body
                        f_sendGeoNetMessage(
                            m_geoNwReq_withLinkLayerDestination(
                                m_geoNwPdu(
                                    m_geoNwUnicastPacket(
                                        f_getPosition(c_compNodeC),
                                        f_longPosVector2ShortPosVector(p_longPosVectorNodeA),
                                        vc_localSeqNumber
                                    ),
                                    -,
                                    c_defaultHopLimit
berge's avatar
berge committed
                                f_getIutMacAddress()
                            )
                        );
                        log("*** " & testcasename() & ": INFO: Message sent ***");
                        f_selfOrClientSyncAndVerdict(c_msgSent, e_success);
                        
                        tc_ac.start;
                        alt {
                            [] geoNetworkingPort.receive(
                                mw_geoNwInd(
                                    mw_geoNwPdu(
                                        mw_geoNwUnicastPacket(
                                            mw_shortPosVectorPosition(f_longPosVector2ShortPosVector(p_longPosVectorNodeA)),
                                            ?
                                        )
berge's avatar
berge committed
                            ) {
                                tc_ac.stop;
                                log("*** " & testcasename() & ": PASS: Re-broadcasted GUC received ***");
                                f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                            }
berge's avatar
berge committed
                            [] tc_ac.timeout {
                                log("*** " & testcasename() & ": FAIL: GUC was not re-broadcasted ***");
                                f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                            }
berge's avatar
berge committed
                        
                        // Postamble
                        f_poNeighbour();
                        
                    } // end f_GEONW_PON_GUC_CBF_BV_02_nodeC
berge's avatar
berge committed
                } // end GEONW_PON_GUC_CBF_BV_02

				group GEONW_PON_GUC_CBF_BV_07 {
                
					/**
					 * @desc    TP Function for TC_GEONW_PON_GUC_CBF_BV_07
					 */
					function f_GEONW_PON_GUC_CBF_BV_07() runs on ItsMtc {
                    
						// Local variables
						var ItsGeoNetworking v_nodeB;
						var ItsGeoNetworking v_nodeC;
						var float v_distance := int2float(f_getCbfMaxCommunicationRange() - 10);
						var LongPosVector v_longPosVectorIut, v_longPosVectorNodeA;
                    
						// Test control
						if (not PICS_GN_GUC_FWD) {
							log("*** " & testcasename() & ": PICS_GN_GUC_FWD required for executing the TC ***");
							setverdict(inconc);
							stop;
						}
						if (f_getNonAreaForwardingAlgorithm() != e_cbf) {
							log("*** " & testcasename() & ": PICS_GN_NON_AREA_FORWARDING_ALGORITHM == e_cbf required for executing the TC ***");
							setverdict(inconc);
							stop;
						}
                    
						// Test component configuration
						f_cf03Up();
						// re-compute NodeA's position.
						v_longPosVectorIut := f_getIutLongPosVector();
						v_longPosVectorNodeA := f_computePositionUsingDistance(v_longPosVectorIut, v_distance, 0);
						v_longPosVectorNodeA.gnAddr := f_getTsGnLocalAddress(c_compNodeA);
                    
						// Preamble
                    
						// Start components
						v_nodeB := f_getComponent(c_compNodeB);
						v_nodeC := f_getComponent(c_compNodeC);
						v_nodeB.start(f_GEONW_PON_GUC_CBF_BV_07_nodeB(v_longPosVectorNodeA));
						v_nodeC.start(f_GEONW_PON_GUC_CBF_BV_07_nodeC(v_longPosVectorNodeA));
                    
						// Synchronization
						f_serverSync2ClientsAndStop({c_prDone, c_tbDone});
                    
						// Cleanup
						f_cf03Down();
                    
					} // end f_GEONW_PON_GUC_CBF_BV_07
                
					/**
					 * @desc    Behavior function for NodeB (TC_GEONW_PON_GUC_CBF_BV_07)
					 * @param   p_longPosVectorNodeA    Position vector of NodeA
					 */
					function f_GEONW_PON_GUC_CBF_BV_07_nodeB(in LongPosVector p_longPosVectorNodeA) runs on ItsGeoNetworking {
                    
						// Local variables
                    
						// Preamble
						f_prNeighbour();
						f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                    
						// Test Body
						f_sleepIgnoreDef(int2float(f_getCbfMaxTime())/2000.0);
                    
						f_sendGeoNetMessage(
							m_geoNwReq_withLinkLayerDestination(
								m_geoNwPdu(
									m_geoNwUnicastPacket(
										f_getPosition(c_compNodeC),
										f_longPosVector2ShortPosVector(p_longPosVectorNodeA),
										vc_localSeqNumber
									),
									-,
									c_defaultHopLimit - 1
								),
								-,
								f_getIutMacAddress()
							)
						);
                    
						tc_noac.start;
						alt {
							[] geoNetworkingPort.receive(
								mw_geoNwInd(
									mw_geoNwPdu(
										mw_geoNwUnicastPacket(
											mw_shortPosVectorPosition(f_longPosVector2ShortPosVector(p_longPosVectorNodeA)),
											?
										)
									)
								)
							) {
								tc_noac.stop;
								log("*** " & testcasename() & ": FAIL: Forwarded GUC received ***");
								f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
							}
                        
							[] tc_noac.timeout {
								log("*** " & testcasename() & ": PASS: GUC was not forwarded ***");
								f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
							}
						}
                    
						// Postamble
						f_poNeighbour();
                    
					} // end f_GEONW_PON_GUC_CBF_BV_07_nodeB
                
					/**
					 * @desc    Behavior function for NodeC (TC_GEONW_PON_GUC_CBF_BV_07)
					 * @param   p_longPosVectorNodeA    Position vector of NodeA
					 */
					function f_GEONW_PON_GUC_CBF_BV_07_nodeC(in LongPosVector p_longPosVectorNodeA) runs on ItsGeoNetworking {
                    
						// Local variables
                    
						// Preamble
						f_prNeighbour();
						f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                    
						// Test Body
						//Note: Sending of the GUC packet move to test body in contrast to the test purpose due to time critical behaviour
						f_sendGeoNetMessage(
							m_geoNwReq_withLinkLayerDestination(
								m_geoNwPdu(
									m_geoNwUnicastPacket(
										f_getPosition(c_compNodeC),
										f_longPosVector2ShortPosVector(p_longPosVectorNodeA),
										vc_localSeqNumber
									),
									-,
									c_defaultHopLimit
								),
								-,
								f_getIutMacAddress()
							)
						);
                    
						tc_noac.start;
						alt {
							[] geoNetworkingPort.receive(
								mw_geoNwInd(
									mw_geoNwPdu(
										mw_geoNwUnicastPacket(
											mw_shortPosVectorPosition(f_longPosVector2ShortPosVector(p_longPosVectorNodeA)),
											?
										)
									)
								)
							) {
								tc_ac.stop;
								log("*** " & testcasename() & ": FAIL: Forwarded GUC received ***");
								f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
							}
							[] tc_noac.timeout {
								log("*** " & testcasename() & ": PASS: GUC was not forwarded ***");
								f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
							}
						}
                    
						// Postamble
						f_poNeighbour();
                    
					} // end f_GEONW_PON_GUC_CBF_BV_07_nodeC
                
				} // end GEONW_PON_GUC_CBF_BV_07                

                group GEONW_PON_GUC_CBF_BV_20 {
berge's avatar
berge committed
                    /**
                     * @desc    TP Function for TC_GEONW_PON_GUC_CBF_BV_20
                     */
                    function f_GEONW_PON_GUC_CBF_BV_20() runs on ItsMtc {
                        
                        // Local variables
                        var ItsGeoNetworking v_nodeB;
                        var ItsGeoNetworking v_nodeC;
                        var float v_distance := int2float(f_getCbfMaxCommunicationRange() * 2);
                        var LongPosVector v_longPosVectorIut, v_longPosVectorNodeC;
                        
                        // Test control
                        if (not PICS_GN_GUC_FWD) {
                            log("*** " & testcasename() & ": PICS_GN_GUC_FWD required for executing the TC ***");
                            setverdict(inconc);
                            stop;
                        }
                        if (f_getNonAreaForwardingAlgorithm() != e_cbf) {
                            log("*** " & testcasename() & ": PICS_GN_NON_AREA_FORWARDING_ALGORITHM == e_cbf required for executing the TC ***");
                            setverdict(inconc);
                            stop;
                        }
                        
                        // Test component configuration
                        f_cf03Up();
                        // re-compute NodeC's position.
                        v_longPosVectorIut := f_getIutLongPosVector();
                        v_longPosVectorNodeC := f_computePositionUsingDistance(v_longPosVectorIut, v_distance, 180);
                        v_longPosVectorNodeC.gnAddr := f_getTsGnLocalAddress(c_compNodeC);
                        
                        // Preamble
                        
                        // Start components
                        v_nodeB := f_getComponent(c_compNodeB);
                        v_nodeC := f_getComponent(c_compNodeC);
                        v_nodeB.start(f_GEONW_PON_GUC_CBF_BV_20_nodeB(v_longPosVectorNodeC));
                        v_nodeC.start(f_GEONW_PON_GUC_CBF_BV_20_nodeC(v_longPosVectorNodeC));
                        
                        // Synchronization
                        f_serverSync2ClientsAndStop({c_prDone, c_msgSent, c_tbDone});
                        
                        // Cleanup
                        f_cf03Down();
                        
                    } // end f_GEONW_PON_GUC_CBF_BV_20
berge's avatar
berge committed
                    /**
                     * @desc    Behavior function for NodeB (TC_GEONW_PON_GUC_CBF_BV_20)
                     * @param   p_longPosVectorNodeC    Position vector of NodeC
                     */
                    function f_GEONW_PON_GUC_CBF_BV_20_nodeB(in LongPosVector p_longPosVectorNodeC) runs on ItsGeoNetworking {
                        
                        // Local variables
                        timer t_toCbf := int2float(f_getCbfMinTime()) / 1000.0;
						var LongPosVector v_longPosVectorNodeA := f_getPosition(c_compNodeA);
						
                        // Preamble
                        f_prNeighbour();
                        f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                        
                        // Test Body
                        log("*** " & testcasename() & ": INFO: Message sent ***");
                        f_selfOrClientSyncAndVerdict(c_msgSent, e_success);
                        
                        tc_ac.start;
                        t_toCbf.start;
                        alt {
                            [] geoNetworkingPort.receive(
                                mw_geoNwInd(
                                    mw_geoNwPdu(
                                        mw_geoNwUnicastPacket(
                                            mw_shortPosVectorPosition(f_longPosVector2ShortPosVector(v_longPosVectorNodeA)),
                                            ?
                                        )
                                    )
                                )
                            ) {
                                tc_ac.stop;
                                if(t_toCbf.running) {
                                    t_toCbf.stop;
                                    log("*** " & testcasename() & ": FAIL: IUT re-broadcasted the packet too early ***");
                                    f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                                }
                                else {
                                    log("*** " & testcasename() & ": PASS: Forwarded GUC received ***");
                                    f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                                }
                            }
                            [] t_toCbf.timeout {
                                log("*** " & testcasename() & ": INFO: Ready for receiving re-broadcasting ***");
                                repeat;
                            }
                            
                            [] tc_ac.timeout {
                                log("*** " & testcasename() & ": FAIL: GUC was not forwarded ***");
                                f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                            }
                        }
                        
                        // Postamble
                        f_poNeighbour();
                        
                    } // end f_GEONW_PON_GUC_CBF_BV_20_nodeB
berge's avatar
berge committed
                    /**
                     * @desc    Behavior function for NodeC (TC_GEONW_PON_GUC_CBF_BV_20)
                     * @param   p_longPosVectorNodeC    Position vector of NodeC
                     */
                    function f_GEONW_PON_GUC_CBF_BV_20_nodeC(LongPosVector p_longPosVectorNodeC) 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_geoNwUnicastPacket(
						                p_longPosVectorNodeC,
                                        f_longPosVector2ShortPosVector(v_longPosVectorNodeA),
                                        vc_localSeqNumber
                                    ),
                                    -,
                                    c_defaultHopLimit
berge's avatar
berge committed
                                f_getIutMacAddress()
                            )
                        );
                        log("*** " & testcasename() & ": INFO: Message sent ***");
                        f_selfOrClientSyncAndVerdict(c_msgSent, e_success);
                        
                        tc_ac.start;
                        alt {
                            [] geoNetworkingPort.receive(
                                mw_geoNwInd(
                                    mw_geoNwPdu(
                                        mw_geoNwUnicastPacket(
                                            mw_shortPosVectorPosition(f_longPosVector2ShortPosVector(v_longPosVectorNodeA)),
                                            ?
                                        )
berge's avatar
berge committed
                            ) {
                                tc_ac.stop;
                                log("*** " & testcasename() & ": PASS: Forwarded GUC received ***");
                                f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                            }
                            [] tc_ac.timeout {
                                log("*** " & testcasename() & ": FAIL: GUC was not forwarded ***");
                                f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                            }
berge's avatar
berge committed
                          
                        // Postamble
                        f_poNeighbour();
                        
                    } // end f_GEONW_PON_GUC_CBF_BV_20_nodeC
berge's avatar
berge committed
                } // end GEONW_PON_GUC_CBF_BV_20
berge's avatar
berge committed
                group GEONW_PON_GUC_CBF_BV_21 {
berge's avatar
berge committed
                    /**
                     * @desc    TP Function for TC_GEONW_PON_GUC_CBF_BV_21
                     */
                    function f_GEONW_PON_GUC_CBF_BV_21() runs on ItsMtc {
                        
                        // Local variables
                        var ItsGeoNetworking v_nodeB;
                        var ItsGeoNetworking v_nodeC;
						var ItsGeoNetworking v_nodeD;
                        var float v_distance := int2float(f_getCbfMaxCommunicationRange() - 10);
                        var LongPosVector v_longPosVectorIut, v_longPosVectorNodeA;
                        
                        // Test control
                        if (not PICS_GN_GUC_FWD) {
                            log("*** " & testcasename() & ": PICS_GN_GUC_FWD required for executing the TC ***");
                            setverdict(inconc);
                            stop;
                        }
                        if (f_getNonAreaForwardingAlgorithm() != e_cbf) {
                            log("*** " & testcasename() & ": PICS_GN_NON_AREA_FORWARDING_ALGORITHM == e_cbf required for executing the TC ***");
                            setverdict(inconc);
                            stop;
                        }
                        
                        // Test component configuration
                        f_cf04Up();
                        // re-compute NodeA's position.
                        v_longPosVectorIut := f_getIutLongPosVector();
                        v_longPosVectorNodeA := f_computePositionUsingDistance(v_longPosVectorIut, v_distance, 0);
                        v_longPosVectorNodeA.gnAddr := f_getTsGnLocalAddress(c_compNodeA);
                        
                        // Preamble
                        
                        // Start components
                        v_nodeB := f_getComponent(c_compNodeB);
                        v_nodeC := f_getComponent(c_compNodeC);
						v_nodeD := f_getComponent(c_compNodeD);
                        v_nodeB.start(f_GEONW_PON_GUC_CBF_BV_21_nodeB(v_longPosVectorNodeA));
                        v_nodeC.start(f_GEONW_PON_GUC_CBF_BV_21_nodeC(v_longPosVectorNodeA));
						v_nodeC.start(f_GEONW_PON_GUC_CBF_BV_21_nodeD(v_longPosVectorNodeA));
                        
                        // Synchronization
                        f_serverSync2ClientsAndStop({c_prDone, c_tbDone});
                        
                        // Cleanup
                        f_cf04Down();
                        
                    } // end f_GEONW_PON_GUC_CBF_BV_21
berge's avatar
berge committed
                    /**
                     * @desc    Behavior function for NodeB (TC_GEONW_PON_GUC_CBF_BV_21)
                     * @param   p_longPosVectorNodeA    Position vector of NodeA
                     */
                    function f_GEONW_PON_GUC_CBF_BV_21_nodeB(in LongPosVector p_longPosVectorNodeA) runs on ItsGeoNetworking {
                        
                        // Local variables
                        
                        // Preamble
                        f_prNeighbour();
                        f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                        
                        // Test Body                        
                        tc_ac.start;
                        alt {
                            [] geoNetworkingPort.receive(
                                mw_geoNwInd(
                                    mw_geoNwPdu(
                                        mw_geoNwUnicastPacket(
                                            mw_shortPosVectorPosition(f_longPosVector2ShortPosVector(p_longPosVectorNodeA)),
                                            ?
                                        )
berge's avatar
berge committed
                            ) {
                                tc_ac.stop;
                                log("*** " & testcasename() & ": PASS: Re-broadcasted GUC received ***");
                                f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                            }
berge's avatar
berge committed
                            
                            [] tc_ac.timeout {
                                log("*** " & testcasename() & ": FAIL: GUC was not forwarded ***");
                                f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                            }
berge's avatar
berge committed
                        // Postamble
                        f_poNeighbour();
                        
                    } // end f_GEONW_PON_GUC_CBF_BV_21_nodeB
berge's avatar
berge committed
                    /**
                     * @desc    Behavior function for NodeC (TC_GEONW_PON_GUC_CBF_BV_21)
                     * @param   p_longPosVectorNodeA    Position vector of NodeA
                     */
                    function f_GEONW_PON_GUC_CBF_BV_21_nodeC(in LongPosVector p_longPosVectorNodeA) runs on ItsGeoNetworking {
                        
                        // Local variables
                        
                        // Preamble
                        f_prNeighbour();
                        f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                        
                        // Test Body
                        tc_ac.start;
                        alt {
                            [] geoNetworkingPort.receive(
                                mw_geoNwInd(
                                    mw_geoNwPdu(
                                        mw_geoNwUnicastPacket(
                                            mw_shortPosVectorPosition(f_longPosVector2ShortPosVector(p_longPosVectorNodeA)),
                                            ?
                                        )
berge's avatar
berge committed
                            ) {
                                tc_ac.stop;
                                log("*** " & testcasename() & ": PASS: Re-broadcasted GUC received ***");
                                f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                            }
                            [] tc_ac.timeout {
                                log("*** " & testcasename() & ": FAIL: GUC was not forwarded ***");
                                f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                            }
berge's avatar
berge committed
                        
                        // Postamble
                        f_poNeighbour();
                        
                    } // end f_GEONW_PON_GUC_CBF_BV_21_nodeC

					/**
					 * @desc    Behavior function for NodeD (TC_GEONW_PON_GUC_CBF_BV_21)
                     * @param   p_longPosVectorNodeA    Position vector of NodeA
					 */
					function f_GEONW_PON_GUC_CBF_BV_21_nodeD(in LongPosVector p_longPosVectorNodeA) runs on ItsGeoNetworking {
                            
						// Local variables
						var LongPosVector v_longPosVectorNodeC := f_getPosition(c_compNodeC);
						timer t_toCbf := int2float(f_getCbfMaxTime()) * 0.95 / 1000.0;
                            
						// Preamble
						f_prNonNeighbour();
						f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                            
						// Test Body
						f_sendGeoNetMessage(
                        	m_geoNwReq_withLinkLayerDestination(
                        		m_geoNwPdu(
                        			m_geoNwUnicastPacket(
                        				f_getPosition(c_compNodeC),
                        				f_longPosVector2ShortPosVector(p_longPosVectorNodeA),
                        				vc_localSeqNumber
                        			),
                        			-,
                        			c_defaultHopLimit
                        		),
                        		-,
                        		f_getIutMacAddress()
                        	)
                        );
                            
						t_toCbf.start;                    
						tc_ac.start;
						alt {
							[] geoNetworkingPort.receive(
								mw_geoNwInd(
									mw_geoNwPdu(
										mw_geoNwUnicastPacket(
											mw_shortPosVectorPosition(f_longPosVector2ShortPosVector(p_longPosVectorNodeA)),
											?
										)
									)
								)
							) {
								tc_ac.stop;                           
                                    
								if(t_toCbf.running) {                               
									t_toCbf.stop;
									log("*** " & testcasename() & ": FAIL: GUC retransmitted before CBF timer expiration ***");
									f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
								}
								else {
									log("*** " & testcasename() & ": PASS: GUC message received ***");
									f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
								}
							}
							[] t_toCbf.timeout {
								log("*** " & testcasename() & ": INFO: GUC timer elapsed ***");
								repeat;
							}
							[] tc_ac.timeout {
								log("*** " & testcasename() & ": FAIL: GUC message not received ***");
								f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
							}
						}
                            
						// Postamble
						f_poDefault();
                            
					} // end f_GEONW_PON_GUC_CBF_BV_21_nodeD                        
berge's avatar
berge committed
                } // end GEONW_PON_GUC_CBF_BV_21
berge's avatar
berge committed
				group GEONW_PON_GUC_CBF_BV_22 {
berge's avatar
berge committed
					/**
					 * @desc    TP Function for TC_GEONW_PON_GUC_CBF_BV_22
					 */
					function f_GEONW_PON_GUC_CBF_BV_22() runs on ItsMtc {
berge's avatar
berge committed
						// Local variables
						var ItsGeoNetworking v_nodeB;
						var ItsGeoNetworking v_nodeC;
						var ItsGeoNetworking v_nodeD;
						var float v_distance := int2float(f_getCbfMaxCommunicationRange() - 10);
						var LongPosVector v_longPosVectorIut, v_longPosVectorNodeA;
                        
						// Test control
						if (not PICS_GN_GUC_FWD) {
							log("*** " & testcasename() & ": PICS_GN_GUC_FWD required for executing the TC ***");
							setverdict(inconc);
							stop;
						}
						if (f_getNonAreaForwardingAlgorithm() != e_cbf) {
							log("*** " & testcasename() & ": PICS_GN_NON_AREA_FORWARDING_ALGORITHM == e_cbf required for executing the TC ***");
							setverdict(inconc);
							stop;
						}
                        
						// Test component configuration
						f_cf04Up();
						// re-compute NodeA's position.
						v_longPosVectorIut := f_getIutLongPosVector();
						v_longPosVectorNodeA := f_computePositionUsingDistance(v_longPosVectorIut, v_distance, 0);
						v_longPosVectorNodeA.gnAddr := f_getTsGnLocalAddress(c_compNodeA);
                        
						// Preamble
                        
						// Start components
						v_nodeB := f_getComponent(c_compNodeB);
						v_nodeC := f_getComponent(c_compNodeC);
						v_nodeD := f_getComponent(c_compNodeD);
						v_nodeB.start(f_GEONW_PON_GUC_CBF_BV_22_nodeB(v_longPosVectorNodeA));
						v_nodeC.start(f_GEONW_PON_GUC_CBF_BV_22_nodeC(v_longPosVectorNodeA));
						v_nodeC.start(f_GEONW_PON_GUC_CBF_BV_22_nodeD(v_longPosVectorNodeA));
                        
						// Synchronization
						f_serverSync2ClientsAndStop({c_prDone, c_tbDone});
                        
						// Cleanup
						f_cf04Down();
                        
					} // end f_GEONW_PON_GUC_CBF_BV_22
berge's avatar
berge committed
					/**
					 * @desc    Behavior function for NodeB (TC_GEONW_PON_GUC_CBF_BV_22)
					 * @param   p_longPosVectorNodeA    Position vector of NodeA
					 */
					function f_GEONW_PON_GUC_CBF_BV_22_nodeB(in LongPosVector p_longPosVectorNodeA) runs on ItsGeoNetworking {
                        
						// Local variables
                        
						// Preamble
						f_prNeighbour();
						f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                        
						// Test Body                        
						tc_ac.start;
						alt {
							[] geoNetworkingPort.receive(
								mw_geoNwInd(
									mw_geoNwPdu(
										mw_geoNwUnicastPacket(
											mw_shortPosVectorPosition(f_longPosVector2ShortPosVector(p_longPosVectorNodeA)),
											?
										)
									)
								)
							) {
								tc_ac.stop;
								log("*** " & testcasename() & ": PASS: Re-broadcasted GUC received ***");
								f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
							}
                            
							[] tc_ac.timeout {
								log("*** " & testcasename() & ": FAIL: GUC was not forwarded ***");
								f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
							}
						}
                        
						// Postamble
						f_poNeighbour();
                        
					} // end f_GEONW_PON_GUC_CBF_BV_22_nodeB
berge's avatar
berge committed
					/**
					 * @desc    Behavior function for NodeC (TC_GEONW_PON_GUC_CBF_BV_22)
					 * @param   p_longPosVectorNodeA    Position vector of NodeA
					 */
					function f_GEONW_PON_GUC_CBF_BV_22_nodeC(in LongPosVector p_longPosVectorNodeA) runs on ItsGeoNetworking {
                        
						// Local variables
                        
						// Preamble
						f_prNeighbour();
						f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                        
						// Test Body
						tc_ac.start;
						alt {
							[] geoNetworkingPort.receive(
								mw_geoNwInd(
									mw_geoNwPdu(
										mw_geoNwUnicastPacket(
											mw_shortPosVectorPosition(f_longPosVector2ShortPosVector(p_longPosVectorNodeA)),
											?
										)
									)
								)
							) {
								tc_ac.stop;
								log("*** " & testcasename() & ": PASS: Re-broadcasted GUC received ***");
								f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
							}
							[] tc_ac.timeout {
								log("*** " & testcasename() & ": FAIL: GUC was not forwarded ***");
								f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
							}
						}
                        
						// Postamble
						f_poNeighbour();
                        
					} // end f_GEONW_PON_GUC_CBF_BV_22_nodeC

					/**
					 * @desc    Behavior function for NodeD (TC_GEONW_PON_GUC_CBF_BV_22)
					 * @param   p_longPosVectorNodeA    Position vector of NodeA
					 */
					function f_GEONW_PON_GUC_CBF_BV_22_nodeD(in LongPosVector p_longPosVectorNodeA) runs on ItsGeoNetworking {
                            
						// Local variables
						var LongPosVector v_longPosVectorNodeD := f_getPosition(c_compNodeD);
						timer t_toCbf := int2float(f_getCbfMaxTime()) * 0.95 / 1000.0;
                            
						// Preamble
						v_longPosVectorNodeD.pai := int2bit(0,1);
					    f_changePositon(c_compNodeD, v_longPosVectorNodeD); 
					    f_prNeighbour();
					    f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                            
						// Test Body
						f_sendGeoNetMessage(
							m_geoNwReq_withLinkLayerDestination(
								m_geoNwPdu(
									m_geoNwUnicastPacket(
										f_getPosition(c_compNodeC),
										f_longPosVector2ShortPosVector(p_longPosVectorNodeA),
										vc_localSeqNumber
									),
									-,
									c_defaultHopLimit
								),
								-,
								f_getIutMacAddress()
							)
						);
                            
						t_toCbf.start;                    
						tc_ac.start;
						alt {
							[] geoNetworkingPort.receive(
								mw_geoNwInd(
									mw_geoNwPdu(
										mw_geoNwUnicastPacket(
											mw_shortPosVectorPosition(f_longPosVector2ShortPosVector(p_longPosVectorNodeA)),
											?
										)
									)
								)
							) {
								tc_ac.stop;                           
                                    
								if(t_toCbf.running) {                               
									t_toCbf.stop;
									log("*** " & testcasename() & ": FAIL: GUC retransmitted before CBF timer expiration ***");
									f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
								}
								else {
									log("*** " & testcasename() & ": PASS: GUC message received ***");
									f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
								}
							}
							[] t_toCbf.timeout {
								log("*** " & testcasename() & ": INFO: GUC timer elapsed ***");
								repeat;
							}
							[] tc_ac.timeout {
								log("*** " & testcasename() & ": FAIL: GUC message not received ***");
								f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
							}
						}
                            
						// Postamble
						f_poDefault();
                            
					} // end f_GEONW_PON_GUC_CBF_BV_22_nodeD                        
berge's avatar
berge committed
				} // end GEONW_PON_GUC_CBF_BV_22

            } // end gucContentionBasedForwarding
                        
        } // end geoGeoUnicast
        
        // 6.2.2.9
        group geoGeoBroadcast {
berge's avatar
berge committed
			group gbcNonAreaForwarding {
            
				group gbcNonAreaAllForwardingAlgorithm {
					
					group GEONW_PON_GBC_NONAREA_ALL_BV_03 {
                        
						/**
						 * @desc    TP Function for TC_GEONW_PON_GBC_NONAREA_ALL_BV_03
						 */
						function f_GEONW_PON_GBC_NONAREA_ALL_BV_03() runs on ItsMtc {
                            
							// Local variables
							var ItsGeoNetworking v_nodeB;
							var ItsGeoNetworking v_nodeC;
                            
							// Test control
							if (not PICS_GN_GBC_FWD) {
								log("*** " & testcasename() & ": PICS_GN_GBC_FWD required for executing the TC ***");
								setverdict(inconc);
								stop;
							}
                            
							// 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_GBC_NONAREA_ALL_BV_03_nodeB());
							v_nodeC.start(f_GEONW_PON_GBC_NONAREA_ALL_BV_03_nodeC());
                            
							// Synchronization
							f_serverSync2ClientsAndStop({c_prDone, c_tbDone});
                            
							// Cleanup
							f_cf03Down();
                            
						} // end f_GEONW_PON_GBC_NONAREA_ALL_BV_03
                        
						/**
						 * @desc    Behavior function for NodeB (TC_GEONW_PON_GBC_NONAREA_ALL_BV_03)
						 */
						function f_GEONW_PON_GBC_NONAREA_ALL_BV_03_nodeB() runs on ItsGeoNetworking {
                            
							// Local variables
							var LongPosVector v_longPosVectorNodeC := f_getPosition(c_compNodeC);
                            
							// Preamble
							f_prNeighbour();
							f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                            
							// Test Body
							tc_ac.start;
							alt {
								[] a_receiveGeoBroadcastWithAreaWithHopLimit(
									mw_longPosVectorPosition(v_longPosVectorNodeC),
									?,
									f_getGeoBroadcastArea(c_area2),
									c_defaultHopLimit - 1,
									c_defaultHopLimit) {
									tc_ac.stop;
									log("*** " & testcasename() & ": PASS: GBC message correctly retransmitted ***");
									f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
								}
								[] a_receiveGeoBroadcastWithAreaWithHopLimit(
									mw_longPosVectorPosition(v_longPosVectorNodeC),
									?,
									f_getGeoBroadcastArea(c_area2),
									?,
									?) {
									tc_ac.stop;
									log("*** " & testcasename() & ": FAIL: GBC message fields not updated ***");
									f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
								}
								[] tc_ac.timeout {
									log("*** " & testcasename() & ": INCONC: GBC message not retransmitted ***");
									f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
								}
							}
                            
							// Postamble
							f_poNeighbour();
                            
						} // end f_GEONW_PON_GBC_NONAREA_ALL_BV_03_nodeB
                        
						/**
						 * @desc    Behavior function for NodeC (TC_GEONW_PON_GBC_NONAREA_ALL_BV_03)
						 */
						function f_GEONW_PON_GBC_NONAREA_ALL_BV_03_nodeC() runs on ItsGeoNetworking {
                            
							// Local variables
							var LongPosVector v_longPosVectorNodeC := f_getPosition(c_compNodeC);
							var GeoNetworkingInd v_msgInd;
                            
							// Preamble
							f_prNeighbour();
							f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                            
							// Test Body
							f_sendGeoNetMessage(
								m_geoNwReq_linkLayerBroadcast(
									m_geoNwPdu(
										m_geoNwBroadcastPacket(
											v_longPosVectorNodeC,
											vc_localSeqNumber,
											f_getGeoBroadcastArea(c_area2),
											c_defaultHopLimit
										),
										-,
										c_defaultHopLimit
									)
								)
							);
							f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                            
							// Postamble
							f_poNeighbour();
                            
						} // end f_GEONW_PON_GBC_NONAREA_ALL_BV_03_nodeC
                        
					} // end GEONW_PON_GBC_NONAREA_ALL_BV_03
            
					group GEONW_PON_GBC_NONAREA_ALL_BV_04 {
                        
						/**
						 * @desc    TP Function for TC_GEONW_PON_GBC_NONAREA_ALL_BV_04
						 */
						function f_GEONW_PON_GBC_NONAREA_ALL_BV_04() runs on ItsMtc {
                            
							// Local variables
							var ItsGeoNetworking v_nodeB;
							var ItsGeoNetworking v_nodeC;
                            
							// Test control
							if (not PICS_GN_GBC_FWD) {
								log("*** " & testcasename() & ": PICS_GN_GBC_FWD required for executing the TC ***");
								setverdict(inconc);
								stop;
							}
                            
							// 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_GBC_NONAREA_ALL_BV_04_nodeB());
							v_nodeC.start(f_GEONW_PON_GBC_NONAREA_ALL_BV_04_nodeC());
                            
							// Synchronization
							f_serverSync2ClientsAndStop({c_prDone, c_tbDone});
                            
							// Cleanup
							f_cf03Down();
                            
						} // end f_GEONW_PON_GBC_NONAREA_ALL_BV_04
                        
						/**
						 * @desc    Behavior function for NodeB (TC_GEONW_PON_GBC_NONAREA_ALL_BV_04)
						 */
						function f_GEONW_PON_GBC_NONAREA_ALL_BV_04_nodeB() runs on ItsGeoNetworking {
                            
							// Local variables
							var LongPosVector v_longPosVectorNodeC := f_getPosition(c_compNodeC);
                            
							// Preamble
							f_prNeighbour();
							f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                            
							// Test Body
							tc_noac.start;
							alt {
								[] a_receiveGeoBroadcastWithArea(
									mw_longPosVectorPosition(v_longPosVectorNodeC),
									?,
									f_getGeoBroadcastArea(c_area2)) {
									tc_noac.stop;
									log("*** " & testcasename() & ": FAIL: GBC message retransmitted ***");
									f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
								}
								[] tc_noac.timeout {
									log("*** " & testcasename() & ": PASS: GBC message not retransmitted ***");
									f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
								}
							}
                            
							// Postamble
							f_poNeighbour();
                            
						} // end f_GEONW_PON_GBC_NONAREA_ALL_BV_04_nodeB
                        
						/**
						 * @desc    Behavior function for NodeC (TC_GEONW_PON_GBC_NONAREA_ALL_BV_04)
						 */
						function f_GEONW_PON_GBC_NONAREA_ALL_BV_04_nodeC() runs on ItsGeoNetworking {
                            
							// Local variables
							var LongPosVector v_longPosVectorNodeC := f_getPosition(c_compNodeC);
                            
							// Preamble
							f_prNeighbour();
							f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                            
							// Test Body
							f_sendGeoNetMessage(
								m_geoNwReq_linkLayerBroadcast(
									m_geoNwPdu(
										m_geoNwBroadcastPacket(
											v_longPosVectorNodeC,
											vc_localSeqNumber,
											f_getGeoBroadcastArea(c_area2)
										),
										-,
										c_hopLimit1
									)
								)
							);
                            
							tc_noac.start;
							alt {
								[] a_receiveGeoBroadcastWithArea(
									mw_longPosVectorPosition(v_longPosVectorNodeC),
									?,
									f_getGeoBroadcastArea(c_area2)) {
									tc_noac.stop;
									log("*** " & testcasename() & ": FAIL: GBC message retransmitted ***");
									f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
								}
								[] tc_noac.timeout {
									log("*** " & testcasename() & ": PASS: GBC message not retransmitted ***");
									f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
								}
							}
                            
							// Postamble
							f_poNeighbour();
                            
						} // end f_GEONW_PON_GBC_NONAREA_ALL_BV_04_nodeC
                        
					} // end GEONW_PON_GBC_NONAREA_ALL_BV_04

                    /**
                     * @desc    TP Function for TC_GEONW_PON_GBC_NONAREA_ALL_BV_06
                     */
                    function f_GEONW_PON_GBC_NONAREA_ALL_BV_06() runs on ItsGeoNetworking {
                        
                        // Local variables
                        var LongPosVector v_longPosVectorNodeB;
                        var template (value) GeoNetworkingPdu v_gnPacket;
                        var integer i;
                        var GnRawPayload v_sentRawPayload;
                        
                        // Test control
                        if (not PICS_GN_GBC_FWD) {
                            log("*** " & testcasename() & ": PICS_GN_GBC_FWD required for executing the TC ***");
                            setverdict(inconc);
                            stop;
berge's avatar
berge committed
                        // Test component configuration
                        f_cf01Up();
                        v_longPosVectorNodeB := f_getPosition(c_compNodeB);
                        
                        // Test adapter configuration
                        
                        // Preamble
                        f_prNeighbour();
                        f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                        
                        // Test Body
                        v_gnPacket := m_geoNwPdu(m_geoNwBroadcastPacket(
                                                    v_longPosVectorNodeB,
                                                    vc_localSeqNumber,
                                                    f_getGeoBroadcastArea(c_area2)
                                                )
                                            );
                        f_sendGeoNetMessage(m_geoNwReq_linkLayerBroadcast(v_gnPacket));
                        
                        f_sleep(PX_TAC);
                        
                        if(0 != lengthof(vc_utInds)) {
                            log("*** " & testcasename() & ": FAIL: GN was transmitted to upper layer ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                        }
berge's avatar
berge committed
                        else {
                            log("*** " & testcasename() & ": PASS: GN was NOT transmitted to upper layer ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                        }
                        
                        // Postamble
                        f_poNeighbour();
                        f_cf01Down();
                        
                    } // end f_GEONW_PON_GBC_NONAREA_ALL_BV_06

                    group GEONW_PON_GBC_NONAREA_ALL_BO_09 {
                        
                        /**
                         * @desc    TP Function for TC_GEONW_PON_GBC_NONAREA_ALL_BO_09
                         */
                        function f_GEONW_PON_GBC_NONAREA_ALL_BO_09() runs on ItsMtc {
                            
                            // Local variables
                            var ItsGeoNetworking v_nodeB;
                            var ItsGeoNetworking v_nodeC;
                            var ItsGeoNetworking v_nodeD;
                            var UInt16 v_distanceTooBig;
                            
                            // Test control
                            if (not PICS_GN_GBC_FWD) {
                                log("*** " & testcasename() & ": PICS_GN_GBC_FWD required for executing the TC ***");
                                setverdict(inconc);
                                stop;
                            }
                            
                            // Test component configuration
                            f_cf04Up();
                            v_distanceTooBig := float2int(1.1 * f_radiusFromCircularArea(f_getGnMaxAreaSize()*c_squareKm));
                            
                            // Preamble
                            
                            // Start components
                            v_nodeB := f_getComponent(c_compNodeB);
                            v_nodeC := f_getComponent(c_compNodeC);
                            v_nodeD := f_getComponent(c_compNodeD);
                            v_nodeB.start(f_GEONW_PON_GBC_NONAREA_ALL_BO_09_nodeB(v_distanceTooBig));
                            v_nodeC.start(f_GEONW_PON_GBC_NONAREA_ALL_BO_09_nodeC(v_distanceTooBig));
                            v_nodeD.start(f_GEONW_PON_GBC_NONAREA_ALL_BO_09_nodeD(v_distanceTooBig));
                            
                            // Synchronization
                            f_serverSync3ClientsAndStop({c_prDone, c_tbDone});
                            
                            // Cleanup
                            f_cf04Down();
                            
                        } // end f_GEONW_PON_GBC_NONAREA_ALL_BO_09
                        
                        /**
                         * @desc    Behavior function for NodeB (TC_GEONW_PON_GBC_BO_19)
                         */
                        function f_GEONW_PON_GBC_NONAREA_ALL_BO_09_nodeB(in UInt16 p_distanceTooBig) runs on ItsGeoNetworking {
                            
                            // Local variables
                            var LongPosVector v_longPosVectorNodeC := f_getPosition(c_compNodeC);
                            var GeoArea v_areaTooBig;
                            
                            // Preamble
                            f_prNeighbour();
                            v_areaTooBig := f_computeCircularArea(
                                f_getPosition(c_compNodeB), 
                                p_distanceTooBig
                            );
                            f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                            
                            // Test Body
                            tc_noac.start;
                            alt {
                                [] geoNetworkingPort.receive(mw_geoNwInd(mw_geoNwPdu(mw_geoNwBroadcastPacketWithArea(
                                        mw_longPosVectorPosition(v_longPosVectorNodeC),
                                        ?,
                                        f_geoArea2GeoBroadcastArea(v_areaTooBig)
                                    )))) {
                                    tc_noac.stop;
                                    log("*** " & testcasename() & ": FAIL: GBC message retransmitted ***");
                                    f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                                }
                                [] tc_noac.timeout {
                                    log("*** " & testcasename() & ": PASS: GBC message not retransmitted ***");
                                    f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                                }
                            }
                            
                            // Postamble
                            f_poNeighbour();
                            
                        } // end f_GEONW_PON_GBC_NONAREA_ALL_BO_09_nodeB
                        
                        /**
                         * @desc    Behavior function for NodeC (TC_GEONW_PON_GBC_NONAREA_ALL_BO_09)
                         */
                        function f_GEONW_PON_GBC_NONAREA_ALL_BO_09_nodeC(in UInt16 p_distanceTooBig) runs on ItsGeoNetworking {
                            
                            // Local variables
                            var LongPosVector v_longPosVectorNodeC := f_getPosition(c_compNodeC);
                            var GeoArea v_areaTooBig;
                            
                            // Preamble
                            f_prNeighbour();
                            v_areaTooBig := f_computeCircularArea(
                                f_getPosition(c_compNodeB), 
                                p_distanceTooBig
                            );
                            f_sendGeoNetMessage(
                                m_geoNwReq_linkLayerBroadcast(
                                    m_geoNwPdu(
                                        m_geoNwBroadcastPacket(
                                            v_longPosVectorNodeC,
                                            vc_localSeqNumber,
                                            f_geoArea2GeoBroadcastArea(v_areaTooBig)
                                        )
berge's avatar
berge committed
                            );
                            f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                            
                            // Test Body
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
berge's avatar
berge committed
                            
                            // Postamble
                            f_poNeighbour();
                            
                        } // end f_GEONW_PON_GBC_NONAREA_ALL_BO_09_nodeC
                        
                        /**
                         * @desc    Behavior function for NodeD (TC_GEONW_PON_GBC_NONAREA_ALL_BO_09)
                         */
                        function f_GEONW_PON_GBC_NONAREA_ALL_BO_09_nodeD(in UInt16 p_distanceTooBig) runs on ItsGeoNetworking {
                            
                            // Local variables
                            var LongPosVector v_longPosVectorNodeC := f_getPosition(c_compNodeC);
                            var GeoArea v_areaTooBig;
                            
                            // Preamble
                            f_prNeighbour();
                            v_areaTooBig := f_computeCircularArea(
                                f_getPosition(c_compNodeB), 
                                p_distanceTooBig
                            );
                            f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                            
                            // Test Body
                            tc_noac.start;
                            alt {
                                [] geoNetworkingPort.receive(mw_geoNwInd(mw_geoNwPdu(mw_geoNwBroadcastPacketWithArea(
                                        mw_longPosVectorPosition(v_longPosVectorNodeC),
                                        ?,
                                        f_geoArea2GeoBroadcastArea(v_areaTooBig)
                                    )))) {
                                    tc_noac.stop;
                                    log("*** " & testcasename() & ": FAIL: GBC message forwarded ***");
                                    f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                                }
                                [] tc_noac.timeout {
                                    log("*** " & testcasename() & ": PASS: GBC message not forwarded ***");
                                    f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                                }
                            }
                            
                            // Postamble
                            f_poNeighbour();
                            
                        } // end f_GEONW_PON_GBC_NONAREA_ALL_BO_09_nodeD
                        
                    } // end GEONW_PON_GBC_NONAREA_ALL_BO_09
berge's avatar
berge committed
                    group GEONW_PON_GBC_NONAREA_ALL_BO_10 {
                        
                        /**
                         * @desc    TP Function for TC_GEONW_PON_GBC_NONAREA_ALL_BO_10
                         */
                        function f_GEONW_PON_GBC_NONAREA_ALL_BO_10() runs on ItsMtc {
                            
                            // Local variables
                            var ItsGeoNetworking v_nodeB;
                            var ItsGeoNetworking v_nodeC;
                            var ItsGeoNetworking v_nodeD;
                            
                            // Test control
                            if (not PICS_GN_GBC_FWD) {
                                log("*** " & testcasename() & ": PICS_GN_GBC_FWD required for executing the TC ***");
                                setverdict(inconc);
                                stop;
                            }
                            
        //                    if (f_getCbfMinTime() < 300) {
        //                        log("*** " & testcasename() & ": PICS_GN_GEOBROADCAST_CBF_MIN_TIME >= 300 required for executing the TC ***");
        //                        setverdict(inconc);
        //                        stop;
        //                    }
                                                                  
                            // Test component configuration
                            f_cf04Up();
                            
                            // Preamble
                            
                            // Start components
                            v_nodeB := f_getComponent(c_compNodeB);
                            v_nodeC := f_getComponent(c_compNodeC);
                            v_nodeD := f_getComponent(c_compNodeD);
                            v_nodeB.start(f_GEONW_PON_GBC_NONAREA_ALL_BO_10_nodeB());
                            v_nodeC.start(f_GEONW_PON_GBC_NONAREA_ALL_BO_10_nodeC());
                            v_nodeD.start(f_GEONW_PON_GBC_NONAREA_ALL_BO_10_nodeD());
                            
                            // Synchronization
                            f_serverSync3ClientsAndStop({c_prDone, c_tbDone});
                            
                            // Cleanup
                            f_cf04Down();
                            
                        } // end f_GEONW_PON_GBC_NONAREA_ALL_BO_10
                        
                        /**
                         * @desc    Behavior function for NodeB (TC_GEONW_PON_GBC_NONAREA_ALL_BO_10)
                         */
                        function f_GEONW_PON_GBC_NONAREA_ALL_BO_10_nodeB() runs on ItsGeoNetworking {
                            
                            // Local variables
                            
                            // Preamble
                            f_prNeighbour();
                            f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                            
                            // Test Body                    
                            tc_noac.start;
                            alt {
                                [] geoNetworkingPort.receive(mw_geoNwInd(mw_geoNwPdu(?))) {
                                    tc_noac.stop;
                                    log("*** " & testcasename() & ": FAIL: GBC received and not discarded ***");
                                    f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                                }
                                [] tc_noac.timeout {
                                    log("*** " & testcasename() & ": PASS: GBC message discarded ***");
                                    f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                                }
                            }
                            
                            // Postamble
                            f_poNeighbour();
                            
                        } // end f_GEONW_PON_GBC_NONAREA_ALL_BO_10_nodeB
                        
                        /**
                         * @desc    Behavior function for NodeC (TC_GEONW_PON_GBC_NONAREA_ALL_BO_10)
                         */
                        function f_GEONW_PON_GBC_NONAREA_ALL_BO_10_nodeC() runs on ItsGeoNetworking {
                            
                            // Local variables
                            
                            // Preamble
                            f_prNeighbour();
                            f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                            
                            // Test Body
                            tc_noac.start;
                            alt {
                                [] geoNetworkingPort.receive(mw_geoNwInd(mw_geoNwPdu(?))) {
                                    tc_noac.stop;
                                    log("*** " & testcasename() & ": FAIL: GBC received and not discarded ***");
                                    f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                                }
                                [] tc_noac.timeout {
                                    log("*** " & testcasename() & ": PASS: GBC message discarded ***");
                                    f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                                }
                            }
                            
                            // Postamble
                            f_poNeighbour();
                            
                        } // end f_GEONW_PON_GBC_NONAREA_ALL_BO_10_nodeC
                        
                        /**
                         * @desc    Behavior function for NodeD (TC_GEONW_PON_GBC_NONAREA_ALL_BO_10)
                         */
                        function f_GEONW_PON_GBC_NONAREA_ALL_BO_10_nodeD() runs on ItsGeoNetworking {
                            
                            // Local variables
                            var LongPosVector v_longPosVectorNodeD := f_getPosition(c_compNodeD);
                            
                            // Preamble
                            f_prNeighbour();
                            f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                            
                            // Test Body
                            f_sendGeoNetMessage(
                                m_geoNwReq_linkLayerBroadcast(
                                    m_geoNwPdu(
                                        m_geoNwBroadcastPacket(
                                            v_longPosVectorNodeD,
                                            vc_localSeqNumber,
                                            f_getGeoBroadcastArea(c_area2)
                                        )
berge's avatar
berge committed
                            );
                            
                            tc_noac.start;
                            alt {
                                [] geoNetworkingPort.receive(mw_geoNwInd(mw_geoNwPdu(?))) {
                                    tc_noac.stop;
                                    log("*** " & testcasename() & ": FAIL: GBC received and not discarded ***");
                                    f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                                }
                                [] tc_noac.timeout {
                                    log("*** " & testcasename() & ": PASS: GBC message discarded ***");
                                    f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                                }
                            }
                            
                            // Postamble
                            f_poNeighbour();
                            
                        } // end f_GEONW_PON_GBC_NONAREA_ALL_BO_10_nodeD
                        
                    } // end GEONW_PON_GBC_NONAREA_ALL_BO_10
            
				} // end gbcNonAreaAllForwardingAlgorithm
            
				group gbcNonAreaGreedyForwarding {
					
                    group GEONW_PON_GBC_NONAREA_GRD_BV_01 {
                        
                        /**
                         * @desc    TP Function for TC_GEONW_PON_GBC_NONAREA_GRD_BV_01
                         */
                        function f_GEONW_PON_GBC_NONAREA_GRD_BV_01() runs on ItsMtc {
                            
                            // Local variables
                            var ItsGeoNetworking v_nodeB;
                            var ItsGeoNetworking v_nodeD;
                            
                            // Test control
                            if (not PICS_GN_GBC_SRC) {
                                log("*** " & testcasename() & ": PICS_GN_GBC_SRC required for executing the TC ***");
                                setverdict(inconc);
                                stop;
                            }
                            if ((f_getNonAreaForwardingAlgorithm() != e_greedy) and (f_getNonAreaForwardingAlgorithm() != e_unspecified)) {
                                log("*** " & testcasename() & ": PICS_GN_NON_AREA_FORWARDING_ALGORITHM == ( e_greedy or e_unspecified ) required for executing the TC ***");
                                setverdict(inconc);
                                stop;
                            }
                                                
                            // 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_GBC_NONAREA_GRD_BV_02_nodeB());
                            v_nodeD.start(f_GEONW_PON_GBC_NONAREA_GRD_BV_02_nodeD());
                            
                            // Synchronization
                            f_serverSync2ClientsAndStop({c_prDone, c_tbDone});
                            
                            // Cleanup
                            f_cf02Down();
                            
                        } // end f_GEONW_PON_GBC_NONAREA_GRD_BV_01
                        
                        /**
                         * @desc    Behavior function for NodeB (TC_GEONW_PON_GBC_NONAREA_GRD_BV_01)
                         */
                        function f_GEONW_PON_GBC_NONAREA_GRD_BV_01_nodeB() runs on ItsGeoNetworking {
                            
                            // Local variables
                            var LongPosVector v_longPosVectorIut := f_getPosition(c_compIut);
                            
                            // Preamble
                            f_prNeighbour();
                            f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                            
                            // Test Body
                            if ( not f_utTriggerEvent(m_generateGeoBroadcastMessage(f_getArea(c_area2))) ) {
                                log("*** " & testcasename() & ": INCONC: Trigger failed ***");
                                f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
                            }
                            
                            tc_ac.start;
                            alt {
                                [] a_receiveGeoBroadcastWithArea(
                                        mw_longPosVectorPosition(v_longPosVectorIut),
                                        ?,
                                        f_getGeoBroadcastArea(c_area2)) {
                                    tc_ac.stop;
                                    log("*** " & testcasename() & ": PASS: GBC message received correctly ***");
                                    f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                                }
                                [] tc_ac.timeout {
                                    log("*** " & testcasename() & ": FAIL: GBC message not received ***");
                                    f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                                }
                            }
                            
                            // Postamble
                            f_poNeighbour();
                            
                        } // end f_GEONW_PON_GBC_NONAREA_GRD_BV_01_nodeB
                        
                        /**
                         * @desc    Behavior function for NodeD (TC_GEONW_PON_GBC_NONAREA_GRD_BV_01)
                         */
                        function f_GEONW_PON_GBC_NONAREA_GRD_BV_01_nodeD() runs on ItsGeoNetworking {
                            
                            // Local variables
                            var LongPosVector v_longPosVectorIut := f_getPosition(c_compIut);
                            
                            // Preamble
                            f_prNeighbour();
                            f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                            
                            // Test Body
                            tc_noac.start;
                            alt {
                                [] a_receiveGeoBroadcastWithArea(
                                        mw_longPosVectorPosition(v_longPosVectorIut),
                                        ?,
                                        f_getGeoBroadcastArea(c_area2)) {
                                    tc_noac.stop;
                                    log("*** " & testcasename() & ": FAIL: received GBC message ***");
                                    f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                                }
                                [] tc_noac.timeout {
                                    log("*** " & testcasename() & ": PASS: GBC message not received ***");
                                    f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                                }
                            }
                            
                            // Postamble
                            f_poNeighbour();
                            
                        } // end f_GEONW_PON_GBC_NONAREA_GRD_BV_01_nodeD
                        
                    } // end GEONW_PON_GBC_NONAREA_GRD_BV_01
berge's avatar
berge committed
                    group GEONW_PON_GBC_NONAREA_GRD_BV_02 {
                        
                        /**
                         * @desc    TP Function for TC_GEONW_PON_GBC_NONAREA_GRD_BV_02
                         */
                        function f_GEONW_PON_GBC_NONAREA_GRD_BV_02() runs on ItsMtc {
                            
                            // Local variables
                            var ItsGeoNetworking v_nodeB;
                            var ItsGeoNetworking v_nodeC;
                            var ItsGeoNetworking v_nodeD;
                            
                            // Test control
                            if (not PICS_GN_GBC_FWD) {
                                log("*** " & testcasename() & ": PICS_GN_GBC_FWD required for executing the TC ***");
                                setverdict(inconc);
                                stop;
                            }
							if ((f_getNonAreaForwardingAlgorithm() != e_greedy) and (f_getNonAreaForwardingAlgorithm() != e_unspecified)) {
								log("*** " & testcasename() & ": PICS_GN_NON_AREA_FORWARDING_ALGORITHM == ( e_greedy or e_unspecified ) required for executing the TC ***");
								setverdict(inconc);
								stop;
							}
                            
                            // Test component configuration
                            f_cf04Up();
                            
                            // Preamble
                            
                            // Start components
                            v_nodeB := f_getComponent(c_compNodeB);
                            v_nodeC := f_getComponent(c_compNodeC);
                            v_nodeD := f_getComponent(c_compNodeD);
                            v_nodeB.start(f_GEONW_PON_GBC_NONAREA_GRD_BV_02_nodeB());
                            v_nodeC.start(f_GEONW_PON_GBC_NONAREA_GRD_BV_02_nodeC());
                            v_nodeD.start(f_GEONW_PON_GBC_NONAREA_GRD_BV_02_nodeD());
                            
                            // Synchronization
                            f_serverSync3ClientsAndStop({c_prDone, c_tbDone});
                            
                            // Cleanup
                            f_cf04Down();
                            
                        } // end f_GEONW_PON_GBC_NONAREA_GRD_BV_02
                        
                        /**
                         * @desc    Behavior function for NodeB (TC_GEONW_PON_GBC_NONAREA_GRD_BV_02)
                         */
                        function f_GEONW_PON_GBC_NONAREA_GRD_BV_02_nodeB() runs on ItsGeoNetworking {
                            
                            // Local variables
                            var LongPosVector v_longPosVectorNodeC := f_getPosition(c_compNodeC);
                            
                            // Preamble
                            f_prNeighbour();
                            f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                            
                            // Test Body
                            tc_ac.start;
                            alt {
                                [] a_receiveGeoBroadcastWithArea(
                                        mw_longPosVectorPosition(v_longPosVectorNodeC),
                                        ?,
                                        f_getGeoBroadcastArea(c_area2)) {
                                    tc_ac.stop;
                                    log("*** " & testcasename() & ": PASS: GBC message correctly forwarded to area center ***");
                                    f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                                }
                                [] tc_ac.timeout {
                                    log("*** " & testcasename() & ": FAIL: GBC message not received ***");
                                    f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                                }
                            }
                            
                            // Postamble
                            f_poNeighbour();
                            
                        } // end f_GEONW_PON_GBC_NONAREA_GRD_BV_02_nodeB
                        
                        /**
                         * @desc    Behavior function for NodeC (TC_GEONW_PON_GBC_NONAREA_GRD_BV_02)
                         */
                        function f_GEONW_PON_GBC_NONAREA_GRD_BV_02_nodeC() runs on ItsGeoNetworking {
                            
                            // Local variables
                            var LongPosVector v_longPosVectorNodeC := f_getPosition(c_compNodeC);
                            var GeoNetworkingInd v_msgInd;
                            
                            // Preamble
                            f_prNeighbour();
                            f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                            
                            // Test Body
                            f_sendGeoNetMessage(
                                m_geoNwReq_linkLayerBroadcast(
                                    m_geoNwPdu(
                                        m_geoNwBroadcastPacket(
                                            v_longPosVectorNodeC,
                                            vc_localSeqNumber,
                                            f_getGeoBroadcastArea(c_area2)
                                        )
berge's avatar
berge committed
                            );
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                            
                            // Postamble
                            f_poNeighbour();
                            
                        } // end f_GEONW_PON_GBC_NONAREA_GRD_BV_02_nodeC
                        
                        /**
                         * @desc    Behavior function for NodeD (TC_GEONW_PON_GBC_NONAREA_GRD_BV_02)
                         */
                        function f_GEONW_PON_GBC_NONAREA_GRD_BV_02_nodeD() runs on ItsGeoNetworking {
                            
                            // Local variables
                            var LongPosVector v_longPosVectorNodeC := f_getPosition(c_compNodeC);
                            
                            // Preamble
                            f_prNeighbour();
                            f_selfOrClientSyncAndVerdict(c_prDone, e_success);
berge's avatar
berge committed
                            
                            // Test Body
                            tc_noac.start;
                            alt {
                                [] a_receiveGeoBroadcastWithArea(
                                        mw_longPosVectorPosition(v_longPosVectorNodeC),
                                        ?,
                                        f_getGeoBroadcastArea(c_area2)) {
                                    tc_noac.stop;
                                    log("*** " & testcasename() & ": FAIL: GBC message not forwarded to area center ***");
                                    f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                                }
                                
                                [] tc_noac.timeout {
                                    log("*** " & testcasename() & ": PASS: GBC message not received ***");
                                    f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                                }
                            }
                            
                            // Postamble
                            f_poNeighbour();
                            
                        } // end f_GEONW_PON_GBC_NONAREA_GRD_BV_02_nodeD
                        
                    } // end GEONW_PON_GBC_NONAREA_GRD_BV_02
					
                    group GEONW_PON_GBC_NONAREA_GRD_BO_07 {
                        
                        /**
                         * @desc    TP Function for TC_GEONW_PON_GBC_NONAREA_GRD_BO_07
                         */
                        function f_GEONW_PON_GBC_NONAREA_GRD_BO_07() runs on ItsMtc {
                            
                            // Local variables
                            var ItsGeoNetworking v_nodeB;
                            var ItsGeoNetworking v_nodeC;
                            var ItsGeoNetworking v_nodeD;
                            var UInt16 v_sequenceNumber := f_getInitialSequenceNumber();
                            
                            // Test control
                            if (not PICS_GN_GBC_FWD) {
                                log("*** " & testcasename() & ": PICS_GN_GBC_FWD required for executing the TC ***");
                                setverdict(inconc);
                                stop;
                            }
                            if ((f_getNonAreaForwardingAlgorithm() != e_greedy) and (f_getNonAreaForwardingAlgorithm() != e_unspecified)) {
                                log("*** " & testcasename() & ": PICS_GN_NON_AREA_FORWARDING_ALGORITHM == ( e_greedy or e_unspecified ) required for executing the TC ***");
                                setverdict(inconc);
                                stop;
                            }
                            
                            // Test component configuration
                            f_cf04Up();
                            
                            // Preamble
                            
                            // Start components
                            v_nodeB := f_getComponent(c_compNodeB);
                            v_nodeC := f_getComponent(c_compNodeC);
                            v_nodeD := f_getComponent(c_compNodeD);
                            v_nodeB.start(f_GEONW_PON_GBC_NONAREA_GRD_BO_07_nodeB());
                            v_nodeC.start(f_GEONW_PON_GBC_NONAREA_GRD_BO_07_nodeC(v_sequenceNumber));
                            v_nodeD.start(f_GEONW_PON_GBC_NONAREA_GRD_BO_07_nodeD(v_sequenceNumber));
                            
                            // Synchronization
                            f_serverSync3ClientsAndStop({c_prDone, c_tbDone});
                            
                            // Cleanup
                            f_cf04Down();
                            
                        } // end f_GEONW_PON_GBC_NONAREA_GRD_BO_07
                        
                        /**
                         * @desc    Behavior function for NodeB (TC_GEONW_PON_GBC_NONAREA_GRD_BO_07)
                         */
                        function f_GEONW_PON_GBC_NONAREA_GRD_BO_07_nodeB() runs on ItsGeoNetworking {
                            
                            // Local variables
                            var LongPosVector v_longPosVectorNodeC := f_getPosition(c_compNodeC);
                            var template (present) GeoNetworkingInd v_msgInd;
                            
                            // Preamble
                            f_prNeighbour();
                            tc_ac.start;
                            alt {
                                [] geoNetworkingPort.receive(mw_geoNwInd(mw_geoNwPdu(mw_geoNwBroadcastPacketWithArea(
                                        mw_longPosVectorPosition(v_longPosVectorNodeC),
                                        ?,
                                        f_getGeoBroadcastArea(c_area2)
                                    )))) -> value v_msgInd {
                                    tc_ac.stop;
                                    log("*** " & testcasename() & ": PASS: Pre-conditions: GBC message correctly forwarded to area center ***");
                                    f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                                }
                                [] tc_ac.timeout {
                                    log("*** " & testcasename() & ": INCONC: Pre-conditions: GBC message not received ***");
                                    f_selfOrClientSyncAndVerdict(c_prDone, e_timeout);
                                }
                            }
                            
                            // Test Body
                            v_msgInd.msgIn.basicHeader.routerHopLimit := ?;
                            tc_noac.start;
                            alt {
                                [] geoNetworkingPort.receive(v_msgInd) {
                                    tc_noac.stop;
                                    log("*** " & testcasename() & ": FAIL: GBC message re-forwarded to area center ***");
                                    f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                                }
                                [] tc_noac.timeout {
                                    log("*** " & testcasename() & ": PASS: GBC message not re-forwarded ***");
                                    f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                                }
                            }
                            
                            // Postamble
                            f_poNeighbour();
                            
                        } // end f_GEONW_PON_GBC_NONAREA_GRD_BO_07_nodeB
                        
                        /**
                         * @desc    Behavior function for NodeC (TC_GEONW_PON_GBC_NONAREA_GRD_BO_07)
                         */
                        function f_GEONW_PON_GBC_NONAREA_GRD_BO_07_nodeC(in UInt16 p_sequenceNumber) runs on ItsGeoNetworking {
                            
                            // Local variables
                            var LongPosVector v_longPosVectorNodeC := f_getPosition(c_compNodeC);
                            
                            // Preamble
                            f_prNeighbour();
                            f_sendGeoNetMessage(
                                m_geoNwReq_linkLayerBroadcast(
                                    m_geoNwPdu(
                                        m_geoNwBroadcastPacket(
                                            v_longPosVectorNodeC,
                                            p_sequenceNumber,
                                            f_getGeoBroadcastArea(c_area2)
                                        ),
                                        -,
                                        c_defaultHopLimit
berge's avatar
berge committed
                            );
                            f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                            
                            // Test Body
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                            
                            // Postamble
                            f_poNeighbour();
                            
                        } // end f_GEONW_PON_GBC_NONAREA_GRD_BO_07_nodeC
                        
                        /**
                         * @desc    Behavior function for NodeD (TC_GEONW_PON_GBC_NONAREA_GRD_BO_07)
                         */
                        function f_GEONW_PON_GBC_NONAREA_GRD_BO_07_nodeD(in UInt16 p_sequenceNumber) runs on ItsGeoNetworking {
                            
                            // Local variables
                            var LongPosVector v_longPosVectorNodeC := f_getPosition(c_compNodeC);
                            
                            // Preamble
                            f_prNeighbour();
                            tc_noac.start;
                            alt {
                                [] geoNetworkingPort.receive(mw_geoNwInd(mw_geoNwPdu(mw_geoNwBroadcastPacketWithArea(
                                        mw_longPosVectorPosition(v_longPosVectorNodeC),
                                        ?,
                                        f_getGeoBroadcastArea(c_area2)
                                    )))) {
                                    tc_noac.stop;
                                    log("*** " & testcasename() & ": INCONC: Pre-conditions: GBC message not forwarded to area center ***");
                                    f_selfOrClientSyncAndVerdict(c_prDone, e_error);
                                }
                                [] tc_noac.timeout {
                                    log("*** " & testcasename() & ": PASS: Pre-conditions: GBC message not received ***");
                                    f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                                }
                            }
                            
                            // Test Body
                            // send geoBroadcast for second time (same source + same seq Nr + lower RHL)
                            f_sendGeoNetMessage(
                                m_geoNwReq_linkLayerBroadcast(
                                    m_geoNwPdu(
                                        m_geoNwBroadcastPacket(
                                            v_longPosVectorNodeC,
                                            p_sequenceNumber,
                                            f_getGeoBroadcastArea(c_area2)
                                        ),
                                        -,
                                        c_defaultHopLimit - 1
berge's avatar
berge committed
                            );
                            
                            tc_noac.start;
                            alt {
                                [] geoNetworkingPort.receive(mw_geoNwInd(mw_geoNwPdu(mw_geoNwBroadcastPacketWithArea(
                                        mw_longPosVectorPosition(v_longPosVectorNodeC),
                                        ?,
                                        f_getGeoBroadcastArea(c_area2)
                                    )))) {
                                    tc_noac.stop;
                                    log("*** " & testcasename() & ": FAIL: GBC re-forwarded! (not to area center!) ***");
                                    f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                                }
                                [] tc_noac.timeout {
                                    log("*** " & testcasename() & ": PASS: GBC message not received ***");
                                    f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                                }
                            }
                            
                            // Postamble
                            f_poNeighbour();
                            
                        } // end f_GEONW_PON_GBC_NONAREA_GRD_BO_07_nodeD
berge's avatar
berge committed
                    } // end GEONW_PON_GBC_NONAREA_GRD_BO_07					
berge's avatar
berge committed
9226 9227 9228 9229 9230 9231 9232 9233 9234 9235 9236 9237 9238 9239 9240 9241 9242 9243 9244 9245 9246 9247 9248 9249 9250 9251 9252 9253 9254 9255 9256 9257 9258 9259 9260 9261 9262 9263 9264 9265 9266 9267 9268 9269 9270 9271 9272 9273 9274 9275 9276 9277 9278 9279 9280 9281 9282 9283 9284 9285 9286 9287 9288 9289 9290 9291 9292 9293 9294 9295 9296 9297 9298 9299 9300 9301 9302 9303 9304 9305 9306 9307 9308 9309 9310 9311 9312 9313 9314 9315 9316 9317 9318 9319 9320 9321 9322 9323 9324 9325 9326 9327 9328 9329 9330 9331 9332 9333 9334 9335 9336 9337 9338 9339 9340 9341 9342 9343 9344 9345 9346 9347 9348 9349 9350 9351 9352 9353 9354 9355 9356 9357 9358 9359 9360 9361 9362 9363 9364 9365 9366 9367 9368 9369 9370 9371 9372 9373 9374 9375 9376 9377 9378 9379 9380 9381 9382 9383 9384 9385 9386 9387 9388 9389 9390 9391 9392 9393 9394 9395 9396 9397 9398 9399 9400 9401 9402 9403 9404 9405 9406 9407 9408 9409 9410 9411 9412 9413 9414 9415 9416 9417 9418 9419 9420 9421 9422 9423 9424 9425 9426 9427 9428 9429 9430 9431 9432 9433 9434 9435 9436 9437 9438 9439 9440 9441 9442 9443 9444 9445 9446 9447 9448 9449 9450 9451 9452 9453 9454 9455 9456 9457 9458 9459 9460 9461 9462 9463 9464 9465 9466 9467 9468 9469 9470 9471 9472 9473 9474 9475 9476 9477 9478 9479 9480 9481 9482 9483 9484 9485 9486 9487 9488 9489 9490 9491 9492 9493 9494 9495 9496 9497 9498 9499 9500 9501 9502 9503 9504 9505 9506 9507 9508 9509 9510 9511 9512 9513 9514 9515 9516 9517 9518 9519 9520 9521 9522 9523 9524 9525 9526 9527 9528 9529 9530 9531 9532 9533 9534 9535 9536 9537 9538 9539 9540 9541 9542 9543 9544 9545 9546 9547 9548 9549 9550 9551 9552 9553 9554 9555 9556 9557 9558 9559 9560 9561 9562 9563 9564 9565 9566 9567 9568 9569 9570 9571 9572 9573 9574 9575 9576 9577 9578 9579 9580 9581 9582 9583 9584 9585 9586 9587 9588 9589 9590 9591 9592 9593 9594 9595 9596 9597 9598 9599 9600 9601 9602 9603 9604 9605 9606 9607 9608 9609 9610 9611 9612 9613 9614 9615 9616 9617 9618 9619 9620 9621 9622 9623 9624 9625 9626 9627 9628 9629 9630 9631 9632 9633 9634 9635 9636 9637 9638 9639 9640 9641 9642 9643 9644 9645 9646 9647 9648 9649 9650 9651 9652 9653 9654 9655 9656 9657 9658 9659 9660 9661 9662 9663 9664 9665 9666 9667 9668 9669 9670 9671 9672 9673 9674 9675 9676 9677 9678 9679 9680 9681 9682 9683 9684 9685 9686 9687 9688 9689 9690 9691 9692 9693 9694 9695 9696 9697 9698 9699 9700 9701 9702 9703 9704 9705 9706 9707 9708 9709 9710 9711 9712 9713 9714 9715 9716 9717 9718 9719 9720 9721 9722 9723 9724 9725 9726 9727 9728 9729 9730 9731 9732 9733 9734 9735 9736 9737 9738 9739 9740 9741 9742 9743 9744 9745 9746 9747 9748 9749 9750 9751 9752 9753 9754 9755 9756 9757 9758 9759 9760 9761 9762 9763 9764 9765 9766 9767 9768 9769 9770 9771 9772 9773 9774 9775 9776 9777 9778 9779 9780 9781 9782 9783 9784 9785 9786 9787 9788 9789 9790 9791 9792 9793 9794 9795 9796 9797 9798 9799 9800 9801 9802 9803 9804 9805 9806 9807 9808 9809 9810 9811 9812 9813 9814 9815 9816 9817 9818 9819 9820 9821 9822 9823 9824 9825 9826 9827 9828 9829 9830 9831 9832 9833 9834 9835 9836 9837 9838 9839 9840 9841 9842 9843 9844 9845 9846 9847 9848 9849 9850 9851 9852 9853 9854 9855 9856 9857 9858 9859 9860 9861 9862 9863 9864
				} // end gbcNonAreaGreedyForwarding

				group gbcNonAreaContentionBasedForwarding {

                    group GEONW_PON_GBC_NONAREA_CBF_BV_01 {
                        
                        /**
                         * @desc    TP Function for TC_GEONW_PON_GBC_NONAREA_CBF_BV_01
                         */
                        function f_GEONW_PON_GBC_NONAREA_CBF_BV_01() runs on ItsMtc {
                            
                            // Local variables
                            var ItsGeoNetworking v_nodeB;
                            var ItsGeoNetworking v_nodeD;
                            
                            // Test control
                            if (not PICS_GN_GBC_SRC) {
                                log("*** " & testcasename() & ": PICS_GN_GBC_SRC required for executing the TC ***");
                                setverdict(inconc);
                                stop;
                            }
                            if ((f_getNonAreaForwardingAlgorithm() != e_cbf)) {
                                log("*** " & testcasename() & ": PICS_GN_NON_AREA_FORWARDING_ALGORITHM == ( e_cbf ) required for executing the TC ***");
                                setverdict(inconc);
                                stop;
                            }
                            
                            // 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_GBC_NONAREA_CBF_BV_01_nodeB());
                            v_nodeD.start(f_GEONW_PON_GBC_NONAREA_CBF_BV_01_nodeD());
                            
                            // Synchronization
                            f_serverSync2ClientsAndStop({c_prDone, c_tbDone});
                            
                            // Cleanup
                            f_cf02Down();
                            
                        } // end f_GEONW_PON_GBC_NONAREA_CBF_BV_01
                        
                        /**
                         * @desc    Behavior function for NodeB (TC_GEONW_PON_GBC_NONAREA_CBF_BV_01)
                         */
                        function f_GEONW_PON_GBC_NONAREA_CBF_BV_01_nodeB() runs on ItsGeoNetworking {
                            
                            // Local variables
                            var LongPosVector v_longPosVectorIut := f_getPosition(c_compIut);
                            
                            // Preamble
                            f_prNeighbour();
                            f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                            
                            // Test Body
                            if ( not f_utTriggerEvent(m_generateGeoBroadcastMessage(f_getArea(c_area2))) ) {
                                log("*** " & testcasename() & ": INCONC: Trigger failed ***");
                                f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
                            }
                            
                            tc_ac.start;
                            alt {
                                [] a_receiveGeoBroadcastWithArea(
                                        mw_longPosVectorPosition(v_longPosVectorIut),
                                        ?,
                                        f_getGeoBroadcastArea(c_area2)) {
                                    tc_ac.stop;
                                    log("*** " & testcasename() & ": PASS: GBC message received correctly ***");
                                    f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                                }
                                [] tc_ac.timeout {
                                    log("*** " & testcasename() & ": FAIL: GBC message not received ***");
                                    f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                                }
                            }
                            
                            // Postamble
                            f_poNeighbour();
                            
                        } // end f_GEONW_PON_GBC_NONAREA_CBF_BV_01_nodeB
                        
                        /**
                         * @desc    Behavior function for NodeD (TC_GEONW_PON_GBC_NONAREA_CBF_BV_01)
                         */
                        function f_GEONW_PON_GBC_NONAREA_CBF_BV_01_nodeD() runs on ItsGeoNetworking {
                            
                            // Local variables
                            var LongPosVector v_longPosVectorIut := f_getPosition(c_compIut);
                            
                            // Preamble
                            f_prNeighbour();
                            f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                            
                            // Test Body
                            tc_ac.start;
                            alt {
                                [] a_receiveGeoBroadcastWithArea(
                                        mw_longPosVectorPosition(v_longPosVectorIut),
                                        ?,
                                        f_getGeoBroadcastArea(c_area2)) {
                                    tc_ac.stop;
                                    log("*** " & testcasename() & ": PASS: GBC message received correctly ***");
                                    f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                                }
                                [] tc_ac.timeout {
                                    log("*** " & testcasename() & ": FAIL: GBC message not received ***");
                                    f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                                }
                            }
                            
                            // Postamble
                            f_poNeighbour();
                            
                        } // end f_GEONW_PON_GBC_NONAREA_CBF_BV_01_nodeD
                        
                    } // end GEONW_PON_GBC_NONAREA_CBF_BV_01

					group GEONW_PON_GBC_NONAREA_CBF_BV_02 {
                        
						/**
						 * @desc    TP Function for TC_GEONW_PON_GBC_NONAREA_CBF_BV_02
						 */
						function f_GEONW_PON_GBC_NONAREA_CBF_BV_02() runs on ItsMtc {
                            
							// Local variables
							var ItsGeoNetworking v_nodeB;
							var ItsGeoNetworking v_nodeC;
							var ItsGeoNetworking v_nodeD;
                            
							// Test control
							if (not PICS_GN_GBC_FWD) {
								log("*** " & testcasename() & ": PICS_GN_GBC_FWD required for executing the TC ***");
								setverdict(inconc);
								stop;
							}
							if (f_getNonAreaForwardingAlgorithm() != e_cbf) {
								log("*** " & testcasename() & ": PICS_GN_NON_AREA_FORWARDING_ALGORITHM == e_cbf required for executing the TC ***");
								setverdict(inconc);
								stop;
							}
                            
		//                    if (f_getCbfMinTime() < 300) {
		//                        log("*** " & testcasename() & ": PICS_GN_GEOBROADCAST_CBF_MIN_TIME >= 300 required for executing the TC ***");
		//                        setverdict(inconc);
		//                        stop;
		//                    }
                            
							// Test component configuration
							f_cf04Up();
                            
							// Preamble
                            
							// Start components
							v_nodeB := f_getComponent(c_compNodeB);
							v_nodeC := f_getComponent(c_compNodeC);
							v_nodeD := f_getComponent(c_compNodeD);
							v_nodeB.start(f_GEONW_PON_GBC_NONAREA_CBF_BV_02_nodeB());
							v_nodeC.start(f_GEONW_PON_GBC_NONAREA_CBF_BV_02_nodeC());
							v_nodeD.start(f_GEONW_PON_GBC_NONAREA_CBF_BV_02_nodeD());
                            
							// Synchronization
							f_serverSync3ClientsAndStop({c_prDone, c_tbDone});
                            
							// Cleanup
							f_cf04Down();
                            
						} // end f_GEONW_PON_GBC_NONAREA_CBF_BV_02
                        
						/**
						 * @desc    Behavior function for NodeB (TC_GEONW_PON_GBC_NONAREA_CBF_BV_02)
						 */
						function f_GEONW_PON_GBC_NONAREA_CBF_BV_02_nodeB() runs on ItsGeoNetworking {
                            
							// Local variables
							var LongPosVector v_longPosVectorNodeC := f_getPosition(c_compNodeC);
                            
							// 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_longPosVectorNodeC),
										?,
										f_getGeoBroadcastArea(c_area2)
									)))) {
									tc_ac.stop;
									log("*** " & testcasename() & ": PASS: GBC message broadcasted ***");
									f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
								}
								[] tc_ac.timeout {
									log("*** " & testcasename() & ": FAIL: GBC message not broadcasted ***");
									f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
								}
							}
                            
							// Postamble
							f_poNeighbour();
                            
						} // end f_GEONW_PON_GBC_NONAREA_CBF_BV_02_nodeB
                        
						/**
						 * @desc    Behavior function for NodeC (TC_GEONW_PON_GBC_NONAREA_CBF_BV_02)
						 */
						function f_GEONW_PON_GBC_NONAREA_CBF_BV_02_nodeC() runs on ItsGeoNetworking {
                            
							// Local variables
							var LongPosVector v_longPosVectorNodeC := f_getPosition(c_compNodeC);
							var LongPosVector v_longPosVectorIut := f_getPosition(c_compIut);
							timer t_toCbf := (int2float(f_getCbfMaxTime())
								+ (
									int2float(f_getCbfMinTime() - f_getCbfMaxTime())
									/ int2float(f_getCbfMaxCommunicationRange())
								) * f_distance(v_longPosVectorNodeC, v_longPosVectorIut)) * 0.95 / 1000.0;
                            
							// Preamble
							f_prNeighbour();
							f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                            
							// Test Body
							f_sendGeoNetMessage(
								m_geoNwReq_linkLayerBroadcast(
									m_geoNwPdu(
										m_geoNwBroadcastPacket(
											v_longPosVectorNodeC,
											vc_localSeqNumber,
											f_getGeoBroadcastArea(c_area2)
										)
									)
								)
							);
                            
							t_toCbf.start;                    
							tc_ac.start;
							alt {
								[] geoNetworkingPort.receive(mw_geoNwInd(mw_geoNwPdu(mw_geoNwBroadcastPacketWithArea(
										mw_longPosVectorPosition(v_longPosVectorNodeC),
										?,
										f_getGeoBroadcastArea(c_area2)
									)))) {
									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);
									}
									else {
										log("*** " & testcasename() & ": PASS: GBC message received ***");
										f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
									}
								}
								[] t_toCbf.timeout {
									log("*** " & testcasename() & ": INFO: CBF timer elapsed ***");
									repeat;
								}
								[] tc_ac.timeout {
									log("*** " & testcasename() & ": FAIL: GBC message not received ***");
									f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
								}
							}
                            
							// Postamble
							f_poNeighbour();
                            
						} // end f_GEONW_PON_GBC_NONAREA_CBF_BV_02_nodeC
                        
						/**
						 * @desc    Behavior function for NodeD (TC_GEONW_PON_GBC_NONAREA_CBF_BV_02)
						 */
						function f_GEONW_PON_GBC_NONAREA_CBF_BV_02_nodeD() runs on ItsGeoNetworking {
                            
							// Local variables
							var LongPosVector v_longPosVectorNodeC := f_getPosition(c_compNodeC);
                            
							// 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_longPosVectorNodeC),
										?,
										f_getGeoBroadcastArea(c_area2)
									)))) {
									tc_ac.stop;
									log("*** " & testcasename() & ": PASS: GBC message broadcasted ***");
									f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
								}
								[] tc_ac.timeout {
									log("*** " & testcasename() & ": FAIL: GBC message not broadcasted ***");
									f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
								}
							}
                            
							// Postamble
							f_poNeighbour();
                            
						} // end f_GEONW_PON_GBC_NONAREA_CBF_BV_02_nodeD
                        
					} // end GEONW_PON_GBC_NONAREA_CBF_BV_02

					group GEONW_PON_GBC_NONAREA_CBF_BV_07 {
                        
						/**
						 * @desc    TP Function for TC_GEONW_PON_GBC_NONAREA_CBF_BV_07
						 */
						function f_GEONW_PON_GBC_NONAREA_CBF_BV_07() runs on ItsMtc {
                            
							// Local variables
							var ItsGeoNetworking v_nodeB;
							var ItsGeoNetworking v_nodeC;
							var ItsGeoNetworking v_nodeD;
							var UInt16 v_sequenceNumberC := f_getInitialSequenceNumber();
                            
							// Test control
							if (not PICS_GN_GBC_FWD) {
								log("*** " & testcasename() & ": PICS_GN_GBC_FWD required for executing the TC ***");
								setverdict(inconc);
								stop;
							}
							if (f_getNonAreaForwardingAlgorithm() != e_cbf) {
								log("*** " & testcasename() & ": PICS_GN_NON_AREA_FORWARDING_ALGORITHM == e_cbf required for executing the TC ***");
								setverdict(inconc);
								stop;
							}
                            
		//                    if (f_getCbfMinTime() < 300) {
		//                        log("*** " & testcasename() & ": PICS_GN_GEOBROADCAST_CBF_MIN_TIME >= 300 required for executing the TC ***");
		//                        setverdict(inconc);
		//                        stop;
		//                    }
                                                
							// Test component configuration
							f_cf04Up();
                            
							// Preamble
                            
							// Start components
							v_nodeB := f_getComponent(c_compNodeB);
							v_nodeC := f_getComponent(c_compNodeC);
							v_nodeD := f_getComponent(c_compNodeD);
							v_nodeB.start(f_GEONW_PON_GBC_NONAREA_CBF_BV_07_nodeB());
							v_nodeC.start(f_GEONW_PON_GBC_NONAREA_CBF_BV_07_nodeC(v_sequenceNumberC));
							v_nodeD.start(f_GEONW_PON_GBC_NONAREA_CBF_BV_07_nodeD(v_sequenceNumberC));
                            
							// Synchronization
							f_serverSync3ClientsAndStop({c_prDone, c_tbDone});
                            
							// Cleanup
							f_cf04Down();
                            
						} // end f_GEONW_PON_GBC_NONAREA_CBF_BV_07
                        
						/**
						 * @desc    Behavior function for NodeB (TC_GEONW_PON_GBC_NONAREA_CBF_BV_07)
						 */
						function f_GEONW_PON_GBC_NONAREA_CBF_BV_07_nodeB() runs on ItsGeoNetworking {
                            
							// Local variables
							var LongPosVector v_longPosVectorNodeC := f_getPosition(c_compNodeC);
                            
							// Preamble
							f_prNeighbour();
							f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                            
							// Test Body
							tc_noac.start;
							alt {
								[] geoNetworkingPort.receive(mw_geoNwInd(mw_geoNwPdu(mw_geoNwBroadcastPacketWithArea(
										mw_longPosVectorPosition(v_longPosVectorNodeC),
										?,
										f_getGeoBroadcastArea(c_area2)
									)))) {
									tc_noac.stop;
									log("*** " & testcasename() & ": FAIL: GBC message re-broadcasted ***");
									f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
								}
								[] tc_noac.timeout {
									log("*** " & testcasename() & ": PASS: GBC message not re-broadcasted ***");
									f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
								}
							}
                            
							// Postamble
							f_poNeighbour();
                            
						} // end f_GEONW_PON_GBC_NONAREA_CBF_BV_07_nodeB
                        
						/**
						 * @desc    Behavior function for NodeC (TC_GEONW_PON_GBC_NONAREA_CBF_BV_07)
						 */
						function f_GEONW_PON_GBC_NONAREA_CBF_BV_07_nodeC(in UInt16 p_sequenceNumberC) runs on ItsGeoNetworking {
                            
							// Local variables
							var LongPosVector v_longPosVectorNodeC := f_getPosition(c_compNodeC);
                            
							// Preamble
							f_prNeighbour();
							f_sendGeoNetMessage(
								m_geoNwReq_linkLayerBroadcast(
									m_geoNwPdu(
										m_geoNwBroadcastPacket(
											v_longPosVectorNodeC,
											p_sequenceNumberC,
											f_getGeoBroadcastArea(c_area2)
										)
									)
								)
							);
							f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                            
							// Test Body
							tc_noac.start;
							alt {
								[] geoNetworkingPort.receive(mw_geoNwInd(mw_geoNwPdu(mw_geoNwBroadcastPacketWithArea(
										mw_longPosVectorPosition(v_longPosVectorNodeC),
										?,
										f_getGeoBroadcastArea(c_area2)
									)))) {
									tc_noac.stop;
									log("*** " & testcasename() & ": FAIL: GBC message re-broadcasted ***");
									f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
								}
								[] tc_noac.timeout {
									log("*** " & testcasename() & ": PASS: GBC message not re-broadcasted ***");
									f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
								}
							}
                            
							// Postamble
							f_poNeighbour();
                            
						} // end f_GEONW_PON_GBC_NONAREA_CBF_BV_07_nodeC
                        
						/**
						 * @desc    Behavior function for NodeD (TC_GEONW_PON_GBC_NONAREA_CBF_BV_07)
						 */
						function f_GEONW_PON_GBC_NONAREA_CBF_BV_07_nodeD(in UInt16 p_sequenceNumberC) runs on ItsGeoNetworking {
                            
							// Local variables
							var LongPosVector v_longPosVectorNodeC := f_getPosition(c_compNodeC);
                            
							// Preamble
							f_prNeighbour();
							f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                            
							// Test Body
							f_sendGeoNetMessage(
								m_geoNwReq_linkLayerBroadcast(
									m_geoNwPdu(
										m_geoNwBroadcastPacket(
											v_longPosVectorNodeC,
											p_sequenceNumberC,
											f_getGeoBroadcastArea(c_area2)
										)
									)
								)
							);
                            
							tc_noac.start;
							alt {
								[] geoNetworkingPort.receive(mw_geoNwInd(mw_geoNwPdu(mw_geoNwBroadcastPacketWithArea(
										mw_longPosVectorPosition(v_longPosVectorNodeC),
										?,
										f_getGeoBroadcastArea(c_area2)
									)))) {
									tc_noac.stop;
									log("*** " & testcasename() & ": FAIL: GBC message re-broadcasted ***");
									f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
								}
								[] tc_noac.timeout {
									log("*** " & testcasename() & ": PASS: GBC message not re-broadcasted ***");
									f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
								}
							}
                            
							// Postamble
							f_poNeighbour();
                            
						} // end f_GEONW_PON_GBC_NONAREA_CBF_BV_071_nodeD
                        
					} // end GEONW_PON_GBC_NONAREA_CBF_BV_07
					
                    group GEONW_PON_GBC_NONAREA_CBF_BV_20 {
                
						/**
						 * @desc    TP Function for TC_GEONW_PON_GBC_NONAREA_CBF_BV_20
						 */
						function f_GEONW_PON_GBC_NONAREA_CBF_BV_20() runs on ItsMtc {
                    
							// Local variables
							var ItsGeoNetworking v_nodeB;
							var ItsGeoNetworking v_nodeC;
							var float v_distance := int2float(f_getCbfMaxCommunicationRange() * 2);
							var LongPosVector v_longPosVectorIut, v_longPosVectorNodeC;
                    
							// Test control
							if (not PICS_GN_GBC_FWD) {
								log("*** " & testcasename() & ": PICS_GN_GUC_FWD required for executing the TC ***");
								setverdict(inconc);
								stop;
							}
							if (f_getNonAreaForwardingAlgorithm() != e_cbf) {
								log("*** " & testcasename() & ": PICS_GN_NON_AREA_FORWARDING_ALGORITHM == e_cbf required for executing the TC ***");
								setverdict(inconc);
								stop;
							}
                    
							// Test component configuration
							f_cf03Up();
							// re-compute NodeC's position.
							v_longPosVectorIut := f_getIutLongPosVector();
							v_longPosVectorNodeC := f_computePositionUsingDistance(v_longPosVectorIut, v_distance, 180);
							v_longPosVectorNodeC.gnAddr := f_getTsGnLocalAddress(c_compNodeC);
                    
							// Preamble
                    
							// Start components
							v_nodeB := f_getComponent(c_compNodeB);
							v_nodeC := f_getComponent(c_compNodeC);
							v_nodeB.start(f_GEONW_PON_GBC_NONAREA_CBF_BV_20_nodeB(v_longPosVectorNodeC));
							v_nodeC.start(f_GEONW_PON_GBC_NONAREA_CBF_BV_20_nodeC(v_longPosVectorNodeC));
                    
							// Synchronization
							f_serverSync2ClientsAndStop({c_prDone, c_msgSent, c_tbDone});
                    
							// Cleanup
							f_cf03Down();
                    
						} // end f_GEONW_PON_GBC_NONAREA_CBF_BV_20
                
						/**
						 * @desc    Behavior function for NodeB (TC_GEONW_PON_GBC_NONAREA_CBF_BV_20)
						 * @param   p_longPosVectorNodeC    Position vector of NodeC
						 */
						function f_GEONW_PON_GBC_NONAREA_CBF_BV_20_nodeB(in LongPosVector p_longPosVectorNodeC) runs on ItsGeoNetworking {
                    
							// Local variables
							timer t_toCbf := int2float(f_getCbfMinTime()) / 1000.0;
                    
							// Preamble
							f_prNeighbour();
							f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                    
							// Test Body
							log("*** " & testcasename() & ": INFO: Message sent ***");
							f_selfOrClientSyncAndVerdict(c_msgSent, e_success);
                    
							tc_ac.start;
							t_toCbf.start;
							alt {
								[] geoNetworkingPort.receive(mw_geoNwInd(mw_geoNwPdu(mw_geoNwBroadcastPacketWithArea(
        								mw_longPosVectorPosition(p_longPosVectorNodeC),
        								?,
        								f_getGeoBroadcastArea(c_area2)
    							    )))) {
									tc_ac.stop;
									if(t_toCbf.running) {
										t_toCbf.stop;
										log("*** " & testcasename() & ": FAIL: IUT re-broadcasted the packet too early ***");
										f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
									}
									else {
										log("*** " & testcasename() & ": PASS: Forwarded GUC received ***");
										f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
									}
								}
								[] t_toCbf.timeout {
									log("*** " & testcasename() & ": INFO: Ready for receiving re-broadcasting ***");
									repeat;
								}
                        
								[] tc_ac.timeout {
									log("*** " & testcasename() & ": FAIL: GUC was not forwarded ***");
									f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
								}
							}
                    
							// Postamble
							f_poNeighbour();
                    
						} // end f_GEONW_PON_GBC_NONAREA_CBF_BV_20_nodeB
                
						/**
						 * @desc    Behavior function for NodeC (TC_GEONW_PON_GBC_NONAREA_CBF_BV_20)
						 * @param   p_longPosVectorNodeC    Position vector of NodeC
						 */
						function f_GEONW_PON_GBC_NONAREA_CBF_BV_20_nodeC(LongPosVector p_longPosVectorNodeC) runs on ItsGeoNetworking {
                    
							// Local variables
                    
							// Preamble
							f_prNeighbour();
							f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                    
							// Test Body
							f_sendGeoNetMessage(
								m_geoNwReq_linkLayerBroadcast(
									m_geoNwPdu(
										m_geoNwBroadcastPacket(
											p_longPosVectorNodeC,
							                vc_localSeqNumber,
											f_getGeoBroadcastArea(c_area2)
										)
									)
								)
							);
							
							log("*** " & testcasename() & ": INFO: Message sent ***");
							f_selfOrClientSyncAndVerdict(c_msgSent, e_success);
                    
							tc_ac.start;
							alt {
								[] geoNetworkingPort.receive(mw_geoNwInd(mw_geoNwPdu(mw_geoNwBroadcastPacketWithArea(
										mw_longPosVectorPosition(p_longPosVectorNodeC),
										?,
										f_getGeoBroadcastArea(c_area2)
									)))) {
									tc_ac.stop;
									log("*** " & testcasename() & ": PASS: Forwarded GUC received ***");
									f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
								}
								[] tc_ac.timeout {
									log("*** " & testcasename() & ": FAIL: GUC was not forwarded ***");
									f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
								}
							}
                      
							// Postamble
							f_poNeighbour();
berge's avatar
berge committed
						} // end f_GEONW_PON_GBC_NONAREA_CBF_BV_20_nodeC

                    } // end GEONW_PON_GBC_NONAREA_CBF_BV_20	

                    group GEONW_PON_GBC_NONAREA_CBF_BV_21 {
                        
                        /**
                         * @desc    TP Function for TC_GEONW_PON_GBC_NONAREA_CBF_BV_21
                         */
                        function f_GEONW_PON_GBC_NONAREA_CBF_BV_21() runs on ItsMtc {
                            
                            // Local variables
                            var ItsGeoNetworking v_nodeB;
                            var ItsGeoNetworking v_nodeC;
                            var ItsGeoNetworking v_nodeD;
                            
                            // Test control
                            if (not PICS_GN_GBC_FWD) {
                                log("*** " & testcasename() & ": PICS_GN_GBC_FWD required for executing the TC ***");
                                setverdict(inconc);
                                stop;
                            }
                            if (f_getNonAreaForwardingAlgorithm() != e_cbf) {
                                log("*** " & testcasename() & ": PICS_GN_NON_AREA_FORWARDING_ALGORITHM == e_cbf required for executing the TC ***");
                                setverdict(inconc);
                                stop;
                            }
                            
        //                    if (f_getCbfMinTime() < 300) {
        //                        log("*** " & testcasename() & ": PICS_GN_GEOBROADCAST_CBF_MIN_TIME >= 300 required for executing the TC ***");
        //                        setverdict(inconc);
        //                        stop;
        //                    }
                            
                            // Test component configuration
                            f_cf04Up();
                            
                            // Preamble
                            
                            // Start components
                            v_nodeB := f_getComponent(c_compNodeB);
                            v_nodeC := f_getComponent(c_compNodeC);
                            v_nodeD := f_getComponent(c_compNodeD);
                            v_nodeB.start(f_GEONW_PON_GBC_NONAREA_CBF_BV_21_nodeB());
                            v_nodeC.start(f_GEONW_PON_GBC_NONAREA_CBF_BV_21_nodeC());
                            v_nodeD.start(f_GEONW_PON_GBC_NONAREA_CBF_BV_21_nodeD());
                            
                            // Synchronization
                            f_serverSync3ClientsAndStop({c_prDone, c_tbDone});
                            
                            // Cleanup
                            f_cf04Down();
                            
                        } // end f_GEONW_PON_GBC_NONAREA_CBF_BV_21
                        
                        /**
                         * @desc    Behavior function for NodeB (TC_GEONW_PON_GBC_NONAREA_CBF_BV_21)
                         */
                        function f_GEONW_PON_GBC_NONAREA_CBF_BV_21_nodeB() runs on ItsGeoNetworking {
                            
                            // Local variables
                            var LongPosVector v_longPosVectorNodeC := f_getPosition(c_compNodeC);
                            
                            // 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_longPosVectorNodeC),
                                        ?,
                                        f_getGeoBroadcastArea(c_area2)
                                    )))) {
                                    tc_ac.stop;
                                    log("*** " & testcasename() & ": PASS: GBC broadcasted ***");
                                    f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                                }
                                [] tc_ac.timeout {
                                    log("*** " & testcasename() & ": FAIL: GBC not broadcasted ***");
                                    f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                                }
                            }
                            
                            // Postamble
                            f_poNeighbour();
                            
                        } // end f_GEONW_PON_GBC_NONAREA_CBF_BV_21_nodeB
                        
                        /**
                         * @desc    Behavior function for NodeC (TC_GEONW_PON_GBC_NONAREA_CBF_BV_21)
                         */
                        function f_GEONW_PON_GBC_NONAREA_CBF_BV_21_nodeC() runs on ItsGeoNetworking {
                            
                            // Local variables
                            
                            // Preamble
                            f_prNeighbour();
                            f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                            
                            // Test Body                    
                            tc_ac.start;
                            alt {
                                [] geoNetworkingPort.receive(mw_geoNwInd(mw_geoNwPdu(?))) {
                                    tc_ac.stop;
                                    log("*** " & testcasename() & ": PASS: GBC message re-broadcasted ***");
                                    f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                                }
                                [] tc_ac.timeout {
                                    log("*** " & testcasename() & ": FAIL: GBC message not re-broadcasted ***");
                                    f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                                }
                            }
                            
                            // Postamble
                            f_poNeighbour();
                            
                        } // end f_GEONW_PON_GBC_NONAREA_CBF_BV_21_nodeC
                        
                        /**
                         * @desc    Behavior function for NodeD (TC_GEONW_PON_GBC_NONAREA_CBF_BV_21)
                         */
                        function f_GEONW_PON_GBC_NONAREA_CBF_BV_21_nodeD() runs on ItsGeoNetworking {
                            
                            // Local variables
                            var LongPosVector v_longPosVectorNodeC := f_getPosition(c_compNodeC);
							timer t_toCbf := int2float(f_getCbfMaxTime()) * 0.95 / 1000.0;
                            
                            // Preamble
                            f_prNonNeighbour();
                            f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                            
                            // Test Body
                            f_sendGeoNetMessage(
                                m_geoNwReq_linkLayerBroadcast(
                                    m_geoNwPdu(
                                        m_geoNwBroadcastPacket(
                                            v_longPosVectorNodeC,
                                            vc_localSeqNumber,
                                            f_getGeoBroadcastArea(c_area2)
                                        )
                                    )
                                )
                            );
                            
							t_toCbf.start;                    
							tc_ac.start;
							alt {
								[] geoNetworkingPort.receive(mw_geoNwInd(mw_geoNwPdu(mw_geoNwBroadcastPacketWithArea(
										mw_longPosVectorPosition(v_longPosVectorNodeC),
										?,
										f_getGeoBroadcastArea(c_area2)
									)))) {
									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);
									}
									else {
										log("*** " & testcasename() & ": PASS: GBC message received ***");
										f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
									}
								}
								[] t_toCbf.timeout {
									log("*** " & testcasename() & ": INFO: CBF timer elapsed ***");
									repeat;
								}
								[] tc_ac.timeout {
									log("*** " & testcasename() & ": FAIL: GBC message not received ***");
									f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
								}
							}
                            
                            // Postamble
                            f_poDefault();
                            
                        } // end f_GEONW_PON_GBC_NONAREA_CBF_BV_21_nodeD
                        
                    } // end GEONW_PON_GBC_NONAREA_CBF_BV_21
berge's avatar
berge committed
10049 10050 10051 10052 10053 10054 10055 10056 10057 10058 10059 10060 10061 10062 10063 10064 10065 10066 10067 10068 10069 10070 10071 10072 10073 10074 10075 10076 10077 10078 10079 10080 10081 10082 10083 10084 10085 10086 10087 10088 10089 10090 10091 10092 10093 10094 10095 10096 10097 10098 10099 10100 10101 10102 10103 10104 10105 10106 10107 10108 10109 10110 10111 10112 10113 10114 10115 10116 10117 10118 10119 10120 10121 10122 10123 10124 10125 10126 10127 10128 10129 10130 10131 10132 10133 10134 10135 10136 10137 10138 10139 10140 10141 10142 10143 10144 10145 10146 10147 10148 10149 10150 10151 10152 10153 10154 10155 10156 10157 10158 10159 10160 10161 10162 10163 10164 10165 10166 10167 10168 10169 10170 10171 10172 10173 10174 10175 10176 10177 10178 10179 10180 10181 10182 10183 10184 10185 10186 10187 10188 10189 10190 10191 10192 10193 10194 10195 10196 10197 10198 10199 10200 10201 10202 10203 10204 10205 10206 10207 10208 10209 10210 10211 10212 10213 10214 10215 10216 10217 10218 10219 10220 10221 10222 10223 10224 10225 10226 10227 10228 10229 10230 10231 10232 10233 10234 10235 10236 10237 10238 10239 10240 10241 10242 10243 10244 10245 10246 10247 10248 10249 10250 10251 10252 10253 10254 10255 10256 10257 10258 10259 10260 10261 10262 10263 10264 10265 10266 10267 10268 10269 10270 10271 10272 10273 10274 10275 10276 10277 10278 10279 10280 10281 10282 10283 10284 10285 10286 10287 10288 10289 10290 10291 10292 10293 10294 10295 10296 10297 10298 10299 10300 10301 10302 10303 10304 10305 10306 10307 10308 10309 10310 10311 10312 10313 10314 10315 10316 10317 10318 10319 10320 10321 10322 10323 10324 10325 10326 10327 10328 10329 10330 10331 10332 10333 10334 10335 10336 10337 10338 10339 10340 10341 10342 10343 10344 10345 10346 10347 10348 10349 10350 10351 10352 10353 10354 10355 10356 10357 10358 10359 10360 10361 10362 10363 10364 10365 10366 10367 10368 10369 10370 10371 10372 10373 10374 10375 10376 10377 10378 10379 10380 10381 10382 10383 10384 10385 10386 10387 10388 10389 10390 10391 10392 10393 10394 10395 10396 10397 10398 10399 10400 10401 10402 10403 10404 10405 10406 10407 10408 10409 10410 10411 10412 10413 10414 10415 10416 10417 10418 10419 10420 10421 10422 10423 10424 10425 10426 10427 10428 10429 10430 10431 10432 10433 10434 10435 10436 10437 10438 10439 10440 10441 10442 10443 10444 10445 10446 10447 10448 10449 10450 10451 10452 10453 10454 10455 10456 10457 10458 10459 10460 10461 10462 10463 10464 10465 10466 10467 10468 10469 10470 10471 10472 10473 10474 10475 10476 10477 10478 10479 10480 10481 10482 10483 10484 10485 10486 10487 10488 10489 10490 10491
                    group GEONW_PON_GBC_NONAREA_CBF_BV_22 {
                        
                        /**
                         * @desc    TP Function for TC_GEONW_PON_GBC_NONAREA_CBF_BV_22
                         */
                        function f_GEONW_PON_GBC_NONAREA_CBF_BV_22() runs on ItsMtc {
                            
                            // Local variables
                            var ItsGeoNetworking v_nodeB;
                            var ItsGeoNetworking v_nodeC;
                            var ItsGeoNetworking v_nodeD;
                            
                            // Test control
                            if (not PICS_GN_GBC_FWD) {
                                log("*** " & testcasename() & ": PICS_GN_GBC_FWD required for executing the TC ***");
                                setverdict(inconc);
                                stop;
                            }
                            if (f_getNonAreaForwardingAlgorithm() != e_cbf) {
                                log("*** " & testcasename() & ": PICS_GN_NON_AREA_FORWARDING_ALGORITHM == e_cbf required for executing the TC ***");
                                setverdict(inconc);
                                stop;
                            }
                            
        //                    if (f_getCbfMinTime() < 300) {
        //                        log("*** " & testcasename() & ": PICS_GN_GEOBROADCAST_CBF_MIN_TIME >= 300 required for executing the TC ***");
        //                        setverdict(inconc);
        //                        stop;
        //                    }
                            
                            // Test component configuration
                            f_cf04Up();
                            
                            // Preamble
                            
                            // Start components
                            v_nodeB := f_getComponent(c_compNodeB);
                            v_nodeC := f_getComponent(c_compNodeC);
                            v_nodeD := f_getComponent(c_compNodeD);
                            v_nodeB.start(f_GEONW_PON_GBC_NONAREA_CBF_BV_22_nodeB());
                            v_nodeC.start(f_GEONW_PON_GBC_NONAREA_CBF_BV_22_nodeC());
                            v_nodeD.start(f_GEONW_PON_GBC_NONAREA_CBF_BV_22_nodeD());
                            
                            // Synchronization
                            f_serverSync3ClientsAndStop({c_prDone, c_tbDone});
                            
                            // Cleanup
                            f_cf04Down();
                            
                        } // end f_GEONW_PON_GBC_NONAREA_CBF_BV_22
                        
                        /**
                         * @desc    Behavior function for NodeB (TC_GEONW_PON_GBC_NONAREA_CBF_BV_22)
                         */
                        function f_GEONW_PON_GBC_NONAREA_CBF_BV_22_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_area2)
                                    )))) {
                                    tc_ac.stop;
                                    log("*** " & testcasename() & ": PASS: GBC broadcasted ***");
                                    f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                                }
                                [] tc_ac.timeout {
                                    log("*** " & testcasename() & ": FAIL: GBC not broadcasted ***");
                                    f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                                }
                            }
                            
                            // Postamble
                            f_poNeighbour();
                            
                        } // end f_GEONW_PON_GBC_NONAREA_CBF_BV_22_nodeB
                        
                        /**
                         * @desc    Behavior function for NodeC (TC_GEONW_PON_GBC_NONAREA_CBF_BV_22)
                         */
                        function f_GEONW_PON_GBC_NONAREA_CBF_BV_22_nodeC() runs on ItsGeoNetworking {
                            
                            // Local variables
                            var LongPosVector v_longPosVectorNodeC := f_getPosition(c_compNodeC);
                            var LongPosVector v_longPosVectorNodeA := f_getPosition(c_compNodeA);
							timer t_toCbf := int2float(f_getCbfMaxTime()) * 0.95 / 1000.0;
							
                            // Preamble
                            v_longPosVectorNodeC.pai := int2bit(0,1);
                            f_changePositon(c_compNodeC, v_longPosVectorNodeC); 
                            f_prNeighbour();
                            f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                            
                            // Test Body 
                            f_sendGeoNetMessage(
                                m_geoNwReq_linkLayerBroadcast(
                                    m_geoNwPdu(
                                        m_geoNwBroadcastPacket(
                                            v_longPosVectorNodeA,
                                            vc_localSeqNumber,
                                            f_getGeoBroadcastArea(c_area2)
                                        )
                                    )
                                )
                            );                   
                            
							t_toCbf.start;                    
							tc_ac.start;
							alt {
								[] geoNetworkingPort.receive(mw_geoNwInd(mw_geoNwPdu(mw_geoNwBroadcastPacketWithArea(
										mw_longPosVectorPosition(v_longPosVectorNodeA),
										?,
										f_getGeoBroadcastArea(c_area2)
									)))) {
									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);
									}
									else {
										log("*** " & testcasename() & ": PASS: GBC message received ***");
										f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
									}
								}
								[] t_toCbf.timeout {
									log("*** " & testcasename() & ": INFO: CBF timer elapsed ***");
									repeat;
								}
								[] tc_ac.timeout {
									log("*** " & testcasename() & ": FAIL: GBC message not received ***");
									f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
								}
							}
                            
                            // Postamble
                            f_poNeighbour();
                            
                        } // end f_GEONW_PON_GBC_NONAREA_CBF_BV_22_nodeC
                        
                        /**
                         * @desc    Behavior function for NodeD (TC_GEONW_PON_GBC_NONAREA_CBF_BV_22)
                         */
                        function f_GEONW_PON_GBC_NONAREA_CBF_BV_22_nodeD() 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_area2)
                                    )))) {
                                    tc_ac.stop;
                                    log("*** " & testcasename() & ": PASS: GBC broadcasted ***");
                                    f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                                }
                                [] tc_ac.timeout {
                                    log("*** " & testcasename() & ": FAIL: GBC not broadcasted ***");
                                    f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                                }
                            }
                            
                            // Postamble
                            f_poNeighbour();
                            
                        } // end f_GEONW_PON_GBC_NONAREA_CBF_BV_22_nodeD
                        
                    } // end GEONW_PON_GBC_NONAREA_CBF_BV_22
                    			                
				} // end gbcNonAreaContentionBasedForwarding
                            
			} // end gbcNonAreaForwarding
        
			group gbcAreaForwarding {
				
				group gbcAreaAllForwardingAlgorithm {

                    group GEONW_PON_GBC_AREA_ALL_BV_01 {
                        
                        /**
                         * @desc    TP Function for TC_GEONW_PON_GBC_AREA_ALL_BV_01
                         */
                        function f_GEONW_PON_GBC_AREA_ALL_BV_01() runs on ItsMtc {
                            
                            // Local variables
                            var ItsGeoNetworking v_nodeB;
                            var ItsGeoNetworking v_nodeD;
                            
                            // Test control
                            if (not PICS_GN_GBC_SRC) {
                                log("*** " & testcasename() & ": PICS_GN_GBC_SRC required for executing the TC ***");
                                setverdict(inconc);
                                stop;
                            }
                            
                            // 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_GBC_AREA_ALL_BV_01_nodeB());
                            v_nodeD.start(f_GEONW_PON_GBC_AREA_ALL_BV_01_nodeD());
                            
                            // Synchronization
                            f_serverSync2ClientsAndStop({c_prDone, c_tbDone});
                            
                            // Cleanup
                            f_cf02Down();
                            
                        } // end f_GEONW_PON_GBC_AREA_ALL_BV_01
                        
                        /**
                         * @desc    Behavior function for NodeB (TC_GEONW_PON_GBC_AREA_ALL_BV_01)
                         */
                        function f_GEONW_PON_GBC_AREA_ALL_BV_01_nodeB() runs on ItsGeoNetworking {
                            
                            // Local variables
                            var LongPosVector v_longPosVectorIut := f_getPosition(c_compIut);
                            
                            // Preamble
                            f_prNeighbour();
                            f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                            
                            // Test Body
                            if ( not f_utTriggerEvent(m_generateGeoBroadcastMessage(f_getArea(c_area1))) ) {
                                log("*** " & testcasename() & ": INCONC: Trigger failed ***");
                                f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
                            }
                            
                            tc_ac.start;
                            alt {
                                [] a_receiveGeoBroadcastWithArea(
                                        mw_longPosVectorPosition(v_longPosVectorIut),
                                        ?,
                                        f_getGeoBroadcastArea(c_area1)) {
                                    tc_ac.stop;
                                    log("*** " & testcasename() & ": PASS: GBC message received correctly ***");
                                    f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                                }
                                [] tc_ac.timeout {
                                    log("*** " & testcasename() & ": FAIL: GBC message not received ***");
                                    f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                                }
                            }
                            
                            // Postamble
                            f_poNeighbour();
                            
                        } // end f_GEONW_PON_GBC_AREA_ALL_BV_01_nodeB
                        
                        /**
                         * @desc    Behavior function for NodeD (TC_GEONW_PON_GBC_AREA_ALL_BV_01)
                         */
                        function f_GEONW_PON_GBC_AREA_ALL_BV_01_nodeD() runs on ItsGeoNetworking {
                            
                            // Local variables
                            var LongPosVector v_longPosVectorIut := f_getPosition(c_compIut);
                            
                            // Preamble
                            f_prNeighbour();
                            f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                            
                            // Test Body
                            tc_ac.start;
                            alt {
                                [] a_receiveGeoBroadcastWithArea(
                                        mw_longPosVectorPosition(v_longPosVectorIut),
                                        ?,
                                        f_getGeoBroadcastArea(c_area1)) {
                                    tc_ac.stop;
                                    log("*** " & testcasename() & ": PASS: GBC message received correctly ***");
                                    f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                                }
                                [] tc_ac.timeout {
                                    log("*** " & testcasename() & ": FAIL: GBC message not received ***");
                                    f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                                }
                            }
                            
                            // Postamble
                            f_poNeighbour();
                            
                        } // end f_GEONW_PON_GBC_AREA_ALL_BV_01_nodeD
                        
                    } // end GEONW_PON_GBC_AREA_ALL_BV_01

                    group GEONW_PON_GBC_AREA_ALL_BV_03 {
                        
                        /**
                         * @desc    TP Function for TC_GEONW_PON_GBC_AREA_ALL_BV_03
                         */
                        function f_GEONW_PON_GBC_AREA_ALL_BV_03() runs on ItsMtc {
                            
                            // Local variables
                            var ItsGeoNetworking v_nodeB;
                            var ItsGeoNetworking v_nodeD;
                            
                            // Test control
                            if (not PICS_GN_GBC_FWD) {
                                log("*** " & testcasename() & ": PICS_GN_GBC_FWD required for executing the TC ***");
                                setverdict(inconc);
                                stop;
                            }
                            
                            // 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_GBC_AREA_ALL_BV_03_nodeB());
                            v_nodeD.start(f_GEONW_PON_GBC_AREA_ALL_BV_03_nodeD());
                            
                            // Synchronization
                            f_serverSync2ClientsAndStop({c_prDone, c_tbDone});
                            
                            // Cleanup
                            f_cf02Down();
                            
                        } // end f_GEONW_PON_GBC_AREA_ALL_BV_03
                        
                        /**
                         * @desc    Behavior function for NodeB (TC_GEONW_PON_GBC_AREA_ALL_BV_03)
                         */
                        function f_GEONW_PON_GBC_AREA_ALL_BV_03_nodeB() runs on ItsGeoNetworking {
                            
                            // Local variables
                            var LongPosVector v_longPosVectorNodeB := f_getPosition(c_compNodeB);
                            
                            // Preamble
                            f_prNeighbour();
                            f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                            
                            // Test Body
                            f_sendGeoNetMessage(
                                m_geoNwReq_linkLayerBroadcast(
                                    m_geoNwPdu(
                                        m_geoNwBroadcastPacket(
                                            v_longPosVectorNodeB,
                                            vc_localSeqNumber,
                                            f_getGeoBroadcastArea(c_area1),
                                            c_defaultHopLimit
                                        ),
                                        -,
                                        c_defaultHopLimit
                                    )
                                )
                            );
                            
                            tc_ac.start;
                            alt {
                                [] a_receiveGeoBroadcastWithAreaWithHopLimit(
                                        mw_longPosVectorPosition(v_longPosVectorNodeB),
                                        ?,
                                        f_getGeoBroadcastArea(c_area1),
                                        c_defaultHopLimit - 1,
                                        c_defaultHopLimit) {
                                    tc_ac.stop;
                                    log("*** " & testcasename() & ": PASS: GBC message correctly retransmitted ***");
                                    f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                                }
								[] a_receiveGeoBroadcastWithAreaWithHopLimit(
										mw_longPosVectorPosition(v_longPosVectorNodeB),
										?,
										f_getGeoBroadcastArea(c_area1),
										?,
										?) {
									tc_ac.stop;
									log("*** " & testcasename() & ": FAIL: GBC message fields not updated ***");
									f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
								}
                                [] tc_ac.timeout {
                                    log("*** " & testcasename() & ": INCONC: GBC message not retransmitted ***");
                                    f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
                                }
                            }
                            
                            // Postamble
                            f_poNeighbour();
                            
                        } // end f_GEONW_PON_GBC_AREA_ALL_BV_03_nodeB
                        
                        /**
                         * @desc    Behavior function for NodeD (TC_GEONW_PON_GBC_AREA_ALL_BV_03)
                         */
                        function f_GEONW_PON_GBC_AREA_ALL_BV_03_nodeD() runs on ItsGeoNetworking {
                            
                            // Local variables
                            var LongPosVector v_longPosVectorNodeB := f_getPosition(c_compNodeB);
                            var GeoNetworkingInd v_msgInd;
                            
                            // Preamble
                            f_prNeighbour();
                            f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                            
                            // Test Body
                            tc_ac.start;
                            alt {
                                [] a_receiveGeoBroadcastWithAreaWithHopLimit(
                                        mw_longPosVectorPosition(v_longPosVectorNodeB),
                                        ?,
                                        f_getGeoBroadcastArea(c_area1),
                                        c_defaultHopLimit - 1,
                                        c_defaultHopLimit) {
                                    tc_ac.stop;
                                    log("*** " & testcasename() & ": PASS: GBC message correctly retransmitted ***");
                                    f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                                }
                                [] tc_ac.timeout {
                                    log("*** " & testcasename() & ": INCONC: GBC message not retransmitted ***");
                                    f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
                                }
                            }
                            
                            // Postamble
                            f_poNeighbour();
                            
                        } // end f_GEONW_PON_GBC_AREA_ALL_BV_03_nodeD
                        
                    } // end GEONW_PON_GBC_AREA_ALL_BV_03
berge's avatar
berge committed
                    group GEONW_PON_GBC_AREA_ALL_BV_04 {
                        
                        /**
                         * @desc    TP Function for TC_GEONW_PON_GBC_AREA_ALL_BV_04
                         */
                        function f_GEONW_PON_GBC_AREA_ALL_BV_04() runs on ItsMtc {
                            
                            // Local variables
                            var ItsGeoNetworking v_nodeB;
                            var ItsGeoNetworking v_nodeD;
                            
                            // Test control
                            if (not PICS_GN_GBC_FWD) {
                                log("*** " & testcasename() & ": PICS_GN_GBC_FWD required for executing the TC ***");
                                setverdict(inconc);
                                stop;
                            }
                            
                            // 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_GBC_AREA_ALL_BV_04_nodeB());
                            v_nodeD.start(f_GEONW_PON_GBC_AREA_ALL_BV_04_nodeD());
                            
                            // Synchronization
                            f_serverSync2ClientsAndStop({c_prDone, c_tbDone});
                            
                            // Cleanup
                            f_cf02Down();
                            
                        } // end f_GEONW_PON_GBC_AREA_ALL_BV_04
                        
                        /**
                         * @desc    Behavior function for NodeB (TC_GEONW_PON_GBC_AREA_ALL_BV_04)
                         */
                        function f_GEONW_PON_GBC_AREA_ALL_BV_04_nodeB() runs on ItsGeoNetworking {
                            
                            // Local variables
                            var LongPosVector v_longPosVectorNodeB := f_getPosition(c_compNodeB);
                            
                            // Preamble
                            f_prNeighbour();
                            f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                            
                            // Test Body
                            f_sendGeoNetMessage(
                                m_geoNwReq_linkLayerBroadcast(
                                    m_geoNwPdu(
                                        m_geoNwBroadcastPacket(
                                            v_longPosVectorNodeB,
                                            vc_localSeqNumber,
                                            f_getGeoBroadcastArea(c_area1)
                                        ),
                                        -,
                                        c_hopLimit1
                                    )
                                )
                            );
                            
                            tc_noac.start;
                            alt {
                                [] a_receiveGeoBroadcast(
                                        mw_longPosVectorPosition(v_longPosVectorNodeB),
                                        ?) {
                                    tc_noac.stop;
                                    log("*** " & testcasename() & ": FAIL: GBC message retransmitted ***");
                                    f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                                }
                                [] tc_noac.timeout {
                                    log("*** " & testcasename() & ": PASS: GBC message not retransmitted ***");
                                    f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                                }
                            }
                            
                            // Postamble
                            f_poNeighbour();
                            
                        } // end f_GEONW_PON_GBC_AREA_ALL_BV_04_nodeB
                        
                        /**
                         * @desc    Behavior function for NodeD (TC_GEONW_PON_GBC_AREA_ALL_BV_04)
                         */
                        function f_GEONW_PON_GBC_AREA_ALL_BV_04_nodeD() runs on ItsGeoNetworking {
                            
                            // Local variables
                            var LongPosVector v_longPosVectorNodeB := f_getPosition(c_compNodeB);
                            
                            // Preamble
                            f_prNeighbour();
                            f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                            
                            // Test Body
                            tc_noac.start;
                            alt {
                                [] a_receiveGeoBroadcast(
                                        mw_longPosVectorPosition(v_longPosVectorNodeB),
                                        ?) {
                                    tc_noac.stop;
                                    log("*** " & testcasename() & ": FAIL: GBC message retransmitted ***");
                                    f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                                }
                                [] tc_noac.timeout {
                                    log("*** " & testcasename() & ": PASS: GBC message not retransmitted ***");
                                    f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                                }
                            }
                            
                            // Postamble
                            f_poNeighbour();
                            
                        } // end f_GEONW_PON_GBC_AREA_ALL_BV_04_nodeD
                        
                    } // end GEONW_PON_GBC_AREA_ALL_BV_04

					/**
					 * @desc    TP Function for TC_GEONW_PON_GBC_AREA_ALL_BV_05
					 */
                    function f_GEONW_PON_GBC_AREA_ALL_BV_05() runs on ItsGeoNetworking {
                        
                        // Local variables
                        var LongPosVector v_longPosVectorNodeB;
                        var template (value) GeoNetworkingPdu v_gnPacket;
                        var integer i;
                        var GnRawPayload v_sentRawPayload;
                        
                        // Test control
                            if (not PICS_GN_GBC_DST) {
                                log("*** " & testcasename() & ": PICS_GN_GBC_DST required for executing the TC ***");
                                setverdict(inconc);
                                stop;
                            }
                        
                        // Test component configuration
                        f_cf01Up();
                        v_longPosVectorNodeB := f_getPosition(c_compNodeB);
                        
                        // Test adapter configuration
                        
                        // Preamble
                        f_prNeighbour();
                        f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                        
                        // Test Body
                        v_gnPacket := m_geoNwPdu(m_geoNwBroadcastPacket(
                                                    v_longPosVectorNodeB,
                                                    vc_localSeqNumber,
                                                    f_getGeoBroadcastArea(c_area1)
                                                )
                                            );
                        f_sendGeoNetMessage(m_geoNwReq_linkLayerBroadcast(v_gnPacket));
                        
                        f_sleep(PX_TAC);
                        
                        v_sentRawPayload := f_adaptPayloadForUtInd_m(v_gnPacket.gnPacket.packet.payload);
                        for(i:=0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i:=i+1) {
                            // empty on purpose 
berge's avatar
berge committed
                        if(i < lengthof(vc_utInds)) {
                            log("*** " & testcasename() & ": PASS: GN was transmitted to upper layer ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
berge's avatar
berge committed
                        else {
                            log("*** " & testcasename() & ": FAIL: GN was not transmitted to upper layer ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                        }
berge's avatar
berge committed
                        
                        // Postamble
                        f_poNeighbour();
                        f_cf01Down();
                        
                    } // end f_GEONW_PON_GBC_AREA_ALL_BV_05
berge's avatar
berge committed
                    group GEONW_PON_GBC_AREA_ALL_BO_08 {
                        
                        /**
                         * @desc    TP Function for TC_GEONW_PON_GBC_AREA_ALL_BO_08
                         */
                        function f_GEONW_PON_GBC_AREA_ALL_BO_08() runs on ItsMtc {
                            
                            // Local variables
                            var ItsGeoNetworking v_nodeB;
                            var ItsGeoNetworking v_nodeD;
                            
                            // Test control
                            if (not PICS_GN_GBC_DST) {
                                log("*** " & testcasename() & ": PICS_GN_GBC_DST required for executing the TC ***");
                                setverdict(inconc);
                                stop;
                            }
                            
                            // Test component configuration
                            f_cf02Up(c_compNodeB);
                            
                            // Preamble
                            
                            // Start components
                            v_nodeB := f_getComponent(c_compNodeB);
                            v_nodeD := f_getComponent(c_compNodeD);
                            v_nodeB.start(f_GEONW_PON_GBC_AREA_ALL_BO_08_nodeB());
                            v_nodeD.start(f_GEONW_PON_GBC_AREA_ALL_BO_08_nodeD());
                            
                            // Synchronization
                            f_serverSync2ClientsAndStop({c_prDone, c_tbDone});
                            
                            // Cleanup
                            f_cf02Down();
                            
                        } // end f_GEONW_PON_GBC_AREA_ALL_BO_08
                        
                        /**
                         * @desc    Behavior function for NodeB (TC_GEONW_PON_GBC_AREA_ALL_BO_08)
                         */
                        function f_GEONW_PON_GBC_AREA_ALL_BO_08_nodeB() runs on ItsGeoNetworking {
                            
                            // Local variables
                            var LongPosVector v_longPosVectorNodeB := f_getPosition(c_compNodeB);
                            var template (present) GeoNetworkingPdu v_gnPacket;
                            var integer i;
                            var GnRawPayload v_sentRawPayload;
                            
                            // Preamble
                            f_prNeighbour();
                            v_gnPacket := m_geoNwPdu(m_geoNwBroadcastPacket(
                                                        v_longPosVectorNodeB,
                                                        vc_localSeqNumber,
                                                        f_getGeoBroadcastArea(c_area1)
                                                    ),
                                                    -,
                                                    c_defaultHopLimit
                                                );
                            f_sendGeoNetMessage(m_geoNwReq_linkLayerBroadcast(valueof(v_gnPacket)));
                            
                            // IUT should also rebroadcast the packet. Get ready
                            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() & ": INFO: GBC message rebroadcasted ***");
                                }
                                [] tc_ac.timeout {
                                    log("*** " & testcasename() & ": INFO: GBC message not rebroadcasted ***");
                                }
                            }
                            
                            f_sleep(PX_TAC);
                            
                            v_sentRawPayload := f_adaptPayloadForUtInd_m(valueof(v_gnPacket.gnPacket.packet.payload));
                            for(i:=0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i:=i+1) {
                                // empty on purpose 
                            }
                            if(i < lengthof(vc_utInds)) {
                                log("*** " & testcasename() & ": PASS: GN was transmitted to upper layer ***");
                                //flush received upper indications 
                                vc_utInds := {};
                                f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                            }
                            else {
                                log("*** " & testcasename() & ": INCONC: GN was not transmitted to upper layer ***");
                                f_selfOrClientSyncAndVerdict(c_prDone, e_error);
                            }
                            
                            // Test Body
                            f_sleep(PX_TAC);
                            
                            if(0 != lengthof(vc_utInds)) {
                                log("*** " & testcasename() & ": FAIL: GN was transmitted to upper layer ***");
                                f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                            }
                            else {
                                log("*** " & testcasename() & ": PASS: GN was NOT transmitted to upper layer ***");
                                f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                            }
                            
                            // Postamble
                            f_poNeighbour();
                            
                        } // end f_GEONW_PON_GBC_AREA_ALL_BO_08_nodeB
                        
                        /**
                         * @desc    Behavior function for NodeD (TC_GEONW_PON_GBC_AREA_ALL_BO_08)
                         */
                        function f_GEONW_PON_GBC_AREA_ALL_BO_08_nodeD() runs on ItsGeoNetworking {
                            
                            // Local variables
                            var LongPosVector v_longPosVectorNodeB := f_getPosition(c_compNodeB);
                            var template (value) GeoNetworkingInd v_msgInd;
                            var integer i;
                            
                            // Preamble
                            f_prNeighbour();
                            
                            // IUT should also rebroadcast the packet. Get ready
                            tc_ac.start;
                            alt {
                                [] geoNetworkingPort.receive(mw_geoNwInd(mw_geoNwPdu(mw_geoNwBroadcastPacketWithArea(
                                        mw_longPosVectorPosition(v_longPosVectorNodeB),
                                        ?,
                                        f_getGeoBroadcastArea(c_area1)
                                    )))) -> value v_msgInd {
                                    tc_ac.stop;
                                    log("*** " & testcasename() & ": INFO: Pre-conditions: GBC message rebroadcasted ***");
                                    f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                                }
                                [] tc_ac.timeout {
                                    log("*** " & testcasename() & ": INFO: Pre-conditions: GBC message not rebroadcasted ***");
                                    f_selfOrClientSyncAndVerdict(c_prDone, e_timeout);
                                }
                            }
                             
                            // Test Body
                            v_msgInd.msgIn.basicHeader.routerHopLimit := valueof(v_msgInd.msgIn.basicHeader.routerHopLimit) / 2;
                            f_sendGeoNetMessage(m_geoNwReq_linkLayerBroadcast(v_msgInd.msgIn));
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
berge's avatar
berge committed
                            
                            // Postamble
                            f_poNeighbour();
                            
                        } // end f_GEONW_PON_GBC_AREA_ALL_BO_08_nodeD
                        
                    } // end GEONW_PON_GBC_AREA_ALL_BO_08
berge's avatar
berge committed
				} // end gbcAreaAllForwardingAlgorithm

				group gbcAreaSimpleForwarding {

                    group GEONW_PON_GBC_AREA_SMP_BV_02 {
                        
                        /**
                         * @desc    TP Function for TC_GEONW_PON_GBC_AREA_SMP_BV_02
                         */
                        function f_GEONW_PON_GBC_AREA_SMP_BV_02() runs on ItsMtc {
                            
                            // Local variables
                            var ItsGeoNetworking v_nodeB;
                            var ItsGeoNetworking v_nodeD;
                            
                            // Test control
                            if (not PICS_GN_GBC_SRC) {
                                log("*** " & testcasename() & ": PICS_GN_GBC_SRC required for executing the TC ***");
                                setverdict(inconc);
                                stop;
                            }
                            if ((f_getAreaForwardingAlgorithm() != e_simple) and (f_getAreaForwardingAlgorithm() != e_unspecified)) {
                                log("*** " & testcasename() & ": PICS_GN_AREA_FORWARDING_ALGORITHM == ( e_simple or e_unspecified ) required for executing the TC ***");
                                setverdict(inconc);
                                stop;
                            }
                            
                            // 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_GBC_AREA_SMP_BV_02_nodeB());
                            v_nodeD.start(f_GEONW_PON_GBC_AREA_SMP_BV_02_nodeD());
                            
                            // Synchronization
                            f_serverSync2ClientsAndStop({c_prDone, c_tbDone});
                            
                            // Cleanup
                            f_cf02Down();
                            
                        } // end f_GEONW_PON_GBC_AREA_SMP_BV_02
                        
                        /**
                         * @desc    Behavior function for NodeB (TC_GEONW_PON_GBC_AREA_SMP_BV_02)
                         */
                        function f_GEONW_PON_GBC_AREA_SMP_BV_02_nodeB() runs on ItsGeoNetworking {
                            
                            // Local variables
                            var LongPosVector v_longPosVectorNodeB := f_getPosition(c_compNodeB);
                            
                            // Preamble
                            f_prNeighbour();
                            f_selfOrClientSyncAndVerdict(c_prDone, e_success);
berge's avatar
berge committed
                            
                            // Test Body
                            f_sendGeoNetMessage(
                                m_geoNwReq_linkLayerBroadcast(
                                    m_geoNwPdu(
                                        m_geoNwBroadcastPacket(
                                            v_longPosVectorNodeB,
                                            vc_localSeqNumber,
                                            f_getGeoBroadcastArea(c_area1)
                                        )
                                    )
                                )
                            );
                            
                            tc_ac.start;
                            alt {
                                [] a_receiveGeoBroadcastWithArea(
                                        mw_longPosVectorPosition(v_longPosVectorNodeB),
                                        ?,
                                        f_getGeoBroadcastArea(c_area1)) {
                                    tc_ac.stop;
                                    log("*** " & testcasename() & ": PASS: GBC message received correctly ***");
                                    f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                                }
                                [] tc_ac.timeout {
                                    log("*** " & testcasename() & ": FAIL: GBC message not received ***");
                                    f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                                }
                            }
                            
                            // Postamble
                            f_poNeighbour();
                            
                        } // end f_GEONW_PON_GBC_AREA_SMP_BV_02_nodeB
                        
                        /**
                         * @desc    Behavior function for NodeD (TC_GEONW_PON_GBC_AREA_SMP_BV_02)
                         */
                        function f_GEONW_PON_GBC_AREA_SMP_BV_02_nodeD() runs on ItsGeoNetworking {
                            
                            // Local variables
                            var LongPosVector v_longPosVectorNodeB := f_getPosition(c_compNodeB);
                            
                            // Preamble
                            f_prNeighbour();
                            f_selfOrClientSyncAndVerdict(c_prDone, e_success);
berge's avatar
berge committed
10926 10927 10928 10929 10930 10931 10932 10933 10934 10935 10936 10937 10938 10939 10940 10941 10942 10943 10944 10945 10946 10947 10948 10949 10950 10951 10952 10953 10954 10955 10956 10957 10958 10959 10960 10961 10962 10963 10964 10965 10966 10967 10968 10969 10970 10971 10972 10973 10974 10975 10976 10977 10978 10979 10980 10981 10982 10983 10984 10985 10986 10987 10988 10989 10990 10991 10992 10993 10994 10995 10996 10997 10998 10999 11000 11001 11002 11003 11004 11005 11006 11007 11008 11009 11010 11011 11012 11013 11014 11015 11016 11017 11018 11019 11020 11021 11022 11023 11024 11025 11026 11027 11028 11029 11030 11031 11032 11033 11034 11035 11036 11037 11038 11039 11040 11041 11042 11043 11044 11045 11046 11047 11048 11049 11050 11051 11052 11053 11054 11055 11056 11057 11058 11059 11060 11061 11062 11063 11064 11065 11066 11067 11068 11069 11070 11071 11072 11073 11074 11075 11076 11077 11078 11079 11080 11081 11082 11083 11084 11085 11086 11087 11088 11089 11090 11091 11092 11093 11094 11095 11096 11097 11098 11099 11100 11101 11102 11103 11104 11105 11106 11107 11108 11109 11110 11111 11112 11113 11114 11115 11116 11117 11118 11119 11120 11121 11122 11123 11124 11125 11126 11127 11128 11129 11130 11131 11132 11133 11134 11135 11136 11137 11138 11139 11140 11141 11142 11143 11144 11145 11146 11147 11148 11149 11150 11151 11152 11153 11154 11155 11156 11157 11158 11159 11160 11161 11162 11163 11164 11165 11166 11167 11168 11169 11170 11171 11172 11173 11174 11175 11176 11177 11178 11179 11180 11181 11182 11183 11184 11185 11186 11187 11188 11189 11190 11191 11192 11193 11194 11195 11196 11197 11198 11199 11200 11201 11202 11203 11204 11205 11206 11207 11208 11209 11210 11211 11212 11213 11214 11215 11216 11217 11218 11219 11220 11221 11222 11223 11224 11225 11226
                            
                            // Test Body
                            tc_ac.start;
                            alt {
                                [] a_receiveGeoBroadcastWithArea(
                                        mw_longPosVectorPosition(v_longPosVectorNodeB),
                                        ?,
                                        f_getGeoBroadcastArea(c_area1)) {
                                    tc_ac.stop;
                                    log("*** " & testcasename() & ": PASS: GBC message received correctly ***");
                                    f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                                }
                                [] tc_ac.timeout {
                                    log("*** " & testcasename() & ": FAIL: GBC message not received ***");
                                    f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                                }
                            }
                            
                            // Postamble
                            f_poNeighbour();
                            
                        } // end f_GEONW_PON_GBC_AREA_SMP_BV_02_nodeD
                        
                    } // end GEONW_PON_GBC_AREA_SMP_BV_02

                    group GEONW_PON_GBC_AREA_SMP_BO_07 {
                        
                        /**
                         * @desc    TP Function for TC_GEONW_PON_GBC_AREA_SMP_BO_07
                         */
                        function f_GEONW_PON_GBC_AREA_SMP_BO_07() runs on ItsMtc {
                            
                            // Local variables
                            var ItsGeoNetworking v_nodeB;
                            var ItsGeoNetworking v_nodeD;
                            
                            // Test control
                            if (not PICS_GN_GBC_FWD) {
                                log("*** " & testcasename() & ": PICS_GN_GBC_FWD required for executing the TC ***");
                                setverdict(inconc);
                                stop;
                            }
                            if ((f_getAreaForwardingAlgorithm() != e_simple) and (f_getAreaForwardingAlgorithm() != e_unspecified)) {
                                log("*** " & testcasename() & ": PICS_GN_AREA_FORWARDING_ALGORITHM == ( e_simple or e_unspecified ) required for executing the TC ***");
                                setverdict(inconc);
                                stop;
                            }
                            
                            // 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_GBC_AREA_SMP_BO_07_nodeB());
                            v_nodeD.start(f_GEONW_PON_GBC_AREA_SMP_BO_07_nodeD());
                            
                            // Synchronization
                            f_serverSync2ClientsAndStop({c_prDone, c_tbDone});
                            
                            // Cleanup
                            f_cf02Down();
                            
                        } // end f_GEONW_PON_GBC_BO_04
                        
                        /**
                         * @desc    Behavior function for NodeB (TC_GEONW_PON_GBC_AREA_SMP_BO_07)
                         */
                        function f_GEONW_PON_GBC_AREA_SMP_BO_07_nodeB() runs on ItsGeoNetworking {
                            
                            // Local variables
                            var LongPosVector v_longPosVectorNodeB := f_getPosition(c_compNodeB);
                            var template (present) GeoNetworkingPdu v_gnPacket;
                            
                            // Preamble
                            f_prNeighbour();
                            v_gnPacket := m_geoNwPdu(
                                              m_geoNwBroadcastPacket(
                                                  v_longPosVectorNodeB,
                                                  vc_localSeqNumber,
                                                  f_getGeoBroadcastArea(c_area1)
                                              ),
                                              -,
                                              c_defaultHopLimit
                                          );
                            f_sendGeoNetMessage(m_geoNwReq_linkLayerBroadcast(valueof(v_gnPacket)));
                            
                            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: Pre-conditions: GBC message received correctly ***");
                                    f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                                }
                                [] tc_ac.timeout {
                                    log("*** " & testcasename() & ": INCONC: Pre-conditions: GBC message not received ***");
                                    f_selfOrClientSyncAndVerdict(c_prDone, e_timeout);
                                }
                            }
                            
                            // Test Body
                            tc_noac.start;
                            alt {
                                [] a_receiveGeoBroadcast(
                                        ?,
                                        ?) {
                                    tc_noac.stop;
                                    log("*** " & testcasename() & ": FAIL: GBC message re-broadcasted ***");
                                    f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                                }
                                [] tc_noac.timeout {
                                    log("*** " & testcasename() & ": PASS: GBC message not re-broadcasted ***");
                                    f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                                }
                            }
                            
                            // Postamble
                            f_poNeighbour();
                            
                        } // end f_GEONW_PON_GBC_AREA_SMP_BO_07_nodeB
                        
                        /**
                         * @desc    Behavior function for NodeD (TC_GEONW_PON_GBC_AREA_SMP_BO_07)
                         */
                        function f_GEONW_PON_GBC_AREA_SMP_BO_07_nodeD() runs on ItsGeoNetworking {
                            
                            // Local variables
                            var LongPosVector v_longPosVectorNodeB := f_getPosition(c_compNodeB);
                            var template (present) GeoNetworkingInd v_msgInd;
                            
                            // Preamble
                            f_prNeighbour();
                            tc_ac.start;
                            alt {
                                [] geoNetworkingPort.receive(mw_geoNwInd(mw_geoNwPdu(mw_geoNwBroadcastPacketWithArea(
                                        mw_longPosVectorPosition(v_longPosVectorNodeB),
                                        ?,
                                        f_getGeoBroadcastArea(c_area1)
                                    )))) -> value v_msgInd {
                                    tc_ac.stop;
                                    log("*** " & testcasename() & ": PASS: Pre-conditions: GBC message received correctly ***");
                                    f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                                }
                                [] tc_ac.timeout {
                                    log("*** " & testcasename() & ": FAIL: Pre-conditions: GBC message not received ***");
                                    f_selfOrClientSyncAndVerdict(c_prDone, e_error);
                                }
                            }
                            
                            // Test Body
                            // send geoBroadcast for second time (same source + same seq Nr + lower RHL)
                            v_msgInd.msgIn.basicHeader.routerHopLimit := valueof(v_msgInd.msgIn.basicHeader.routerHopLimit) - 1;
                            f_sendGeoNetMessage(m_geoNwReq_linkLayerBroadcast(valueof(v_msgInd.msgIn)));
                            
                            v_msgInd.msgIn.basicHeader.routerHopLimit := ?;
                            tc_noac.start;
                            alt {
                                [] a_receiveGeoBroadcast(
                                        ?,
                                        ?) {
                                    tc_noac.stop;
                                    log("*** " & testcasename() & ": FAIL: GBC message re-broadcasted ***");
                                    f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                                }
                                [] tc_noac.timeout {
                                    log("*** " & testcasename() & ": PASS: GBC message not re-broadcasted ***");
                                    f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                                }
                            }
                            
                            // Postamble
                            f_poNeighbour();
                            
                        } // end f_GEONW_PON_GBC_AREA_SMP_BO_07_nodeD
                        
                    } // end GEONW_PON_GBC_AREA_SMP_BO_07

				} // end gbcAreaSimpleForwarding

				group gbcAreaContentionBasedForwarding {

                    group GEONW_PON_GBC_AREA_CBF_BV_02 {
                        
                        /**
                         * @desc    TP Function for TC_GEONW_PON_GBC_AREA_CBF_BV_02
                         */
                        function f_GEONW_PON_GBC_AREA_CBF_BV_02() runs on ItsMtc {
                            
                            // Local variables
                            var ItsGeoNetworking v_nodeB;
                            var ItsGeoNetworking v_nodeC;
                            var ItsGeoNetworking v_nodeD;
                            
                            // Test control
                            if (not PICS_GN_GBC_FWD) {
                                log("*** " & testcasename() & ": PICS_GN_GBC_FWD required for executing the TC ***");
                                setverdict(inconc);
                                stop;
                            }
                            if (f_getAreaForwardingAlgorithm() != e_cbf) {
                                log("*** " & testcasename() & ": PICS_GN_AREA_FORWARDING_ALGORITHM == e_cbf required for executing the TC ***");
                                setverdict(inconc);
                                stop;
                            }
                            
        //                    if (f_getCbfMinTime() < 300) {
        //                        log("*** " & testcasename() & ": PICS_GN_GEOBROADCAST_CBF_MIN_TIME >= 300 required for executing the TC ***");
        //                        setverdict(inconc);
        //                        stop;
        //                    }
                            
                            // Test component configuration
                            f_cf04Up();
                            
                            // Preamble
                            
                            // Start components
                            v_nodeB := f_getComponent(c_compNodeB);
                            v_nodeC := f_getComponent(c_compNodeC);
                            v_nodeD := f_getComponent(c_compNodeD);
                            v_nodeB.start(f_GEONW_PON_GBC_AREA_CBF_BV_02_nodeB());
                            v_nodeC.start(f_GEONW_PON_GBC_AREA_CBF_BV_02_nodeC());
                            v_nodeD.start(f_GEONW_PON_GBC_AREA_CBF_BV_02_nodeD());
                            
                            // Synchronization
                            f_serverSync3ClientsAndStop({c_prDone, c_tbDone});
                            
                            // Cleanup
                            f_cf04Down();
                            
                        } // end f_GEONW_PON_GBC_AREA_CBF_BV_02
                        
                        /**
                         * @desc    Behavior function for NodeB (TC_GEONW_PON_GBC_AREA_CBF_BV_02)
                         */
                        function f_GEONW_PON_GBC_AREA_CBF_BV_02_nodeB() runs on ItsGeoNetworking {
                            
                            // Local variables
                            var LongPosVector v_longPosVectorNodeC := f_getPosition(c_compNodeC);
                            
                            // 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_longPosVectorNodeC),
                                        ?,
                                        f_getGeoBroadcastArea(c_area1)
                                    )))) {
                                    tc_ac.stop;
                                    log("*** " & testcasename() & ": PASS: GBC message broadcasted ***");
                                    f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                                }
                                [] tc_ac.timeout {
                                    log("*** " & testcasename() & ": FAIL: GBC message not broadcasted ***");
                                    f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                                }
                            }
                            
                            // Postamble
                            f_poNeighbour();
                            
                        } // end f_GEONW_PON_GBC_AREA_CBF_BV_02_nodeB
                        
                        /**
                         * @desc    Behavior function for NodeC (TC_GEONW_PON_GBC_AREA_CBF_BV_02)
                         */
                        function f_GEONW_PON_GBC_AREA_CBF_BV_02_nodeC() runs on ItsGeoNetworking {
                            
                            // Local variables
                            var LongPosVector v_longPosVectorNodeC := f_getPosition(c_compNodeC);
                            var LongPosVector v_longPosVectorIut := f_getPosition(c_compIut);
                            timer t_toCbf := (int2float(f_getCbfMaxTime())
                                + (
                                    int2float(f_getCbfMinTime() - f_getCbfMaxTime())
                                    / int2float(f_getCbfMaxCommunicationRange())
                                ) * f_distance(v_longPosVectorNodeC, v_longPosVectorIut)) * 0.95 / 1000.0;
                            
                            // Preamble
                            f_prNeighbour();
                            f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                            
                            // Test Body
                            f_sendGeoNetMessage(
                                m_geoNwReq_linkLayerBroadcast(
                                    m_geoNwPdu(
                                        m_geoNwBroadcastPacket(
                                            v_longPosVectorNodeC,
                                            vc_localSeqNumber,
                                            f_getGeoBroadcastArea(c_area1)
                                        )
                                    )
berge's avatar
berge committed
                            );
                            
                            t_toCbf.start;                    
                            tc_ac.start;
                            alt {
                                [] geoNetworkingPort.receive(mw_geoNwInd(mw_geoNwPdu(mw_geoNwBroadcastPacketWithArea(
                                        mw_longPosVectorPosition(v_longPosVectorNodeC),
                                        ?,
                                        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);
                                    }
                                    else {
                                        log("*** " & testcasename() & ": PASS: GBC message received ***");
                                        f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                                    }
                                }
                                [] t_toCbf.timeout {
                                    log("*** " & testcasename() & ": INFO: CBF timer elapsed ***");
                                    repeat;
                                }
                                [] tc_ac.timeout {
                                    log("*** " & testcasename() & ": FAIL: GBC message not received ***");
                                    f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                                }
                            }
                            
                            // Postamble
                            f_poNeighbour();
                            
                        } // end f_GEONW_PON_GBC_AREA_CBF_BV_02_nodeC
berge's avatar
berge committed
                        /**
                         * @desc    Behavior function for NodeD (TC_GEONW_PON_GBC_AREA_CBF_BV_02)
                         */
                        function f_GEONW_PON_GBC_AREA_CBF_BV_02_nodeD() runs on ItsGeoNetworking {
                            
                            // Local variables
                            var LongPosVector v_longPosVectorNodeC := f_getPosition(c_compNodeC);
                            
                            // Preamble
                            f_prNeighbour();
                            f_selfOrClientSyncAndVerdict(c_prDone, e_success);
berge's avatar
berge committed
                            
                            // Test Body                    
                            tc_ac.start;
                            alt {
                                [] geoNetworkingPort.receive(mw_geoNwInd(mw_geoNwPdu(mw_geoNwBroadcastPacketWithArea(
                                        mw_longPosVectorPosition(v_longPosVectorNodeC),
                                        ?,
                                        f_getGeoBroadcastArea(c_area1)
                                    )))) {
                                    tc_ac.stop;
                                    log("*** " & testcasename() & ": PASS: GBC message broadcasted ***");
                                    f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                                }
                                [] tc_ac.timeout {
                                    log("*** " & testcasename() & ": FAIL: GBC message not broadcasted ***");
                                    f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                                }
                            }
                            
                            // Postamble
                            f_poNeighbour();
                            
                        } // end f_GEONW_PON_GBC_AREA_CBF_BV_02_nodeD
                        
                    } // end GEONW_PON_GBC_AREA_CBF_BV_02

                    group GEONW_PON_GBC_AREA_CBF_BV_07 {
                        
                        /**
                         * @desc    TP Function for TC_GEONW_PON_GBC_AREA_CBF_BV_07
                         */
                        function f_GEONW_PON_GBC_AREA_CBF_BV_07() runs on ItsMtc {
                            
                            // Local variables
                            var ItsGeoNetworking v_nodeB;
                            var ItsGeoNetworking v_nodeC;
                            var ItsGeoNetworking v_nodeD;
                            var UInt16 v_sequenceNumberC := f_getInitialSequenceNumber();
                            
                            // Test control
                            if (not PICS_GN_GBC_FWD) {
                                log("*** " & testcasename() & ": PICS_GN_GBC_FWD required for executing the TC ***");
                                setverdict(inconc);
                                stop;
                            }
                            if (f_getAreaForwardingAlgorithm() != e_cbf) {
                                log("*** " & testcasename() & ": PICS_GN_AREA_FORWARDING_ALGORITHM == e_cbf required for executing the TC ***");
                                setverdict(inconc);
                                stop;
                            }
                            
        //                    if (f_getCbfMinTime() < 300) {
        //                        log("*** " & testcasename() & ": PICS_GN_GEOBROADCAST_CBF_MIN_TIME >= 300 required for executing the TC ***");
        //                        setverdict(inconc);
        //                        stop;
        //                    }
                                                
                            // Test component configuration
                            f_cf04Up();
                            
                            // Preamble
                            
                            // Start components
                            v_nodeB := f_getComponent(c_compNodeB);
                            v_nodeC := f_getComponent(c_compNodeC);
                            v_nodeD := f_getComponent(c_compNodeD);
                            v_nodeB.start(f_GEONW_PON_GBC_AREA_CBF_BV_07_nodeB());
                            v_nodeC.start(f_GEONW_PON_GBC_AREA_CBF_BV_07_nodeC(v_sequenceNumberC));
                            v_nodeD.start(f_GEONW_PON_GBC_AREA_CBF_BV_07_nodeD(v_sequenceNumberC));
                            
                            // Synchronization
                            f_serverSync3ClientsAndStop({c_prDone, c_tbDone});
                            
                            // Cleanup
                            f_cf04Down();
                            
                        } // end f_GEONW_PON_BCA_BV_01
                        
                        /**
                         * @desc    Behavior function for NodeB (TC_GEONW_PON_GBC_AREA_CBF_BV_07)
                         */
                        function f_GEONW_PON_GBC_AREA_CBF_BV_07_nodeB() runs on ItsGeoNetworking {
                            
                            // Local variables
                            var LongPosVector v_longPosVectorNodeC := f_getPosition(c_compNodeC);
                            
                            // Preamble
                            f_prNeighbour();
                            f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                            
                            // Test Body
                            tc_noac.start;
                            alt {
                                [] geoNetworkingPort.receive(mw_geoNwInd(mw_geoNwPdu(mw_geoNwBroadcastPacketWithArea(
                                        mw_longPosVectorPosition(v_longPosVectorNodeC),
                                        ?,
                                        f_getGeoBroadcastArea(c_area1)
                                    )))) {
                                    tc_noac.stop;
                                    log("*** " & testcasename() & ": FAIL: GBC message re-broadcasted ***");
                                    f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                                }
                                [] tc_noac.timeout {
                                    log("*** " & testcasename() & ": PASS: GBC message not re-broadcasted ***");
                                    f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                                }
                            }
                            
                            // Postamble
                            f_poNeighbour();
                            
                        } // end f_GEONW_PON_GBC_AREA_CBF_BV_07_nodeB
                        
                        /**
                         * @desc    Behavior function for NodeC (TC_GEONW_PON_GBC_AREA_CBF_BV_07)
                         */
                        function f_GEONW_PON_GBC_AREA_CBF_BV_07_nodeC(in UInt16 p_sequenceNumberC) runs on ItsGeoNetworking {
                            
                            // Local variables
                            var LongPosVector v_longPosVectorNodeC := f_getPosition(c_compNodeC);
                            
                            // Preamble
                            f_prNeighbour();
                            f_sendGeoNetMessage(
                                m_geoNwReq_linkLayerBroadcast(
                                    m_geoNwPdu(
                                        m_geoNwBroadcastPacket(
                                            v_longPosVectorNodeC,
                                            p_sequenceNumberC,
                                            f_getGeoBroadcastArea(c_area1)
                                        )
                                    )
berge's avatar
berge committed
                            );
                            f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                            
                            // Test Body
                            tc_noac.start;
                            alt {
                                [] geoNetworkingPort.receive(mw_geoNwInd(mw_geoNwPdu(mw_geoNwBroadcastPacketWithArea(
                                        mw_longPosVectorPosition(v_longPosVectorNodeC),
                                        ?,
                                        f_getGeoBroadcastArea(c_area1)
                                    )))) {
                                    tc_noac.stop;
                                    log("*** " & testcasename() & ": FAIL: GBC message re-broadcasted ***");
                                    f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                                }
                                [] tc_noac.timeout {
                                    log("*** " & testcasename() & ": PASS: GBC message not re-broadcasted ***");
                                    f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                                }
                            }
                            
                            // Postamble
                            f_poNeighbour();
                            
                        } // end f_GEONW_PON_GBC_AREA_CBF_BV_07_nodeC
                        
                        /**
                         * @desc    Behavior function for NodeD (TC_GEONW_PON_GBC_AREA_CBF_BV_07)
                         */
                        function f_GEONW_PON_GBC_AREA_CBF_BV_07_nodeD(in UInt16 p_sequenceNumberC) runs on ItsGeoNetworking {
                            
                            // Local variables
                            var LongPosVector v_longPosVectorNodeC := f_getPosition(c_compNodeC);
                            
                            // Preamble
                            f_prNeighbour();
                            f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                            
                            // Test Body
                            f_sendGeoNetMessage(
                                m_geoNwReq_linkLayerBroadcast(
                                    m_geoNwPdu(
                                        m_geoNwBroadcastPacket(
                                            v_longPosVectorNodeC,
                                            p_sequenceNumberC,
                                            f_getGeoBroadcastArea(c_area1)
                                        )
                                    )
                                )
                            );
                            
                            tc_noac.start;
                            alt {
                                [] geoNetworkingPort.receive(mw_geoNwInd(mw_geoNwPdu(mw_geoNwBroadcastPacketWithArea(
                                        mw_longPosVectorPosition(v_longPosVectorNodeC),
                                        ?,
                                        f_getGeoBroadcastArea(c_area1)
                                    )))) {
                                    tc_noac.stop;
                                    log("*** " & testcasename() & ": FAIL: GBC message re-broadcasted ***");
                                    f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                                }
                                [] tc_noac.timeout {
                                    log("*** " & testcasename() & ": PASS: GBC message not re-broadcasted ***");
                                    f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                                }
                            }
                            
                            // Postamble
                            f_poNeighbour();
                            
                        } // end f_GEONW_PON_GBC_AREA_CBF_BV_071_nodeD
                        
                    } // end GEONW_PON_GBC_AREA_CBF_BV_07

                    group GEONW_PON_GBC_AREA_CBF_BV_21 {
                        
                        /**
                         * @desc    TP Function for TC_GEONW_PON_GBC_AREA_CBF_BV_21
                         */
                        function f_GEONW_PON_GBC_AREA_CBF_BV_21() runs on ItsMtc {
                            
                            // Local variables
                            var ItsGeoNetworking v_nodeB;
                            var ItsGeoNetworking v_nodeC;
                            var ItsGeoNetworking v_nodeD;
                            
                            // Test control
                            if (not PICS_GN_GBC_FWD) {
                                log("*** " & testcasename() & ": PICS_GN_GBC_FWD required for executing the TC ***");
                                setverdict(inconc);
                                stop;
                            }
                            if (f_getAreaForwardingAlgorithm() != e_cbf) {
                                log("*** " & testcasename() & ": PICS_GN_AREA_FORWARDING_ALGORITHM == e_cbf required for executing the TC ***");
                                setverdict(inconc);
                                stop;
                            }
                            
        //                    if (f_getCbfMinTime() < 300) {
        //                        log("*** " & testcasename() & ": PICS_GN_GEOBROADCAST_CBF_MIN_TIME >= 300 required for executing the TC ***");
        //                        setverdict(inconc);
        //                        stop;
        //                    }
                            
                            // Test component configuration
                            f_cf04Up();
                            
                            // Preamble
                            
                            // Start components
                            v_nodeB := f_getComponent(c_compNodeB);
                            v_nodeC := f_getComponent(c_compNodeC);
                            v_nodeD := f_getComponent(c_compNodeD);
                            v_nodeB.start(f_GEONW_PON_GBC_AREA_CBF_BV_21_nodeB());
                            v_nodeC.start(f_GEONW_PON_GBC_AREA_CBF_BV_21_nodeC());
                            v_nodeD.start(f_GEONW_PON_GBC_AREA_CBF_BV_21_nodeD());
                            
                            // Synchronization
                            f_serverSync3ClientsAndStop({c_prDone, c_tbDone});
                            
                            // Cleanup
                            f_cf04Down();
                            
                        } // end f_GEONW_PON_GBC_AREA_CBF_BV_21
                        
                        /**
                         * @desc    Behavior function for NodeB (TC_GEONW_PON_GBC_AREA_CBF_BV_21)
                         */
                        function f_GEONW_PON_GBC_AREA_CBF_BV_21_nodeB() runs on ItsGeoNetworking {
                            
                            // Local variables
                            var LongPosVector v_longPosVectorNodeC := f_getPosition(c_compNodeC);
                            
                            // 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_longPosVectorNodeC),
                                        ?,
                                        f_getGeoBroadcastArea(c_area1)
                                    )))) {
                                    tc_ac.stop;
                                    log("*** " & testcasename() & ": PASS: GBC message broadcasted ***");
                                    f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                                }
                                [] tc_ac.timeout {
                                    log("*** " & testcasename() & ": FAIL: GBC message not broadcasted ***");
                                    f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                                }
                            }
                            
                            // Postamble
                            f_poNeighbour();
                            
                        } // end f_GEONW_PON_GBC_AREA_CBF_BV_21_nodeB
                        
                        /**
                         * @desc    Behavior function for NodeC (TC_GEONW_PON_GBC_AREA_CBF_BV_21)
                         */
                        function f_GEONW_PON_GBC_AREA_CBF_BV_21_nodeC() runs on ItsGeoNetworking {
                            
                            // Local variables
                            var LongPosVector v_longPosVectorNodeC := f_getPosition(c_compNodeC);
                            
                            // 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_longPosVectorNodeC),
                                        ?,
                                        f_getGeoBroadcastArea(c_area1)
                                    )))) {
                                    tc_ac.stop;
                                    log("*** " & testcasename() & ": PASS: GBC message broadcasted ***");
                                    f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                                }
                                [] tc_ac.timeout {
                                    log("*** " & testcasename() & ": FAIL: GBC message not broadcasted ***");
                                    f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                                }
                            }
                            
                            // Postamble
                            f_poNeighbour();
                            
                        } // end f_GEONW_PON_GBC_AREA_CBF_BV_21_nodeC
                        
                        /**
                         * @desc    Behavior function for NodeD (TC_GEONW_PON_GBC_AREA_CBF_BV_21)
                         */
                        function f_GEONW_PON_GBC_AREA_CBF_BV_21_nodeD() runs on ItsGeoNetworking {
                            
                            // Local variables
                            var LongPosVector v_longPosVectorNodeC := f_getPosition(c_compNodeC);
                            timer t_toCbf := int2float(f_getCbfMaxTime()) * 0.95 / 1000.0;
                            
                            // Preamble
                            f_prNonNeighbour();
                            f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                            
                            // Test Body
                            f_sendGeoNetMessage(
                                m_geoNwReq_linkLayerBroadcast(
                                    m_geoNwPdu(
                                        m_geoNwBroadcastPacket(
                                            v_longPosVectorNodeC,
                                            vc_localSeqNumber,
                                            f_getGeoBroadcastArea(c_area1)
                                        )
                                    )
berge's avatar
berge committed
                            t_toCbf.start;                    
                            tc_ac.start;
                            alt {
                                [] geoNetworkingPort.receive(mw_geoNwInd(mw_geoNwPdu(mw_geoNwBroadcastPacketWithArea(
                                        mw_longPosVectorPosition(v_longPosVectorNodeC),
                                        ?,
                                        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);
                                    }
                                    else {
                                        log("*** " & testcasename() & ": PASS: GBC message received ***");
                                        f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                                    }
                                }
                                [] t_toCbf.timeout {
                                    log("*** " & testcasename() & ": INFO: CBF timer elapsed ***");
                                    repeat;
                                }
                                [] tc_ac.timeout {
                                    log("*** " & testcasename() & ": FAIL: GBC message not received ***");
                                    f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                                }
berge's avatar
berge committed
                            
                            // Postamble
                            f_poDefault();
                            
                        } // end f_GEONW_PON_GBC_AREA_CBF_BV_21_nodeD
                        
                    } // end GEONW_PON_GBC_AREA_CBF_BV_21                    
        
                    group GEONW_PON_GBC_AREA_CBF_BV_22 {
                        
                        /**
                         * @desc    TP Function for TC_GEONW_PON_GBC_AREA_CBF_BV_22
                         */
                        function f_GEONW_PON_GBC_AREA_CBF_BV_22() runs on ItsMtc {
                            
                            // Local variables
                            var ItsGeoNetworking v_nodeB;
                            var ItsGeoNetworking v_nodeC;
                            var ItsGeoNetworking v_nodeD;
                            
                            // Test control
                            if (not PICS_GN_GBC_FWD) {
                                log("*** " & testcasename() & ": PICS_GN_GBC_FWD required for executing the TC ***");
                                setverdict(inconc);
                                stop;
berge's avatar
berge committed
                            if (f_getAreaForwardingAlgorithm() != e_cbf) {
                                log("*** " & testcasename() & ": PICS_GN_AREA_FORWARDING_ALGORITHM == e_cbf required for executing the TC ***");
                                setverdict(inconc);
                                stop;
                            }
                            
        //                    if (f_getCbfMinTime() < 300) {
        //                        log("*** " & testcasename() & ": PICS_GN_GEOBROADCAST_CBF_MIN_TIME >= 300 required for executing the TC ***");
        //                        setverdict(inconc);
        //                        stop;
        //                    }
                            
                            // Test component configuration
                            f_cf04Up();
                            
                            // Preamble
                            
                            // Start components
                            v_nodeB := f_getComponent(c_compNodeB);
                            v_nodeC := f_getComponent(c_compNodeC);
                            v_nodeD := f_getComponent(c_compNodeD);
                            v_nodeB.start(f_GEONW_PON_GBC_AREA_CBF_BV_22_nodeB());
                            v_nodeC.start(f_GEONW_PON_GBC_AREA_CBF_BV_22_nodeC());
                            v_nodeD.start(f_GEONW_PON_GBC_AREA_CBF_BV_22_nodeD());
                            
                            // Synchronization
                            f_serverSync3ClientsAndStop({c_prDone, c_tbDone});
                            
                            // Cleanup
                            f_cf04Down();
                            
                        } // end f_GEONW_PON_GBC_AREA_CBF_BV_22
                        
                        /**
                         * @desc    Behavior function for NodeB (TC_GEONW_PON_GBC_AREA_CBF_BV_22)
                         */
                        function f_GEONW_PON_GBC_AREA_CBF_BV_22_nodeB() runs on ItsGeoNetworking {
                            
                            // Local variables
                            var LongPosVector v_longPosVectorNodeC := f_getPosition(c_compNodeC);
                            
                            // 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_longPosVectorNodeC),
                                        ?,
                                        f_getGeoBroadcastArea(c_area1)
                                    )))) {
                                    tc_ac.stop;
                                    log("*** " & testcasename() & ": PASS: GBC message broadcasted ***");
                                    f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                                }
                                [] tc_ac.timeout {
                                    log("*** " & testcasename() & ": FAIL: GBC message not broadcasted ***");
                                    f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                                }
                            }
                            
                            // Postamble
                            f_poNeighbour();
                            
                        } // end f_GEONW_PON_GBC_AREA_CBF_BV_22_nodeB
                        
                        /**
                         * @desc    Behavior function for NodeC (TC_GEONW_PON_GBC_AREA_CBF_BV_22)
                         */
                        function f_GEONW_PON_GBC_AREA_CBF_BV_22_nodeC() runs on ItsGeoNetworking {
                            
                            // Local variables
                            var LongPosVector v_longPosVectorNodeC := f_getPosition(c_compNodeC);
                            
                            // 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_longPosVectorNodeC),
                                        ?,
                                        f_getGeoBroadcastArea(c_area1)
                                    )))) {
                                    tc_ac.stop;
                                    log("*** " & testcasename() & ": PASS: GBC message broadcasted ***");
                                    f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                                }
                                [] tc_ac.timeout {
                                    log("*** " & testcasename() & ": FAIL: GBC message not broadcasted ***");
                                    f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                                }
                            }
                            
                            // Postamble
                            f_poNeighbour();
                            
                        } // end f_GEONW_PON_GBC_AREA_CBF_BV_22_nodeC
                        
                        /**
                         * @desc    Behavior function for NodeD (TC_GEONW_PON_GBC_AREA_CBF_BV_22)
                         */
                        function f_GEONW_PON_GBC_AREA_CBF_BV_22_nodeD() runs on ItsGeoNetworking {
                            
                            // Local variables
                            var LongPosVector v_longPosVectorNodeC := f_getPosition(c_compNodeC);
                            var LongPosVector v_longPosVectorNodeD := f_getPosition(c_compNodeD);
                            timer t_toCbf := int2float(f_getCbfMaxTime()) * 0.95 / 1000.0;
                            
                            // Preamble                    
                            v_longPosVectorNodeD.pai := int2bit(0,1);
                            f_changePositon(c_compNodeD, v_longPosVectorNodeD); 
                            f_prNeighbour();
                            f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                            
                            // Test Body
                            f_sendGeoNetMessage(
                                m_geoNwReq_linkLayerBroadcast(
                                    m_geoNwPdu(
                                        m_geoNwBroadcastPacket(
                                            v_longPosVectorNodeC,
                                            vc_localSeqNumber,
                                            f_getGeoBroadcastArea(c_area1)
                                        )
                                    )
berge's avatar
berge committed
                            );
                            
                            t_toCbf.start;                    
                            tc_ac.start;
                            alt {
                                [] geoNetworkingPort.receive(mw_geoNwInd(mw_geoNwPdu(mw_geoNwBroadcastPacketWithArea(
                                        mw_longPosVectorPosition(v_longPosVectorNodeC),
                                        ?,
                                        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);
                                    }
                                    else {
                                        log("*** " & testcasename() & ": PASS: GBC message received ***");
                                        f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                                    }
                                }
                                [] t_toCbf.timeout {
                                    log("*** " & testcasename() & ": INFO: CBF timer elapsed ***");
                                    repeat;
                                }
                                [] tc_ac.timeout {
                                    log("*** " & testcasename() & ": FAIL: GBC message not received ***");
                                    f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                                }
                            }
                            
                            // Postamble
                            f_poDefault();
                            
                        } // end f_GEONW_PON_GBC_AREA_CBF_BV_22_nodeD
                        
                    } // end GEONW_PON_GBC_AREA_CBF_BV_22
berge's avatar
berge committed
11855 11856 11857 11858 11859 11860 11861 11862 11863 11864 11865 11866 11867 11868 11869 11870 11871 11872 11873 11874 11875 11876 11877 11878 11879 11880 11881 11882 11883 11884 11885 11886 11887 11888 11889 11890 11891 11892 11893 11894 11895 11896 11897 11898 11899 11900 11901 11902 11903 11904 11905 11906 11907 11908 11909 11910 11911 11912 11913 11914 11915 11916 11917 11918 11919 11920 11921 11922 11923 11924 11925 11926 11927 11928 11929 11930 11931 11932 11933 11934 11935 11936 11937 11938 11939 11940 11941 11942 11943 11944 11945 11946 11947 11948 11949 11950 11951 11952 11953 11954 11955 11956 11957 11958 11959 11960 11961 11962 11963 11964 11965 11966 11967 11968 11969 11970 11971 11972 11973 11974 11975 11976 11977 11978 11979 11980 11981 11982 11983 11984 11985 11986 11987 11988 11989 11990 11991 11992 11993 11994 11995 11996 11997 11998 11999 12000 12001 12002 12003 12004 12005 12006 12007 12008 12009 12010 12011 12012 12013 12014 12015 12016 12017 12018 12019 12020 12021 12022 12023 12024 12025 12026 12027 12028 12029 12030 12031 12032 12033 12034 12035 12036 12037 12038 12039 12040 12041 12042 12043 12044 12045 12046 12047 12048 12049 12050 12051 12052 12053 12054 12055 12056 12057 12058 12059 12060 12061 12062 12063 12064 12065 12066 12067 12068 12069 12070 12071 12072 12073 12074 12075 12076 12077 12078 12079 12080 12081 12082 12083 12084 12085 12086 12087 12088 12089 12090 12091 12092 12093 12094 12095 12096 12097 12098 12099 12100 12101 12102 12103 12104 12105 12106 12107 12108 12109 12110 12111 12112 12113 12114 12115 12116 12117 12118 12119 12120 12121 12122 12123 12124 12125 12126 12127 12128 12129 12130 12131 12132 12133 12134 12135 12136 12137 12138 12139 12140 12141 12142 12143 12144 12145 12146 12147 12148 12149 12150 12151 12152 12153 12154 12155 12156 12157 12158 12159 12160 12161 12162 12163 12164 12165 12166 12167 12168 12169 12170 12171 12172 12173 12174 12175 12176 12177 12178 12179 12180 12181 12182 12183 12184 12185 12186 12187 12188 12189 12190 12191 12192 12193 12194 12195 12196 12197 12198 12199 12200 12201 12202 12203 12204 12205
				} // end gbcAreaContentionBasedForwarding
				
				group gbcAreaAdvancedForwarding {

                    group GEONW_PON_GBC_AREA_ADV_BV_21 {
                        
                        /**
                         * @desc    TP Function for TC_GEONW_PON_GBC_AREA_ADV_BV_21
                         */
                        function f_GEONW_PON_GBC_AREA_ADV_BV_21() runs on ItsMtc {
                            
                            // Local variables
                            var ItsGeoNetworking v_nodeB;
                            var ItsGeoNetworking v_nodeE;
                            
                            // Test control
                            if (not PICS_GN_GBC_FWD) {
                                log("*** " & testcasename() & ": PICS_GN_GBC_FWD required for executing the TC ***");
                                setverdict(inconc);
                                stop;
                            }
                            if (f_getAreaForwardingAlgorithm() != e_advanced) {
                                log("*** " & testcasename() & ": PICS_GN_AREA_FORWARDING_ALGORITHM == e_advanced required for executing the TC ***");
                                setverdict(inconc);
                                stop;
                            }
                            
        //                    if (f_getCbfMinTime() < 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_GBC_AREA_ADV_BV_21_nodeB());
                            v_nodeE.start(f_GEONW_PON_GBC_AREA_ADV_BV_21_nodeE());
                            
                            // Synchronization
                            f_serverSync2ClientsAndStop({c_prDone, c_tbDone});
                            
                            // Cleanup
                            f_cf05Down();
                            
                        } // end f_GEONW_PON_GBC_AREA_ADV_BV_21
                        
                        /**
                         * @desc    Behavior function for NodeB (TC_GEONW_PON_GBC_AREA_ADV_BV_21)
                         */
                        function f_GEONW_PON_GBC_AREA_ADV_BV_21_nodeB() runs on ItsGeoNetworking {
                            
                            // Local variables
                            var LongPosVector v_longPosVectorNodeB := f_getPosition(c_compNodeB);
                            timer t_toCbf := int2float(f_getCbfMaxTime()) * 0.95 / 1000.0;
                            
                            // Preamble
                            f_prNeighbour();
                            f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                            
                            // Test Body
                            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);
                                    }
                                    else {
                                        log("*** " & testcasename() & ": PASS: GBC message received ***");
                                        f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                                    }
                                }
                                [] 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);
                                }
                            }
                            
                            // Postamble
                            f_poNeighbour();
                            
                        } // end f_GEONW_PON_GBC_AREA_ADV_BV_21_nodeB
                        
                        /**
                         * @desc    Behavior function for NodeE (TC_GEONW_PON_GBC_AREA_ADV_BV_21)
                         */
                        function f_GEONW_PON_GBC_AREA_ADV_BV_21_nodeE() runs on ItsGeoNetworking {
                            
                            // Local variables
                            var LongPosVector v_longPosVectorNodeB := f_getPosition(c_compNodeB);
                            timer t_toCbf := int2float(f_getCbfMaxTime()) * 0.95 / 1000.0;
                            
                            // Preamble
                            f_prNonNeighbour();
                            f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                            
                            // 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);
                                    }
                                    else {
                                        log("*** " & testcasename() & ": PASS: GBC message received ***");
                                        f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                                    }
                                }
                                [] 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);
                                }
                            }
                            
                            // Postamble
                            f_poNeighbour();
                            
                        } // end f_GEONW_PON_GBC_AREA_ADV_BV_21_nodeE
                        
                    } // end GEONW_PON_GBC_AREA_ADV_BV_21

                    group GEONW_PON_GBC_AREA_ADV_BV_23 {
                        
                        /**
                         * @desc    TP Function for TC_GEONW_PON_GBC_AREA_ADV_BV_23
                         */
                        function f_GEONW_PON_GBC_AREA_ADV_BV_23() runs on ItsMtc {
                            
                            // Local variables
                            var ItsGeoNetworking v_nodeB;
                            var ItsGeoNetworking v_nodeF;
                            
                            // Test control
                            if (not PICS_GN_GBC_FWD) {
                                log("*** " & testcasename() & ": PICS_GN_GBC_FWD required for executing the TC ***");
                                setverdict(inconc);
                                stop;
                            }
                            if (f_getAreaForwardingAlgorithm() != e_advanced) {
                                log("*** " & testcasename() & ": PICS_GN_AREA_FORWARDING_ALGORITHM == e_advanced required for executing the TC ***");
                                setverdict(inconc);
                                stop;
                            }
                            
        //                    if (f_getCbfMinTime() < 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_GBC_AREA_ADV_BV_23_nodeB());
                            v_nodeF.start(f_GEONW_PON_GBC_AREA_ADV_BV_23_nodeF());
                            
                            // Synchronization
                            f_serverSync2ClientsAndStop({c_prDone, c_tbDone});
                            
                            // Cleanup
                            f_cf06Down();
                            
                        } // end f_GEONW_PON_GBC_AREA_ADV_BV_23
                        
                        /**
                         * @desc    Behavior function for NodeB (TC_GEONW_PON_GBC_AREA_ADV_BV_23)
                         */
                        function f_GEONW_PON_GBC_AREA_ADV_BV_23_nodeB() runs on ItsGeoNetworking {
                            
                            // Local variables
                            
                            // Preamble
                            f_prNeighbour();
                            f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                            
                            // 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);
                                }
                                [] tc_noac.timeout {
                                    log("*** " & testcasename() & ": PASS: No message received ***");
                                    f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                                }
                            }
                            
                            // Postamble
                            f_poNeighbour();
                            
                        } // end f_GEONW_PON_GBC_AREA_ADV_BV_23_nodeB
                        
                        /**
                         * @desc    Behavior function for NodeF (TC_GEONW_PON_GBC_AREA_ADV_BV_23)
                         */
                        function f_GEONW_PON_GBC_AREA_ADV_BV_23_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);
                            
                            // 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);
                                }
                                [] tc_noac.timeout {
                                    log("*** " & testcasename() & ": PASS: No message received ***");
                                    f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                                }
                            }
                            
                            // Postamble
                            f_poNeighbour();
                            
                        } // end f_GEONW_PON_GBC_AREA_ADV_BV_23_nodeF
                        
                    } // end GEONW_PON_GBC_AREA_ADV_BV_23

                    group GEONW_PON_GBC_AREA_ADV_BV_24 {
                        
                        /**
                         * @desc    TP Function for TC_GEONW_PON_GBC_AREA_ADV_BV_24
                         */
                        function f_GEONW_PON_GBC_AREA_ADV_BV_24() runs on ItsMtc {
                            
                            // Local variables
                            var ItsGeoNetworking v_nodeB;
                            var ItsGeoNetworking v_nodeE;
                                                            
                            // Test control
                            if (not PICS_GN_GBC_FWD) {
                                log("*** " & testcasename() & ": PICS_GN_GBC_FWD required for executing the TC ***");
                                setverdict(inconc);
                                stop;
                            }
                            if (f_getAreaForwardingAlgorithm() != e_advanced) {
                                log("*** " & testcasename() & ": PICS_GN_AREA_FORWARDING_ALGORITHM == e_advanced required for executing the TC ***");
                                setverdict(inconc);
                                stop;
                            }
                            
        //                    if (f_getCbfMinTime() < 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_GBC_AREA_ADV_BV_24_nodeB());
                            v_nodeE.start(f_GEONW_PON_GBC_AREA_ADV_BV_24_nodeE());
                            
                            // Synchronization
                            f_serverSync2ClientsAndStop({c_prDone, c_tbDone});
                            
                            // Cleanup
                            f_cf05Down();
                            
                        } // end f_GEONW_PON_GBC_AREA_ADV_BV_24
                        
                        /**
                         * @desc    Behavior function for NodeB (TC_GEONW_PON_GBC_AREA_ADV_BV_24)
                         */
                        function f_GEONW_PON_GBC_AREA_ADV_BV_24_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)
                                    )
berge's avatar
berge committed
                            ));
                            f_selfOrClientSyncAndVerdict(c_prDone, e_success);
berge's avatar
berge 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);
                                }
                                [] tc_noac.timeout {
                                    log("*** " & testcasename() & ": PASS: No message received ***");
                                    f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                                }
berge's avatar
berge committed
                            
                            // Postamble
                            f_poNeighbour();
                            
                        } // end f_GEONW_PON_GBC_AREA_ADV_BV_24_nodeB
                        
                        /**
                         * @desc    Behavior function for NodeE (TC_GEONW_PON_GBC_AREA_ADV_BV_24)
                         */
                        function f_GEONW_PON_GBC_AREA_ADV_BV_24_nodeE() runs on ItsGeoNetworking {
                            
                            // Local variables
                            var LongPosVector v_longPosVectorNodeB := f_getPosition(c_compNodeB);
                            
                            // Preamble
                            f_prNeighbour();
                            f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                            
                            // 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);
                                }
                                [] tc_noac.timeout {
                                    log("*** " & testcasename() & ": PASS: No message received ***");
                                    f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                                }
berge's avatar
berge committed
                            
                            // Postamble
                            f_poNeighbour();
                            
                        } // end f_GEONW_PON_GBC_AREA_ADV_BV_24_nodeE
                        
                    } // end GEONW_PON_GBC_AREA_ADV_BV_24
berge's avatar
berge committed
                    group GEONW_PON_GBC_AREA_ADV_BV_25 {
                        
                        /**
                         * @desc    TP Function for TC_GEONW_PON_GBC_AREA_ADV_BV_25
                         */
                        function f_GEONW_PON_GBC_AREA_ADV_BV_25() runs on ItsMtc {
                            
                            // Local variables
                            var ItsGeoNetworking v_nodeB;
                            var ItsGeoNetworking v_nodeF;
                                
                            // Test control
                            if (not PICS_GN_GBC_FWD) {
                                log("*** " & testcasename() & ": PICS_GN_GBC_FWD required for executing the TC ***");
                                setverdict(inconc);
                                stop;
                            }
                            if (f_getAreaForwardingAlgorithm() != e_advanced) {
                                log("*** " & testcasename() & ": PICS_GN_AREA_FORWARDING_ALGORITHM == e_advanced required for executing the TC ***");
                                setverdict(inconc);
                                stop;
                            }
                            
        //                    if (f_getCbfMinTime() < 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_GBC_AREA_ADV_BV_25_nodeB());
                            v_nodeF.start(f_GEONW_PON_GBC_AREA_ADV_BV_25_nodeF());
                            
                            // Synchronization
                            f_serverSync2ClientsAndStop({c_prDone, c_tbDone});
                            
                            // Cleanup
                            f_cf06Down();
                            
                        } // end f_GEONW_PON_GBC_AREA_ADV_BV_25
                        
                        /**
                         * @desc    Behavior function for NodeB (TC_GEONW_PON_GBC_AREA_ADV_BV_25)
                         */
                        function f_GEONW_PON_GBC_AREA_ADV_BV_25_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);
                            
                            // 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: GBC message received ***");
                                    f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                                }
                                [] tc_ac.timeout {
                                    log("*** " & testcasename() & ": FAIL: GBC message not received ***");
                                    f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                                }
                            }
                            
                            // Postamble
                            f_poNeighbour();
                            
                        } // end f_GEONW_PON_GBC_AREA_ADV_BV_25_nodeB
                        
                        /**
                         * @desc    Behavior function for NodeF (TC_GEONW_PON_GBC_AREA_ADV_BV_25)
                         */
                        function f_GEONW_PON_GBC_AREA_ADV_BV_25_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_getCbfMaxTime())
                                + (
                                    int2float(f_getCbfMinTime() - f_getCbfMaxTime())
                                    / int2float(f_getCbfMaxCommunicationRange())
                                ) * f_distance(v_longPosVectorNodeF, v_longPosVectorIut)) * 0.95 / 1000.0;
                            
                            // Preamble
                            f_prNeighbour();
                            f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                            
                            // 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);
                                    }
                                    else {
                                        log("*** " & testcasename() & ": PASS: GBC message received ***");
                                        f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                                    }
                                }
                                [] t_toCbf.timeout {
                                    log("*** " & testcasename() & ": INFO: CBF timer elapsed ***");
                                    repeat;
                                }
                                [] tc_ac.timeout {
                                    log("*** " & testcasename() & ": FAIL: GBC message not received ***");
                                    f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                                }
                            }
                            
                            // Postamble
                            f_poNeighbour();
                            
                        } // end f_GEONW_PON_GBC_AREA_ADV_BV_25_nodeF
                        
                    } // end GEONW_PON_GBC_AREA_ADV_BV_25
berge's avatar
berge committed
                    group GEONW_PON_GBC_AREA_ADV_BV_26 {
                        
                        /**
                         * @desc    TP Function for TC_GEONW_PON_GBC_AREA_ADV_BV_26
                         */
                        function f_GEONW_PON_GBC_AREA_ADV_BV_26() runs on ItsMtc {
                            
                            // Local variables
                            var ItsGeoNetworking v_nodeB;
                            var ItsGeoNetworking v_nodeD;
                                
                            // Test control
                            if (not PICS_GN_GBC_FWD) {
                                log("*** " & testcasename() & ": PICS_GN_GBC_FWD required for executing the TC ***");
                                setverdict(inconc);
                                stop;
                            }
                            if (f_getAreaForwardingAlgorithm() != e_advanced) {
                                log("*** " & testcasename() & ": PICS_GN_AREA_FORWARDING_ALGORITHM == e_advanced required for executing the TC ***");
                                setverdict(inconc);
                                stop;
                            }
                            
        //                    if (f_getCbfMinTime() < 300) {
        //                        log("*** " & testcasename() & ": PICS_GN_GEOBROADCAST_CBF_MIN_TIME >= 300 required for executing the TC ***");
        //                        setverdict(inconc);
        //                        stop;
        //                    }
                            
                            // Test component configuration
                            f_cf07Up();
                            
                            // Preamble
                                            
                            // Start components
                            v_nodeB := f_getComponent(c_compNodeB);
                            v_nodeD := f_getComponent(c_compNodeD);
                            v_nodeB.start(f_GEONW_PON_GBC_AREA_ADV_BV_26_nodeB());
                            v_nodeD.start(f_GEONW_PON_GBC_AREA_ADV_BV_26_nodeD());
                            
                            // Synchronization
                            f_serverSync2ClientsAndStop({c_prDone, c_tbDone});
                            
                            // Cleanup
                            f_cf06Down();
                            
                        } // end f_GEONW_PON_GBC_AREA_ADV_BV_26
                        
                        /**
                         * @desc    Behavior function for NodeB (TC_GEONW_PON_GBC_AREA_ADV_BV_26)
                         */
                        function f_GEONW_PON_GBC_AREA_ADV_BV_26_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);
                            
                            // 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: GBC message received ***");
                                    f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                                }
                                [] tc_ac.timeout {
                                    log("*** " & testcasename() & ": FAIL: GBC message not received ***");
                                    f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                                }
                            }
                            
                            // Postamble
                            f_poNeighbour();
                            
                        } // end f_GEONW_PON_GBC_AREA_ADV_BV_26_nodeB
                        
                        /**
                         * @desc    Behavior function for NodeD (TC_GEONW_PON_GBC_AREA_ADV_BV_26)
                         */
                        function f_GEONW_PON_GBC_AREA_ADV_BV_26_nodeD() runs on ItsGeoNetworking {
                            
                            // Local variables
                            var LongPosVector v_longPosVectorNodeB := f_getPosition(c_compNodeB);
                            var LongPosVector v_longPosVectorIut := f_getPosition(c_compIut);
                            timer t_toCbf := (int2float(f_getCbfMaxTime())
                                + (
                                    int2float(f_getCbfMinTime() - f_getCbfMaxTime())
                                    / int2float(f_getCbfMaxCommunicationRange())
                                ) * f_distance(v_longPosVectorNodeB, v_longPosVectorIut)) * 0.95 / 1000.0;
                            
                            // Preamble
                            f_prNeighbour();
                            f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                            
                            // 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);
                                    }
                                    else {
                                        log("*** " & testcasename() & ": PASS: GBC message received ***");
                                        f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                                    }
                                }
                                [] t_toCbf.timeout {
                                    log("*** " & testcasename() & ": INFO: CBF timer elapsed ***");
                                    repeat;
                                }
                                [] tc_ac.timeout {
                                    log("*** " & testcasename() & ": FAIL: GBC message not received ***");
                                    f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                                }
                            }
                            
                            // Postamble
                            f_poNeighbour();
                            
                        } // end f_GEONW_PON_GBC_AREA_ADV_BV_26_nodeD
                        
                    } // end GEONW_PON_GBC_AREA_ADV_BV_26
berge's avatar
berge committed
                    group GEONW_PON_GBC_AREA_ADV_BV_27 {
                        
                        /**
                         * @desc    TP Function for TC_GEONW_PON_GBC_AREA_ADV_BV_27
                         */
                        function f_GEONW_PON_GBC_AREA_ADV_BV_27() runs on ItsMtc {
                            
                            // Local variables
                            var ItsGeoNetworking v_nodeB;
                            var ItsGeoNetworking v_nodeE;
                            
                            // Test control
                            if (not PICS_GN_GBC_FWD) {
                                log("*** " & testcasename() & ": PICS_GN_GBC_FWD required for executing the TC ***");
                                setverdict(inconc);
                                stop;
                            }
                            if (f_getAreaForwardingAlgorithm() != e_advanced) {
                                log("*** " & testcasename() & ": PICS_GN_AREA_FORWARDING_ALGORITHM == e_advanced required for executing the TC ***");
                                setverdict(inconc);
                                stop;
                            }
                            
        //                    if (f_getCbfMinTime() < 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_GBC_AREA_ADV_BV_27_nodeB());
                            v_nodeE.start(f_GEONW_PON_GBC_AREA_ADV_BV_27_nodeE());
                            
                            // Synchronization
                            f_serverSync2ClientsAndStop({c_prDone, c_tbDone});
                            
                            // Cleanup
                            f_cf05Down();
                            
                        } // end f_GEONW_PON_GBC_AREA_ADV_BV_27
                        
                        /**
                         * @desc    Behavior function for NodeB (TC_GEONW_PON_GBC_AREA_ADV_BV_27)
                         */
                        function f_GEONW_PON_GBC_AREA_ADV_BV_27_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 forwarded ***");
                                    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_GBC_AREA_ADV_BV_27_nodeB
                        
                        /**
                         * @desc    Behavior function for NodeE (TC_GEONW_PON_GBC_AREA_ADV_BV_27)
                         */
                        function f_GEONW_PON_GBC_AREA_ADV_BV_27_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()
                                )
                            );
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
berge's avatar
berge committed
12692 12693 12694 12695 12696 12697 12698 12699 12700 12701 12702 12703 12704 12705 12706 12707 12708 12709 12710 12711 12712 12713 12714 12715 12716 12717 12718 12719 12720 12721 12722 12723 12724 12725 12726 12727 12728 12729 12730 12731 12732 12733 12734 12735 12736 12737 12738 12739 12740 12741 12742 12743 12744 12745 12746 12747 12748 12749 12750 12751 12752 12753 12754 12755 12756 12757 12758 12759 12760 12761 12762 12763 12764 12765 12766 12767 12768 12769 12770 12771 12772 12773 12774 12775 12776 12777 12778 12779 12780 12781 12782 12783 12784 12785 12786 12787 12788 12789 12790 12791 12792 12793 12794 12795 12796 12797 12798 12799 12800 12801 12802 12803 12804 12805 12806 12807 12808 12809 12810 12811 12812 12813 12814 12815 12816 12817 12818 12819 12820 12821 12822 12823 12824 12825 12826 12827 12828 12829 12830 12831 12832 12833 12834 12835 12836 12837 12838 12839 12840 12841 12842 12843 12844 12845 12846 12847 12848 12849 12850 12851 12852 12853 12854 12855 12856 12857 12858 12859 12860 12861 12862 12863 12864 12865 12866 12867 12868 12869 12870 12871 12872 12873 12874 12875 12876 12877 12878 12879 12880 12881 12882 12883 12884 12885 12886 12887 12888 12889 12890 12891 12892 12893 12894 12895 12896 12897 12898 12899 12900 12901 12902 12903 12904 12905 12906 12907 12908 12909 12910 12911 12912 12913 12914 12915 12916 12917 12918 12919 12920 12921 12922 12923 12924 12925 12926 12927 12928 12929 12930 12931 12932 12933 12934 12935 12936 12937 12938 12939 12940 12941 12942 12943 12944 12945 12946 12947 12948 12949 12950 12951 12952 12953 12954 12955 12956 12957
                            
                            // Postamble
                            f_poNeighbour();
                            
                        } // end f_GEONW_PON_GBC_AREA_ADV_BV_27_nodeE
                        
                    } // end GEONW_PON_GBC_AREA_ADV_BV_27

                    group GEONW_PON_GBC_AREA_ADV_BV_28 {
                        
                        /**
                         * @desc    TP Function for TC_GEONW_PON_GBC_AREA_ADV_BV_28
                         */
                        function f_GEONW_PON_GBC_AREA_ADV_BV_28() runs on ItsMtc {
                            
                            // Local variables
                            var ItsGeoNetworking v_nodeB;
                            var ItsGeoNetworking v_nodeE;
                            
                            // Test control
                            if (not PICS_GN_GBC_FWD) {
                                log("*** " & testcasename() & ": PICS_GN_GBC_FWD required for executing the TC ***");
                                setverdict(inconc);
                                stop;
                            }
                            if (f_getAreaForwardingAlgorithm() != e_advanced) {
                                log("*** " & testcasename() & ": PICS_GN_AREA_FORWARDING_ALGORITHM == e_advanced required for executing the TC ***");
                                setverdict(inconc);
                                stop;
                            }
                            
        //                    if (f_getCbfMinTime() < 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_GBC_AREA_ADV_BV_28_nodeB());
                            v_nodeE.start(f_GEONW_PON_GBC_AREA_ADV_BV_28_nodeE());
                            
                            // Synchronization
                            f_serverSync2ClientsAndStop({c_prDone, c_tbDone});
                            
                            // Cleanup
                            f_cf05Down();
                            
                        } // end f_GEONW_PON_GBC_AREA_ADV_BV_28
                        
                        /**
                         * @desc    Behavior function for NodeB (TC_GEONW_PON_GBC_AREA_ADV_BV_28)
                         */
                        function f_GEONW_PON_GBC_AREA_ADV_BV_28_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_GBC_AREA_ADV_BV_28_nodeB
                        
                        /**
                         * @desc    Behavior function for NodeE (TC_GEONW_PON_GBC_AREA_ADV_BV_28)
                         */
                        function f_GEONW_PON_GBC_AREA_ADV_BV_28_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_GBC_AREA_ADV_BV_28_nodeE
                        
                    } // end GEONW_PON_GBC_AREA_ADV_BV_28
                                
                    group GEONW_PON_GBC_AREA_ADV_BV_29 {
                        
                        /**
                         * @desc    TP Function for TC_GEONW_PON_GBC_AREA_ADV_BV_29
                         */
                        function f_GEONW_PON_GBC_AREA_ADV_BV_29() runs on ItsMtc {
                            
                            // Local variables
                            var ItsGeoNetworking v_nodeB;
                            var ItsGeoNetworking v_nodeE;
                                                
                            // Test control
                            if (not PICS_GN_GBC_FWD) {
                                log("*** " & testcasename() & ": PICS_GN_GBC_FWD required for executing the TC ***");
                                setverdict(inconc);
                                stop;
                            }
                            if (f_getAreaForwardingAlgorithm() != e_advanced) {
                                log("*** " & testcasename() & ": PICS_GN_AREA_FORWARDING_ALGORITHM == e_advanced required for executing the TC ***");
                                setverdict(inconc);
                                stop;
                            }
                            
        //                    if (f_getCbfMinTime() < 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_GBC_AREA_ADV_BV_29_nodeB());
                            v_nodeE.start(f_GEONW_PON_GBC_AREA_ADV_BV_29_nodeE());
                            
                            // Synchronization
                            f_serverSync2ClientsAndStop({c_prDone, c_tbDone});
                            
                            // Cleanup
                            f_cf05Down();
                            
                        } // end f_GEONW_PON_GBC_AREA_ADV_BV_29
                        
                        /**
                         * @desc    Behavior function for NodeB (TC_GEONW_PON_GBC_AREA_ADV_BV_29)
                         */
                        function f_GEONW_PON_GBC_AREA_ADV_BV_29_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_getCbfMaxTime())
                                + (
                                    int2float(f_getCbfMinTime() - f_getCbfMaxTime())
                                    / int2float(f_getCbfMaxCommunicationRange())
                                ) * f_distance(v_longPosVectorNodeE, v_longPosVectorIut)) * 0.95 / 1000.0;
                            
                            // Preamble
                            f_prNeighbour();
                            f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                            
                            // 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);
                                    }
                                    else {
                                        log("*** " & testcasename() & ": PASS: GBC message received ***");
                                        f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                                    }
                                }
                                [] 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);
                                }
                            }
                            
                            // Postamble
                            f_poNeighbour();
                            
                        } // end f_GEONW_PON_GBC_AREA_ADV_BV_29_nodeB
                        
                        /**
                         * @desc    Behavior function for NodeE (TC_GEONW_PON_GBC_AREA_ADV_BV_29)
                         */
                        function f_GEONW_PON_GBC_AREA_ADV_BV_29_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_getCbfMaxTime())
                                + (
                                    int2float(f_getCbfMinTime() - f_getCbfMaxTime())
                                    / int2float(f_getCbfMaxCommunicationRange())
                                ) * f_distance(v_longPosVectorNodeE, v_longPosVectorIut)) * 0.95 / 1000.0;
                            
                            // Preamble
                            f_prNeighbour();
                            f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                            
                            // Test Body
                            f_sendGeoNetMessage(
                                m_geoNwReq_linkLayerBroadcast(
                                    m_geoNwPdu(m_geoNwBroadcastPacket(
                                            v_longPosVectorNodeE,
                                            0,
                                            f_getGeoBroadcastArea(c_area1)
                                        )
berge's avatar
berge committed
                                    )
                                )
                            );
                            
                            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);
                                    }
                                    else {
                                        log("*** " & testcasename() & ": PASS: GBC message received ***");
                                        f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                                    }
                                }
                                [] 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);
                                }
                            }
                            
                            // Postamble
                            f_poNeighbour();
                            
                        } // end f_GEONW_PON_GBC_AREA_ADV_BV_29_nodeE
                        
                    } // end GEONW_PON_GBC_AREA_ADV_BV_29

				} // end gbcAreaAdvancedForwarding
            
			} // end gbcAreaForwarding
            
        } // end geoGeoBroadcast
        
        // 6.2.2.10
        group geoTopologicallyScopedBroadcast {
berge's avatar
berge committed
            group GEONW_PON_TSB_BV_01 {
berge's avatar
berge committed
                 * @desc    TP Function for TC_GEONW_PON_TSB_BV_01
berge's avatar
berge committed
                function f_GEONW_PON_TSB_BV_01() runs on ItsMtc {
                    
                    // Local variables
                    var ItsGeoNetworking v_nodeB;
berge's avatar
berge committed
                    var ItsGeoNetworking v_nodeD;
                    
berge's avatar
berge committed
                    if (not PICS_GN_TSB_SRC) {
                        log("*** " & testcasename() & ": PICS_GN_TSB_SRC required for executing the TC ***");
                        setverdict(inconc);
                        stop;
                    }
                    
                    // Test component configuration
berge's avatar
berge committed
                    f_cf02Up();
                    // Start components
                    v_nodeB := f_getComponent(c_compNodeB);
berge's avatar
berge committed
                    v_nodeD := f_getComponent(c_compNodeD);
                    v_nodeB.start(f_GEONW_PON_TSB_BV_01_nodeB());
                    v_nodeD.start(f_GEONW_PON_TSB_BV_01_nodeD());
                    
                    // Synchronization
                    f_serverSync2ClientsAndStop({c_prDone, c_tbDone});
                    
                    // Cleanup
berge's avatar
berge committed
                    f_cf02Down();
berge's avatar
berge committed
                } // end f_GEONW_PON_TSB_BV_01
berge's avatar
berge committed
                 * @desc    Behavior function for NodeB (TC_GEONW_PON_TSB_BV_01)
berge's avatar
berge committed
                function f_GEONW_PON_TSB_BV_01_nodeB() runs on ItsGeoNetworking {
berge's avatar
berge committed
                    var LongPosVector v_longPosVectorIut := f_getPosition(c_compIut);
                    
                    // Preamble
                    f_prNeighbour();
                    f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                    
                    // Test Body
berge's avatar
berge committed
                    if ( not f_utTriggerEvent(m_generateTsbMessage) ) {
                        log("*** " & testcasename() & ": INCONC: Trigger failed ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
                    }
                    tc_ac.start;
berge's avatar
berge committed
                        [] geoNetworkingPort.receive(
                                mw_geoNwInd(
                                    mw_geoNwPdu(
                                        mw_geoNwTsbPacket(?, mw_longPosVectorPosition(v_longPosVectorIut))
                                    )
                                )
                            ) {
                            tc_ac.stop;
                            log("*** " & testcasename() & ": PASS: TSB packet received correctly  ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                        }
berge's avatar
berge committed
                        [] tc_ac.timeout {
                            log("*** " & testcasename() & ": FAIL: Expected TSB message not received ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                        }
berge's avatar
berge committed
                } // end f_GEONW_PON_TSB_BV_01_nodeB
berge's avatar
berge committed
                 * @desc    Behavior function for NodeD (TC_GEONW_PON_TSB_BV_01)
berge's avatar
berge committed
                function f_GEONW_PON_TSB_BV_01_nodeD() runs on ItsGeoNetworking {
berge's avatar
berge committed
                    var LongPosVector v_longPosVectorIut := f_getPosition(c_compIut);
                    
                    // Preamble
                    f_prNeighbour();
                    f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                    
                    // Test Body
berge's avatar
berge committed
                    tc_ac.start;
berge's avatar
berge committed
                        [] geoNetworkingPort.receive(
                                mw_geoNwInd(
                                    mw_geoNwPdu(
                                        mw_geoNwTsbPacket(?, mw_longPosVectorPosition(v_longPosVectorIut))
                                    )
                                )
                            ) {
                            tc_ac.stop;
                            log("*** " & testcasename() & ": PASS: TSB packet received correctly  ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                        }
berge's avatar
berge committed
                        [] tc_ac.timeout {
                            log("*** " & testcasename() & ": FAIL: Expected TSB message not received ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                        }
berge's avatar
berge committed
                } // end f_GEONW_PON_TSB_BV_01_nodeD
berge's avatar
berge committed
            } // end GEONW_PON_TSB_BV_01
berge's avatar
berge committed
            group GEONW_PON_TSB_BV_02 {
berge's avatar
berge committed
                 * @desc    TP Function for TC_GEONW_PON_TSB_BV_02
berge's avatar
berge committed
                function f_GEONW_PON_TSB_BV_02() runs on ItsMtc {
                    
                    // Local variables
                    var ItsGeoNetworking v_nodeB;
berge's avatar
berge committed
                    var ItsGeoNetworking v_nodeD;
                    
berge's avatar
berge committed
                    if (not PICS_GN_TSB_FWD) {
                        log("*** " & testcasename() & ": PICS_GN_TSB_FWD required for executing the TC ***");
                        setverdict(inconc);
                        stop;
                    }
                    
                    // Test component configuration
berge's avatar
berge committed
                    f_cf02Up();
berge's avatar
berge committed
                    v_nodeB := f_getComponent(c_compNodeB);                    
                    v_nodeD := f_getComponent(c_compNodeD);
                    v_nodeB.start(f_GEONW_PON_TSB_BV_02_nodeB());
                    v_nodeD.start(f_GEONW_PON_TSB_BV_02_nodeD());
                    
                    // Synchronization
                    f_serverSync2ClientsAndStop({c_prDone, c_tbDone});
                    
                    // Cleanup
berge's avatar
berge committed
                    f_cf02Down();
berge's avatar
berge committed
                } // end f_GEONW_PON_TSB_BV_02
berge's avatar
berge committed
                 * @desc    Behavior function for NodeB (TC_GEONW_PON_TSB_BV_02)
berge's avatar
berge committed
                function f_GEONW_PON_TSB_BV_02_nodeB() runs on ItsGeoNetworking {
                    
                    // Local variables
                    var LongPosVector v_longPosVectorNodeB := f_getPosition(c_compNodeB);
                    
                    // Preamble
                    f_prNeighbour();
berge's avatar
berge committed
                    f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                    
                    // Test Body
                    f_sendGeoNetMessage(
                        m_geoNwReq_linkLayerBroadcast(
                            m_geoNwPdu(
                                m_geoNwTsbPacket(
                                    vc_localSeqNumber,
                                    v_longPosVectorNodeB
                                ),
                                -,
                                c_defaultHopLimit
berge's avatar
berge committed
                        [] geoNetworkingPort.receive(
                                mw_geoNwInd(
                                    mw_geoNwPdu(
                                        mw_geoNwTsbPacket(
                                            ?,
                                            mw_longPosVectorPosition(v_longPosVectorNodeB)
                                        )
                                    )
                                )
                            ) {
berge's avatar
berge committed
                            log("*** " & testcasename() & ": PASS: TSB packet received correctly  ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
berge's avatar
berge committed
                            log("*** " & testcasename() & ": FAIL: Expected TSB message not received ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                        }
                    }
                    
                    // Postamble
                    f_poNeighbour();
                    
berge's avatar
berge committed
                } // end f_GEONW_PON_TSB_BV_02_nodeB
berge's avatar
berge committed
                 * @desc    Behavior function for NodeD (TC_GEONW_PON_TSB_BV_02)
berge's avatar
berge committed
                function f_GEONW_PON_TSB_BV_02_nodeD() runs on ItsGeoNetworking {
                    
                    // Local variables
                    var LongPosVector v_longPosVectorNodeB := f_getPosition(c_compNodeB);
                    
                    // Preamble
                    f_prNeighbour();
                    f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                    
                    // Test Body
                    tc_ac.start;
                    alt {
berge's avatar
berge committed
                        [] geoNetworkingPort.receive(
                                mw_geoNwInd(
                                    mw_geoNwPdu(
                                        mw_geoNwTsbPacket(
                                            ?,
                                            mw_longPosVectorPosition(v_longPosVectorNodeB)
                                        )
                                    )
                                )
                            ) {
                            tc_ac.stop;
                            log("*** " & testcasename() & ": PASS: TSB packet received correctly  ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
berge's avatar
berge committed
                            log("*** " & testcasename() & ": FAIL: Expected TSB message not received ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                        }
                    }
                    
                    // Postamble
                    f_poNeighbour();
                    
berge's avatar
berge committed
                } // end f_GEONW_PON_TSB_BV_02_nodeD
berge's avatar
berge committed
            } // end GEONW_PON_TSB_BV_02
berge's avatar
berge committed
            group GEONW_PON_TSB_BV_03 {
berge's avatar
berge committed
                 * @desc    TP Function for TC_GEONW_PON_TSB_BV_03
berge's avatar
berge committed
                function f_GEONW_PON_TSB_BV_03() runs on ItsMtc {
                    
                    // Local variables
                    var ItsGeoNetworking v_nodeB;
berge's avatar
berge committed
                    var ItsGeoNetworking v_nodeD;
berge's avatar
berge committed
                    if (not PICS_GN_TSB_FWD) {
                        log("*** " & testcasename() & ": PICS_GN_TSB_FWD required for executing the TC ***");
                        setverdict(inconc);
                        stop;
                    }
                    
                    // Test component configuration
berge's avatar
berge committed
                    f_cf02Up();
berge's avatar
berge committed
                    v_nodeB := f_getComponent(c_compNodeB);                    
                    v_nodeD := f_getComponent(c_compNodeD);
                    v_nodeB.start(f_GEONW_PON_TSB_BV_03_nodeB());
                    v_nodeD.start(f_GEONW_PON_TSB_BV_03_nodeD());
                    
                    // Synchronization
                    f_serverSync2ClientsAndStop({c_prDone, c_tbDone});
                    
                    // Cleanup
berge's avatar
berge committed
                    f_cf02Down();
berge's avatar
berge committed
                } // end f_GEONW_PON_TSB_BV_03
berge's avatar
berge committed
                 * @desc    Behavior function for NodeB (TC_GEONW_PON_TSB_BV_03)
berge's avatar
berge committed
                function f_GEONW_PON_TSB_BV_03_nodeB() runs on ItsGeoNetworking {
berge's avatar
berge committed
                    var LongPosVector v_longPosVectorNodeB := f_getPosition(c_compNodeB);
                    
                    // Preamble
                    f_prNeighbour();
                    f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                    
berge's avatar
berge committed
                    // Test Body
                    f_sendGeoNetMessage(
                        m_geoNwReq_linkLayerBroadcast(
                            m_geoNwPdu(
                                m_geoNwTsbPacket(
                                    vc_localSeqNumber,
                                    v_longPosVectorNodeB,
                                    c_defaultHopLimit
                                ),
                                -,
                                c_defaultHopLimit
                            )
                        )
                    );
                    
berge's avatar
berge committed
                    alt {
                        [] geoNetworkingPort.receive(
                                mw_geoNwInd(
                                    mw_geoNwPdu(
                                        mw_geoNwTsbPacket(
                                            ?,
                                            mw_longPosVectorPosition(v_longPosVectorNodeB)
                                        ),
                                        -,
                                        c_defaultHopLimit - 1
                                    )
                                )
                            ) {
berge's avatar
berge committed
                            log("*** " & testcasename() & ": PASS: TSB packet received correctly ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                        }
berge's avatar
berge committed
                        [] geoNetworkingPort.receive(
                                mw_geoNwInd(
                                    mw_geoNwPdu(
                                        mw_geoNwTsbPacket(
                                            ?,
                                            mw_longPosVectorPosition(v_longPosVectorNodeB)
                                        ),
                                        -,
                                        ?
                                    )
                                )
                            ) {
                            tc_ac.stop;
                            log("*** " & testcasename() & ": FAIL: TSB packet received with incorrect HopLimit ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                        }
berge's avatar
berge committed
                        [] tc_ac.timeout {
                            log("*** " & testcasename() & ": INCONC: Expected TSB message not received ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
                        }
berge's avatar
berge committed
                } // end f_GEONW_PON_TSB_BV_03_nodeB
berge's avatar
berge committed
                 * @desc    Behavior function for NodeD (TC_GEONW_PON_TSB_BV_03)
berge's avatar
berge committed
                function f_GEONW_PON_TSB_BV_03_nodeD() runs on ItsGeoNetworking {
berge's avatar
berge committed
                    var LongPosVector v_longPosVectorNodeB := f_getPosition(c_compNodeB);
                    
                    // Preamble
                    f_prNeighbour();
                    f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                    
                    // Test Body
berge's avatar
berge committed
                    tc_ac.start;
                    alt {
                        [] geoNetworkingPort.receive(
                                mw_geoNwInd(
                                    mw_geoNwPdu(
                                        mw_geoNwTsbPacketWithHl(
                                            ?,
                                            mw_longPosVectorPosition(v_longPosVectorNodeB),
                                            c_defaultHopLimit
                                        ),
                                        -,
                                        c_defaultHopLimit - 1
                                    )
                                )
                            ) {
                            tc_ac.stop;
                            log("*** " & testcasename() & ": PASS: TSB packet received correctly ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                        }
                        [] geoNetworkingPort.receive(
                                mw_geoNwInd(
                                    mw_geoNwPdu(
                                        mw_geoNwTsbPacket(
                                            ?,
                                            mw_longPosVectorPosition(v_longPosVectorNodeB)
                                        ),
                                        -,
                                        ?
                                    )
                                )
                            ) {
                            tc_ac.stop;
                            log("*** " & testcasename() & ": FAIL: TSB packet received with incorrect HopLimit ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                        }
                        [] tc_ac.timeout {
                            log("*** " & testcasename() & ": INCONC: Expected TSB message not received ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
                        }
                    }
berge's avatar
berge committed
                } // end f_GEONW_PON_TSB_BV_03_nodeD
berge's avatar
berge committed
            } // end GEONW_PON_TSB_BV_03
            
            group GEONW_PON_TSB_BO_04 {
berge's avatar
berge committed
                 * @desc    TP Function for TC_GEONW_PON_TSB_BO_04
berge's avatar
berge committed
                function f_GEONW_PON_TSB_BO_04() runs on ItsMtc {
                    
                    // Local variables
                    var ItsGeoNetworking v_nodeB;
berge's avatar
berge committed
                    var ItsGeoNetworking v_nodeD;
berge's avatar
berge committed
                    if (not PICS_GN_TSB_FWD) {
                        log("*** " & testcasename() & ": PICS_GN_TSB_FWD required for executing the TC ***");
                        setverdict(inconc);
                        stop;
                    }
                    
                    // Test component configuration
berge's avatar
berge committed
                    f_cf02Up();
berge's avatar
berge committed
                    v_nodeB := f_getComponent(c_compNodeB);                    
                    v_nodeD := f_getComponent(c_compNodeD);
                    v_nodeB.start(f_GEONW_PON_TSB_BO_04_nodeB());
                    v_nodeD.start(f_GEONW_PON_TSB_BO_04_nodeD());
                    
                    // Synchronization
                    f_serverSync2ClientsAndStop({c_prDone, c_tbDone});
                    
                    // Cleanup
berge's avatar
berge committed
                    f_cf02Down();
berge's avatar
berge committed
                } // end f_GEONW_PON_TSB_BO_04
berge's avatar
berge committed
                 * @desc    Behavior function for NodeB (TC_GEONW_PON_TSB_BO_04)
berge's avatar
berge committed
                function f_GEONW_PON_TSB_BO_04_nodeB() runs on ItsGeoNetworking {
berge's avatar
berge committed
                    var LongPosVector v_longPosVectorNodeB := f_getPosition(c_compNodeB);
                    
                    // Preamble
                    f_prNeighbour();
                    f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                    
                    // Test Body
berge's avatar
berge committed
                    f_sendGeoNetMessage(
                        m_geoNwReq_linkLayerBroadcast(
                            m_geoNwPdu(
                                m_geoNwTsbPacket(
                                    vc_localSeqNumber,
                                    v_longPosVectorNodeB
                                ),
                                -,
                                1
                            )
                        )
                    );
                    f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
berge's avatar
berge committed
                } // end f_GEONW_PON_TSB_BO_04_nodeB
berge's avatar
berge committed
                 * @desc    Behavior function for NodeD (TC_GEONW_PON_TSB_BO_04)
berge's avatar
berge committed
                function f_GEONW_PON_TSB_BO_04_nodeD() runs on ItsGeoNetworking {
berge's avatar
berge committed
                    var LongPosVector v_longPosVectorNodeB := f_getPosition(c_compNodeB);
                    
                    // Preamble
                    f_prNeighbour();
                    f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                    
                    // Test Body
berge's avatar
berge committed
                    tc_noac.start;
                    alt {
                        [] geoNetworkingPort.receive(
                                mw_geoNwInd(
                                    mw_geoNwPdu(
                                        mw_geoNwTsbPacket(
                                            ?,
                                            mw_longPosVectorPosition(v_longPosVectorNodeB)
                                        )
                                    )
berge's avatar
berge committed
                            ) {
                            tc_noac.stop;
                            log("*** " & testcasename() & ": FAIL: TSB message was re-broadcasted  ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                        }
berge's avatar
berge committed
                        [] tc_noac.timeout {
                            log("*** " & testcasename() & ": PASS: TSB message was not re-broadcasted ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                        }
berge's avatar
berge committed
                } // end f_GEONW_PON_TSB_BO_04_nodeD
berge's avatar
berge committed
            } // end GEONW_PON_TSB_BO_04
            
            /**
             * @desc    TP Function for TC_GEONW_PON_TSB_BV_05
             */
            function f_GEONW_PON_TSB_BV_05() runs on ItsGeoNetworking {
                
                // Local variables
                var LongPosVector v_longPosVectorNodeB;
                var template (value) GeoNetworkingPdu v_gnPacket;
                var integer i;
                var GnRawPayload v_sentRawPayload;
                
                // Test control
                if (not PICS_GN_TSB_DST) {
                    log("*** " & testcasename() & ": PICS_GN_TSB_DST required for executing the TC ***");
                    setverdict(inconc);
                    stop;
                }
                
                // Test component configuration
                f_cf01Up();
                v_longPosVectorNodeB := f_getPosition(c_compNodeB);
                
                // Test adapter configuration
                
                // Preamble
                f_prDefault();
                f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                
                // Test Body
                v_gnPacket := m_geoNwPdu(m_geoNwTsbPacket(
                                            vc_localSeqNumber,
                                            v_longPosVectorNodeB
                                        )
                                    );
                f_sendGeoNetMessage(m_geoNwReq_linkLayerBroadcast(v_gnPacket));
                
                f_sleep(PX_TAC);
                
                v_sentRawPayload := f_adaptPayloadForUtInd_m(v_gnPacket.gnPacket.packet.payload);
                for(i:=0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i:=i+1) {
                    // empty on purpose 
                }
                if(i < lengthof(vc_utInds)) {
                    log("*** " & testcasename() & ": PASS: GN was transmitted to upper layer ***");
                    f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                }
                else {
                    log("*** " & testcasename() & ": FAIL: GN was not transmitted to upper layer ***");
                    f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                }
                
                log("*** " & testcasename() & ": TSB packet passed to Upper Layer  ***");
                f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                
                // Postamble
                f_poDefault();
                f_cf01Down();
                
            } // end f_GEONW_PON_TSB_BV_05

            group GEONW_PON_TSB_BO_07 {
berge's avatar
berge committed
                 * @desc    TP Function for TC_GEONW_PON_TSB_BO_07 
berge's avatar
berge committed
                function f_GEONW_PON_TSB_BO_07() runs on ItsMtc {
                    
                    // Local variables
                    var ItsGeoNetworking v_nodeB;
berge's avatar
berge committed
                    var ItsGeoNetworking v_nodeD;
                    
berge's avatar
berge committed
                    if (not PICS_GN_TSB_FWD) {
                        log("*** " & testcasename() & ": PICS_GN_TSB_FWD required for executing the TC ***");
                        setverdict(inconc);
                        stop;
                    }
                    
                    // Test component configuration
berge's avatar
berge committed
                    f_cf02Up();
                    
                    // Preamble
                    
                    // Start components
                    v_nodeB := f_getComponent(c_compNodeB);
berge's avatar
berge committed
                    v_nodeD := f_getComponent(c_compNodeD);
                    v_nodeB.start(f_GEONW_PON_TSB_BO_07_nodeB());
                    v_nodeD.start(f_GEONW_PON_TSB_BO_07_nodeD());
                    
                    // Synchronization
                    f_serverSync2ClientsAndStop({c_prDone, c_tbDone});
                    
                    // Cleanup
berge's avatar
berge committed
                    f_cf02Down();
berge's avatar
berge committed
                } // end f_GEONW_PON_TSB_BO_07
berge's avatar
berge committed
                 * @desc    Behavior function for NodeB (TC_GEONW_PON_TSB_BO_07)
berge's avatar
berge committed
                function f_GEONW_PON_TSB_BO_07_nodeB() runs on ItsGeoNetworking {
berge's avatar
berge committed
                    var LongPosVector v_longPosVectorNodeB := f_getPosition(c_compNodeB);
                    var template (present) GeoNetworkingPdu v_gnPacket;
berge's avatar
berge committed
                    v_gnPacket := m_geoNwPdu(
                                      m_geoNwTsbPacket(
                                          vc_localSeqNumber,
                                          v_longPosVectorNodeB
                                      ),
                                      -,
                                      c_defaultHopLimit
                                  );
                    
                    f_sendGeoNetMessage(m_geoNwReq_linkLayerBroadcast(valueof(v_gnPacket)));
                    v_gnPacket.basicHeader.routerHopLimit := ?;
                    tc_noac.start;
                    alt {
                        [] geoNetworkingPort.receive(
                                mw_geoNwInd(
                                    mw_geoNwPdu(
                                        mw_geoNwTsbPacket(
                                            ?,
                                            mw_longPosVectorPosition(v_longPosVectorNodeB)
                                        )
                                    )
                                )
                            ) {
                            tc_noac.stop;
                            log("*** " & testcasename() & ": PASS: Pre-conditions: TSB packet received correctly  ***");
                            f_selfOrClientSyncAndVerdict(c_prDone, e_success);
berge's avatar
berge committed
                        [] tc_noac.timeout {
                            log("*** " & testcasename() & ": INCONC: Pre-conditions: Expected TSB message not received ***");
                            f_selfOrClientSyncAndVerdict(c_prDone, e_timeout);
berge's avatar
berge committed
                    }
                    
                    // Test Body
                    tc_noac.start;
                    alt {
                        []  geoNetworkingPort.receive(
                                mw_geoNwInd(
                                    mw_geoNwPdu(
                                        mw_geoNwTsbPacket(
                                            ?,
                                            mw_longPosVectorPosition(v_longPosVectorNodeB)
                                        )
                                    )
                                )
                            ) {
                            tc_noac.stop;
                            log("*** " & testcasename() & ": FAIL: The same TSB packet was re-broadcasted ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                        }
berge's avatar
berge committed
                        [] tc_noac.timeout {
                            log("*** " & testcasename() & ": PASS: The same TSB packet was not re-broadcasted ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                        }
berge's avatar
berge committed
                } // end f_GEONW_PON_TSB_BO_07_nodeB
berge's avatar
berge committed
                 * @desc    Behavior function for NodeD (TC_GEONW_PON_TSB_BO_07)
berge's avatar
berge committed
                function f_GEONW_PON_TSB_BO_07_nodeD() runs on ItsGeoNetworking {
berge's avatar
berge committed
                    var LongPosVector v_longPosVectorNodeB := f_getPosition(c_compNodeB);
                    var template (value) GeoNetworkingInd v_msgInd;
                    
                    // Preamble
                    f_prNeighbour();
                    tc_ac.start;
berge's avatar
berge committed
                    alt {
                        [] geoNetworkingPort.receive(
                                mw_geoNwInd(
                                    mw_geoNwPdu(
                                        mw_geoNwTsbPacket(
                                            ?,
                                            mw_longPosVectorPosition(v_longPosVectorNodeB)
                                        )
                                    )
                                )
                            ) -> value v_msgInd {
berge's avatar
berge committed
                            log("*** " & testcasename() & ": PASS: Pre-conditions: TSB packet received correctly  ***");
                            f_selfOrClientSyncAndVerdict(c_prDone, e_success);
berge's avatar
berge committed
                            log("*** " & testcasename() & ": INCONC: Pre-conditions: Expected TSB message not received ***");
                            f_selfOrClientSyncAndVerdict(c_prDone, e_timeout);
                        }
                    }
                    
                    // Test Body
                    v_msgInd.msgIn.basicHeader.routerHopLimit := valueof(v_msgInd.msgIn.basicHeader.routerHopLimit) -1;
                    f_sendGeoNetMessage(m_geoNwReq_linkLayerBroadcast(v_msgInd.msgIn));
                    
                    tc_noac.start;
                    alt {
                        [] geoNetworkingPort.receive(v_msgInd) {
                            tc_noac.stop;
                            log("*** " & testcasename() & ": FAIL: The same TSB packet was re-broadcasted ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                        }
berge's avatar
berge committed
                        [] tc_noac.timeout {
                            log("*** " & testcasename() & ": PASS: The same TSB packet was not re-broadcasted ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                        }
berge's avatar
berge committed
                } // end f_GEONW_PON_TSB_BO_07_nodeD
berge's avatar
berge committed
            } // end GEONW_PON_TSB_BO_07
berge's avatar
berge committed
            group GEONW_PON_TSB_BO_08 {
berge's avatar
berge committed
                 * @desc    TP Function for TC_GEONW_PON_TSB_BV_08
berge's avatar
berge committed
                function f_GEONW_PON_TSB_BO_08() runs on ItsMtc {
                    
                    // Local variables
                    var ItsGeoNetworking v_nodeB;
                    var ItsGeoNetworking v_nodeD;
berge's avatar
berge committed
                    if (not PICS_GN_TSB_DST) {
                        log("*** " & testcasename() & ": PICS_GN_TSB_DST required for executing the TC ***");
                        setverdict(inconc);
                        stop;
                    }
                    
                    // Test component configuration
berge's avatar
berge committed
                    f_cf02Up(c_compNodeB);
                    
                    // Preamble
                    
                    // Start components
                    v_nodeB := f_getComponent(c_compNodeB);
                    v_nodeD := f_getComponent(c_compNodeD);
berge's avatar
berge committed
                    v_nodeB.start(f_GEONW_PON_TSB_BO_08_nodeB());
                    v_nodeD.start(f_GEONW_PON_TSB_BO_08_nodeD());
berge's avatar
berge committed
                    f_serverSync2ClientsAndStop({c_prDone, c_tbDone});
berge's avatar
berge committed
                    f_cf02Down();
berge's avatar
berge committed
                } // end f_GEONW_PON_TSB_BO_08
berge's avatar
berge committed
                 * @desc    Behavior function for NodeB (TC_GEONW_PON_TSB_BO_08)
berge's avatar
berge committed
                function f_GEONW_PON_TSB_BO_08_nodeB() runs on ItsGeoNetworking {
berge's avatar
berge committed
                    var LongPosVector v_longPosVectorNodeB := f_getPosition(c_compNodeB);
                    var template (value) GeoNetworkingPdu v_gnPacket;
                    var integer i;
                    var GnRawPayload v_sentRawPayload;
berge's avatar
berge committed
                    v_gnPacket := m_geoNwPdu(m_geoNwTsbPacket(
                                                vc_localSeqNumber,
                                                v_longPosVectorNodeB
                                            ),
                                            -,
                                            c_defaultHopLimit
                                        );
                    f_sendGeoNetMessage(m_geoNwReq_linkLayerBroadcast(valueof(v_gnPacket)));
berge's avatar
berge committed
                    alt {
                        [] geoNetworkingPort.receive(
                                mw_geoNwInd(
                                    mw_geoNwPdu(
                                        mw_geoNwTsbPacket(
                                            ?,
                                            mw_longPosVectorPosition(v_longPosVectorNodeB)
                                        )
                                    )
                                )
                            ) {
berge's avatar
berge committed
                            
                            f_sleep(PX_TAC);
                            
                            v_sentRawPayload := f_adaptPayloadForUtInd_m(v_gnPacket.gnPacket.packet.payload);
                            for(i:=0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i:=i+1) {
                                // empty on purpose 
                            }
                            if(i < lengthof(vc_utInds)) {
                                log("*** " & testcasename() & ": PASS: Pre-conditions: TSB correctly rebroadcasted and passed to Upper Layer ***");
                                vc_utInds := {};
                                f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                            }
                            else {
                                log("*** " & testcasename() & ": INCONC: TSB was not transmitted to upper layer ***");
                                f_selfOrClientSyncAndVerdict(c_prDone, e_error);
                            }
berge's avatar
berge committed
                            log("*** " & testcasename() & ": INCONC: Pre-conditions: TSB not rebroadcasted ***");
                            f_selfOrClientSyncAndVerdict(c_prDone, e_timeout);
berge's avatar
berge committed
                    f_sleep(PX_TAC);
                    
                    v_sentRawPayload := f_adaptPayloadForUtInd_m(v_gnPacket.gnPacket.packet.payload);
                    for(i:=0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i:=i+1) {
                        // empty on purpose 
                    }
                    if(i < lengthof(vc_utInds)) {
                        log("*** " & testcasename() & ": FAIL: Same TSB packet was transmitted to upper layer ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                    }
                    else {
                        log("*** " & testcasename() & ": PASS: Same TSB packet was not passed to Upper Layer  ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                    }
berge's avatar
berge committed
                } // end f_GEONW_PON_TSB_BO_08_nodeB
berge's avatar
berge committed
                 * @desc    Behavior function for NodeD (TC_GEONW_PON_TSB_BO_08)
berge's avatar
berge committed
                function f_GEONW_PON_TSB_BO_08_nodeD() runs on ItsGeoNetworking {
berge's avatar
berge committed
                    var LongPosVector v_longPosVectorNodeB := f_getPosition(c_compNodeB);
                    var template (value) GeoNetworkingInd v_msgInd;
                    var integer i;
                    var template (value) GeoNetworkingPdu v_gnPacket;
berge's avatar
berge committed
                    tc_ac.start;
berge's avatar
berge committed
                        [] geoNetworkingPort.receive(
                                mw_geoNwInd(
                                    mw_geoNwPdu(
                                        mw_geoNwTsbPacket(
                                            ?,
                                            mw_longPosVectorPosition(v_longPosVectorNodeB)
                                        )
                                    )
                                )
                            ) -> value v_msgInd {
                            tc_ac.stop;
                            log("*** " & testcasename() & ": PASS: Pre-conditions: TSB correctly rebroadcasted ***");
                            f_selfOrClientSyncAndVerdict(c_prDone, e_success);
berge's avatar
berge committed
                        [] tc_ac.timeout {
                            log("*** " & testcasename() & ": INCONC: Pre-conditions: TSB not rebroadcasted ***");
                            f_selfOrClientSyncAndVerdict(c_prDone, e_timeout);
berge's avatar
berge committed
                    // Test Body
                    v_msgInd.msgIn.basicHeader.routerHopLimit := valueof(v_msgInd.msgIn.basicHeader.routerHopLimit) - 1;
                    v_gnPacket := v_msgInd.msgIn;
                    f_sendGeoNetMessage(m_geoNwReq_linkLayerBroadcast(v_msgInd.msgIn));
                    f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                    
berge's avatar
berge committed
                } // end f_GEONW_PON_TSB_BO_08_nodeD
berge's avatar
berge committed
            } // end GEONW_PON_TSB_BO_08
            
        } // end geoTopologicallyScopedBroadcast
        
        // 6.2.2.11
        group geoSingleHopBroadcast {
berge's avatar
berge committed
            group GEONW_PON_SHB_BV_01 {
berge's avatar
berge committed
                 * @desc    TP Function for TC_GEONW_PON_SHB_BV_01
berge's avatar
berge committed
                function f_GEONW_PON_SHB_BV_01() runs on ItsMtc {
                    
                    // Local variables
                    var ItsGeoNetworking v_nodeB;
                    var ItsGeoNetworking v_nodeD;
berge's avatar
berge committed
                    
                    // Test control
                    if (not PICS_GN_SHB_SRC) {
                        log("*** " & testcasename() & ": PICS_GN_SHB_SRC required for executing the TC ***");
                        setverdict(inconc);
                        stop;
                    }
                    
                    // Test component configuration
berge's avatar
berge committed
                    f_cf02Up();
                    
                    // Preamble
                    
                    // Start components
                    v_nodeB := f_getComponent(c_compNodeB);
                    v_nodeD := f_getComponent(c_compNodeD);
berge's avatar
berge committed
                    v_nodeB.start(f_GEONW_PON_SHB_BV_01_nodeB());
                    v_nodeD.start(f_GEONW_PON_SHB_BV_01_nodeD());
berge's avatar
berge committed
                    f_serverSync2ClientsAndStop({c_prDone, c_tbDone});
berge's avatar
berge committed
                    f_cf02Down();
berge's avatar
berge committed
                } // end f_GEONW_PON_SHB_BV_01
berge's avatar
berge committed
                 * @desc    Behavior function for NodeB (TC_GEONW_PON_SHB_BV_01)
berge's avatar
berge committed
                function f_GEONW_PON_SHB_BV_01_nodeB() runs on ItsGeoNetworking {
berge's avatar
berge committed
                    var LongPosVector v_longPosVectorIut := f_getPosition(c_compIut);
                    
                    // Preamble
                    f_prNeighbour();
                    f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                    
                    // Test Body
berge's avatar
berge committed
                    if ( not f_utTriggerEvent(m_generateShbMessage) ) {
                        log("*** " & testcasename() & ": INCONC: Trigger failed ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
                    }
                    
                    tc_ac.start;
berge's avatar
berge committed
                        [] geoNetworkingPort.receive(
                                mw_geoNwInd(
                                    mw_geoNwPdu(
                                        mw_geoNwShbPacket(mw_longPosVectorPosition(v_longPosVectorIut))
                                    )
                                )
                            ) {
                            tc_ac.stop;
                            log("*** " & testcasename() & ": PASS: SHB packet received correctly  ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                        }
berge's avatar
berge committed
                        [] tc_ac.timeout {
                            log("*** " & testcasename() & ": FAIL: Expected SHB message not received ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                        }
berge's avatar
berge committed
                } // end f_GEONW_PON_SHB_BV_01_nodeB
berge's avatar
berge committed
                 * @desc    Behavior function for NodeD (TC_GEONW_PON_SHB_BV_01)
berge's avatar
berge committed
                function f_GEONW_PON_SHB_BV_01_nodeD() runs on ItsGeoNetworking {
berge's avatar
berge committed
                    var LongPosVector v_longPosVectorIut := f_getPosition(c_compIut);
                    
                    // Preamble
                    f_prNeighbour();
                    f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                    
                    // Test Body
berge's avatar
berge committed
                    tc_ac.start;
berge's avatar
berge committed
                        [] geoNetworkingPort.receive(
                                mw_geoNwInd(
                                    mw_geoNwPdu(
                                        mw_geoNwShbPacket(mw_longPosVectorPosition(v_longPosVectorIut))
                                    )
                                )
                            ) {
                            tc_ac.stop;
                            log("*** " & testcasename() & ": PASS: SHB packet received correctly  ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                        }
                        [] tc_ac.timeout {
                            log("*** " & testcasename() & ": FAIL: Expected SHB message not received ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                        }
berge's avatar
berge committed
14045 14046 14047 14048 14049 14050 14051 14052 14053 14054 14055 14056 14057 14058 14059 14060 14061 14062 14063 14064 14065 14066 14067 14068 14069 14070 14071 14072 14073 14074 14075 14076 14077 14078 14079 14080 14081 14082 14083 14084 14085 14086 14087 14088 14089 14090 14091 14092 14093 14094 14095 14096 14097 14098 14099 14100 14101 14102 14103 14104 14105 14106 14107 14108 14109 14110 14111 14112 14113 14114 14115 14116 14117 14118 14119 14120 14121 14122 14123 14124 14125 14126 14127 14128 14129 14130 14131 14132 14133 14134 14135 14136 14137 14138 14139 14140 14141 14142 14143 14144 14145 14146 14147 14148 14149 14150 14151 14152 14153 14154 14155 14156 14157 14158 14159 14160 14161 14162 14163 14164 14165 14166 14167 14168 14169 14170 14171 14172 14173 14174 14175 14176 14177 14178 14179 14180 14181 14182 14183 14184 14185 14186 14187 14188 14189 14190 14191 14192 14193 14194 14195 14196 14197 14198 14199 14200 14201 14202 14203 14204 14205 14206 14207 14208 14209 14210 14211 14212 14213 14214 14215 14216 14217 14218 14219 14220 14221 14222 14223 14224 14225 14226 14227 14228 14229 14230 14231 14232 14233 14234 14235 14236 14237 14238 14239 14240 14241 14242 14243 14244 14245 14246 14247 14248 14249 14250 14251 14252 14253 14254 14255 14256 14257 14258 14259 14260 14261 14262 14263 14264 14265 14266 14267 14268 14269 14270 14271 14272 14273 14274 14275 14276 14277 14278 14279 14280 14281 14282 14283 14284 14285 14286 14287 14288 14289 14290 14291 14292 14293 14294 14295 14296 14297 14298 14299 14300 14301 14302 14303 14304 14305 14306 14307 14308 14309 14310 14311 14312 14313 14314 14315 14316 14317 14318 14319 14320 14321 14322 14323 14324 14325 14326 14327 14328 14329 14330 14331 14332 14333 14334 14335 14336 14337 14338 14339 14340 14341 14342 14343 14344 14345 14346 14347 14348 14349 14350 14351 14352 14353 14354 14355 14356 14357 14358 14359 14360 14361 14362 14363 14364 14365 14366 14367 14368 14369 14370 14371 14372 14373 14374 14375 14376 14377 14378 14379 14380 14381 14382 14383 14384 14385 14386 14387 14388 14389 14390 14391 14392 14393 14394 14395 14396 14397 14398 14399 14400 14401 14402 14403 14404 14405 14406 14407 14408 14409 14410 14411 14412 14413 14414 14415 14416 14417 14418 14419 14420 14421 14422 14423 14424 14425 14426 14427 14428 14429 14430 14431 14432 14433 14434 14435 14436 14437 14438 14439 14440 14441 14442 14443 14444 14445 14446 14447 14448 14449 14450 14451 14452 14453 14454 14455 14456 14457 14458 14459 14460 14461 14462 14463 14464 14465 14466 14467 14468 14469 14470 14471 14472 14473 14474 14475 14476 14477 14478 14479 14480 14481 14482 14483 14484 14485 14486 14487 14488 14489 14490 14491 14492 14493 14494 14495 14496 14497 14498 14499 14500 14501 14502 14503 14504 14505 14506 14507 14508 14509 14510 14511 14512 14513 14514 14515 14516 14517 14518 14519 14520 14521 14522 14523 14524 14525 14526 14527 14528 14529 14530 14531 14532 14533 14534 14535 14536 14537 14538 14539 14540 14541 14542 14543 14544 14545 14546 14547 14548 14549 14550 14551 14552 14553 14554 14555 14556 14557 14558 14559 14560 14561 14562 14563 14564 14565 14566 14567 14568 14569 14570 14571 14572 14573 14574 14575 14576 14577 14578 14579 14580 14581 14582 14583 14584 14585 14586 14587 14588 14589 14590 14591 14592 14593 14594 14595 14596 14597 14598 14599 14600 14601 14602 14603 14604 14605 14606 14607 14608 14609 14610 14611 14612 14613 14614 14615 14616 14617 14618 14619 14620 14621 14622 14623 14624 14625 14626 14627 14628 14629 14630 14631 14632 14633 14634 14635 14636 14637 14638 14639 14640 14641 14642 14643 14644 14645 14646 14647 14648 14649 14650 14651 14652 14653 14654 14655 14656 14657 14658 14659 14660 14661 14662 14663 14664 14665 14666 14667 14668 14669 14670 14671 14672 14673 14674 14675 14676 14677 14678 14679 14680 14681 14682 14683 14684 14685 14686 14687 14688 14689 14690 14691 14692 14693 14694 14695 14696 14697 14698 14699 14700 14701 14702 14703 14704 14705 14706 14707 14708 14709 14710 14711 14712 14713 14714 14715 14716 14717 14718 14719 14720 14721 14722 14723 14724 14725 14726 14727 14728 14729 14730 14731 14732 14733 14734 14735 14736 14737 14738 14739 14740 14741 14742 14743 14744 14745 14746 14747 14748 14749 14750 14751 14752 14753 14754 14755 14756 14757 14758 14759 14760 14761 14762 14763 14764 14765 14766 14767 14768 14769 14770 14771 14772 14773 14774 14775 14776 14777 14778 14779 14780 14781 14782 14783 14784 14785 14786 14787 14788 14789 14790 14791 14792 14793 14794 14795 14796 14797 14798 14799 14800 14801 14802 14803 14804 14805 14806 14807 14808 14809 14810 14811 14812 14813 14814 14815 14816 14817 14818 14819 14820 14821 14822 14823 14824 14825 14826 14827 14828 14829 14830 14831 14832 14833 14834 14835 14836 14837 14838 14839 14840 14841 14842 14843 14844 14845 14846 14847 14848 14849 14850 14851 14852 14853 14854 14855 14856 14857 14858 14859 14860 14861 14862 14863 14864 14865 14866 14867 14868 14869 14870 14871 14872 14873 14874 14875 14876 14877 14878 14879 14880 14881 14882 14883 14884 14885 14886 14887 14888 14889 14890 14891 14892 14893 14894 14895 14896 14897 14898 14899 14900 14901 14902 14903 14904 14905 14906 14907 14908 14909 14910 14911 14912 14913 14914 14915 14916 14917 14918 14919 14920 14921 14922 14923 14924 14925 14926 14927 14928 14929 14930 14931 14932 14933 14934 14935 14936 14937 14938 14939 14940 14941 14942 14943 14944 14945 14946 14947 14948 14949 14950 14951 14952 14953 14954 14955 14956 14957 14958 14959 14960 14961 14962
                    }
                    
                    // Postamble
                    f_poNeighbour();
                    
                } // end f_GEONW_PON_SHB_BV_01_nodeD
                
            } // end GEONW_PON_SHB_BV_01
            
            /**
             * @desc    TP Function for TC_GEONW_PON_SHB_BV_05
             */
            function f_GEONW_PON_SHB_BV_05() runs on ItsGeoNetworking {
                
                // Local variables
                var LongPosVector v_longPosVectorNodeB;
                var template (value) GeoNetworkingPdu v_gnPacket;
                var integer i;
                var GnRawPayload v_sentRawPayload;
                
                // Test control
                if (not PICS_GN_SHB_DST) {
                    log("*** " & testcasename() & ": PICS_GN_SHB_DST required for executing the TC ***");
                    setverdict(inconc);
                    stop;
                }
                 
                // Test component configuration
                f_cf01Up();
                v_longPosVectorNodeB:= f_getPosition(c_compNodeB);
                
                // Test adapter configuration
                
                // Preamble
                f_prNeighbour();
                f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                
                // Test Body
                v_gnPacket := m_geoNwPdu(m_geoNwShbPacket(v_longPosVectorNodeB));
                f_sendGeoNetMessage(m_geoNwReq_linkLayerBroadcast(v_gnPacket));
                
                f_sleep(PX_TAC);
                
                v_sentRawPayload := f_adaptPayloadForUtInd_m(v_gnPacket.gnPacket.packet.payload);
                for(i:=0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i:=i+1) {
                    // empty on purpose 
                }
                if(i < lengthof(vc_utInds)) {
                    log("*** " & testcasename() & ": PASS: GN was transmitted to upper layer ***");
                    f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                }
                else {
                    log("*** " & testcasename() & ": FAIL: GN was not transmitted to upper layer ***");
                    f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                }
                
                // Postamble
                f_poNeighbour();
                f_cf01Down();
                
            } // end f_GEONW_PON_SHB_BV_05
            
        } // end geoSingleHopBroadcast
        
        // 6.2.2.12
        group geoGeoAnycast {
            
			group gacNonAreaForwarding {
            
				group gacNonAreaAllForwardingAlgorithm {
            
                    group GEONW_PON_GAC_NONAREA_ALL_BV_03 {
                        
                        /**
                         * @desc    TP Function for TC_GEONW_PON_GAC_NONAREA_ALL_BV_03
                         */
                        function f_GEONW_PON_GAC_NONAREA_ALL_BV_03() runs on ItsMtc {
                            
                            // Local variables
                            var ItsGeoNetworking v_nodeB;
                            var ItsGeoNetworking v_nodeC;
                            
                            // Test control
                            if (not PICS_GN_GAC_FWD) {
                                log("*** " & testcasename() & ": PICS_GN_GAC_FWD required for executing the TC ***");
                                setverdict(inconc);
                                stop;
                            }
                            
                            // 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_GAC_NONAREA_ALL_BV_03_nodeB());
                            v_nodeC.start(f_GEONW_PON_GAC_NONAREA_ALL_BV_03_nodeC());
                            
                            // Synchronization
                            f_serverSync2ClientsAndStop({c_prDone, c_tbDone});
                            
                            // Cleanup
                            f_cf03Down();
                            
                        } // end f_GEONW_PON_GAC_NONAREA_ALL_BV_03
                        
                        /**
                         * @desc    Behavior function for NodeB (TC_GEONW_PON_GAC_NONAREA_ALL_BV_03)
                         */
                        function f_GEONW_PON_GAC_NONAREA_ALL_BV_03_nodeB() runs on ItsGeoNetworking {
                            
                            // Local variables
                            var LongPosVector v_longPosVectorNodeC := f_getPosition(c_compNodeC);
                            
                            // Preamble
                            f_prNeighbour();
                            f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                            
                            // Test Body
                            tc_ac.start;
                            alt {
                                [] a_receiveGeoAnycastWithAreaWithHopLimit(
                                    mw_longPosVectorPosition(v_longPosVectorNodeC),
                                    ?,
                                    f_getGeoAnycastArea(c_area2),
                                    c_defaultHopLimit - 1,
                                    c_defaultHopLimit) {
                                    tc_ac.stop;
                                    log("*** " & testcasename() & ": PASS: GAC message correctly retransmitted ***");
                                    f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                                }
								[] a_receiveGeoAnycastWithAreaWithHopLimit(
									mw_longPosVectorPosition(v_longPosVectorNodeC),
									?,
									f_getGeoAnycastArea(c_area2),
									?,
									?) {
									tc_ac.stop;
									log("*** " & testcasename() & ": FAIL: GAC message fields not updated ***");
									f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
								}
								[] tc_ac.timeout {
                                    log("*** " & testcasename() & ": INCONC: GAC message not retransmitted ***");
                                    f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                                }
                            }
                            
                            // Postamble
                            f_poNeighbour();
                            
                        } // end f_GEONW_PON_GAC_NONAREA_ALL_BV_03_nodeB
                        
                        /**
                         * @desc    Behavior function for NodeC (TC_GEONW_PON_GAC_NONAREA_ALL_BV_03)
                         */
                        function f_GEONW_PON_GAC_NONAREA_ALL_BV_03_nodeC() runs on ItsGeoNetworking {
                            
                            // Local variables
                            var LongPosVector v_longPosVectorNodeC := f_getPosition(c_compNodeC);
                            var GeoNetworkingInd v_msgInd;
                            
                            // Preamble
                            f_prNeighbour();
                            f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                            
                            // Test Body
                            f_sendGeoNetMessage(
                                m_geoNwReq_linkLayerBroadcast(
                                    m_geoNwPdu(
                                        m_geoNwAnycastPacket(
                                            v_longPosVectorNodeC,
                                            vc_localSeqNumber,
                                            f_getGeoAnycastArea(c_area2),
                                            c_defaultHopLimit
                                        ),
                                        -,
                                        c_defaultHopLimit
                                    )
                                )
                            );
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                            
                            // Postamble
                            f_poNeighbour();
                            
                        } // end f_GEONW_PON_GAC_NONAREA_ALL_BV_03_nodeC
                        
                    } // end GEONW_PON_GAC_NONAREA_ALL_BV_03
            
                    group GEONW_PON_GAC_NONAREA_ALL_BO_04 {
                        
                        /**
                         * @desc    TP Function for TC_GEONW_PON_GAC_NONAREA_ALL_BO_04
                         */
                        function f_GEONW_PON_GAC_NONAREA_ALL_BO_04() runs on ItsMtc {
                            
                            // Local variables
                            var ItsGeoNetworking v_nodeB;
                            var ItsGeoNetworking v_nodeC;
                            
                            // Test control
                            if (not PICS_GN_GAC_FWD) {
                                log("*** " & testcasename() & ": PICS_GN_GAC_FWD required for executing the TC ***");
                                setverdict(inconc);
                                stop;
                            }
                            
                            // 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_GAC_NONAREA_ALL_BO_04_nodeB());
                            v_nodeC.start(f_GEONW_PON_GAC_NONAREA_ALL_BO_04_nodeC());
                            
                            // Synchronization
                            f_serverSync2ClientsAndStop({c_prDone, c_tbDone});
                            
                            // Cleanup
                            f_cf03Down();
                            
                        } // end f_GEONW_PON_GAC_NONAREA_ALL_BO_04
                        
                        /**
                         * @desc    Behavior function for NodeB (TC_GEONW_PON_GAC_NONAREA_ALL_BO_04)
                         */
                        function f_GEONW_PON_GAC_NONAREA_ALL_BO_04_nodeB() runs on ItsGeoNetworking {
                            
                            // Local variables
                            var LongPosVector v_longPosVectorNodeC := f_getPosition(c_compNodeC);
                            
                            // Preamble
                            f_prNeighbour();
                            f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                            
                            // Test Body
                            tc_noac.start;
                            alt {
                                [] a_receiveGeoAnycastWithArea(
                                    mw_longPosVectorPosition(v_longPosVectorNodeC),
                                    ?,
                                    f_getGeoAnycastArea(c_area2)) {
                                    tc_noac.stop;
                                    log("*** " & testcasename() & ": FAIL: GAC message retransmitted ***");
                                    f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                                }
                                [] tc_noac.timeout {
                                    log("*** " & testcasename() & ": PASS: GAC message not retransmitted ***");
                                    f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                                }
                            }
                            
                            // Postamble
                            f_poNeighbour();
                            
                        } // end f_GEONW_PON_GAC_NONAREA_ALL_BO_04_nodeB
                        
                        /**
                         * @desc    Behavior function for NodeC (TC_GEONW_PON_GAC_NONAREA_ALL_BO_04)
                         */
                        function f_GEONW_PON_GAC_NONAREA_ALL_BO_04_nodeC() runs on ItsGeoNetworking {
                            
                            // Local variables
                            var LongPosVector v_longPosVectorNodeC := f_getPosition(c_compNodeC);
                            
                            // Preamble
                            f_prNeighbour();
                            f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                            
                            // Test Body
                            f_sendGeoNetMessage(
                                m_geoNwReq_linkLayerBroadcast(
                                    m_geoNwPdu(
                                        m_geoNwAnycastPacket(
                                            v_longPosVectorNodeC,
                                            vc_localSeqNumber,
                                            f_getGeoAnycastArea(c_area2)
                                        ),
                                        -,
                                        c_hopLimit1
                                    )
                                )
                            );
                            
							tc_noac.start;
                    	    alt {
                     	 	    [] a_receiveGeoAnycastWithArea(
                    		 	    mw_longPosVectorPosition(v_longPosVectorNodeC),
                    			    ?,
                    			    f_getGeoAnycastArea(c_area2)) {
                    			    tc_noac.stop;
                    			    log("*** " & testcasename() & ": FAIL: GAC message retransmitted ***");
                    			    f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                    		    }
                    		    [] tc_noac.timeout {
                    			    log("*** " & testcasename() & ": PASS: GAC message not retransmitted ***");
                    			    f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                    		    }
                    	    }
                            
                            // Postamble
                            f_poNeighbour();
                            
                        } // end f_GEONW_PON_GAC_NONAREA_ALL_BO_04_nodeC
                        
                    } // end GEONW_PON_GAC_NONAREA_ALL_BO_04
        
                    /**
                     * @desc    TP Function for TC_GEONW_PON_GAC_NONAREA_ALL_BV_06
                     */
                    function f_GEONW_PON_GAC_NONAREA_ALL_BV_06() runs on ItsGeoNetworking {
                        
                        // Local variables
                        var LongPosVector v_longPosVectorNodeB;
                        var template (value) GeoNetworkingPdu v_gnPacket;
                        var integer i;
                        var GnRawPayload v_sentRawPayload;
                        
                        // Test control
                        if (not PICS_GN_GAC_FWD) {
                            log("*** " & testcasename() & ": PICS_GN_GAC_FWD required for executing the TC ***");
                            setverdict(inconc);
                            stop;
                        }
                        
                        // Test component configuration
                        f_cf01Up();
                        v_longPosVectorNodeB := f_getPosition(c_compNodeB);
                        
                        // Test adapter configuration
                        
                        // Preamble
                        f_prNeighbour();
                        f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                        
                        // Test Body
                        v_gnPacket := m_geoNwPdu(m_geoNwAnycastPacket(
                                                    v_longPosVectorNodeB,
                                                    vc_localSeqNumber,
                                                    f_getGeoAnycastArea(c_area2)
                                                )
                                            );
                        f_sendGeoNetMessage(m_geoNwReq_linkLayerBroadcast(v_gnPacket));
        
                        f_sleep(PX_TAC);
                        
                        if(0 != lengthof(vc_utInds)) {
                            log("*** " & testcasename() & ": FAIL: GN was transmitted to upper layer ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                        }
                        else {
                            log("*** " & testcasename() & ": PASS: GN was NOT transmitted to upper layer ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                        }
                        
                        // Postamble
                        f_poNeighbour();
                        f_cf01Down();
                        
                    } // end f_GEONW_PON_GAC_NONAREA_ALL_BV_06

                    group GEONW_PON_GAC_NONAREA_ALL_BO_09 {
                        
                        /**
                         * @desc    TP Function for TC_GEONW_PON_GAC_NONAREA_ALL_BO_09
                         */
                        function f_GEONW_PON_GAC_NONAREA_ALL_BO_09() runs on ItsMtc {
                            
                            // Local variables
                            var ItsGeoNetworking v_nodeB;
                            var ItsGeoNetworking v_nodeC;
                            var ItsGeoNetworking v_nodeD;
                            var UInt16 v_distanceTooBig;
                            
                            // Test control
                            if (not PICS_GN_GAC_FWD) {
                                log("*** " & testcasename() & ": PICS_GN_GAC_FWD required for executing the TC ***");
                                setverdict(inconc);
                                stop;
                            }
                            
                            // Test component configuration
                            f_cf04Up();
                            v_distanceTooBig := float2int(1.1 * f_radiusFromCircularArea(f_getGnMaxAreaSize()*c_squareKm));
                            
                            // Preamble
                            
                            // Start components
                            v_nodeB := f_getComponent(c_compNodeB);
                            v_nodeC := f_getComponent(c_compNodeC);
                            v_nodeD := f_getComponent(c_compNodeD);
                            v_nodeB.start(f_GEONW_PON_GAC_NONAREA_ALL_BO_09_nodeB(v_distanceTooBig));
                            v_nodeC.start(f_GEONW_PON_GAC_NONAREA_ALL_BO_09_nodeC(v_distanceTooBig));
                            v_nodeD.start(f_GEONW_PON_GAC_NONAREA_ALL_BO_09_nodeD(v_distanceTooBig));
                            
                            // Synchronization
                            f_serverSync3ClientsAndStop({c_prDone, c_tbDone});
                            
                            // Cleanup
                            f_cf04Down();
                            
                        } // end f_GEONW_PON_GAC_NONAREA_ALL_BO_09
                        
                        /**
                         * @desc    Behavior function for NodeB (TC_GEONW_PON_GAC_NONAREA_ALL_BO_09)
                         */
                        function f_GEONW_PON_GAC_NONAREA_ALL_BO_09_nodeB(in UInt16 p_distanceTooBig) runs on ItsGeoNetworking {
                            
                            // Local variables
                            var LongPosVector v_longPosVectorNodeC := f_getPosition(c_compNodeC);
                            var GeoArea v_areaTooBig;
                            
                            // Preamble
                            f_prNeighbour();
                            v_areaTooBig := f_computeCircularArea(
                                f_computePosition(f_getPosition(c_compNodeB), 1000, 0), 
                                p_distanceTooBig
                            );
                            f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                            
                            // Test Body
                            tc_noac.start;
                            alt {
                                [] geoNetworkingPort.receive(mw_geoNwInd(mw_geoNwPdu(mw_geoNwAnycastPacketWithArea(
                                        mw_longPosVectorPosition(v_longPosVectorNodeC),
                                        ?,
                                        f_geoArea2GeoAnycastArea(v_areaTooBig)
                                    )))) {
                                    tc_noac.stop;
                                    log("*** " & testcasename() & ": FAIL: GAC message retransmitted ***");
                                    f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                                }
                                [] tc_noac.timeout {
                                    log("*** " & testcasename() & ": PASS: GAC message not retransmitted ***");
                                    f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                                }
                            }
                            
                            // Postamble
                            f_poNeighbour();
                            
                        } // end f_GEONW_PON_GAC_NONAREA_ALL_BO_09_nodeB
                        
                        /**
                         * @desc    Behavior function for NodeC (TC_GEONW_PON_GAC_NONAREA_ALL_BO_09)
                         */
                        function f_GEONW_PON_GAC_NONAREA_ALL_BO_09_nodeC(in UInt16 p_distanceTooBig) runs on ItsGeoNetworking {
                            
                            // Local variables
                            var LongPosVector v_longPosVectorNodeC := f_getPosition(c_compNodeC);
                            var GeoArea v_areaTooBig;
                            
                            // Preamble
                            f_prNeighbour();
                            v_areaTooBig := f_computeCircularArea(
                                f_computePosition(f_getPosition(c_compNodeB), 1000, 0), 
                                p_distanceTooBig
                            );
                            f_sendGeoNetMessage(
                                m_geoNwReq_linkLayerBroadcast(
                                    m_geoNwPdu(
                                        m_geoNwAnycastPacket(
                                            v_longPosVectorNodeC,
                                            vc_localSeqNumber,
                                            f_geoArea2GeoAnycastArea(v_areaTooBig)
                                        )
                                    )
                                )
                            );
                            
							tc_noac.start;
							alt {
								[] geoNetworkingPort.receive(mw_geoNwInd(mw_geoNwPdu(mw_geoNwAnycastPacketWithArea(
										mw_longPosVectorPosition(v_longPosVectorNodeC),
										?,
										f_geoArea2GeoAnycastArea(v_areaTooBig)
									)))) {
									tc_noac.stop;
									log("*** " & testcasename() & ": FAIL: GAC message retransmitted ***");
									f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
								}
								[] tc_noac.timeout {
									log("*** " & testcasename() & ": PASS: GAC message not retransmitted ***");
									f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
								}
							}

                            
                            // Test Body
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                            
                            // Postamble
                            f_poNeighbour();
                            
                        } // end f_GEONW_PON_GAC_NONAREA_ALL_BO_09_nodeC
                        
                        /**
                         * @desc    Behavior function for NodeD (TC_GEONW_PON_GAC_NONAREA_ALL_BO_09)
                         */
                        function f_GEONW_PON_GAC_NONAREA_ALL_BO_09_nodeD(in UInt16 p_distanceTooBig) runs on ItsGeoNetworking {
                            
                            // Local variables
                            var LongPosVector v_longPosVectorNodeC := f_getPosition(c_compNodeC);
                            var GeoArea v_areaTooBig;
                            
                            // Preamble
                            f_prNeighbour();
                            v_areaTooBig := f_computeCircularArea(
                                f_computePosition(f_getPosition(c_compNodeB), 1000, 0), 
                                p_distanceTooBig
                            );
                            f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                            
                            // Test Body
                            tc_noac.start;
                            alt {
                                [] geoNetworkingPort.receive(mw_geoNwInd(mw_geoNwPdu(mw_geoNwAnycastPacketWithArea(
                                        mw_longPosVectorPosition(v_longPosVectorNodeC),
                                        ?,
                                        f_geoArea2GeoAnycastArea(v_areaTooBig)
                                    )))) {
                                    tc_noac.stop;
                                    log("*** " & testcasename() & ": FAIL: GAC message retransmitted ***");
                                    f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                                }
                                [] tc_noac.timeout {
                                    log("*** " & testcasename() & ": PASS: GAC message not retransmitted ***");
                                    f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                                }
                            }
                            
                            // Postamble
                            f_poNeighbour();
                            
                        } // end f_GEONW_PON_GAC_NONAREA_ALL_BO_09_nodeD
                        
                    } // end GEONW_PON_GAC_NONAREA_ALL_BO_09

					group GEONW_PON_GAC_NONAREA_ALL_BV_10 {
                        
						/**
						 * @desc    TP Function for TC_GEONW_PON_GAC_NONAREA_ALL_BV_10
						 */
						function f_GEONW_PON_GAC_NONAREA_ALL_BV_10() runs on ItsMtc {
                            
							// Local variables
							var ItsGeoNetworking v_nodeB;
							var ItsGeoNetworking v_nodeC;
							var ItsGeoNetworking v_nodeD;
                            
							// Test control
							if (not PICS_GN_GAC_FWD) {
								log("*** " & testcasename() & ": PICS_GN_GAC_FWD required for executing the TC ***");
								setverdict(inconc);
								stop;
							}
                            
		//                    if (f_getCbfMinTime() < 300) {
		//                        log("*** " & testcasename() & ": PICS_GN_GEOBROADCAST_CBF_MIN_TIME >= 300 required for executing the TC ***");
		//                        setverdict(inconc);
		//                        stop;
		//                    }
                                                                  
							// Test component configuration
							f_cf04Up();
                            
							// Preamble
                            
							// Start components
							v_nodeB := f_getComponent(c_compNodeB);
							v_nodeC := f_getComponent(c_compNodeC);
							v_nodeD := f_getComponent(c_compNodeD);
							v_nodeB.start(f_GEONW_PON_GAC_NONAREA_ALL_BV_10_nodeB());
							v_nodeC.start(f_GEONW_PON_GAC_NONAREA_ALL_BV_10_nodeC());
							v_nodeD.start(f_GEONW_PON_GAC_NONAREA_ALL_BV_10_nodeD());
                            
							// Synchronization
							f_serverSync3ClientsAndStop({c_prDone, c_tbDone});
                            
							// Cleanup
							f_cf04Down();
                            
						} // end f_GEONW_PON_GAC_NONAREA_ALL_BV_10
                        
						/**
						 * @desc    Behavior function for NodeB (TC_GEONW_PON_GAC_NONAREA_ALL_BV_10)
						 */
						function f_GEONW_PON_GAC_NONAREA_ALL_BV_10_nodeB() runs on ItsGeoNetworking {
                            
							// Local variables
                            
							// Preamble
							f_prNeighbour();
							f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                            
							// Test Body                    
							tc_noac.start;
							alt {
								[] geoNetworkingPort.receive(mw_geoNwInd(mw_geoNwPdu(?))) {
									tc_noac.stop;
									log("*** " & testcasename() & ": FAIL: GAC received and not discarded ***");
									f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
								}
								[] tc_noac.timeout {
									log("*** " & testcasename() & ": PASS: GAC message discarded ***");
									f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
								}
							}
                            
							// Postamble
							f_poNeighbour();
                            
						} // end f_GEONW_PON_GAC_NONAREA_ALL_BV_10_nodeB
                        
						/**
						 * @desc    Behavior function for NodeC (TC_GEONW_PON_GAC_NONAREA_ALL_BV_10)
						 */
						function f_GEONW_PON_GAC_NONAREA_ALL_BV_10_nodeC() runs on ItsGeoNetworking {
                            
							// Local variables
                            
							// Preamble
							f_prNeighbour();
							f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                            
							// Test Body
							tc_noac.start;
							alt {
								[] geoNetworkingPort.receive(mw_geoNwInd(mw_geoNwPdu(?))) {
									tc_noac.stop;
									log("*** " & testcasename() & ": FAIL: GAC received and not discarded ***");
									f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
								}
								[] tc_noac.timeout {
									log("*** " & testcasename() & ": PASS: GAC message discarded ***");
									f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
								}
							}
                            
							// Postamble
							f_poNeighbour();
                            
						} // end f_GEONW_PON_GAC_NONAREA_ALL_BV_10_nodeC
                        
						/**
						 * @desc    Behavior function for NodeD (TC_GEONW_PON_GAC_NONAREA_ALL_BV_10)
						 */
						function f_GEONW_PON_GAC_NONAREA_ALL_BV_10_nodeD() runs on ItsGeoNetworking {
                            
							// Local variables
							var LongPosVector v_longPosVectorNodeD := f_getPosition(c_compNodeD);
                            
							// Preamble
							f_prNeighbour();
							f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                            
							// Test Body
							f_sendGeoNetMessage(
								m_geoNwReq_linkLayerBroadcast(
									m_geoNwPdu(
										m_geoNwAnycastPacket(
											v_longPosVectorNodeD,
											vc_localSeqNumber,
											f_getGeoAnycastArea(c_area2)
										)
									)
								)
							);
                            
							tc_noac.start;
							alt {
								[] geoNetworkingPort.receive(mw_geoNwInd(mw_geoNwPdu(?))) {
									tc_noac.stop;
									log("*** " & testcasename() & ": FAIL: GAC received and not discarded ***");
									f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
								}
								[] tc_noac.timeout {
									log("*** " & testcasename() & ": PASS: GAC message discarded ***");
									f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
								}
							}
                            
							// Postamble
							f_poNeighbour();
                            
						} // end f_GEONW_PON_GAC_NONAREA_ALL_BV_10_nodeD
                        
					} // end GEONW_PON_GAC_NONAREA_ALL_BV_10
            
				} // end gacNonAreaAllForwardingAlgorithm
            
				group gacNonAreaGreedyForwarding {

                    group GEONW_PON_GAC_NONAREA_GRD_BV_01 {
                        
                        /**
                         * @desc    TP Function for TC_GEONW_PON_GAC_NONAREA_GRD_BV_01
                         */
                        function f_GEONW_PON_GAC_NONAREA_GRD_BV_01() runs on ItsMtc {
                            
                            // Local variables
                            var ItsGeoNetworking v_nodeB;
                            var ItsGeoNetworking v_nodeD;
                            
                            // Test control
                            if (not PICS_GN_GAC_SRC) {
                                log("*** " & testcasename() & ": PICS_GN_GAC_SRC required for executing the TC ***");
                                setverdict(inconc);
                                stop;
                            }
                            if ((f_getNonAreaForwardingAlgorithm() != e_greedy) and (f_getNonAreaForwardingAlgorithm() != e_unspecified)) {
                                log("*** " & testcasename() & ": PICS_GN_NON_AREA_FORWARDING_ALGORITHM == ( e_greedy or e_unspecified ) required for executing the TC ***");
                                setverdict(inconc);
                                stop;
                            }
                                                
                            // 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_GAC_NONAREA_GRD_BV_01_nodeB());
                            v_nodeD.start(f_GEONW_PON_GAC_NONAREA_GRD_BV_01_nodeD());
                            
                            // Synchronization
                            f_serverSync2ClientsAndStop({c_prDone, c_tbDone});
                            
                            // Cleanup
                            f_cf02Down();
                            
                        } // end f_GEONW_PON_GAC_NONAREA_GRD_BV_01
                        
                        /**
                         * @desc    Behavior function for NodeB (TC_GEONW_PON_GAC_NONAREA_GRD_BV_01)
                         */
                        function f_GEONW_PON_GAC_NONAREA_GRD_BV_01_nodeB() runs on ItsGeoNetworking {
                            
                            // Local variables
                            var LongPosVector v_longPosVectorIut := f_getPosition(c_compIut);
                            
                            // Preamble
                            f_prNeighbour();
                            f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                            
                            // Test Body
                            if ( not f_utTriggerEvent(m_generateGeoAnycastMessage(f_getArea(c_area2))) ) {
                                log("*** " & testcasename() & ": INCONC: Trigger failed ***");
                                f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
                            }
                            
                            tc_ac.start;
                            alt {
                                [] a_receiveGeoAnycastWithArea(
                                        mw_longPosVectorPosition(v_longPosVectorIut),
                                        ?,
                                        f_getGeoAnycastArea(c_area2)) {
                                    tc_ac.stop;
                                    log("*** " & testcasename() & ": PASS: GAC message received correctly ***");
                                    f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                                }
                                [] tc_ac.timeout {
                                    log("*** " & testcasename() & ": FAIL: GAC message not received ***");
                                    f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                                }
                            }
                            
                            // Postamble
                            f_poNeighbour();
                            
                        } // end f_GEONW_PON_GAC_NONAREA_GRD_BV_01_nodeB
                        
                        /**
                         * @desc    Behavior function for NodeD (TC_GEONW_PON_GAC_NONAREA_GRD_BV_01)
                         */
                        function f_GEONW_PON_GAC_NONAREA_GRD_BV_01_nodeD() runs on ItsGeoNetworking {
                            
                            // Local variables
                            var LongPosVector v_longPosVectorIut := f_getPosition(c_compIut);
                            
                            // Preamble
                            f_prNeighbour();
                            f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                            
                            // Test Body
                            tc_noac.start;
                            alt {
                                [] a_receiveGeoAnycastWithArea(
                                        mw_longPosVectorPosition(v_longPosVectorIut),
                                        ?,
                                        f_getGeoAnycastArea(c_area2)) {
                                    tc_noac.stop;
                                    log("*** " & testcasename() & ": FAIL: received GAC message ***");
                                    f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                                }
                                [] tc_noac.timeout {
                                    log("*** " & testcasename() & ": PASS: GAC message not received ***");
                                    f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                                }
                            }
                            
                            // Postamble
                            f_poNeighbour();
                            
                        } // end f_GEONW_PON_GAC_NONAREA_GRD_BV_01_nodeD
                        
                    } // end GEONW_PON_GAC_NONAREA_GRD_BV_01

                    group GEONW_PON_GAC_NONAREA_GRD_BV_02 {
                        
                        /**
                         * @desc    TP Function for TC_GEONW_PON_GAC_NONAREA_GRD_BV_02
                         */
                        function f_GEONW_PON_GAC_NONAREA_GRD_BV_02() runs on ItsMtc {
                            
                            // Local variables
                            var ItsGeoNetworking v_nodeB;
                            var ItsGeoNetworking v_nodeC;
                            var ItsGeoNetworking v_nodeD;
                            
                            // Test control
                            if (not PICS_GN_GAC_FWD) {
                                log("*** " & testcasename() & ": PICS_GN_GAC_FWD required for executing the TC ***");
                                setverdict(inconc);
                                stop;
                            }
							if ((f_getNonAreaForwardingAlgorithm() != e_greedy) and (f_getNonAreaForwardingAlgorithm() != e_unspecified)) {
								log("*** " & testcasename() & ": PICS_GN_NON_AREA_FORWARDING_ALGORITHM == ( e_greedy or e_unspecified ) required for executing the TC ***");
								setverdict(inconc);
								stop;
							}
                            
                            // Test component configuration
                            f_cf04Up();
                            
                            // Preamble
                            
                            // Start components
                            v_nodeB := f_getComponent(c_compNodeB);
                            v_nodeC := f_getComponent(c_compNodeC);
                            v_nodeD := f_getComponent(c_compNodeD);
                            v_nodeB.start(f_GEONW_PON_GAC_NONAREA_GRD_BV_02_nodeB());
                            v_nodeC.start(f_GEONW_PON_GAC_NONAREA_GRD_BV_02_nodeC());
                            v_nodeD.start(f_GEONW_PON_GAC_NONAREA_GRD_BV_02_nodeD());
                            
                            // Synchronization
                            f_serverSync3ClientsAndStop({c_prDone, c_tbDone});
                            
                            // Cleanup
                            f_cf04Down();
                            
                        } // end f_GEONW_PON_GAC_NONAREA_GRD_BV_02
                        
                        /**
                         * @desc    Behavior function for NodeB (TC_GEONW_PON_GAC_NONAREA_GRD_BV_02)
                         */
                        function f_GEONW_PON_GAC_NONAREA_GRD_BV_02_nodeB() runs on ItsGeoNetworking {
                            
                            // Local variables
                            var LongPosVector v_longPosVectorNodeC := f_getPosition(c_compNodeC);
                            
                            // Preamble
                            f_prNeighbour();
                            f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                            
                            // Test Body
                            tc_ac.start;
                            alt {
                                [] a_receiveGeoAnycastWithArea(
                                        mw_longPosVectorPosition(v_longPosVectorNodeC),
                                        ?,
                                        f_getGeoAnycastArea(c_area2)) {
                                    tc_ac.stop;
                                    log("*** " & testcasename() & ": PASS: GAC message correctly forwarded to area center ***");
                                    f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                                }
                                [] tc_ac.timeout {
                                    log("*** " & testcasename() & ": FAIL: GAC message not received ***");
                                    f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                                }
                            }
                            
                            // Postamble
                            f_poNeighbour();
                            
                        } // end f_GEONW_PON_GAC_NONAREA_GRD_BV_02_nodeB
                        
                        /**
                         * @desc    Behavior function for NodeC (TC_GEONW_PON_GAC_NONAREA_GRD_BV_02)
                         */
                        function f_GEONW_PON_GAC_NONAREA_GRD_BV_02_nodeC() runs on ItsGeoNetworking {
                            
                            // Local variables
                            var LongPosVector v_longPosVectorNodeC := f_getPosition(c_compNodeC);
                            
                            // Preamble
                            f_prNeighbour();
                            f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                            
                            // Test Body
                            f_sendGeoNetMessage(
                                m_geoNwReq_linkLayerBroadcast(
                                    m_geoNwPdu(
                                        m_geoNwAnycastPacket(
                                            v_longPosVectorNodeC,
                                            vc_localSeqNumber,
                                            f_getGeoAnycastArea(c_area2)
                                        )
                                    )
                                )
                            );
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
berge's avatar
berge committed
                            
                            // Postamble
                            f_poNeighbour();
                            
                        } // end f_GEONW_PON_GAC_NONAREA_GRD_BV_02_nodeC
                        
                        /**
                         * @desc    Behavior function for NodeD (TC_GEONW_PON_GAC_NONAREA_GRD_BV_02)
                         */
                        function f_GEONW_PON_GAC_NONAREA_GRD_BV_02_nodeD() runs on ItsGeoNetworking {
                            
                            // Local variables
                            var LongPosVector v_longPosVectorNodeC := f_getPosition(c_compNodeC);
                            
                            // Preamble
                            f_prNeighbour();
                            f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                            
                            // Test Body
                            tc_noac.start;
                            alt {
                                [] a_receiveGeoAnycastWithArea(
                                        mw_longPosVectorPosition(v_longPosVectorNodeC),
                                        ?,
                                        f_getGeoAnycastArea(c_area2)) {
                                    tc_noac.stop;
                                    log("*** " & testcasename() & ": FAIL: GAC message not forwarded to area center ***");
                                    f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                                }
                                [] tc_noac.timeout {
                                    log("*** " & testcasename() & ": PASS: GAC message not received ***");
                                    f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                                }
                            }
                            
                            // Postamble
                            f_poNeighbour();
                            
                        } // end f_GEONW_PON_GAC_NONAREA_GRD_BV_02_nodeD
                        
                    } // end GEONW_PON_GAC_NONAREA_GRD_BV_02
berge's avatar
berge committed
                    group GEONW_PON_GAC_NONAREA_GRD_BO_07 {
                        
                        /**
                         * @desc    TP Function for TC_GEONW_PON_GAC_NONAREA_GRD_BO_07
                         */
                        function f_GEONW_PON_GAC_NONAREA_GRD_BO_07() runs on ItsMtc {
                            
                            // Local variables
                            var ItsGeoNetworking v_nodeB;
                            var ItsGeoNetworking v_nodeC;
                            var ItsGeoNetworking v_nodeD;
                            var UInt16 v_sequenceNumber := f_getInitialSequenceNumber();
                            
                            // Test control
                            if (not PICS_GN_GAC_FWD) {
                                log("*** " & testcasename() & ": PICS_GN_GAC_FWD required for executing the TC ***");
                                setverdict(inconc);
                                stop;
                            }
							if ((f_getNonAreaForwardingAlgorithm() != e_greedy) and (f_getNonAreaForwardingAlgorithm() != e_unspecified)) {
								log("*** " & testcasename() & ": PICS_GN_NON_AREA_FORWARDING_ALGORITHM == ( e_greedy or e_unspecified ) required for executing the TC ***");
								setverdict(inconc);
								stop;
							}
							                            
                            // Test component configuration
                            f_cf04Up();
                            
                            // Preamble
                            
                            // Start components
                            v_nodeB := f_getComponent(c_compNodeB);
                            v_nodeC := f_getComponent(c_compNodeC);
                            v_nodeD := f_getComponent(c_compNodeD);
                            v_nodeB.start(f_GEONW_PON_GAC_NONAREA_GRD_BO_07_nodeB());
                            v_nodeC.start(f_GEONW_PON_GAC_NONAREA_GRD_BO_07_nodeC(v_sequenceNumber));
                            v_nodeD.start(f_GEONW_PON_GAC_NONAREA_GRD_BO_07_nodeD(v_sequenceNumber));
                            
                            // Synchronization
                            f_serverSync3ClientsAndStop({c_prDone, c_tbDone});
                            
                            // Cleanup
                            f_cf04Down();
                            
                        } // end f_GEONW_PON_GAC_NONAREA_GRD_BO_07
                        
                        /**
                         * @desc    Behavior function for NodeB (TC_GEONW_PON_GAC_NONAREA_GRD_BO_07)
                         */
                        function f_GEONW_PON_GAC_NONAREA_GRD_BO_07_nodeB() runs on ItsGeoNetworking {
                            
                            // Local variables
                            var LongPosVector v_longPosVectorNodeC := f_getPosition(c_compNodeC);
                            var template (present) GeoNetworkingInd v_msgInd;
                            
                            // Preamble
                            f_prNeighbour();
                            tc_ac.start;
                            alt {
                                [] geoNetworkingPort.receive(
                                        mw_geoNwInd(
                                            mw_geoNwPdu(
                                                mw_geoNwAnycastPacketWithArea(
                                                    mw_longPosVectorPosition(v_longPosVectorNodeC),
                                                    ?,
                                                    f_getGeoAnycastArea(c_area2)
                                                )
                                            )
                                        )
                                    ) -> value v_msgInd {
                                    tc_ac.stop;
                                    log("*** " & testcasename() & ": PASS: Pre-conditions: GAC message correctly forwarded to area center ***");
                                    f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                                }
                                [] tc_ac.timeout {
                                    log("*** " & testcasename() & ": INCONC: Pre-conditions: GAC message not received ***");
                                    f_selfOrClientSyncAndVerdict(c_prDone, e_timeout);
                                }
                            }
                            
                            // Test Body
                            v_msgInd.msgIn.basicHeader.routerHopLimit := ?;
                            tc_noac.start;
                            alt {
                                [] geoNetworkingPort.receive(v_msgInd) {
                                    tc_noac.stop;
                                    log("*** " & testcasename() & ": FAIL: GAC message re-forwarded to area center ***");
                                    f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                                }
                                [] tc_noac.timeout {
                                    log("*** " & testcasename() & ": PASS: GAC message not re-forwarded ***");
                                    f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                                }
                            }
                            
                            // Postamble
                            f_poNeighbour();
                            
                        } // end f_GEONW_PON_GAC_NONAREA_GRD_BO_07_nodeB
                        
                        /**
                         * @desc    Behavior function for NodeC (TC_GEONW_PON_GAC_NONAREA_GRD_BO_07)
                         */
                        function f_GEONW_PON_GAC_NONAREA_GRD_BO_07_nodeC(in UInt16 p_sequenceNumber) runs on ItsGeoNetworking {
                            
                            // Local variables
                            var LongPosVector v_longPosVectorNodeC := f_getPosition(c_compNodeC);
                            
                            // Preamble
                            f_prNeighbour();
                            f_sendGeoNetMessage(
                                m_geoNwReq_linkLayerBroadcast(
                                    m_geoNwPdu(
                                        m_geoNwAnycastPacket(
                                            v_longPosVectorNodeC,
                                            p_sequenceNumber,
                                            f_getGeoAnycastArea(c_area2)
                                        ),
                                        -,
                                        c_defaultHopLimit
                                    )
berge's avatar
berge committed
                            );
                            f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                            
                            // Test Body
                            tc_noac.start;
                            alt {
                                [] a_receiveGeoAnycastWithArea(
                                        mw_longPosVectorPosition(v_longPosVectorNodeC),
                                        ?,
                                        f_getGeoAnycastArea(c_area2)) {
                                    tc_noac.stop;
                                    log("*** " & testcasename() & ": FAIL: GAC re-forwarded! (not to area center!) ***");
                                    f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                                }
                                [] tc_noac.timeout {
                                    log("*** " & testcasename() & ": PASS: GAC message not received ***");
                                    f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                                }
                            }
                            
                            // Postamble
                            f_poNeighbour();
                            
                        } // end f_GEONW_PON_GAC_NONAREA_GRD_BO_07_nodeC
                        
                        /**
                         * @desc    Behavior function for NodeD (TC_GEONW_PON_GAC_NONAREA_GRD_BO_07)
                         */
                        function f_GEONW_PON_GAC_NONAREA_GRD_BO_07_nodeD(in UInt16 p_sequenceNumber) runs on ItsGeoNetworking {
                            
                            // Local variables
                            var LongPosVector v_longPosVectorNodeC := f_getPosition(c_compNodeC);
                            
                            // Preamble
                            f_prNeighbour();
                            tc_noac.start;
                            alt {
                                [] geoNetworkingPort.receive(mw_geoNwInd(mw_geoNwPdu(mw_geoNwAnycastPacketWithArea(
                                        mw_longPosVectorPosition(v_longPosVectorNodeC),
                                        ?,
                                        f_getGeoAnycastArea(c_area2)
                                    )))) {
                                    tc_noac.stop;
                                    log("*** " & testcasename() & ": INCONC: Pre-conditions: GAC message not forwarded to area center ***");
                                    f_selfOrClientSyncAndVerdict(c_prDone, e_error);
                                }
                                [] tc_noac.timeout {
                                    log("*** " & testcasename() & ": PASS: Pre-conditions: GAC message not received ***");
                                    f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                                }
                            }
                            
                            // Test Body
                            // send geoAnycast for second time (same source + same seq Nr + lower RHL)
                            f_sendGeoNetMessage(
                                m_geoNwReq_linkLayerBroadcast(
                                    m_geoNwPdu(
                                        m_geoNwAnycastPacket(
                                            v_longPosVectorNodeC,
                                            p_sequenceNumber,
                                            f_getGeoAnycastArea(c_area2)
                                        ),
                                        -,
                                        c_defaultHopLimit - 1
                                    )
                                )
                            );
                            
                            tc_noac.start;
                            alt {
                                [] a_receiveGeoAnycastWithArea(
                                        mw_longPosVectorPosition(v_longPosVectorNodeC),
                                        ?,
                                        f_getGeoAnycastArea(c_area2)) {
                                    tc_noac.stop;
                                    log("*** " & testcasename() & ": FAIL: GAC re-forwarded! (not to area center!) ***");
                                    f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                                }
                                [] tc_noac.timeout {
                                    log("*** " & testcasename() & ": PASS: GAC message not received ***");
                                    f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                                }
                            }
                            
                            // Postamble
                            f_poNeighbour();
                            
                        } // end f_GEONW_PON_GAC_NONAREA_GRD_BO_07_nodeD
                        
                    } // end GEONW_PON_GAC_NONAREA_GRD_BO_07

berge's avatar
berge committed
				} // end gacNonAreaGreedyForwarding

				group gacNonAreaContentionBasedForwarding {
        
                    group GEONW_PON_GAC_NONAREA_CBF_BV_01 {
                        
                        /**
                         * @desc    TP Function for TC_GEONW_PON_GAC_NONAREA_CBF_BV_01
                         */
                        function f_GEONW_PON_GAC_NONAREA_CBF_BV_01() runs on ItsMtc {
                            
                            // Local variables
                            var ItsGeoNetworking v_nodeB;
                            var ItsGeoNetworking v_nodeD;
                            
                            // Test control
                            if (not PICS_GN_GAC_SRC) {
                                log("*** " & testcasename() & ": PICS_GN_GAC_SRC required for executing the TC ***");
                                setverdict(inconc);
                                stop;
                            }
                            if(f_getNonAreaForwardingAlgorithm() != e_cbf) {
                                log("*** " & testcasename() & ": PICS_GN_NON_AREA_FORWARDING_ALGORITHM == ( e_cbf ) required for executing the TC ***");
                                setverdict(inconc);
                                stop;
                            }
                                                
                            // 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_GAC_NONAREA_CBF_BV_01_nodeB());
                            v_nodeD.start(f_GEONW_PON_GAC_NONAREA_CBF_BV_01_nodeD());
                            
                            // Synchronization
                            f_serverSync2ClientsAndStop({c_prDone, c_tbDone});
                            
                            // Cleanup
                            f_cf02Down();
                            
                        } // end f_GEONW_PON_GAC_NONAREA_CBF_BV_01
                        
                        /**
                         * @desc    Behavior function for NodeB (TC_GEONW_PON_GAC_NONAREA_CBF_BV_01)
                         */
                        function f_GEONW_PON_GAC_NONAREA_CBF_BV_01_nodeB() runs on ItsGeoNetworking {
                            
                            // Local variables
                            var LongPosVector v_longPosVectorIut := f_getPosition(c_compIut);
                            
                            // Preamble
                            f_prNeighbour();
                            f_selfOrClientSyncAndVerdict(c_prDone, e_success);
berge's avatar
berge committed
                            // Test Body
                            if(not f_utTriggerEvent(m_generateGeoAnycastMessage(f_getArea(c_area2)))) {
                                log("*** " & testcasename() & ": INCONC: Trigger failed ***");
                                f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
berge's avatar
berge committed
                            tc_ac.start;
                            alt {
                                [] a_receiveGeoAnycastWithArea(
                                        mw_longPosVectorPosition(v_longPosVectorIut),
                                        ?,
                                        f_getGeoAnycastArea(c_area2)) {
                                    tc_ac.stop;
                                    log("*** " & testcasename() & ": PASS: GAC message received correctly ***");
                                    f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                                }
                                [] tc_ac.timeout {
                                    log("*** " & testcasename() & ": FAIL: GAC message not received ***");
                                    f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                                }
berge's avatar
berge committed
                            
                            // Postamble
                            f_poNeighbour();
                            
                        } // end f_GEONW_PON_GAC_NONAREA_CBF_BV_01_nodeB
                        
                        /**
                         * @desc    Behavior function for NodeD (TC_GEONW_PON_GAC_NONAREA_CBF_BV_01)
                         */
                        function f_GEONW_PON_GAC_NONAREA_CBF_BV_01_nodeD() runs on ItsGeoNetworking {
                            
                            // Local variables
                            var LongPosVector v_longPosVectorIut := f_getPosition(c_compIut);
                            
                            // Preamble
                            f_prNeighbour();
                            f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                            
                            // Test Body
                            tc_ac.start;
                            alt {
                                [] a_receiveGeoAnycastWithArea(
                                        mw_longPosVectorPosition(v_longPosVectorIut),
                                        ?,
                                        f_getGeoAnycastArea(c_area2)) {
                                    tc_ac.stop;
                                    log("*** " & testcasename() & ": PASS: received GAC message ***");
                                    f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                                }
                                [] tc_ac.timeout {
                                    log("*** " & testcasename() & ": FAIL: GAC message not broadcasted ***");
                                    f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                                }
berge's avatar
berge committed
15333 15334 15335 15336 15337 15338 15339 15340 15341 15342 15343 15344 15345 15346 15347 15348 15349 15350 15351 15352 15353 15354 15355 15356 15357 15358 15359 15360 15361 15362 15363 15364 15365 15366 15367 15368 15369 15370 15371 15372 15373 15374 15375 15376 15377 15378 15379 15380 15381 15382 15383 15384 15385 15386 15387 15388 15389 15390 15391 15392 15393 15394 15395 15396 15397 15398 15399 15400 15401 15402 15403 15404 15405 15406 15407 15408 15409 15410 15411 15412 15413 15414 15415 15416 15417 15418 15419 15420 15421 15422 15423 15424 15425 15426 15427 15428 15429 15430 15431 15432 15433 15434 15435 15436 15437 15438 15439 15440 15441 15442 15443 15444 15445 15446 15447 15448 15449 15450 15451 15452 15453 15454 15455 15456 15457 15458 15459 15460 15461 15462 15463 15464 15465 15466 15467 15468 15469 15470 15471 15472 15473 15474 15475 15476 15477 15478 15479 15480 15481 15482 15483 15484 15485 15486 15487 15488 15489 15490 15491 15492 15493 15494 15495 15496 15497 15498 15499 15500 15501 15502 15503 15504 15505 15506 15507 15508 15509 15510 15511 15512 15513 15514 15515 15516 15517 15518 15519 15520 15521 15522 15523 15524 15525 15526 15527 15528 15529 15530 15531 15532 15533 15534 15535 15536 15537 15538 15539 15540 15541 15542 15543 15544 15545 15546 15547 15548 15549 15550 15551 15552 15553 15554 15555 15556 15557 15558 15559 15560 15561 15562 15563 15564 15565 15566 15567 15568 15569 15570 15571 15572 15573 15574 15575 15576 15577 15578 15579 15580 15581 15582 15583 15584 15585 15586 15587 15588 15589 15590 15591 15592 15593 15594 15595 15596 15597 15598 15599 15600 15601 15602 15603 15604 15605 15606 15607 15608 15609 15610 15611 15612 15613 15614 15615 15616 15617 15618 15619 15620 15621 15622 15623 15624 15625 15626 15627 15628 15629 15630 15631 15632 15633 15634 15635 15636 15637 15638 15639 15640 15641 15642 15643 15644 15645 15646 15647 15648 15649 15650 15651 15652 15653 15654 15655 15656 15657 15658 15659 15660 15661 15662 15663 15664 15665 15666 15667 15668 15669 15670 15671 15672 15673 15674 15675 15676 15677 15678 15679 15680 15681 15682 15683 15684 15685 15686 15687 15688 15689 15690 15691 15692 15693 15694 15695 15696 15697 15698 15699 15700 15701 15702 15703 15704 15705 15706 15707 15708 15709 15710 15711 15712 15713 15714 15715 15716 15717 15718 15719 15720 15721 15722 15723 15724 15725 15726 15727 15728 15729 15730 15731 15732 15733 15734 15735 15736 15737 15738 15739 15740 15741 15742 15743 15744 15745 15746 15747 15748 15749 15750 15751 15752 15753 15754 15755 15756 15757 15758 15759 15760 15761 15762 15763 15764 15765 15766 15767 15768 15769 15770 15771 15772 15773 15774 15775 15776 15777 15778 15779 15780 15781 15782 15783 15784 15785 15786 15787 15788 15789 15790 15791 15792 15793 15794 15795 15796 15797 15798 15799 15800 15801 15802 15803 15804 15805 15806 15807 15808 15809 15810 15811 15812 15813 15814 15815 15816 15817 15818 15819 15820 15821 15822 15823 15824 15825 15826 15827 15828 15829 15830 15831 15832 15833 15834 15835 15836 15837 15838 15839 15840 15841 15842 15843 15844 15845 15846 15847 15848 15849 15850 15851 15852 15853 15854 15855 15856 15857 15858
                            
                            // Postamble
                            f_poNeighbour();
                            
                        } // end f_GEONW_PON_GAC_NONAREA_CBF_BV_01_nodeD
                        
                    } // end GEONW_PON_GAC_NONAREA_CBF_BV_01

					group GEONW_PON_GAC_NONAREA_CBF_BV_02 {
                        
						/**
						 * @desc    TP Function for TC_GEONW_PON_GAC_NONAREA_CBF_BV_02
						 */
						function f_GEONW_PON_GAC_NONAREA_CBF_BV_02() runs on ItsMtc {
                            
							// Local variables
							var ItsGeoNetworking v_nodeB;
							var ItsGeoNetworking v_nodeC;
							var ItsGeoNetworking v_nodeD;
                            
							// Test control
							if (not PICS_GN_GAC_FWD) {
								log("*** " & testcasename() & ": PICS_GN_GAC_FWD required for executing the TC ***");
								setverdict(inconc);
								stop;
							}
							if (f_getNonAreaForwardingAlgorithm() != e_cbf) {
								log("*** " & testcasename() & ": PICS_GN_NON_AREA_FORWARDING_ALGORITHM == e_cbf required for executing the TC ***");
								setverdict(inconc);
								stop;
							}
                            
		//                    if (f_getCbfMinTime() < 300) {
		//                        log("*** " & testcasename() & ": PICS_GN_GEOBROADCAST_CBF_MIN_TIME >= 300 required for executing the TC ***");
		//                        setverdict(inconc);
		//                        stop;
		//                    }
                            
							// Test component configuration
							f_cf04Up();
                            
							// Preamble
                            
							// Start components
							v_nodeB := f_getComponent(c_compNodeB);
							v_nodeC := f_getComponent(c_compNodeC);
							v_nodeD := f_getComponent(c_compNodeD);
							v_nodeB.start(f_GEONW_PON_GAC_NONAREA_CBF_BV_02_nodeB());
							v_nodeC.start(f_GEONW_PON_GAC_NONAREA_CBF_BV_02_nodeC());
							v_nodeD.start(f_GEONW_PON_GAC_NONAREA_CBF_BV_02_nodeD());
                            
							// Synchronization
							f_serverSync3ClientsAndStop({c_prDone, c_tbDone});
                            
							// Cleanup
							f_cf04Down();
                            
						} // end f_GEONW_PON_GAC_NONAREA_CBF_BV_02
                        
						/**
						 * @desc    Behavior function for NodeB (TC_GEONW_PON_GAC_NONAREA_CBF_BV_02)
						 */
						function f_GEONW_PON_GAC_NONAREA_CBF_BV_02_nodeB() runs on ItsGeoNetworking {
                            
							// Local variables
							var LongPosVector v_longPosVectorNodeC := f_getPosition(c_compNodeC);
                            
							// Preamble
							f_prNeighbour();
							f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                            
							// Test Body                    
							tc_ac.start;
							alt {
								[] geoNetworkingPort.receive(mw_geoNwInd(mw_geoNwPdu(mw_geoNwAnycastPacketWithArea(
										mw_longPosVectorPosition(v_longPosVectorNodeC),
										?,
										f_getGeoAnycastArea(c_area2)
									)))) {
									tc_ac.stop;
									log("*** " & testcasename() & ": PASS: GAC message broadcasted ***");
									f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
								}
								[] tc_ac.timeout {
									log("*** " & testcasename() & ": FAIL: GAC message not broadcasted ***");
									f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
								}
							}
                            
							// Postamble
							f_poNeighbour();
                            
						} // end f_GEONW_PON_GAC_NONAREA_CBF_BV_02_nodeB
                        
						/**
						 * @desc    Behavior function for NodeC (TC_GEONW_PON_GAC_NONAREA_CBF_BV_02)
						 */
						function f_GEONW_PON_GAC_NONAREA_CBF_BV_02_nodeC() runs on ItsGeoNetworking {
                            
							// Local variables
							var LongPosVector v_longPosVectorNodeC := f_getPosition(c_compNodeC);
							var LongPosVector v_longPosVectorIut := f_getPosition(c_compIut);
							timer t_toCbf := (int2float(f_getCbfMaxTime())
								+ (
									int2float(f_getCbfMinTime() - f_getCbfMaxTime())
									/ int2float(f_getCbfMaxCommunicationRange())
								) * f_distance(v_longPosVectorNodeC, v_longPosVectorIut)) * 0.95 / 1000.0;
                            
							// Preamble
							f_prNeighbour();
							f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                            
							// Test Body
							f_sendGeoNetMessage(
								m_geoNwReq_linkLayerBroadcast(
									m_geoNwPdu(
										m_geoNwAnycastPacket(
											v_longPosVectorNodeC,
											vc_localSeqNumber,
											f_getGeoAnycastArea(c_area2)
										)
									)
								)
							);
                            
							t_toCbf.start;                    
							tc_ac.start;
							alt {
								[] geoNetworkingPort.receive(mw_geoNwInd(mw_geoNwPdu(mw_geoNwAnycastPacketWithArea(
										mw_longPosVectorPosition(v_longPosVectorNodeC),
										?,
										f_getGeoAnycastArea(c_area2)
									)))) {
									tc_ac.stop;                           
                                    
									if(t_toCbf.running) {                               
										t_toCbf.stop;
										log("*** " & testcasename() & ": FAIL: GAC retransmitted before CBF timer expiration ***");
										f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
									}
									else {
										log("*** " & testcasename() & ": PASS: GAC message received ***");
										f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
									}
								}
								[] t_toCbf.timeout {
									log("*** " & testcasename() & ": INFO: CBF timer elapsed ***");
									repeat;
								}
								[] tc_ac.timeout {
									log("*** " & testcasename() & ": FAIL: GAC message not received ***");
									f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
								}
							}
                            
							// Postamble
							f_poNeighbour();
                            
						} // end f_GEONW_PON_GAC_NONAREA_CBF_BV_02_nodeC
                        
						/**
						 * @desc    Behavior function for NodeD (TC_GEONW_PON_GAC_NONAREA_CBF_BV_02)
						 */
						function f_GEONW_PON_GAC_NONAREA_CBF_BV_02_nodeD() runs on ItsGeoNetworking {
                            
							// Local variables
							var LongPosVector v_longPosVectorNodeC := f_getPosition(c_compNodeC);
                            
							// Preamble
							f_prNeighbour();
							f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                            
							// Test Body                    
							tc_ac.start;
							alt {
								[] geoNetworkingPort.receive(mw_geoNwInd(mw_geoNwPdu(mw_geoNwAnycastPacketWithArea(
										mw_longPosVectorPosition(v_longPosVectorNodeC),
										?,
										f_getGeoAnycastArea(c_area2)
									)))) {
									tc_ac.stop;
									log("*** " & testcasename() & ": PASS: GAC message broadcasted ***");
									f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
								}
								[] tc_ac.timeout {
									log("*** " & testcasename() & ": FAIL: GAC message not broadcasted ***");
									f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
								}
							}
                            
							// Postamble
							f_poNeighbour();
                            
						} // end f_GEONW_PON_GAC_NONAREA_CBF_BV_02_nodeD
                        
					} // end GEONW_PON_GAC_NONAREA_CBF_BV_02

					group GEONW_PON_GAC_NONAREA_CBF_BV_07 {
                        
						/**
						 * @desc    TP Function for TC_GEONW_PON_GAC_NONAREA_CBF_BV_07
						 */
						function f_GEONW_PON_GAC_NONAREA_CBF_BV_07() runs on ItsMtc {
                            
							// Local variables
							var ItsGeoNetworking v_nodeB;
							var ItsGeoNetworking v_nodeC;
							var ItsGeoNetworking v_nodeD;
							var UInt16 v_sequenceNumberC := f_getInitialSequenceNumber();
                            
							// Test control
							if (not PICS_GN_GAC_FWD) {
								log("*** " & testcasename() & ": PICS_GN_GAC_FWD required for executing the TC ***");
								setverdict(inconc);
								stop;
							}
							if (f_getNonAreaForwardingAlgorithm() != e_cbf) {
								log("*** " & testcasename() & ": PICS_GN_NON_AREA_FORWARDING_ALGORITHM == e_cbf required for executing the TC ***");
								setverdict(inconc);
								stop;
							}
                            
		//                    if (f_getCbfMinTime() < 300) {
		//                        log("*** " & testcasename() & ": PICS_GN_GEOBROADCAST_CBF_MIN_TIME >= 300 required for executing the TC ***");
		//                        setverdict(inconc);
		//                        stop;
		//                    }
                                                
							// Test component configuration
							f_cf04Up();
                            
							// Preamble
                            
							// Start components
							v_nodeB := f_getComponent(c_compNodeB);
							v_nodeC := f_getComponent(c_compNodeC);
							v_nodeD := f_getComponent(c_compNodeD);
							v_nodeB.start(f_GEONW_PON_GAC_NONAREA_CBF_BV_07_nodeB());
							v_nodeC.start(f_GEONW_PON_GAC_NONAREA_CBF_BV_07_nodeC(v_sequenceNumberC));
							v_nodeD.start(f_GEONW_PON_GAC_NONAREA_CBF_BV_07_nodeD(v_sequenceNumberC));
                            
							// Synchronization
							f_serverSync3ClientsAndStop({c_prDone, c_tbDone});
                            
							// Cleanup
							f_cf04Down();
                            
						} // end f_GEONW_PON_GAC_NONAREA_CBF_BV_07
                        
						/**
						 * @desc    Behavior function for NodeB (TC_GEONW_PON_GAC_NONAREA_CBF_BV_07)
						 */
						function f_GEONW_PON_GAC_NONAREA_CBF_BV_07_nodeB() runs on ItsGeoNetworking {
                            
							// Local variables
							var LongPosVector v_longPosVectorNodeC := f_getPosition(c_compNodeC);
                            
							// Preamble
							f_prNeighbour();
							f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                            
							// Test Body
							tc_noac.start;
							alt {
								[] geoNetworkingPort.receive(mw_geoNwInd(mw_geoNwPdu(mw_geoNwAnycastPacketWithArea(
										mw_longPosVectorPosition(v_longPosVectorNodeC),
										?,
										f_getGeoAnycastArea(c_area2)
									)))) {
									tc_noac.stop;
									log("*** " & testcasename() & ": FAIL: GAC message re-broadcasted ***");
									f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
								}
								[] tc_noac.timeout {
									log("*** " & testcasename() & ": PASS: GAC message not re-broadcasted ***");
									f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
								}
							}
                            
							// Postamble
							f_poNeighbour();
                            
						} // end f_GEONW_PON_GAC_NONAREA_CBF_BV_07_nodeB
                        
						/**
						 * @desc    Behavior function for NodeC (TC_GEONW_PON_GAC_NONAREA_CBF_BV_07)
						 */
						function f_GEONW_PON_GAC_NONAREA_CBF_BV_07_nodeC(in UInt16 p_sequenceNumberC) runs on ItsGeoNetworking {
                            
							// Local variables
							var LongPosVector v_longPosVectorNodeC := f_getPosition(c_compNodeC);
                            
							// Preamble
							f_prNeighbour();
							f_sendGeoNetMessage(
								m_geoNwReq_linkLayerBroadcast(
									m_geoNwPdu(
										m_geoNwAnycastPacket(
											v_longPosVectorNodeC,
											p_sequenceNumberC,
											f_getGeoAnycastArea(c_area2)
										)
									)
								)
							);
							f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                            
							// Test Body
							tc_noac.start;
							alt {
								[] geoNetworkingPort.receive(mw_geoNwInd(mw_geoNwPdu(mw_geoNwAnycastPacketWithArea(
										mw_longPosVectorPosition(v_longPosVectorNodeC),
										?,
										f_getGeoAnycastArea(c_area2)
									)))) {
									tc_noac.stop;
									log("*** " & testcasename() & ": FAIL: GAC message re-broadcasted ***");
									f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
								}
								[] tc_noac.timeout {
									log("*** " & testcasename() & ": PASS: GAC message not re-broadcasted ***");
									f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
								}
							}
                            
							// Postamble
							f_poNeighbour();
                            
						} // end f_GEONW_PON_GAC_NONAREA_CBF_BV_07_nodeC
                        
						/**
						 * @desc    Behavior function for NodeD (TC_GEONW_PON_GAC_NONAREA_CBF_BV_07)
						 */
						function f_GEONW_PON_GAC_NONAREA_CBF_BV_07_nodeD(in UInt16 p_sequenceNumberC) runs on ItsGeoNetworking {
                            
							// Local variables
							var LongPosVector v_longPosVectorNodeC := f_getPosition(c_compNodeC);
                            
							// Preamble
							f_prNeighbour();
							f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                            
							// Test Body
							f_sendGeoNetMessage(
								m_geoNwReq_linkLayerBroadcast(
									m_geoNwPdu(
										m_geoNwAnycastPacket(
											v_longPosVectorNodeC,
											p_sequenceNumberC,
											f_getGeoAnycastArea(c_area2)
										)
									)
								)
							);
                            
							tc_noac.start;
							alt {
								[] geoNetworkingPort.receive(mw_geoNwInd(mw_geoNwPdu(mw_geoNwAnycastPacketWithArea(
										mw_longPosVectorPosition(v_longPosVectorNodeC),
										?,
										f_getGeoAnycastArea(c_area2)
									)))) {
									tc_noac.stop;
									log("*** " & testcasename() & ": FAIL: GAC message re-broadcasted ***");
									f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
								}
								[] tc_noac.timeout {
									log("*** " & testcasename() & ": PASS: GAC message not re-broadcasted ***");
									f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
								}
							}
                            
							// Postamble
							f_poNeighbour();
                            
						} // end f_GEONW_PON_GAC_NONAREA_CBF_BV_071_nodeD
                        
					} // end GEONW_PON_GAC_NONAREA_CBF_BV_07
                    
					group GEONW_PON_GAC_NONAREA_CBF_BV_20 {
                
						/**
						 * @desc    TP Function for TC_GEONW_PON_GAC_NONAREA_CBF_BV_20
						 */
						function f_GEONW_PON_GAC_NONAREA_CBF_BV_20() runs on ItsMtc {
                    
							// Local variables
							var ItsGeoNetworking v_nodeB;
							var ItsGeoNetworking v_nodeC;
							var float v_distance := int2float(f_getCbfMaxCommunicationRange() * 2);
							var LongPosVector v_longPosVectorIut, v_longPosVectorNodeC;
                    
							// Test control
							if (not PICS_GN_GAC_FWD) {
								log("*** " & testcasename() & ": PICS_GN_GUC_FWD required for executing the TC ***");
								setverdict(inconc);
								stop;
							}
							if (f_getNonAreaForwardingAlgorithm() != e_cbf) {
								log("*** " & testcasename() & ": PICS_GN_NON_AREA_FORWARDING_ALGORITHM == e_cbf required for executing the TC ***");
								setverdict(inconc);
								stop;
							}
                    
							// Test component configuration
							f_cf03Up();
							// re-compute NodeC's position.
							v_longPosVectorIut := f_getIutLongPosVector();
							v_longPosVectorNodeC := f_computePositionUsingDistance(v_longPosVectorIut, v_distance, 180);
							v_longPosVectorNodeC.gnAddr := f_getTsGnLocalAddress(c_compNodeC);
                    
							// Preamble
                    
							// Start components
							v_nodeB := f_getComponent(c_compNodeB);
							v_nodeC := f_getComponent(c_compNodeC);
							v_nodeB.start(f_GEONW_PON_GAC_NONAREA_CBF_BV_20_nodeB(v_longPosVectorNodeC));
							v_nodeC.start(f_GEONW_PON_GAC_NONAREA_CBF_BV_20_nodeC(v_longPosVectorNodeC));
                    
							// Synchronization
							f_serverSync2ClientsAndStop({c_prDone, c_msgSent, c_tbDone});
                    
							// Cleanup
							f_cf03Down();
                    
						} // end f_GEONW_PON_GAC_NONAREA_CBF_BV_20
                
						/**
						 * @desc    Behavior function for NodeB (TC_GEONW_PON_GAC_NONAREA_CBF_BV_20)
						 * @param   p_longPosVectorNodeC    Position vector of NodeC
						 */
						function f_GEONW_PON_GAC_NONAREA_CBF_BV_20_nodeB(in LongPosVector p_longPosVectorNodeC) runs on ItsGeoNetworking {
                    
							// Local variables
							timer t_toCbf := int2float(f_getCbfMinTime()) / 1000.0;
                    
							// Preamble
							f_prNeighbour();
							f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                    
							// Test Body
							log("*** " & testcasename() & ": INFO: Message sent ***");
							f_selfOrClientSyncAndVerdict(c_msgSent, e_success);
                    
							tc_ac.start;
							t_toCbf.start;
							alt {
								[] geoNetworkingPort.receive(mw_geoNwInd(mw_geoNwPdu(mw_geoNwAnycastPacketWithArea(
										mw_longPosVectorPosition(p_longPosVectorNodeC),
										?,
										f_getGeoAnycastArea(c_area2)
									)))) {
									tc_ac.stop;
									if(t_toCbf.running) {
										t_toCbf.stop;
										log("*** " & testcasename() & ": FAIL: IUT re-broadcasted the packet too early ***");
										f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
									}
									else {
										log("*** " & testcasename() & ": PASS: Forwarded GUC received ***");
										f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
									}
								}
								[] t_toCbf.timeout {
									log("*** " & testcasename() & ": INFO: Ready for receiving re-broadcasting ***");
									repeat;
								}
                        
								[] tc_ac.timeout {
									log("*** " & testcasename() & ": FAIL: GUC was not forwarded ***");
									f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
								}
							}
                    
							// Postamble
							f_poNeighbour();
                    
						} // end f_GEONW_PON_GAC_NONAREA_CBF_BV_20_nodeB
                
						/**
						 * @desc    Behavior function for NodeC (TC_GEONW_PON_GAC_NONAREA_CBF_BV_20)
						 * @param   p_longPosVectorNodeC    Position vector of NodeC
						 */
						function f_GEONW_PON_GAC_NONAREA_CBF_BV_20_nodeC(LongPosVector p_longPosVectorNodeC) runs on ItsGeoNetworking {
                    
							// Local variables
                    
							// Preamble
							f_prNeighbour();
							f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                    
							// Test Body
							f_sendGeoNetMessage(
								m_geoNwReq_linkLayerBroadcast(
									m_geoNwPdu(
										m_geoNwAnycastPacket(
											p_longPosVectorNodeC,
							                vc_localSeqNumber,
											f_getGeoAnycastArea(c_area2)
										)
									)
								)
							);
                            
							log("*** " & testcasename() & ": INFO: Message sent ***");
							f_selfOrClientSyncAndVerdict(c_msgSent, e_success);
                    
							tc_ac.start;
							alt {
								[] geoNetworkingPort.receive(mw_geoNwInd(mw_geoNwPdu(mw_geoNwAnycastPacketWithArea(
										mw_longPosVectorPosition(p_longPosVectorNodeC),
										?,
										f_getGeoAnycastArea(c_area2)
									)))) {
									tc_ac.stop;
									log("*** " & testcasename() & ": PASS: Forwarded GUC received ***");
									f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
								}
								[] tc_ac.timeout {
									log("*** " & testcasename() & ": FAIL: GUC was not forwarded ***");
									f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
								}
							}
                      
							// Postamble
							f_poNeighbour();
berge's avatar
berge committed
						} // end f_GEONW_PON_GAC_NONAREA_CBF_BV_20_nodeC

					} // end GEONW_PON_GAC_NONAREA_CBF_BV_20    

					group GEONW_PON_GAC_NONAREA_CBF_BV_21 {
                        
						/**
						 * @desc    TP Function for TC_GEONW_PON_GAC_NONAREA_CBF_BV_21
						 */
						function f_GEONW_PON_GAC_NONAREA_CBF_BV_21() runs on ItsMtc {
                            
							// Local variables
							var ItsGeoNetworking v_nodeB;
							var ItsGeoNetworking v_nodeC;
							var ItsGeoNetworking v_nodeD;
                            
							// Test control
							if (not PICS_GN_GAC_FWD) {
								log("*** " & testcasename() & ": PICS_GN_GAC_FWD required for executing the TC ***");
								setverdict(inconc);
								stop;
							}
							if (f_getNonAreaForwardingAlgorithm() != e_cbf) {
								log("*** " & testcasename() & ": PICS_GN_NON_AREA_FORWARDING_ALGORITHM == e_cbf required for executing the TC ***");
								setverdict(inconc);
								stop;
							}
                            
		//                    if (f_getCbfMinTime() < 300) {
		//                        log("*** " & testcasename() & ": PICS_GN_GEOBROADCAST_CBF_MIN_TIME >= 300 required for executing the TC ***");
		//                        setverdict(inconc);
		//                        stop;
		//                    }
                            
							// Test component configuration
							f_cf04Up();
                            
							// Preamble
                            
							// Start components
							v_nodeB := f_getComponent(c_compNodeB);
							v_nodeC := f_getComponent(c_compNodeC);
							v_nodeD := f_getComponent(c_compNodeD);
							v_nodeB.start(f_GEONW_PON_GAC_NONAREA_CBF_BV_21_nodeB());
							v_nodeC.start(f_GEONW_PON_GAC_NONAREA_CBF_BV_21_nodeC());
							v_nodeD.start(f_GEONW_PON_GAC_NONAREA_CBF_BV_21_nodeD());
                            
							// Synchronization
							f_serverSync3ClientsAndStop({c_prDone, c_tbDone});
                            
							// Cleanup
							f_cf04Down();
                            
						} // end f_GEONW_PON_GAC_NONAREA_CBF_BV_21
                        
						/**
						 * @desc    Behavior function for NodeB (TC_GEONW_PON_GAC_NONAREA_CBF_BV_21)
						 */
						function f_GEONW_PON_GAC_NONAREA_CBF_BV_21_nodeB() runs on ItsGeoNetworking {
                            
							// Local variables
							var LongPosVector v_longPosVectorNodeC := f_getPosition(c_compNodeC);
                            
							// Preamble
							f_prNeighbour();
							f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                            
							// Test Body                    
							tc_ac.start;
							alt {
								[] geoNetworkingPort.receive(mw_geoNwInd(mw_geoNwPdu(mw_geoNwAnycastPacketWithArea(
										mw_longPosVectorPosition(v_longPosVectorNodeC),
										?,
										f_getGeoAnycastArea(c_area2)
									)))) {
									tc_ac.stop;
									log("*** " & testcasename() & ": PASS: GAC broadcasted ***");
									f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
								}
								[] tc_ac.timeout {
									log("*** " & testcasename() & ": FAIL: GAC not broadcasted ***");
									f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
								}
							}
                            
							// Postamble
							f_poNeighbour();
                            
						} // end f_GEONW_PON_GAC_NONAREA_CBF_BV_21_nodeB
                        
						/**
						 * @desc    Behavior function for NodeC (TC_GEONW_PON_GAC_NONAREA_CBF_BV_21)
						 */
						function f_GEONW_PON_GAC_NONAREA_CBF_BV_21_nodeC() runs on ItsGeoNetworking {
                            
							// Local variables
                            
							// Preamble
							f_prNeighbour();
							f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                            
							// Test Body                    
							tc_ac.start;
							alt {
								[] geoNetworkingPort.receive(mw_geoNwInd(mw_geoNwPdu(?))) {
									tc_ac.stop;
									log("*** " & testcasename() & ": PASS: GAC message re-broadcasted ***");
									f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
								}
								[] tc_ac.timeout {
									log("*** " & testcasename() & ": FAIL: GAC message not re-broadcasted ***");
									f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
								}
							}
                            
							// Postamble
							f_poNeighbour();
                            
						} // end f_GEONW_PON_GAC_NONAREA_CBF_BV_21_nodeC
                        
						/**
						 * @desc    Behavior function for NodeD (TC_GEONW_PON_GAC_NONAREA_CBF_BV_21)
						 */
						function f_GEONW_PON_GAC_NONAREA_CBF_BV_21_nodeD() runs on ItsGeoNetworking {
                            
							// Local variables
							var LongPosVector v_longPosVectorNodeC := f_getPosition(c_compNodeC);
							timer t_toCbf := int2float(f_getCbfMaxTime()) * 0.95 / 1000.0;
                            
							// Preamble
							f_prNonNeighbour();
							f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                            
							// Test Body
							f_sendGeoNetMessage(
								m_geoNwReq_linkLayerBroadcast(
									m_geoNwPdu(
										m_geoNwAnycastPacket(
											v_longPosVectorNodeC,
											vc_localSeqNumber,
											f_getGeoAnycastArea(c_area2)
										)
									)
								)
							);
                            
							t_toCbf.start;                    
							tc_ac.start;
							alt {
								[] geoNetworkingPort.receive(mw_geoNwInd(mw_geoNwPdu(mw_geoNwAnycastPacketWithArea(
										mw_longPosVectorPosition(v_longPosVectorNodeC),
										?,
										f_getGeoAnycastArea(c_area2)
									)))) {
									tc_ac.stop;                           
                                    
									if(t_toCbf.running) {                               
										t_toCbf.stop;
										log("*** " & testcasename() & ": FAIL: GAC retransmitted before CBF timer expiration ***");
										f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
									}
									else {
										log("*** " & testcasename() & ": PASS: GAC message received ***");
										f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
									}
								}
								[] t_toCbf.timeout {
									log("*** " & testcasename() & ": INFO: CBF timer elapsed ***");
									repeat;
								}
								[] tc_ac.timeout {
									log("*** " & testcasename() & ": FAIL: GAC message not received ***");
									f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
								}
							}
                            
							// Postamble
							f_poDefault();
                            
						} // end f_GEONW_PON_GAC_NONAREA_CBF_BV_21_nodeD
                        
					} // end GEONW_PON_GAC_NONAREA_CBF_BV_21
berge's avatar
berge committed
					group GEONW_PON_GAC_NONAREA_CBF_BV_22 {
                        
						/**
						 * @desc    TP Function for TC_GEONW_PON_GAC_NONAREA_CBF_BV_22
						 */
						function f_GEONW_PON_GAC_NONAREA_CBF_BV_22() runs on ItsMtc {
                            
							// Local variables
							var ItsGeoNetworking v_nodeB;
							var ItsGeoNetworking v_nodeC;
							var ItsGeoNetworking v_nodeD;
                            
							// Test control
							if (not PICS_GN_GAC_FWD) {
								log("*** " & testcasename() & ": PICS_GN_GAC_FWD required for executing the TC ***");
								setverdict(inconc);
								stop;
							}
							if (f_getNonAreaForwardingAlgorithm() != e_cbf) {
								log("*** " & testcasename() & ": PICS_GN_NON_AREA_FORWARDING_ALGORITHM == e_cbf required for executing the TC ***");
								setverdict(inconc);
								stop;
							}
                            
		//                    if (f_getCbfMinTime() < 300) {
		//                        log("*** " & testcasename() & ": PICS_GN_GEOBROADCAST_CBF_MIN_TIME >= 300 required for executing the TC ***");
		//                        setverdict(inconc);
		//                        stop;
		//                    }
                            
							// Test component configuration
							f_cf04Up();
                            
							// Preamble
                            
							// Start components
							v_nodeB := f_getComponent(c_compNodeB);
							v_nodeC := f_getComponent(c_compNodeC);
							v_nodeD := f_getComponent(c_compNodeD);
							v_nodeB.start(f_GEONW_PON_GAC_NONAREA_CBF_BV_22_nodeB());
							v_nodeC.start(f_GEONW_PON_GAC_NONAREA_CBF_BV_22_nodeC());
							v_nodeD.start(f_GEONW_PON_GAC_NONAREA_CBF_BV_22_nodeD());
                            
							// Synchronization
							f_serverSync3ClientsAndStop({c_prDone, c_tbDone});
                            
							// Cleanup
							f_cf04Down();
                            
						} // end f_GEONW_PON_GAC_NONAREA_CBF_BV_22
                        
						/**
						 * @desc    Behavior function for NodeB (TC_GEONW_PON_GAC_NONAREA_CBF_BV_22)
						 */
						function f_GEONW_PON_GAC_NONAREA_CBF_BV_22_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_geoNwAnycastPacketWithArea(
										mw_longPosVectorPosition(v_longPosVectorNodeA),
										?,
										f_getGeoAnycastArea(c_area2)
									)))) {
									tc_ac.stop;
									log("*** " & testcasename() & ": PASS: GAC broadcasted ***");
									f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
								}
								[] tc_ac.timeout {
									log("*** " & testcasename() & ": FAIL: GAC not broadcasted ***");
									f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
								}
							}
                            
							// Postamble
							f_poNeighbour();
                            
						} // end f_GEONW_PON_GAC_NONAREA_CBF_BV_22_nodeB
                        
						/**
						 * @desc    Behavior function for NodeC (TC_GEONW_PON_GAC_NONAREA_CBF_BV_22)
						 */
						function f_GEONW_PON_GAC_NONAREA_CBF_BV_22_nodeC() runs on ItsGeoNetworking {
                            
							// Local variables
							var LongPosVector v_longPosVectorNodeC := f_getPosition(c_compNodeC);
							var LongPosVector v_longPosVectorNodeA := f_getPosition(c_compNodeA);
							timer t_toCbf := int2float(f_getCbfMaxTime()) * 0.95 / 1000.0;
                            
							// Preamble
							v_longPosVectorNodeC.pai := int2bit(0,1);
							f_changePositon(c_compNodeC, v_longPosVectorNodeC); 
							f_prNeighbour();
							f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                            
							// Test Body 
							f_sendGeoNetMessage(
								m_geoNwReq_linkLayerBroadcast(
									m_geoNwPdu(
										m_geoNwAnycastPacket(
											v_longPosVectorNodeA,
											vc_localSeqNumber,
											f_getGeoAnycastArea(c_area2)
										)
									)
								)
							);                   
                            
							t_toCbf.start;                    
							tc_ac.start;
							alt {
								[] geoNetworkingPort.receive(mw_geoNwInd(mw_geoNwPdu(mw_geoNwAnycastPacketWithArea(
										mw_longPosVectorPosition(v_longPosVectorNodeA),
										?,
										f_getGeoAnycastArea(c_area2)
									)))) {
									tc_ac.stop;                           
        
									if(t_toCbf.running) {                               
										t_toCbf.stop;
										log("*** " & testcasename() & ": FAIL: GAC retransmitted before CBF timer expiration ***");
										f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
									}
									else {
										log("*** " & testcasename() & ": PASS: GAC message received ***");
										f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
									}
								}
								[] t_toCbf.timeout {
									log("*** " & testcasename() & ": INFO: CBF timer elapsed ***");
									repeat;
								}
								[] tc_ac.timeout {
									log("*** " & testcasename() & ": FAIL: GAC message not received ***");
									f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
								}
							}
                            
							// Postamble
							f_poNeighbour();
                            
						} // end f_GEONW_PON_GAC_NONAREA_CBF_BV_22_nodeC
                        
						/**
						 * @desc    Behavior function for NodeD (TC_GEONW_PON_GAC_NONAREA_CBF_BV_22)
						 */
						function f_GEONW_PON_GAC_NONAREA_CBF_BV_22_nodeD() 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_geoNwAnycastPacketWithArea(
										mw_longPosVectorPosition(v_longPosVectorNodeA),
										?,
										f_getGeoAnycastArea(c_area2)
									)))) {
									tc_ac.stop;
									log("*** " & testcasename() & ": PASS: GAC broadcasted ***");
									f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
								}
								[] tc_ac.timeout {
									log("*** " & testcasename() & ": FAIL: GAC not broadcasted ***");
									f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
								}
							}
                            
							// Postamble
							f_poNeighbour();
                            
						} // end f_GEONW_PON_GAC_NONAREA_CBF_BV_22_nodeD
                        
					} // end GEONW_PON_GAC_NONAREA_CBF_BV_22
berge's avatar
berge committed
				} // end gacNonAreaContentionBasedForwarding
                            
			} // end gacNonAreaForwarding
        
			group gacAreaForwarding {
            
                group GEONW_PON_GAC_AREA_ALL_BV_01 {
berge's avatar
berge committed
                    /**
                     * @desc    TP Function for TC_GEONW_PON_GAC_AREA_ALL_BV_01
                     */
                    function f_GEONW_PON_GAC_AREA_ALL_BV_01() runs on ItsMtc {
                        
                        // Local variables
                        var ItsGeoNetworking v_nodeB;
                        var ItsGeoNetworking v_nodeD;
                        
                        // Test control
                        if (not PICS_GN_GAC_SRC) {
                            log("*** " & testcasename() & ": PICS_GN_GAC_SRC required for executing the TC ***");
                            setverdict(inconc);
                            stop;
                        }
                         
                        // 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_GAC_AREA_ALL_BV_01_nodeB());
                        v_nodeD.start(f_GEONW_PON_GAC_AREA_ALL_BV_01_nodeD());
                        
                        // Synchronization
                        f_serverSync2ClientsAndStop({c_prDone, c_tbDone});
                        
                        // Cleanup
                        f_cf02Down();
                        
                    } // end f_GEONW_PON_GAC_AREA_ALL_BV_01
                    
                    /**
                     * @desc    Behavior function for NodeB (TC_GEONW_PON_GAC_AREA_ALL_BV_01)
                     */
                    function f_GEONW_PON_GAC_AREA_ALL_BV_01_nodeB() runs on ItsGeoNetworking {
                        
                        // Local variables
                        var LongPosVector v_longPosVectorIut := f_getPosition(c_compIut);
                        
                        // Preamble
                        f_prNeighbour();
                        f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                        
                        // Test Body
                        if ( not f_utTriggerEvent(m_generateGeoAnycastMessage(f_getArea(c_area1))) ) {
                            log("*** " & testcasename() & ": INCONC: Trigger failed ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
berge's avatar
berge committed
                        
                        tc_ac.start;
                        alt {
                            [] a_receiveGeoAnycastWithArea(
                                    mw_longPosVectorPosition(v_longPosVectorIut),
                                    ?,
                                    f_getGeoAnycastArea(c_area1)) {
                                tc_ac.stop;
                                log("*** " & testcasename() & ": PASS: GAC message received correctly ***");
                                f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                            }
                            [] tc_ac.timeout {
                                log("*** " & testcasename() & ": FAIL: GAC message not received ***");
                                f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                            }
berge's avatar
berge committed
                        
                        // Postamble
                        f_poNeighbour();
                        
                    } // end f_GEONW_PON_GAC_AREA_ALL_BV_01_nodeB
berge's avatar
berge committed
                    /**
                     * @desc    Behavior function for NodeD (TC_GEONW_PON_GAC_AREA_ALL_BV_01)
                     */
                    function f_GEONW_PON_GAC_AREA_ALL_BV_01_nodeD() runs on ItsGeoNetworking {
                        
                        // Local variables
                        var LongPosVector v_longPosVectorIut := f_getPosition(c_compIut);
                        
                        // Preamble
                        f_prNeighbour();
                        f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                        
                        // Test Body
                        tc_ac.start;
                        alt {
                            [] a_receiveGeoAnycastWithArea(
                                    mw_longPosVectorPosition(v_longPosVectorIut),
                                    ?,
                                    f_getGeoAnycastArea(c_area1)) {
                                tc_ac.stop;
                                log("*** " & testcasename() & ": PASS: GAC message received correctly ***");
                                f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                            }
                            [] tc_ac.timeout {
                                log("*** " & testcasename() & ": FAIL: GAC message not received ***");
                                f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                            }
                        }
                        
                        // Postamble
                        f_poNeighbour();
                        
                    } // end f_GEONW_PON_GAC_AREA_ALL_BV_01_nodeD
berge's avatar
berge committed
                } // end GEONW_PON_GAC_AREA_ALL_BV_01                
berge's avatar
berge committed
                group GEONW_PON_GAC_AREA_ALL_BV_02 {
berge's avatar
berge committed
                    /**
                     * @desc    TP Function for TC_GEONW_PON_GAC_AREA_ALL_BV_02
                     */
                    function f_GEONW_PON_GAC_AREA_ALL_BV_02() runs on ItsMtc {
                        
                        // Local variables
                        var ItsGeoNetworking v_nodeB;
                        var ItsGeoNetworking v_nodeD;
                        
                        // Test control
                        if (not PICS_GN_GAC_FWD) {
                            log("*** " & testcasename() & ": PICS_GN_GAC_FWD required for executing the TC ***");
                            setverdict(inconc);
                            stop;
                        }
                         
                        // 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_GAC_AREA_ALL_BV_02_nodeB());
                        v_nodeD.start(f_GEONW_PON_GAC_AREA_ALL_BV_02_nodeD());
                        
                        // Synchronization
                        f_serverSync2ClientsAndStop({c_prDone, c_tbDone});
                        
                        // Cleanup
                        f_cf02Down();
                        
                    } // end f_GEONW_PON_GAC_AREA_ALL_BV_02
berge's avatar
berge committed
                    /**
                     * @desc    Behavior function for NodeB (TC_GEONW_PON_GAC_AREA_ALL_BV_02)
                     */
                    function f_GEONW_PON_GAC_AREA_ALL_BV_02_nodeB() runs on ItsGeoNetworking {
                        
                        // Local variables
                        var LongPosVector v_longPosVectorNodeB := f_getPosition(c_compNodeB);
                        
                        // Preamble
                        f_prNeighbour();
                        f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                        
                        // Test Body
                        f_sendGeoNetMessage(
                            m_geoNwReq_linkLayerBroadcast(
                                m_geoNwPdu(
                                    m_geoNwAnycastPacket(
                                        v_longPosVectorNodeB,
                                        vc_localSeqNumber,
                                        f_getGeoAnycastArea(c_area1)
                                    )
berge's avatar
berge committed
                        );
                        
                        tc_noac.start;
                        alt {
                            [] a_receiveGeoAnycastWithArea(
                                    mw_longPosVectorPosition(v_longPosVectorNodeB),
                                    ?,
                                    f_getGeoAnycastArea(c_area1)) {
                                tc_noac.stop;
                                log("*** " & testcasename() & ": FAIL: GAC message retransmitted ***");
                                f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                            }
                            [] tc_noac.timeout {
                                log("*** " & testcasename() & ": PASS: GAC message not retransmitted ***");
                                f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                            }
berge's avatar
berge committed
                        
                        // Postamble
                        f_poNeighbour();
                        
                    } // end f_GEONW_PON_GAC_AREA_ALL_BV_02_nodeB
berge's avatar
berge committed
                    /**
                     * @desc    Behavior function for NodeD (TC_GEONW_PON_GAC_AREA_ALL_BV_02)
                     */
                    function f_GEONW_PON_GAC_AREA_ALL_BV_02_nodeD() runs on ItsGeoNetworking {
                        
                        // Local variables
                        var LongPosVector v_longPosVectorNodeB := f_getPosition(c_compNodeB);
                        
                        // Preamble
                        f_prNeighbour();
                        f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                        
                        // Test Body
                        tc_noac.start;
                        alt {
                            [] a_receiveGeoAnycastWithArea(
                                    mw_longPosVectorPosition(v_longPosVectorNodeB),
                                    ?,
                                    f_getGeoAnycastArea(c_area1)) {
                                tc_noac.stop;
                                log("*** " & testcasename() & ": FAIL: GAC message retransmitted ***");
                                f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                            }
                            [] tc_noac.timeout {
                                log("*** " & testcasename() & ": PASS: GAC message not retransmitted ***");
                                f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                            }
berge's avatar
berge committed
                        
                        // Postamble
                        f_poNeighbour();
    
                    } // end f_GEONW_PON_GAC_AREA_ALL_BV_02_nodeD
berge's avatar
berge committed
                } // end GEONW_PON_GAC_AREA_ALL_BV_02
berge's avatar
berge committed
                 * @desc    TP Function for TC_GEONW_PON_GAC_AREA_ALL_BV_05
berge's avatar
berge committed
                function f_GEONW_PON_GAC_AREA_ALL_BV_05() runs on ItsGeoNetworking {
berge's avatar
berge committed
                    var LongPosVector v_longPosVectorNodeB;
                    var template (value) GeoNetworkingPdu v_gnPacket;
                    var integer i;
                    var GnRawPayload v_sentRawPayload;
                    
berge's avatar
berge committed
                    if (not PICS_GN_GAC_DST) {
                        log("*** " & testcasename() & ": PICS_GN_GAC_DST required for executing the TC ***");
                        setverdict(inconc);
                        stop;
                    }
                    
                    // Test component configuration
berge's avatar
berge committed
                    f_cf01Up();
                    v_longPosVectorNodeB := f_getPosition(c_compNodeB);
berge's avatar
berge committed
                    // Test adapter configuration
                    
                    // Preamble
                    f_prNeighbour();
                    f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                    
berge's avatar
berge committed
                    // Test Body
                    v_gnPacket := m_geoNwPdu(m_geoNwAnycastPacket(
                                                v_longPosVectorNodeB,
                                                vc_localSeqNumber,
                                                f_getGeoAnycastArea(c_area1)
                                            )
                                        );
                    f_sendGeoNetMessage(m_geoNwReq_linkLayerBroadcast(v_gnPacket));
                    
                    f_sleep(PX_TAC);
                    
                    v_sentRawPayload := f_adaptPayloadForUtInd_m(v_gnPacket.gnPacket.packet.payload);
                    for(i:=0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i:=i+1) {
                        // empty on purpose 
                    }
                    if(i < lengthof(vc_utInds)) {
                        log("*** " & testcasename() & ": PASS: GN was transmitted to upper layer ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
berge's avatar
berge committed
                    else {
                        log("*** " & testcasename() & ": FAIL: GN was not transmitted to upper layer ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                    }
                    
                    log("*** " & testcasename() & ": GAC packet passed to Upper Layer ***");
                    f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
berge's avatar
berge committed
                    f_cf01Down();
berge's avatar
berge committed
                } // end f_GEONW_PON_GAC_AREA_ALL_BV_05
berge's avatar
berge committed
                group GEONW_PON_GAC_AREA_ALL_BO_08 {
berge's avatar
berge committed
                    /**
                     * @desc    TP Function for TC_GEONW_PON_GAC_AREA_ALL_BO_08
                     */
                    function f_GEONW_PON_GAC_AREA_ALL_BO_08() runs on ItsMtc {
                        
                        // Local variables
                        var ItsGeoNetworking v_nodeB;
                        var ItsGeoNetworking v_nodeD;
                        var template (value) GeoNetworkingPdu v_gnPacket;
                        
                        // Test control
                        if (not PICS_GN_GAC_DST) {
                            log("*** " & testcasename() & ": PICS_GN_GAC_DST required for executing the TC ***");
                            setverdict(inconc);
                            stop;
                        }
                        
                        // Test component configuration
                        f_cf02Up(c_compNodeB);
                        
                        // Preamble
                        
                        // Start components
                        v_nodeB := f_getComponent(c_compNodeB);
                        v_nodeD := f_getComponent(c_compNodeD);
                        v_nodeB.start(f_GEONW_PON_GAC_AREA_ALL_BO_08_nodeB());
                        v_nodeD.start(f_GEONW_PON_GAC_AREA_ALL_BO_08_nodeD());
                        
                        // Synchronization
                        f_serverSync2ClientsAndStop({c_prDone, c_tbDone});
                        
                        // Cleanup
                        f_cf02Down();
                        
                    } // end f_GEONW_PON_GAC_AREA_ALL_BO_08
berge's avatar
berge committed
                    /**
                     * @desc    Behavior function for NodeB (TC_GEONW_PON_GAC_AREA_ALL_BO_08)
                     */
                    function f_GEONW_PON_GAC_AREA_ALL_BO_08_nodeB() runs on ItsGeoNetworking {
                        
                        // Local variables
                        var LongPosVector v_longPosVectorNodeD := f_getPosition(c_compNodeD);
                        var template (value) GeoNetworkingPdu v_gnPacket;
                        var integer i;
                        var GnRawPayload v_sentRawPayload;
                        
                        // Preamble
                        f_prNeighbour();
                        
                        f_sleep(PX_TAC);
                        
                        v_gnPacket := m_geoNwPdu(m_geoNwAnycastPacket(
                                                    v_longPosVectorNodeD,
                                                    vc_localSeqNumber,
                                                    f_getGeoAnycastArea(c_area1)
                                                ),
                                                -,
                                                c_defaultHopLimit
                                            );
                        v_sentRawPayload := f_adaptPayloadForUtInd_m(v_gnPacket.gnPacket.packet.payload);
                        for(i:=0; i < lengthof(vc_utInds) and not match(vc_utInds[i].rawPayload, v_sentRawPayload); i:=i+1) {
                            // empty on purpose 
                        }
                        if(i < lengthof(vc_utInds)) {
                            log("*** " & testcasename() & ": PASS: GN was transmitted to upper layer ***");
                            vc_utInds := {};
                            f_selfOrClientSyncAndVerdict(c_prDone, e_success);
berge's avatar
berge committed
                        else {
                            log("*** " & testcasename() & ": INCONC: GN was not transmitted to upper layer ***");
                            f_selfOrClientSyncAndVerdict(c_prDone, e_error);
berge's avatar
berge committed
                        
                        // Test Body
                        v_gnPacket.basicHeader.routerHopLimit := valueof(v_gnPacket.basicHeader.routerHopLimit) / 2;
                        f_sendGeoNetMessage(m_geoNwReq_linkLayerBroadcast(v_gnPacket));
                        
                        f_sleep(PX_TAC);
                        
                        if(0 != lengthof(vc_utInds)) {
                            log("*** " & testcasename() & ": FAIL: GN was transmitted to upper layer ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                        }
berge's avatar
berge committed
                        else {
                            log("*** " & testcasename() & ": PASS: GN was NOT transmitted to upper layer ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                        }
                        
                        // Postamble
                        f_poNeighbour();
                        
                    } // end f_GEONW_PON_GAC_AREA_ALL_BO_08_nodeB
berge's avatar
berge committed
                    /**
                     * @desc    Behavior function for NodeD (TC_GEONW_PON_GAC_AREA_ALL_BO_08)
                     */
                    function f_GEONW_PON_GAC_AREA_ALL_BO_08_nodeD() runs on ItsGeoNetworking {
                        
                        // Local variables
                        var LongPosVector v_longPosVectorNodeD := f_getPosition(c_compNodeD);
                        var template (value) GeoNetworkingPdu v_gnPacket;
                        var integer i;
                        
                        // Preamble
                        f_prNeighbour();
                        v_gnPacket := m_geoNwPdu(m_geoNwAnycastPacket(
                                                    v_longPosVectorNodeD,
                                                    vc_localSeqNumber,
                                                    f_getGeoAnycastArea(c_area1)
                                                ),
                                                -,
                                                c_defaultHopLimit
                                            );
                        f_sendGeoNetMessage(m_geoNwReq_linkLayerBroadcast(v_gnPacket));
                        
                        f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                        
                        // Test Body
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                        
                        // Postamble
                        f_poNeighbour();
                        
                    } // end f_GEONW_PON_GAC_AREA_ALL_BO_08_nodeD
berge's avatar
berge committed
                } // end GEONW_PON_GAC_AREA_ALL_BO_08
berge's avatar
berge committed
			} // end gacAreaForwarding
            
        } // end geoGeoAnycast
16661 16662 16663 16664 16665 16666 16667 16668 16669 16670 16671 16672 16673 16674 16675 16676 16677 16678 16679 16680 16681 16682 16683 16684 16685 16686 16687 16688 16689 16690 16691 16692 16693 16694 16695 16696 16697 16698 16699 16700 16701 16702 16703 16704 16705 16706 16707 16708 16709 16710 16711 16712 16713 16714 16715 16716 16717 16718 16719 16720 16721 16722 16723 16724 16725 16726 16727 16728 16729 16730 16731 16732 16733 16734 16735 16736 16737 16738 16739 16740 16741 16742 16743 16744 16745 16746 16747 16748 16749 16750 16751 16752 16753 16754 16755 16756 16757 16758 16759 16760 16761 16762 16763 16764 16765 16766 16767 16768 16769 16770 16771 16772 16773 16774 16775 16776 16777 16778 16779 16780 16781 16782 16783 16784 16785 16786 16787 16788 16789 16790 16791 16792 16793 16794 16795 16796 16797 16798 16799 16800 16801 16802 16803 16804 16805 16806 16807 16808 16809 16810 16811 16812 16813 16814 16815 16816 16817 16818 16819 16820 16821 16822 16823 16824 16825 16826 16827 16828 16829 16830 16831 16832 16833 16834 16835 16836 16837 16838 16839 16840 16841 16842 16843 16844 16845 16846 16847 16848 16849 16850 16851 16852 16853 16854 16855 16856 16857 16858 16859 16860 16861 16862 16863 16864 16865 16866 16867 16868 16869 16870 16871 16872 16873 16874 16875 16876 16877 16878 16879 16880 16881 16882 16883 16884 16885 16886 16887 16888 16889 16890 16891 16892 16893 16894 16895 16896 16897 16898 16899 16900 16901 16902 16903 16904 16905 16906 16907 16908 16909 16910 16911 16912 16913 16914 16915 16916 16917 16918 16919 16920 16921 16922 16923 16924 16925 16926 16927 16928 16929 16930 16931 16932 16933 16934 16935 16936 16937 16938 16939 16940 16941 16942 16943 16944 16945 16946 16947 16948 16949 16950 16951 16952 16953 16954 16955 16956 16957 16958 16959 16960 16961 16962 16963 16964 16965 16966 16967 16968 16969 16970 16971 16972 16973 16974 16975 16976 16977 16978 16979 16980 16981 16982 16983 16984 16985 16986 16987 16988 16989 16990 16991 16992 16993
        
    } // end geoProtocolOperation
    
    // 6.2.3 Capacities
    group geoCapacities {
        
        // 6.2.3.1
        group geoCapLocationService {
            
            /**
             * @desc    TP Function for TC_GEONW_CAP_LOS_BV_01
             */
            function f_GEONW_CAP_LOS_BV_01() runs on ItsGeoNetworking {
                
                // Local variables
                var LongPosVector v_longPosVectorNodeA;
                var LongPosVector v_longPosVectorNodeB;
                var LongPosVector v_longPosVectorIut;
                var GeoNetworkingInd v_msg;
                var integer v_packetSize := 0;
                var integer v_index := 0;
                var integer v_nbrOfPackets := 0;
                
                // Test control
                if (not PICS_GN_LS_REQ_SRC) {
                    log("*** " & testcasename() & ": PICS_GN_LS_REQ_SRC required for executing the TC ***");
                    setverdict(inconc);
                    stop;
                }
                
                // Test component configuration
                f_cf01Up();
                
                // Test adapter configuration
                
                // Preamble
                v_longPosVectorNodeA := f_getPosition(c_compNodeA);
                v_longPosVectorNodeB := f_getPosition(c_compNodeB);
                v_longPosVectorIut := f_getPosition(c_compIut);
                f_prNeighbour();
                
                // Trigger message to NodeB in order to get an estimation of packet size
                if ( not f_utTriggerEvent(m_generateGeoUnicastMessageWithPayload(v_longPosVectorNodeB.gnAddr, char2oct("PAYLOAD_" & oct2str(int2oct(0, 2))))) ) {
                    log("*** " & testcasename() & ": INCONC: Trigger failed ***");
                    f_selfOrClientSyncAndVerdict(c_prDone, e_timeout);
                }
                tc_ac.start;
                alt {
                    [] geoNetworkingPort.receive(
                            mw_geoNwInd(
                                mw_geoNwPdu(
                                    mw_geoNwUnicastPacket(
                                        mw_shortPosVectorPosition(f_longPosVector2ShortPosVector(v_longPosVectorNodeB)),
                                        ?
                                    )
                                )
                            )
                        ) -> value v_msg {
                        var GeoNetworkingReq v_req;
                        tc_ac.stop;
                        //if we use directly v_msg(GeoNetworkingInd) for encvalue the encoder must also be able to provide
                        //encoding of "incoming messages"...
                        v_req.msgOut := v_msg.msgIn;
                        v_packetSize := lengthof(bit2oct(encvalue(v_req.msgOut)));
                    }
                }
                
                // implicitely trigger LS_REQUEST
                if ( not f_utTriggerEvent(m_generateGeoUnicastMessage(v_longPosVectorNodeA.gnAddr)) ) {
                    log("*** " & testcasename() & ": INCONC: Trigger failed ***");
                    f_selfOrClientSyncAndVerdict(c_prDone, e_timeout);
                }
                tc_ac.start;
                alt {
                    [] a_receiveLsRequest(
                        ?,
                        v_longPosVectorNodeA.gnAddr.mid,
                        v_longPosVectorIut
                    ) {
                    }
                }
                f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                
                // Test Body
                // Fill the LS buffer + one more message to remove an older message
                v_nbrOfPackets := f_getLsPacketBufferSize() / v_packetSize + 1;
                log("*** " & testcasename() & ": " & int2str(v_nbrOfPackets) & " ***");
                for (v_index:=1; v_index <= v_nbrOfPackets; v_index:=v_index+1) {
	                if ( not f_utTriggerEvent(m_generateGeoUnicastMessageWithPayload(v_longPosVectorNodeA.gnAddr, char2oct("PAYLOAD_" & oct2str(int2oct(v_index, 2))))) ) {
	                    log("*** " & testcasename() & ": INCONC: Trigger failed ***");
	                    f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
	                }
                }
                
                f_sleepIgnoreDef(0.5);
                f_sendGeoNetMessage(
                    m_geoNwReq_linkLayerBroadcast(
                        m_geoNwPdu(
                            m_geoNwLsReplyPacket(
                                v_longPosVectorNodeB,
                                f_longPosVector2ShortPosVector(v_longPosVectorIut),
                                vc_localSeqNumber
                            )
                        )
                    )
                );
                
                // packet 1 shall be dropped
                v_index := 2;
                tc_ac.start;
                alt {
                    [] geoNetworkingPort.receive(
                        f_receiveGeoNetMessageWithPayload(
                            mw_geoNwInd(
                                mw_geoNwPdu(
                                    mw_geoNwUnicastPacket(
                                        mw_shortPosVectorPosition(f_longPosVector2ShortPosVector(v_longPosVectorNodeA)),
                                        ?
                                    )
                                )
                            ),
                            f_adaptPayload_mw(char2oct("PAYLOAD_" & oct2str(int2oct(v_index, 2))))
                        )
                    ) {
                        if (v_index < v_nbrOfPackets) {
                            v_index := v_index + 1;
                            repeat;
                        }
                        tc_ac.stop;
                        log("*** " & testcasename() & ": Older message was removed, new message was inserted ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": Expected amount of messages were not received ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                    }
                }
                
                // Postamble
                f_poNeighbour();
                f_cf01Down();
                
            } // end f_GEONW_CAP_LOS_BV_01
            
        } // end geoCapLocationService
        
        // 6.2.3.2
        group geoCapForwardingPacketBuffer {
            
            group GEONW_CAP_FPB_BV_01 {
                
                /**
                 * @desc    TP Function for TC_GEONW_CAP_LOS_BV_01
                 */
                function f_GEONW_CAP_FPB_BV_01() runs on ItsMtc {
                    
                    // Local variables
                    var ItsGeoNetworking v_nodeB;
                    var ItsGeoNetworking v_nodeC;
                    var template (value) GeoNetworkingPdu v_geoNetworkingMsg;
                    var integer v_packetSize := 0;
                    var integer v_nbrOfPackets := 0;
                    var integer v_payloadSize := f_min(1400, f_getUcForwardingPacketBufferSize() / 10 );
                    var octetstring v_payload;
                    const integer c_nbrOfDiscardedMessages := 1;
                    var UInt16 v_sequenceNumberC := f_getInitialSequenceNumber();
                    
                    // Test control
                    if (not PICS_GN_GUC_FWD) {
                        log("*** " & testcasename() & ": PICS_GN_GUC_FWD required for executing the TC ***");
                        setverdict(inconc);
                        stop;
                    }
                     
                    // Test component configuration
                    f_cf03Up();
                    
                    // Preamble
                    
                    // Prepare GUC message
                    v_payload := int2oct(0, v_payloadSize);
                    v_geoNetworkingMsg := m_geoNwPdu(
                        m_geoNwUnicastPacket(
                            m_dummyLongPosVector,
                            f_longPosVector2ShortPosVector(valueof(m_dummyLongPosVector)),
                            0)
                    );
                    v_geoNetworkingMsg.gnPacket.packet.payload := f_adaptPayload_m(v_payload);
                    v_packetSize := lengthof(bit2oct(encvalue(v_geoNetworkingMsg)));
                    
                    // Fill the UC forwarding buffer + c_nbrOfDiscardedMessages more message to remove older messages
                    v_nbrOfPackets := f_getUcForwardingPacketBufferSize() / v_packetSize + c_nbrOfDiscardedMessages + 1;
                    log("*** " & testcasename() & ": " & int2str(v_nbrOfPackets) & " ***");
                    
                    // Start components
                    v_nodeB := f_getComponent(c_compNodeB);
                    v_nodeC := f_getComponent(c_compNodeC);
                    v_nodeB.start(f_GEONW_CAP_FPB_BV_01_nodeB(v_sequenceNumberC, v_nbrOfPackets, c_nbrOfDiscardedMessages));
                    v_nodeC.start(f_GEONW_CAP_FPB_BV_01_nodeC(v_sequenceNumberC, v_nbrOfPackets, v_geoNetworkingMsg));
                    
                    // Synchronization
                    f_serverSync2ClientsAndStop({c_prDone, c_tbDone});
                    
                    // Cleanup
                    f_cf03Down();
                    
                } // end f_GEONW_CAP_FPB_BV_01
                
                /**
                 * @desc    Behavior function for NodeB (TC_GEONW_CAP_FPB_BV_01)
                 * @param   p_sequenceNumberC           Initial sequence number of NodeC
                 * @param   p_nbrOfPackets              Number of packets sent by other component
                 * @param   p_nbrOfDiscardedMessages    Number of packets that should be discarded
                 */
                function f_GEONW_CAP_FPB_BV_01_nodeB(
                    in UInt16 p_sequenceNumberC,
                    in integer p_nbrOfPackets,
                    in integer p_nbrOfDiscardedMessages
                ) runs on ItsGeoNetworking {
                    
                    // Local variables
                    var LongPosVector v_longPosVectorNodeA := f_getPosition(c_compNodeA);
                    var UInt16 v_expectedSeqNumber := p_sequenceNumberC + p_nbrOfDiscardedMessages + 1;
                    var integer v_nbReceivedMessages := 0;
                    
                    // Preamble
                    f_prDefault(); // NodeB is not yet a neighbour
                    f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                    
                    // Test Body
                    f_startBeingNeighbour();
                    
                    tc_ac.start;
                    alt {
                        [] geoNetworkingPort.receive(
                                mw_geoNwInd(
                                    mw_geoNwPdu(
                                        mw_geoNwUnicastPacket(
                                            mw_shortPosVectorPosition(f_longPosVector2ShortPosVector(v_longPosVectorNodeA)),
                                            v_expectedSeqNumber
                                        )
                                    )
                                )
                            ) {
                            v_nbReceivedMessages := v_nbReceivedMessages + 1;
                            v_expectedSeqNumber := v_expectedSeqNumber + 1;
                            repeat; // repeat in any case => IUT may send more messages !
                        }
                        [] geoNetworkingPort.receive(
                                mw_geoNwInd(
                                    mw_geoNwPdu(
                                        mw_geoNwUnicastPacket(
                                            mw_shortPosVectorPosition(f_longPosVector2ShortPosVector(v_longPosVectorNodeA)),
                                            ?
                                        )
                                    )
                                )
                            ) {
                            tc_ac.stop;
                            log("*** " & testcasename() & ": FAIL: Unexpected message received (Bad sequence number) ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                        }
                        [] tc_ac.timeout {
                            if(v_nbReceivedMessages == (p_nbrOfPackets - p_nbrOfDiscardedMessages)) {
                                log("*** " & testcasename() & ": PASS: Older messages wer removed, new messages were inserted ***");
                                f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                            }
                            else {
                                log("*** " & testcasename() & ": FAIL: Expected amount of messages were not received ***");
                                f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                            }
                        }
                    }
                    
                    // Postamble
                    f_poNeighbour();
                    
                } // end f_GEONW_CAP_FPB_BV_01_nodeB
                
                /**
                 * @desc    Behavior function for NodeC (TC_GEONW_CAP_FPB_BV_01)
                 * @param   p_sequenceNumberC     Initial sequence number of NodeC
                 * @param   p_nbrOfPackets        Number of packets to be send
                 * @param   p_geoNetworkingMsg    Pdu to be sent (template)
                 */
                function f_GEONW_CAP_FPB_BV_01_nodeC(
                    in UInt16 p_sequenceNumberC,
                    in integer p_nbrOfPackets,
                    in template (value) GeoNetworkingPdu p_geoNetworkingMsg
                ) 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;
                    
                    p_geoNetworkingMsg.gnPacket.packet.extendedHeader.geoUnicastHeader.srcPosVector := v_longPosVectorNodeC;
                    p_geoNetworkingMsg.gnPacket.packet.extendedHeader.geoUnicastHeader.dstPosVector := f_longPosVector2ShortPosVector(v_longPosVectorNodeA);
                    for (i:=0; i < p_nbrOfPackets; i:=i+1) {
                        p_geoNetworkingMsg.gnPacket.packet.extendedHeader.geoUnicastHeader.seqNumber := vc_localSeqNumber;
                        f_sendGeoNetMessage(m_geoNwReq_linkLayerBroadcast(p_geoNetworkingMsg));
                    }
                    f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                    
                    // Test Body
                    f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                    
                    // Postamble
                    f_poNeighbour();
                    
                } // end f_GEONW_CAP_FPB_BV_01_nodeC
                
            } // end GEONW_CAP_FPB_BV_01
            
            group GEONW_CAP_FPB_BV_02 {
                
                /**
                 * @desc    TP Function for TC_GEONW_CAP_FPB_BV_02
                 */
                function f_GEONW_CAP_FPB_BV_02() runs on ItsMtc {
                    
                    // Local variables
                    var ItsGeoNetworking v_nodeB;
                    var ItsGeoNetworking v_nodeC;
                    var template (value) GeoNetworkingPdu v_geoNetworkingMsg;
                    var integer v_packetSize := 0;
                    var integer v_nbrOfPackets := 0;
                    const integer c_nbrOfDiscardedMessages := 1;
                    var UInt16 v_sequenceNumberC := f_getInitialSequenceNumber();
                    const octetstring c_defaultPayload := char2oct("DEFAULT_PAYLOAD");
                    const integer c_itsGnMaxSduSize := 1398;
                    var octetstring v_payload := c_defaultPayload;
                    
                    // Test control
                    if (not PICS_GN_GBC_FWD) {
                        log("*** " & testcasename() & ": PICS_GN_GBC_FWD required for executing the TC ***");
                        setverdict(inconc);
                        stop;
                    }
                    
                    // Test component configuration
                    f_cf03Up();
                    
                    // Preamble
                    
                    v_geoNetworkingMsg := m_geoNwPdu(m_geoNwBroadcastPacket(
                        m_dummyLongPosVector,
                        0,
                        m_dummyGeoBroadcastArea));
                    
                    while (lengthof(v_payload) < (c_itsGnMaxSduSize- lengthof(c_defaultPayload))) {
                        v_payload := v_payload & c_defaultPayload;
                    }
                    
                    v_geoNetworkingMsg.gnPacket.packet.payload := f_adaptPayload_m(v_payload);
                    
                    v_packetSize := lengthof(bit2oct(encvalue(v_geoNetworkingMsg)));
                    
                    // Fill the BC forwarding buffer + c_nbrOfDiscardedMessages more message to remove older messages
                    v_nbrOfPackets := f_getBcForwardingPacketBufferSize() / v_packetSize + c_nbrOfDiscardedMessages;
                    
                    // Start components
                    v_nodeB := f_getComponent(c_compNodeB);
                    v_nodeC := f_getComponent(c_compNodeC);
                    v_nodeB.start(f_GEONW_CAP_FPB_BV_02_nodeB(v_sequenceNumberC, v_nbrOfPackets, c_nbrOfDiscardedMessages));
                    v_nodeC.start(f_GEONW_CAP_FPB_BV_02_nodeC(v_sequenceNumberC, v_nbrOfPackets, v_geoNetworkingMsg));
                    
                    // Synchronization
                    f_serverSync2ClientsAndStop({c_prDone, c_tbDone});
                    
                    // Cleanup
                    f_cf03Down();
                    
                } // end f_GEONW_CAP_FPB_BV_02
                
                /**
                 * @desc    Behavior function for NodeB (TC_GEONW_CAP_FPB_BV_02)
                 * @param   p_sequenceNumberC           Initial sequence number of NodeC
                 * @param   p_nbrOfPackets              Number of packets sent by other component
                 * @param   p_nbrOfDiscardedMessages    Number of packets that should be discarded
                 */
                function f_GEONW_CAP_FPB_BV_02_nodeB(
                    in UInt16 p_sequenceNumberC,
                    in integer p_nbrOfPackets,
                    in integer p_nbrOfDiscardedMessages
                ) runs on ItsGeoNetworking {
                    
                    // Local variables
                    var LongPosVector v_longPosVectorIut := f_getPosition(c_compIut);
                    var LongPosVector v_longPosVectorNodeC := f_getPosition(c_compNodeC);
                    var UInt16 v_expectedSeqNumber := p_sequenceNumberC + p_nbrOfDiscardedMessages;
                    var integer v_nbReceivedMessages := 0;
                    
                    // Preamble
                    f_prDefault(); // NodeB is not yet a neighbour
                    f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                    
                    // Test Body
                    f_startBeingNeighbour();
                    
                    tc_ac.start;
                    alt {
                        [] a_receiveGeoBroadcast(
garciay's avatar
garciay committed
                            mw_longPosVectorPosition(v_longPosVectorNodeC),
                            v_expectedSeqNumber
                        ) {
                            v_nbReceivedMessages := v_nbReceivedMessages + 1;
                            v_expectedSeqNumber := v_expectedSeqNumber + 1;
                            repeat; // repeat in any case => IUT may send more messages !
                        }
                        [] a_receiveGeoBroadcast(
garciay's avatar
garciay committed
                            mw_longPosVectorPosition(v_longPosVectorNodeC),
                            ?
                        ) {
                            tc_ac.stop;
                            log("*** " & testcasename() & ": FAIL: Unexpected message received (Bad sequence number) ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                        }
                        [] tc_ac.timeout {
                            if(v_nbReceivedMessages == (p_nbrOfPackets - p_nbrOfDiscardedMessages)) {
                                log("*** " & testcasename() & ": PASS: Older messages wer removed, new messages were inserted ***");
                                f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                            }
                            else {
                                log("*** " & testcasename() & ": FAIL: Expected amount of messages were not received ***");
                                f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                            }
                        }
                    }
                    
                    // Postamble
                    f_poNeighbour();
                    
                } // end f_GEONW_CAP_FPB_BV_02_nodeB
                
                /**
                 * @desc    Behavior function for NodeC (TC_GEONW_CAP_FPB_BV_02)
                 * @param   p_sequenceNumberC     Initial sequence number of NodeC
                 * @param   p_nbrOfPackets        Number of packets to be send
                 * @param   p_geoNetworkingMsg    Pdu to be sent (template)
                 */
                function f_GEONW_CAP_FPB_BV_02_nodeC(
                    in UInt16 p_sequenceNumberC,
                    in integer p_nbrOfPackets,
                    in template (value) GeoNetworkingPdu p_geoNetworkingMsg
                ) runs on ItsGeoNetworking {
                    
                    // Local variables
                    var LongPosVector v_longPosVectorNodeC := f_getPosition(c_compNodeC);
                    var integer i := 0;
                    var Payload v_payload := valueof(p_geoNetworkingMsg.gnPacket.packet.payload); //save the given payload
                    
                    // Preamble
                    f_prNeighbour();
                    vc_localSeqNumber := p_sequenceNumberC;
                    
                    p_geoNetworkingMsg.gnPacket.packet := m_geoNwBroadcastPacket(
                        v_longPosVectorNodeC,
                        0,
                        f_getGeoBroadcastArea(c_area2)
                    );
                    p_geoNetworkingMsg.gnPacket.packet.payload := v_payload; //set back the original given payload
                    
                    for (i:=0; i < p_nbrOfPackets; i:=i+1) {
                        p_geoNetworkingMsg.gnPacket.packet.extendedHeader.geoBroadcastHeader.seqNumber := vc_localSeqNumber;
                        f_sendGeoNetMessage(m_geoNwReq_linkLayerBroadcast(p_geoNetworkingMsg));
                    }
                    f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                    
                    // Test Body
                    f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                    
                    // Postamble
                    f_poNeighbour();
                    
                } // end f_GEONW_CAP_FPB_BV_02_nodeC
                
            } // end GEONW_CAP_FPB_BV_02
            
        } // end geoCapForwardingPacketBuffer
        
    } // end geoCapacities
    
} // end ItsGeoNetworking_TpFunctions