ItsGeoNetworking_TpFunctions.ttcn 718 KB
Newer Older
/**
 *  @author     ETSI / STF405 / STF449
 *  @version    $URL$
 *              $Id$
 *  @desc       GeoNetworking TP Functions
 *
 */
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;
    
    // LibIts
    import from LibItsCommon_Functions all;
    import from LibItsGeoNetworking_TestSystem all;
    import from LibItsGeoNetworking_Functions all;
    import from LibItsGeoNetworking_Templates all;
    import from LibItsGeoNetworking_TypesAndValues all;
    import from LibItsGeoNetworking_Pics all;
	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),
2003 2004 2005 2006 2007 2008 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
                        ?) {
                        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());
2405 2406 2407 2408 2409 2410 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
                    }
                    [] 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),
2786 2787 2788 2789 2790 2791 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
                                            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
                            ),
5432 5433 5434 5435 5436 5437 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
                            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(
5990 5991 5992 5993 5994 5995 5996 5997 5998 5999 6000 6001 6002 6003 6004 6005 6006 6007 6008 6009 6010 6011 6012 6013 6014 6015 6016 6017 6018 6019 6020 6021 6022 6023 6024 6025 6026 6027 6028 6029 6030 6031 6032 6033 6034 6035 6036 6037 6038 6039 6040 6041 6042 6043 6044 6045 6046 6047 6048 6049 6050 6051 6052 6053 6054 6055 6056 6057 6058 6059 6060 6061 6062 6063 6064 6065 6066 6067 6068 6069 6070 6071 6072 6073 6074 6075 6076 6077 6078 6079 6080 6081 6082 6083 6084 6085 6086 6087 6088 6089 6090 6091 6092 6093 6094 6095 6096 6097 6098 6099 6100 6101 6102 6103 6104 6105 6106 6107 6108 6109 6110 6111 6112 6113 6114 6115 6116 6117 6118 6119 6120 6121 6122 6123 6124 6125 6126 6127 6128 6129 6130 6131 6132 6133 6134 6135 6136 6137 6138 6139 6140 6141 6142 6143 6144 6145 6146 6147 6148 6149 6150 6151 6152 6153 6154 6155 6156 6157 6158 6159 6160 6161 6162 6163 6164 6165 6166 6167 6168 6169 6170 6171 6172 6173 6174 6175 6176 6177 6178 6179 6180 6181 6182 6183 6184 6185 6186 6187 6188 6189 6190 6191 6192 6193 6194 6195 6196 6197 6198 6199 6200 6201 6202 6203 6204 6205 6206 6207 6208 6209 6210 6211 6212 6213 6214 6215 6216 6217 6218 6219 6220 6221 6222 6223 6224 6225 6226 6227 6228 6229 6230 6231 6232 6233 6234 6235 6236 6237 6238 6239 6240 6241 6242 6243 6244 6245 6246 6247 6248 6249 6250 6251 6252 6253 6254 6255 6256 6257 6258 6259 6260 6261 6262 6263 6264 6265 6266 6267 6268 6269 6270 6271 6272 6273 6274 6275 6276 6277 6278 6279 6280 6281 6282 6283 6284 6285 6286 6287 6288 6289 6290 6291 6292 6293 6294 6295 6296 6297 6298 6299 6300 6301 6302 6303 6304 6305 6306 6307 6308 6309 6310 6311 6312 6313 6314 6315 6316 6317 6318 6319 6320 6321 6322 6323 6324 6325 6326 6327 6328 6329 6330 6331 6332 6333 6334 6335 6336 6337 6338 6339 6340 6341 6342 6343 6344 6345 6346 6347 6348 6349 6350
                                ?  // 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 {
            
            /**
             * @desc    TP Function for TC_GEONW_PON_GUC_BV_01
             */
            function f_GEONW_PON_GUC_BV_01() runs on ItsGeoNetworking {
                
                // Local variables
                var LongPosVector v_longPosVectorNodeB;
                
                // Test control
                if (not PICS_GN_GUC_SRC) {
                    log("*** " & testcasename() & ": PICS_GN_GUC_SRC required for executing the TC ***");
                    setverdict(inconc);
                    stop;
                }
                if ((f_getGeoUnicastForwardingAlgorithm() != e_greedy) and (f_getGeoUnicastForwardingAlgorithm() != e_unspecified)) {
                    log("*** " & testcasename() & ": PICS_GN_GEOUNICAST_FORWARDING_ALGORITHM == (e_greedy  or e_unspecified) 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 {
                    [] geoNetworkingPort.receive(
                            mw_geoNwInd(
                                mw_geoNwPdu(
                                    mw_geoNwUnicastPacket(
                                        mw_shortPosVectorPosition(f_longPosVector2ShortPosVector(v_longPosVectorNodeB)),
                                        ?
                                    )
                                )
                            )
                        ) {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": DEPV of the received GUC message correctly set ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                    }
                    [] geoNetworkingPort.receive(
                            mw_geoNwInd(
                                mw_geoNwPdu(
                                    mw_geoNwUnicastPacket(
                                        ?,
                                        ?
                                    )
                                )
                            )
                        ) {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": DEPV of the received GUC message incorrectly set ***");
                        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_GUC_BV_01
            
            group GEONW_PON_GUC_BV_02 {
                
                /**
                 * @desc    TP Function for TC_GEONW_PON_GUC_BV_02
                 */
                function f_GEONW_PON_GUC_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_getGeoUnicastForwardingAlgorithm() != e_greedy) and (f_getGeoUnicastForwardingAlgorithm() != e_unspecified)) {
                        log("*** " & testcasename() & ": PICS_GN_GEOUNICAST_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_BV_02_nodeB());
                    v_nodeC.start(f_GEONW_PON_GUC_BV_02_nodeC());
                    v_nodeD.start(f_GEONW_PON_GUC_BV_02_nodeD());
                    
                    // Synchronization
                    f_serverSync3ClientsAndStop({c_prDone, c_tbDone});
                    
                    // Cleanup
                    f_cf04Down();
                    
                } // end f_GEONW_PON_GUC_BV_02
                
                /**
                 * @desc    Behavior function for NodeB (TC_GEONW_PON_GUC_BV_02)
                 */
                function f_GEONW_PON_GUC_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_BV_02_nodeB
                
                /**
                 * @desc    Behavior function for NodeC (TC_GEONW_PON_GUC_BV_02)
                 */
                function f_GEONW_PON_GUC_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
                                ),
                                -,
                                c_defaultHopLimit
                            ),
                            f_getIutMacAddress()
                        )
                    );
                    
                    f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                    
                    // Postamble
                    f_poNeighbour();
                    
                } // end f_GEONW_PON_GUC_BV_02_nodeC
                
                /**
                 * @desc    Behavior function for NodeD (TC_GEONW_PON_GUC_BV_02)
                 */
                function f_GEONW_PON_GUC_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_BV_02_nodeD
                
            } // end GEONW_PON_GUC_BV_02
            
            group GEONW_PON_GUC_BV_03 {
                
                /**
                 * @desc    TP Function for TC_GEONW_PON_GUC_BV_03
                 */
                function f_GEONW_PON_GUC_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_BV_03_nodeB());
                    v_nodeC.start(f_GEONW_PON_GUC_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_BV_03)
                 */
                function f_GEONW_PON_GUC_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(
                                        ?,
                                        ?
                                    )
                                )
                            )
                        ) {
                            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 forwarded ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                        }
                    }
                    
                    // Postamble
                    f_poNeighbour();
                    
                } // end f_GEONW_PON_GUC_BV_03_nodeB
                
                /**
                 * @desc    Behavior function for NodeC (TC_GEONW_PON_GUC_BV_03)
                 */
                function f_GEONW_PON_GUC_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);
                    
                    // Postamble
                    f_poNeighbour();
                    
                } // end f_GEONW_PON_GUC_BV_03_nodeC
                
            } // end GEONW_PON_GUC_BV_03
            
            group GEONW_PON_GUC_BO_04 {
                
                /**
                 * @desc    TP Function for TC_GEONW_PON_GUC_BO_04
                 */
                function f_GEONW_PON_GUC_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_BO_04_nodeB());
                    v_nodeC.start(f_GEONW_PON_GUC_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_BO_04)
                 */
                function f_GEONW_PON_GUC_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)),
                                        ?
                                    ),
                                    -,
                                    ?
                                )
                            )
                        ) {
                            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_BO_04_nodeB
                
                /**
                 * @desc    Behavior function for NodeC (TC_GEONW_PON_GUC_BO_04)
                 */
                function f_GEONW_PON_GUC_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()
                        )
                    );
                    
                    f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                    
                    // Postamble
                    f_poNeighbour();
                    
                } // end f_GEONW_PON_GUC_BO_04_nodeC
                
            } // end GEONW_PON_GUC_BO_04
            
            /**
             * @desc    TP Function for TC_GEONW_PON_GUC_BV_05
             */
            function f_GEONW_PON_GUC_BV_05() runs on ItsGeoNetworking {
                
                // Local variables
                var template (value) GeoNetworkingPdu v_gnPacket;
                var integer i;
                var GnRawPayload v_sentRawPayload;
                
                // 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_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_getIutShortPosVector(),
                                      vc_localSeqNumber
                                  )
                              );
                f_sendGeoNetMessage(m_geoNwReq_withLinkLayerDestination(v_gnPacket, -, f_getIutMacAddress()));
                
                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_poDefault();
                f_cf01Down();
                
            } // end f_GEONW_PON_GUC_BV_05
            
            group GEONW_PON_GUC_BV_06 {
                
                /**
                 * @desc    TP Function for TC_GEONW_PON_GUC_BV_06
                 */
                function f_GEONW_PON_GUC_BV_06() 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_getGeoUnicastForwardingAlgorithm() != e_cbf) {
                        log("*** " & testcasename() & ": PICS_GN_GEOUNICAST_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_BV_06_nodeB(v_distance, v_longPosVectorNodeA));
                    v_nodeC.start(f_GEONW_PON_GUC_BV_06_nodeC(v_longPosVectorNodeA));
                    
                    // Synchronization
                    f_serverSync2ClientsAndStop({c_prDone, c_msgSent, c_tbDone});
                    
                    // Cleanup
                    f_cf03Down();
                    
                } // end f_GEONW_PON_GUC_BV_06
                
                /**
                 * @desc    Behavior function for NodeB (TC_GEONW_PON_GUC_BV_06)
                 * @param   p_distanceToNodeA       Distance between IUT and NodeA
                 * @param   p_longPosVectorNodeA    Position vector of NodeA
                 */
                function f_GEONW_PON_GUC_BV_06_nodeB(in float p_distanceToNodeA, in LongPosVector p_longPosVectorNodeA) runs on ItsGeoNetworking {
                    
                    // Local variables
                    timer t_toCbf := (int2float(f_getGeoUnicastCbfMaxTime())
                        + (
                            int2float(f_getGeoUnicastCbfMinTime() - f_getGeoUnicastCbfMaxTime())
                            / 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_BV_06_nodeB
                
                /**
                 * @desc    Behavior function for NodeC (TC_GEONW_PON_GUC_BV_06)
                 * @param   p_longPosVectorNodeA    Position vector of NodeA
                 */
                function f_GEONW_PON_GUC_BV_06_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
                            ),
                            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)),
                                        ?
                                    )
                                )
                            )
                        ) {
                            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 re-broadcasted ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                        }
                    }
                    
                    // Postamble
                    f_poNeighbour();
                    
                } // end f_GEONW_PON_GUC_BV_06_nodeC
                
            } // end GEONW_PON_GUC_BV_06
            
            group GEONW_PON_GUC_BV_07 {
                
                /**
                 * @desc    TP Function for TC_GEONW_PON_GUC_BV_07
                 */
                function f_GEONW_PON_GUC_BV_07() 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_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_getGeoUnicastForwardingAlgorithm() != e_cbf) {
                        log("*** " & testcasename() & ": PICS_GN_GEOUNICAST_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_BV_07_nodeB(v_longPosVectorNodeA));
                    v_nodeC.start(f_GEONW_PON_GUC_BV_07_nodeC(v_longPosVectorNodeA));
                    
                    // Synchronization
                    f_serverSync2ClientsAndStop({c_prDone, c_msgSent, c_tbDone});
                    
                    // Cleanup
                    f_cf03Down();
                    
                } // end f_GEONW_PON_GUC_BV_07
                
                /**
                 * @desc    Behavior function for NodeB (TC_GEONW_PON_GUC_BV_07)
                 * @param   p_longPosVectorNodeA    Position vector of NodeA
                 */
                function f_GEONW_PON_GUC_BV_07_nodeB(in LongPosVector p_longPosVectorNodeA) runs on ItsGeoNetworking {
                    
                    // Local variables
                    timer t_toCbf := int2float(f_getGeoUnicastCbfMinTime()) / 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_BV_07_nodeB
                
                /**
                 * @desc    Behavior function for NodeC (TC_GEONW_PON_GUC_BV_07)
                 * @param   p_longPosVectorNodeA    Position vector of NodeA
                 */
                function f_GEONW_PON_GUC_BV_07_nodeC(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
                            ),
                            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)),
                                        ?
                                    )
                                )
                            )
                        ) {
                            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_BV_07_nodeC
                
            } // end GEONW_PON_GUC_BV_07
            
            group GEONW_PON_GUC_BV_08 {
                
                /**
                 * @desc    TP Function for TC_GEONW_PON_GUC_BV_08
                 */
                function f_GEONW_PON_GUC_BV_08() 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_getGeoUnicastForwardingAlgorithm() != e_cbf) {
                        log("*** " & testcasename() & ": PICS_GN_GEOUNICAST_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_BV_08_nodeB(v_longPosVectorNodeA));
                    v_nodeC.start(f_GEONW_PON_GUC_BV_08_nodeC(v_longPosVectorNodeA));
                    
                    // Synchronization
                    f_serverSync2ClientsAndStop({c_prDone, c_tbDone});
                    
                    // Cleanup
                    f_cf03Down();
                    
                } // end f_GEONW_PON_GUC_BV_08
                
                /**
                 * @desc    Behavior function for NodeB (TC_GEONW_PON_GUC_BV_08)
                 * @param   p_longPosVectorNodeA    Position vector of NodeA
                 */
                function f_GEONW_PON_GUC_BV_08_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_getGeoUnicastCbfMaxTime())/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_BV_08_nodeB
                
                /**
                 * @desc    Behavior function for NodeC (TC_GEONW_PON_GUC_BV_08)
                 * @param   p_longPosVectorNodeA    Position vector of NodeA
                 */
                function f_GEONW_PON_GUC_BV_08_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_BV_08_nodeC
                
            } // end GEONW_PON_GUC_BV_08
            
            group GEONW_PON_GUC_BV_10 {
                
                /**
                 * @desc    TP Function for TC_GEONW_PON_GUC_BV_10
                 */
                function f_GEONW_PON_GUC_BV_10() 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_getGeoUnicastForwardingAlgorithm() != e_cbf) {
                        log("*** " & testcasename() & ": PICS_GN_GEOUNICAST_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_BV_10_nodeB(v_longPosVectorNodeA));
                    v_nodeC.start(f_GEONW_PON_GUC_BV_10_nodeC(v_longPosVectorNodeA));
                    
                    // Synchronization
                    f_serverSync2ClientsAndStop({c_prDone, c_tbDone});
                    
                    // Cleanup
                    f_cf03Down();
                    
                } // end f_GEONW_PON_GUC_BV_10
                
                /**
                 * @desc    Behavior function for NodeB (TC_GEONW_PON_GUC_BV_10)
                 * @param   p_longPosVectorNodeA    Position vector of NodeA
                 */
                function f_GEONW_PON_GUC_BV_10_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_getGeoUnicastCbfMaxTime())/2000.0);
                    
                    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_BV_10_nodeB
                
                /**
                 * @desc    Behavior function for NodeC (TC_GEONW_PON_GUC_BV_10)
                 * @param   p_longPosVectorNodeA    Position vector of NodeA
                 */
                function f_GEONW_PON_GUC_BV_10_nodeC(in LongPosVector p_longPosVectorNodeA) runs on ItsGeoNetworking {
                    
                    // Local variables
                    
                    // Preamble
                    f_prDefault();
                    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()
                        )
                    );
                    
                    f_sleepIgnoreDef(int2float(f_getGeoUnicastCbfMaxTime())/2000.0);
                    
                    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_BV_10_nodeC
                
            } // end GEONW_PON_GUC_BV_10

            group GEONW_PON_GUC_BV_11 {
                
                /**
                 * @desc    TP Function for TC_GEONW_PON_GUC_BV_11
                 */
                function f_GEONW_PON_GUC_BV_11() 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;
                    }
                    if (f_getGeoUnicastForwardingAlgorithm() != e_cbf) {
                        log("*** " & testcasename() & ": PICS_GN_GEOUNICAST_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_BV_11_nodeB());
                    v_nodeC.start(f_GEONW_PON_GUC_BV_11_nodeC());
                    
                    // Synchronization
                    f_serverSync2ClientsAndStop({c_prDone, c_tbDone});
                    
                    // Cleanup
                    f_cf03Down();
                    
                } // end f_GEONW_PON_GUC_BV_11
                
                /**
                 * @desc    Behavior function for NodeB (TC_GEONW_PON_GUC_BV_11)
                 */
                function f_GEONW_PON_GUC_BV_11_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_BV_11_nodeB
                
                /**
                 * @desc    Behavior function for NodeC (TC_GEONW_PON_GUC_BV_11)
                 */
                function f_GEONW_PON_GUC_BV_11_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_BV_11_nodeC
                                
            } // end GEONW_PON_GUC_BV_11

            group GEONW_PON_GUC_BO_12 {
                
                /**
                 * @desc    TP Function for TC_GEONW_PON_GUC_BO_12
                 */
                function f_GEONW_PON_GUC_BO_12() 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_getGeoUnicastForwardingAlgorithm() != e_greedy) and (f_getGeoUnicastForwardingAlgorithm() != e_unspecified)) {
                        log("*** " & testcasename() & ": PICS_GN_GEOUNICAST_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_BO_12_nodeB());
                    v_nodeC.start(f_GEONW_PON_GUC_BO_12_nodeC());
                    
                    // Synchronization
                    f_serverSync2ClientsAndStop({c_prDone, c_tbDone});
                    
                    // Cleanup
                    f_cf03Down();
                    
                } // end f_GEONW_PON_GUC_BO_12
                
                /**
                 * @desc    Behavior function for NodeB (TC_GEONW_PON_GUC_BO_12)
                 */
                function f_GEONW_PON_GUC_BO_12_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
                                ),
                                -,
                                c_defaultHopLimit - 1
                            ),
                            f_getIutMacAddress()
                        )
                    );
                    
                    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);                            
                        }
                    }
                    
                    // Postamble
                    f_poNeighbour();
                    
                } // end f_GEONW_PON_GUC_BO_12_nodeB
                
                /**
                 * @desc    Behavior function for NodeC (TC_GEONW_PON_GUC_BO_12)
                 */
                function f_GEONW_PON_GUC_BO_12_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()
                        )
                    );
                    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);                            
                        }
                    }
                    
                    // Postamble
                    f_poNeighbour();
                    
                } // end f_GEONW_PON_GUC_BO_12_nodeC
                
            } // end GEONW_PON_GUC_BO_12

            group GEONW_PON_GUC_BO_13 {
                
                /**
                 * @desc    TP Function for TC_GEONW_PON_GUC_BO_13
                 */
                function f_GEONW_PON_GUC_BO_13() 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;
                    }
                    if ((f_getGeoUnicastForwardingAlgorithm() != e_greedy) and (f_getGeoUnicastForwardingAlgorithm() != e_unspecified)) {
                        log("*** " & testcasename() & ": PICS_GN_GEOUNICAST_FORWARDING_ALGORITHM == (e_greedy  or e_unspecified) 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_BO_13_nodeB());
                    v_nodeC.start(f_GEONW_PON_GUC_BO_13_nodeC());
                    
                    // Synchronization
                    f_serverSync2ClientsAndStop({c_prDone, c_tbDone});
                    
                    // Cleanup
                    f_cf03Down();
                    
                } // end f_GEONW_PON_GUC_BV_13
                
                /**
                 * @desc    Behavior function for NodeB (TC_GEONW_PON_GUC_BO_13)
                 */
                function f_GEONW_PON_GUC_BO_13_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
                        ),
                        -,
                        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()));
                    
                    if(0 != lengthof(vc_utInds)) {
                        log("*** " & testcasename() & ": FAIL: GN was transmitted to upper layer ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                        log("*** " & testcasename() & ": PASS: GN was not transmitted to upper layer ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                    }
                    
                    // Postamble
                    f_poNeighbour();
                    
                } // end f_GEONW_PON_GUC_BO_13_nodeB
                
                /**
                 * @desc    Behavior function for NodeC (TC_GEONW_PON_GUC_BO_13)
                 */
                function f_GEONW_PON_GUC_BO_13_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_BO_13_nodeC
                
            } // end GEONW_PON_GUC_BO_13
                        
        } // end geoGeoUnicast
        
        // 6.2.2.9
        group geoGeoBroadcast {
            
            group GEONW_PON_GBC_BV_01 {
                
                /**
                 * @desc    TP Function for TC_GEONW_PON_GBC_BV_01
                 */
                function f_GEONW_PON_GBC_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_BV_01_nodeB());
                    v_nodeD.start(f_GEONW_PON_GBC_BV_01_nodeD());
                    
                    // Synchronization
                    f_serverSync2ClientsAndStop({c_prDone, c_tbDone});
                    
                    // Cleanup
                    f_cf02Down();
                    
                } // end f_GEONW_PON_GBC_BV_01
                
                /**
                 * @desc    Behavior function for NodeB (TC_GEONW_PON_GBC_BV_01)
                 */
                function f_GEONW_PON_GBC_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(
garciay's avatar
garciay committed
                                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_BV_01_nodeB
                
                /**
                 * @desc    Behavior function for NodeD (TC_GEONW_PON_GBC_BV_01)
                 */
                function f_GEONW_PON_GBC_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(
garciay's avatar
garciay committed
                                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_BV_01_nodeD
                
            } // end GEONW_PON_GBC_BV_01
            
            group GEONW_PON_GBC_BV_02 {
                
                /**
                 * @desc    TP Function for TC_GEONW_PON_GBC_BV_02
                 */
                function f_GEONW_PON_GBC_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_getGeoBroadcastForwardingAlgorithm() != e_simple) and (f_getGeoBroadcastForwardingAlgorithm() != e_unspecified) and (f_getGeoBroadcastForwardingAlgorithm() != e_advanced)) {
                        log("*** " & testcasename() & ": PICS_GN_GEOBROADCAST_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_BV_02_nodeB());
                    v_nodeD.start(f_GEONW_PON_GBC_BV_02_nodeD());
                    
                    // Synchronization
                    f_serverSync2ClientsAndStop({c_prDone, c_tbDone});
                    
                    // Cleanup
                    f_cf02Down();
                    
                } // end f_GEONW_PON_GBC_BV_02
                
                /**
                 * @desc    Behavior function for NodeB (TC_GEONW_PON_GBC_BV_02)
                 */
                function f_GEONW_PON_GBC_BV_02_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(
garciay's avatar
garciay committed
                                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_BV_02_nodeB
                
                /**
                 * @desc    Behavior function for NodeD (TC_GEONW_PON_GBC_BV_02)
                 */
                function f_GEONW_PON_GBC_BV_02_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(
garciay's avatar
garciay committed
                                mw_longPosVectorPosition(v_longPosVectorIut),
8011 8012 8013 8014 8015 8016 8017 8018 8019 8020 8021 8022 8023 8024 8025 8026 8027 8028 8029 8030 8031 8032 8033 8034 8035 8036 8037 8038 8039 8040 8041 8042 8043 8044 8045 8046 8047 8048 8049 8050 8051 8052 8053 8054 8055 8056 8057 8058 8059 8060 8061 8062 8063 8064 8065 8066 8067 8068 8069 8070 8071 8072 8073 8074 8075 8076 8077 8078 8079 8080 8081 8082 8083 8084 8085 8086 8087 8088 8089 8090 8091 8092 8093 8094 8095 8096 8097 8098 8099 8100 8101 8102 8103 8104 8105 8106 8107 8108 8109 8110 8111 8112 8113 8114 8115 8116 8117 8118 8119 8120 8121 8122 8123 8124 8125 8126 8127 8128 8129 8130 8131 8132 8133 8134 8135 8136 8137 8138 8139 8140 8141 8142 8143 8144 8145 8146 8147 8148 8149 8150 8151 8152 8153 8154 8155 8156 8157 8158 8159 8160 8161 8162 8163 8164 8165 8166 8167 8168 8169 8170 8171 8172 8173 8174 8175 8176 8177 8178 8179 8180 8181 8182 8183 8184 8185 8186 8187 8188 8189 8190 8191 8192 8193 8194 8195 8196 8197 8198 8199 8200 8201 8202 8203 8204 8205 8206 8207 8208 8209 8210 8211 8212 8213 8214 8215 8216 8217 8218 8219 8220 8221 8222 8223 8224 8225 8226 8227 8228 8229 8230 8231 8232 8233 8234 8235 8236 8237 8238 8239 8240 8241 8242 8243 8244 8245 8246 8247 8248 8249 8250 8251 8252 8253 8254 8255 8256 8257 8258 8259 8260 8261 8262 8263 8264 8265 8266 8267 8268 8269 8270 8271 8272 8273 8274 8275 8276 8277 8278 8279 8280 8281 8282 8283 8284 8285 8286 8287 8288 8289 8290 8291 8292 8293 8294 8295 8296 8297 8298 8299 8300 8301 8302 8303 8304 8305 8306 8307 8308 8309 8310 8311 8312 8313 8314 8315 8316 8317 8318 8319 8320 8321 8322 8323 8324 8325 8326 8327 8328 8329 8330 8331 8332 8333 8334 8335 8336 8337 8338 8339 8340 8341 8342 8343 8344 8345 8346 8347 8348 8349 8350 8351 8352 8353 8354 8355 8356 8357 8358 8359 8360 8361 8362 8363 8364 8365 8366 8367 8368 8369 8370 8371 8372 8373 8374 8375 8376 8377 8378 8379 8380 8381 8382 8383 8384 8385 8386 8387 8388 8389 8390 8391 8392 8393 8394 8395 8396 8397 8398 8399 8400 8401 8402 8403 8404 8405 8406 8407 8408 8409 8410 8411 8412 8413 8414 8415 8416 8417 8418 8419 8420 8421 8422 8423 8424 8425 8426 8427 8428 8429 8430 8431 8432 8433 8434 8435 8436 8437 8438 8439 8440 8441 8442 8443 8444 8445 8446 8447 8448 8449 8450 8451 8452 8453 8454 8455 8456 8457 8458 8459 8460 8461 8462 8463 8464 8465 8466 8467 8468 8469 8470 8471 8472 8473 8474 8475 8476 8477 8478 8479 8480 8481 8482 8483 8484 8485 8486 8487 8488 8489 8490 8491 8492 8493 8494 8495 8496 8497 8498 8499 8500 8501 8502 8503 8504 8505 8506 8507 8508 8509 8510 8511 8512 8513 8514 8515 8516 8517 8518 8519 8520 8521 8522 8523 8524 8525 8526 8527 8528 8529 8530 8531 8532 8533 8534 8535 8536 8537 8538 8539 8540 8541 8542 8543 8544 8545 8546 8547 8548 8549 8550 8551 8552 8553 8554 8555 8556 8557 8558 8559 8560 8561 8562 8563 8564 8565 8566 8567 8568 8569 8570 8571 8572 8573 8574 8575 8576 8577 8578 8579 8580 8581 8582 8583 8584 8585 8586 8587 8588 8589 8590 8591 8592 8593 8594 8595 8596 8597 8598 8599 8600 8601 8602 8603 8604 8605 8606 8607 8608 8609 8610 8611 8612 8613 8614 8615 8616 8617 8618 8619 8620 8621 8622 8623 8624 8625 8626 8627 8628 8629 8630 8631 8632 8633 8634 8635 8636 8637 8638 8639 8640 8641 8642 8643 8644 8645 8646 8647 8648 8649 8650 8651 8652 8653 8654 8655 8656 8657 8658 8659 8660 8661 8662 8663 8664 8665 8666 8667 8668 8669 8670 8671 8672 8673 8674 8675 8676 8677 8678 8679 8680 8681 8682 8683 8684 8685 8686 8687 8688 8689 8690 8691 8692 8693 8694 8695 8696 8697 8698 8699 8700 8701 8702 8703 8704 8705 8706 8707 8708 8709 8710 8711 8712 8713 8714 8715 8716 8717 8718 8719 8720 8721 8722 8723 8724 8725 8726 8727 8728 8729 8730 8731 8732 8733 8734 8735 8736 8737 8738 8739 8740 8741 8742 8743 8744 8745 8746 8747 8748 8749 8750 8751 8752 8753 8754 8755 8756 8757 8758 8759 8760 8761 8762 8763 8764 8765 8766 8767 8768 8769 8770 8771 8772 8773 8774 8775 8776 8777 8778 8779 8780 8781 8782 8783 8784 8785 8786 8787 8788 8789 8790 8791 8792 8793 8794 8795 8796 8797 8798 8799 8800 8801 8802 8803 8804 8805 8806 8807 8808 8809 8810 8811 8812 8813 8814 8815 8816 8817 8818 8819 8820 8821 8822 8823 8824 8825 8826 8827 8828 8829 8830 8831 8832 8833 8834 8835 8836 8837 8838 8839 8840 8841 8842 8843 8844 8845 8846 8847 8848 8849 8850 8851 8852 8853 8854 8855 8856 8857 8858 8859 8860 8861 8862 8863 8864 8865 8866 8867 8868 8869 8870 8871 8872 8873 8874 8875 8876 8877 8878 8879 8880 8881 8882 8883 8884 8885 8886 8887 8888 8889 8890 8891 8892 8893 8894 8895 8896 8897 8898 8899 8900 8901 8902 8903
                                ?,
                                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_BV_02_nodeD
                
            } // end GEONW_PON_GBC_BV_02
            
            group GEONW_PON_GBC_BV_03 {
                
                /**
                 * @desc    TP Function for TC_GEONW_PON_GBC_BV_03
                 */
                function f_GEONW_PON_GBC_BV_03() 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_getGeoBroadcastForwardingAlgorithm() != e_simple) and (f_getGeoBroadcastForwardingAlgorithm() != e_unspecified)) {
                        log("*** " & testcasename() & ": PICS_GN_GEOBROADCAST_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_BV_03_nodeB());
                    v_nodeD.start(f_GEONW_PON_GBC_BV_03_nodeD());
                    
                    // Synchronization
                    f_serverSync2ClientsAndStop({c_prDone, c_tbDone});
                    
                    // Cleanup
                    f_cf02Down();
                    
                } // end f_GEONW_PON_GBC_BV_03
                
                /**
                 * @desc    Behavior function for NodeB (TC_GEONW_PON_GBC_BV_03)
                 */
                function f_GEONW_PON_GBC_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)
                                )
                            )
                        )
                    );
                    
                    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_BV_03_nodeB
                
                /**
                 * @desc    Behavior function for NodeD (TC_GEONW_PON_GBC_BV_03)
                 */
                function f_GEONW_PON_GBC_BV_03_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 {
                        [] 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_BV_03_nodeD
                
            } // end GEONW_PON_GBC_BV_03
            
            group GEONW_PON_GBC_BO_04 {
                
                /**
                 * @desc    TP Function for TC_GEONW_PON_GBC_BO_04
                 */
                function f_GEONW_PON_GBC_BO_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;
                    }
                    if ((f_getGeoBroadcastForwardingAlgorithm() != e_simple) and (f_getGeoBroadcastForwardingAlgorithm() != e_unspecified)) {
                        log("*** " & testcasename() & ": PICS_GN_GEOBROADCAST_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_BO_04_nodeB());
                    v_nodeD.start(f_GEONW_PON_GBC_BO_04_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_BO_04)
                 */
                function f_GEONW_PON_GBC_BO_04_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_BO_04_nodeB
                
                /**
                 * @desc    Behavior function for NodeD (TC_GEONW_PON_GBC_BO_04)
                 */
                function f_GEONW_PON_GBC_BO_04_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_BO_04_nodeD
                
            } // end GEONW_PON_GBC_BO_04
            
            group GEONW_PON_GBC_BV_05 {
                
                /**
                 * @desc    TP Function for TC_GEONW_PON_GBC_BV_05
                 */
                function f_GEONW_PON_GBC_BV_05() 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;
                    }
                    
                    // 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_BV_05_nodeB());
                    v_nodeC.start(f_GEONW_PON_GBC_BV_05_nodeC());
                    v_nodeD.start(f_GEONW_PON_GBC_BV_05_nodeD());
                    
                    // Synchronization
                    f_serverSync3ClientsAndStop({c_prDone, c_tbDone});
                    
                    // Cleanup
                    f_cf04Down();
                    
                } // end f_GEONW_PON_GBC_BV_05
                
                /**
                 * @desc    Behavior function for NodeB (TC_GEONW_PON_GBC_BV_05)
                 */
                function f_GEONW_PON_GBC_BV_05_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_BV_05_nodeB
                
                /**
                 * @desc    Behavior function for NodeC (TC_GEONW_PON_GBC_BV_05)
                 */
                function f_GEONW_PON_GBC_BV_05_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)
                                )
                            )
                        )
                    );
                    f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                    
                    // Postamble
                    f_poNeighbour();
                    
                } // end f_GEONW_PON_GBC_BV_05_nodeC
                
                /**
                 * @desc    Behavior function for NodeD (TC_GEONW_PON_GBC_BV_05)
                 */
                function f_GEONW_PON_GBC_BV_05_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_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_BV_05_nodeD
                
            } // end GEONW_PON_GBC_BV_05
            
            group GEONW_PON_GBC_BO_06 {
                
                /**
                 * @desc    TP Function for TC_GEONW_PON_GBC_BO_06
                 */
                function f_GEONW_PON_GBC_BO_06() 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_getGeoBroadcastForwardingAlgorithm() != e_simple) and (f_getGeoBroadcastForwardingAlgorithm() != e_unspecified)) {
                        log("*** " & testcasename() & ": PICS_GN_GEOBROADCAST_FORWARDING_ALGORITHM == ( e_simple 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_BO_06_nodeB());
                    v_nodeC.start(f_GEONW_PON_GBC_BO_06_nodeC(v_sequenceNumber));
                    v_nodeD.start(f_GEONW_PON_GBC_BO_06_nodeD(v_sequenceNumber));
                    
                    // Synchronization
                    f_serverSync3ClientsAndStop({c_prDone, c_tbDone});
                    
                    // Cleanup
                    f_cf04Down();
                    
                } // end f_GEONW_PON_GBC_BO_06
                
                /**
                 * @desc    Behavior function for NodeB (TC_GEONW_PON_GBC_BO_06)
                 */
                function f_GEONW_PON_GBC_BO_06_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_BO_06_nodeB
                
                /**
                 * @desc    Behavior function for NodeC (TC_GEONW_PON_GBC_BO_06)
                 */
                function f_GEONW_PON_GBC_BO_06_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
                            )
                        )
                    );
                    f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                    
                    // Test Body
                    f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                    
                    // Postamble
                    f_poNeighbour();
                    
                } // end f_GEONW_PON_GBC_BO_06_nodeC
                
                /**
                 * @desc    Behavior function for NodeD (TC_GEONW_PON_GBC_BO_06)
                 */
                function f_GEONW_PON_GBC_BO_06_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
                            )
                        )
                    );
                    
                    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_BO_06_nodeD
                
            } // end GEONW_PON_GBC_BO_06
            
            group GEONW_PON_GBC_BV_07 {
                
                /**
                 * @desc    TP Function for TC_GEONW_PON_GBC_BV_07
                 */
                function f_GEONW_PON_GBC_BV_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;
                    }
                    
                    // 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_BV_07_nodeB());
                    v_nodeD.start(f_GEONW_PON_GBC_BV_07_nodeD());
                    
                    // Synchronization
                    f_serverSync2ClientsAndStop({c_prDone, c_tbDone});
                    
                    // Cleanup
                    f_cf02Down();
                    
                } // end f_GEONW_PON_GBC_BV_07
                
                /**
                 * @desc    Behavior function for NodeB (TC_GEONW_PON_GBC_BV_07)
                 */
                function f_GEONW_PON_GBC_BV_07_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 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_BV_07_nodeB
                
                /**
                 * @desc    Behavior function for NodeD (TC_GEONW_PON_GBC_BV_07)
                 */
                function f_GEONW_PON_GBC_BV_07_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 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_BV_07_nodeD
                
            } // end GEONW_PON_GBC_BV_07
            
            group GEONW_PON_GBC_BV_08 {
                
                /**
                 * @desc    TP Function for TC_GEONW_PON_GBC_BV_08
                 */
                function f_GEONW_PON_GBC_BV_08() 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_BV_08_nodeB());
                    v_nodeD.start(f_GEONW_PON_GBC_BV_08_nodeD());
                    
                    // Synchronization
                    f_serverSync2ClientsAndStop({c_prDone, c_tbDone});
                    
                    // Cleanup
                    f_cf02Down();
                    
                } // end f_GEONW_PON_GBC_BV_08
                
                /**
                 * @desc    Behavior function for NodeB (TC_GEONW_PON_GBC_BV_08)
                 */
                function f_GEONW_PON_GBC_BV_08_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 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_BV_08_nodeB
                
                /**
                 * @desc    Behavior function for NodeD (TC_GEONW_PON_GBC_BV_08)
                 */
                function f_GEONW_PON_GBC_BV_08_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 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_BV_08_nodeD
                
            } // end GEONW_PON_GBC_BV_08
            
            /**
             * @desc    TP Function for TC_GEONW_PON_GBC_BV_09
             */
            function f_GEONW_PON_GBC_BV_09() 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 
                }
                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_GBC_BV_09
            
            group GEONW_PON_GBC_BO_10 {
                
                /**
                 * @desc    TP Function for TC_GEONW_PON_GBC_BO_10
                 */
                function f_GEONW_PON_GBC_BO_10() 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;
                    }
                    if ((f_getGeoBroadcastForwardingAlgorithm() != e_simple) and (f_getGeoBroadcastForwardingAlgorithm() != e_unspecified)) {
                        log("*** " & testcasename() & ": PICS_GN_GEOBROADCAST_FORWARDING_ALGORITHM == ( e_simple or e_unspecified ) 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_BO_10_nodeB());
                    v_nodeD.start(f_GEONW_PON_GBC_BO_10_nodeD());
                    
                    // Synchronization
                    f_serverSync2ClientsAndStop({c_prDone, c_tbDone});
                    
                    // Cleanup
                    f_cf02Down();
                    
                } // end f_GEONW_PON_GBC_BO_10
                
                /**
                 * @desc    Behavior function for NodeB (TC_GEONW_PON_GBC_BO_10)
                 */
                function f_GEONW_PON_GBC_BO_10_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_BO_10_nodeB
                
                /**
                 * @desc    Behavior function for NodeD (TC_GEONW_PON_GBC_BO_10)
                 */
                function f_GEONW_PON_GBC_BO_10_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);
                    
                    // Postamble
                    f_poNeighbour();
                    
                } // end f_GEONW_PON_GBC_BO_10_nodeD
                
            } // end GEONW_PON_GBC_BO_10
            
            /**
             * @desc    TP Function for TC_GEONW_PON_GBC_BV_11
             */
            function f_GEONW_PON_GBC_BV_11() 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;
                }
                
                // 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);
                }
                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_BV_11
            
            group GEONW_PON_GBC_BV_12 {
                
                /**
                 * @desc    TP Function for TC_GEONW_PON_GBC_BV_12
                 */
                function f_GEONW_PON_GBC_BV_12() 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_getGeoBroadcastForwardingAlgorithm() != e_cbf)) {
                        log("*** " & testcasename() & ": PICS_GN_GEOBROADCAST_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_BV_12_nodeB());
                    v_nodeD.start(f_GEONW_PON_GBC_BV_12_nodeD());
                    
                    // Synchronization
                    f_serverSync2ClientsAndStop({c_prDone, c_tbDone});
                    
                    // Cleanup
                    f_cf02Down();
                    
                } // end f_GEONW_PON_GBC_BV_12
                
                /**
                 * @desc    Behavior function for NodeB (TC_GEONW_PON_GBC_BV_12)
                 */
                function f_GEONW_PON_GBC_BV_12_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(
garciay's avatar
garciay committed
                                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_BV_12_nodeB
                
                /**
                 * @desc    Behavior function for NodeD (TC_GEONW_PON_GBC_BV_12)
                 */
                function f_GEONW_PON_GBC_BV_12_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(
garciay's avatar
garciay committed
                                mw_longPosVectorPosition(v_longPosVectorIut),
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 9865 9866 9867 9868 9869 9870 9871 9872 9873 9874 9875 9876 9877 9878 9879 9880 9881 9882 9883 9884 9885 9886 9887 9888 9889 9890 9891 9892 9893 9894 9895 9896 9897 9898 9899 9900 9901 9902 9903 9904 9905 9906 9907 9908 9909 9910 9911 9912 9913 9914 9915 9916 9917 9918 9919 9920 9921 9922 9923 9924 9925 9926 9927 9928 9929 9930 9931 9932 9933 9934 9935 9936 9937 9938 9939 9940 9941 9942 9943 9944 9945 9946 9947 9948 9949 9950 9951 9952 9953 9954 9955 9956 9957 9958 9959 9960 9961 9962 9963 9964 9965 9966 9967 9968 9969 9970 9971 9972 9973 9974 9975 9976 9977 9978 9979 9980 9981 9982 9983 9984 9985 9986 9987 9988 9989 9990 9991 9992 9993 9994 9995 9996 9997 9998 9999 10000 10001 10002 10003 10004 10005 10006 10007 10008 10009 10010 10011 10012 10013 10014 10015 10016 10017 10018 10019 10020 10021 10022 10023 10024 10025 10026 10027 10028 10029 10030 10031 10032 10033 10034 10035 10036 10037 10038 10039 10040 10041 10042 10043 10044 10045 10046 10047 10048 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
                                ?,
                                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_BV_12_nodeD
                
            } // end GEONW_PON_GBC_BV_12
                        
            group GEONW_PON_GBC_BO_19 {
                
                /**
                 * @desc    TP Function for TC_GEONW_PON_GBC_BO_19
                 */
                function f_GEONW_PON_GBC_BO_19() 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_BO_19_nodeB(v_distanceTooBig));
                    v_nodeC.start(f_GEONW_PON_GBC_BO_19_nodeC(v_distanceTooBig));
                    v_nodeD.start(f_GEONW_PON_GBC_BO_19_nodeD(v_distanceTooBig));
                    
                    // Synchronization
                    f_serverSync3ClientsAndStop({c_prDone, c_tbDone});
                    
                    // Cleanup
                    f_cf04Down();
                    
                } // end f_GEONW_PON_GBC_BO_19
                
                /**
                 * @desc    Behavior function for NodeB (TC_GEONW_PON_GBC_BO_19)
                 */
                function f_GEONW_PON_GBC_BO_19_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 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_BO_19_nodeB
                
                /**
                 * @desc    Behavior function for NodeC (TC_GEONW_PON_GBC_BO_19)
                 */
                function f_GEONW_PON_GBC_BO_19_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)
                                )
                            )
                        )
                    );
                    f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                    
                    // Test Body
                    f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                    
                    // Postamble
                    f_poNeighbour();
                    
                } // end f_GEONW_PON_GBC_BO_19_nodeC
                
                /**
                 * @desc    Behavior function for NodeD (TC_GEONW_PON_GBC_BO_19)
                 */
                function f_GEONW_PON_GBC_BO_19_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_BO_19_nodeD
                
            } // end GEONW_PON_GBC_BO_19
            
            group GEONW_PON_GBC_BV_20 {
                
                /**
                 * @desc    TP Function for TC_GEONW_PON_GBC_BV_20
                 */
                function f_GEONW_PON_GBC_BV_20() 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;
                    }
                    
                    // 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_BV_20_nodeB());
                    v_nodeC.start(f_GEONW_PON_GBC_BV_20_nodeC());
                    v_nodeD.start(f_GEONW_PON_GBC_BV_20_nodeD());
                    
                    // Synchronization
                    f_serverSync3ClientsAndStop({c_prDone, c_tbDone});
                    
                    // Cleanup
                    f_cf04Down();
                    
                } // end f_GEONW_PON_GBC_BV_20
                
                /**
                 * @desc    Behavior function for NodeB (TC_GEONW_PON_GBC_BV_20)
                 */
                function f_GEONW_PON_GBC_BV_20_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 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_BV_20_nodeB
                
                /**
                 * @desc    Behavior function for NodeC (TC_GEONW_PON_GBC_BV_20)
                 */
                function f_GEONW_PON_GBC_BV_20_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_area2)
                            )))) {
                            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_BV_20_nodeC
                
                /**
                 * @desc    Behavior function for NodeD (TC_GEONW_PON_GBC_BV_20)
                 */
                function f_GEONW_PON_GBC_BV_20_nodeD() 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)
                                )
                            )
                        )
                    );
                    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 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_BV_20_nodeD
                
            } // end GEONW_PON_GBC_BV_20
            
            group GEONW_PON_GBC_BV_21 {
                
                /**
                 * @desc    TP Function for TC_GEONW_PON_GBC_BV_21
                 */
                function f_GEONW_PON_GBC_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;
                    }
                    
                    // 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_BV_21_nodeB());
                    v_nodeC.start(f_GEONW_PON_GBC_BV_21_nodeC());
                    v_nodeD.start(f_GEONW_PON_GBC_BV_21_nodeD());
                    
                    // Synchronization
                    f_serverSync3ClientsAndStop({c_prDone, c_tbDone});
                    
                    // Cleanup
                    f_cf04Down();
                    
                } // end f_GEONW_PON_GBC_BV_21
                
                /**
                 * @desc    Behavior function for NodeB (TC_GEONW_PON_GBC_BV_20)
                 */
                function f_GEONW_PON_GBC_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 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_BV_21_nodeB
                
                /**
                 * @desc    Behavior function for NodeC (TC_GEONW_PON_GBC_BV_21)
                 */
                function f_GEONW_PON_GBC_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_area2)
                            )))) {
                            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_BV_21_nodeC
                
                /**
                 * @desc    Behavior function for NodeD (TC_GEONW_PON_GBC_BV_21)
                 */
                function f_GEONW_PON_GBC_BV_21_nodeD() runs on ItsGeoNetworking {
                    
                    // Local variables
                    var LongPosVector v_longPosVectorNodeC := f_getPosition(c_compNodeC);
                    var LongPosVector v_longPosVectorNodeD := f_getPosition(c_compNodeD);
                    
                    // 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_area2)
                                )
                            )
                        )
                    );
                    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 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_BV_21_nodeD
                
            } // end GEONW_PON_GBC_BV_21
            
        } // end geoGeoBroadcast
        
        // 6.2.2.10
        group geoTopologicallyScopedBroadcast {
            
            group GEONW_PON_TSB_BV_01 {
                
                /**
                 * @desc    TP Function for TC_GEONW_PON_TSB_BV_01
                 */
                function f_GEONW_PON_TSB_BV_01() runs on ItsMtc {
                    
                    // Local variables
                    var ItsGeoNetworking v_nodeB;
                    var ItsGeoNetworking v_nodeD;
                    
                    // 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_cf02Up();
                    
                    // Preamble
                    
                    // Start components
                    v_nodeB := f_getComponent(c_compNodeB);
                    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
                    f_cf02Down();
                    
                } // end f_GEONW_PON_TSB_BV_01
                
                /**
                 * @desc    Behavior function for NodeB (TC_GEONW_PON_TSB_BV_01)
                 */
                function f_GEONW_PON_TSB_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_generateTsbMessage) ) {
                        log("*** " & testcasename() & ": INCONC: Trigger failed ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
                    }
                    tc_ac.start;
                    alt {
                        [] 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);
                        }
                        [] tc_ac.timeout {
                            log("*** " & testcasename() & ": FAIL: Expected TSB message not received ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                        }
                    }
                    
                    // Postamble
                    f_poNeighbour();
                    
                } // end f_GEONW_PON_TSB_BV_01_nodeB
                
                /**
                 * @desc    Behavior function for NodeD (TC_GEONW_PON_TSB_BV_01)
                 */
                function f_GEONW_PON_TSB_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 {
                        [] 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);
                        }
                        [] tc_ac.timeout {
                            log("*** " & testcasename() & ": FAIL: Expected TSB message not received ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                        }
                    }
                    
                    // Postamble
                    f_poNeighbour();
                    
                } // end f_GEONW_PON_TSB_BV_01_nodeD
                
            } // end GEONW_PON_TSB_BV_01
            
            group GEONW_PON_TSB_BV_02 {
                
                /**
                 * @desc    TP Function for TC_GEONW_PON_TSB_BV_02
                 */
                function f_GEONW_PON_TSB_BV_02() runs on ItsMtc {
                    
                    // Local variables
                    var ItsGeoNetworking v_nodeB;
                    var ItsGeoNetworking v_nodeD;
                    
                    // Test control
                    if (not PICS_GN_TSB_FWD) {
                        log("*** " & testcasename() & ": PICS_GN_TSB_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_TSB_BV_02_nodeB());
                    v_nodeD.start(f_GEONW_PON_TSB_BV_02_nodeD());
                    
                    // Synchronization
                    f_serverSync2ClientsAndStop({c_prDone, c_tbDone});
                    
                    // Cleanup
                    f_cf02Down();
                    
                } // end f_GEONW_PON_TSB_BV_02
                
                /**
                 * @desc    Behavior function for NodeB (TC_GEONW_PON_TSB_BV_02)
                 */
                function f_GEONW_PON_TSB_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_geoNwTsbPacket(
                                    vc_localSeqNumber,
                                    v_longPosVectorNodeB
                                ),
                                -,
                                c_defaultHopLimit
                            )
                        )
                    );
                    
                    tc_ac.start;
                    alt {
                        [] 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);
                        }
                        [] tc_ac.timeout {
                            log("*** " & testcasename() & ": FAIL: Expected TSB message not received ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                        }
                    }
                    
                    // Postamble
                    f_poNeighbour();
                    
                } // end f_GEONW_PON_TSB_BV_02_nodeB
                
                /**
                 * @desc    Behavior function for NodeD (TC_GEONW_PON_TSB_BV_02)
                 */
                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 {
                        [] 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);
                        }
                        [] tc_ac.timeout {
                            log("*** " & testcasename() & ": FAIL: Expected TSB message not received ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                        }
                    }
                    
                    // Postamble
                    f_poNeighbour();
                    
                } // end f_GEONW_PON_TSB_BV_02_nodeD
                
            } // end GEONW_PON_TSB_BV_02
            
            group GEONW_PON_TSB_BO_03 {
                
                /**
                 * @desc    TP Function for TC_GEONW_PON_TSB_BO_03 
                 */
                function f_GEONW_PON_TSB_BO_03() runs on ItsMtc {
                    
                    // Local variables
                    var ItsGeoNetworking v_nodeB;
                    var ItsGeoNetworking v_nodeD;
                    
                    // Test control
                    if (not PICS_GN_TSB_FWD) {
                        log("*** " & testcasename() & ": PICS_GN_TSB_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_TSB_BO_03_nodeB());
                    v_nodeD.start(f_GEONW_PON_TSB_BO_03_nodeD());
                    
                    // Synchronization
                    f_serverSync2ClientsAndStop({c_prDone, c_tbDone});
                    
                    // Cleanup
                    f_cf02Down();
                    
                } // end f_GEONW_PON_TSB_BO_03
                
                /**
                 * @desc    Behavior function for NodeB (TC_GEONW_PON_TSB_BO_03)
                 */
                function f_GEONW_PON_TSB_BO_03_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_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);
                        }
                        [] tc_noac.timeout {
                            log("*** " & testcasename() & ": INCONC: Pre-conditions: Expected TSB message not received ***");
                            f_selfOrClientSyncAndVerdict(c_prDone, e_timeout);
                        }
                    }
                    
                    // 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);
                        }
                        [] tc_noac.timeout {
                            log("*** " & testcasename() & ": PASS: The same TSB packet was not re-broadcasted ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                        }
                    }
                    
                    // Postamble
                    f_poNeighbour();
                    
                } // end f_GEONW_PON_TSB_BO_03_nodeB
                
                /**
                 * @desc    Behavior function for NodeD (TC_GEONW_PON_TSB_BO_03)
                 */
                function f_GEONW_PON_TSB_BO_03_nodeD() runs on ItsGeoNetworking {
                    
                    // Local variables
                    var LongPosVector v_longPosVectorNodeB := f_getPosition(c_compNodeB);
                    var template (value) GeoNetworkingInd v_msgInd;
                    
                    // Preamble
                    f_prNeighbour();
                    tc_ac.start;
                    alt {
                        [] geoNetworkingPort.receive(
                                mw_geoNwInd(
                                    mw_geoNwPdu(
                                        mw_geoNwTsbPacket(
                                            ?,
                                            mw_longPosVectorPosition(v_longPosVectorNodeB)
                                        )
                                    )
                                )
                            ) -> value v_msgInd {
                            tc_ac.stop;
                            log("*** " & testcasename() & ": PASS: Pre-conditions: TSB packet received correctly  ***");
                            f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                        }
                        [] tc_ac.timeout {
                            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);
                        }
                        [] tc_noac.timeout {
                            log("*** " & testcasename() & ": PASS: The same TSB packet was not re-broadcasted ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                        }
                    }
                    
                    // Postamble
                    f_poNeighbour();
                    
                } // end f_GEONW_PON_TSB_BO_03_nodeD
                
            } // end GEONW_PON_TSB_BO_03
            
            group GEONW_PON_TSB_BV_04 {
                
                /**
                 * @desc    TP Function for TC_GEONW_PON_TSB_BV_04
                 */
                function f_GEONW_PON_TSB_BV_04() runs on ItsMtc {
                    
                    // Local variables
                    var ItsGeoNetworking v_nodeB;
                    var ItsGeoNetworking v_nodeD;
                    
                    // Test control
                    if (not PICS_GN_TSB_FWD) {
                        log("*** " & testcasename() & ": PICS_GN_TSB_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_TSB_BV_04_nodeB());
                    v_nodeD.start(f_GEONW_PON_TSB_BV_04_nodeD());
                    
                    // Synchronization
                    f_serverSync2ClientsAndStop({c_prDone, c_tbDone});
                    
                    // Cleanup
                    f_cf02Down();
                    
                } // end f_GEONW_PON_TSB_BV_04
                
                /**
                 * @desc    Behavior function for NodeB (TC_GEONW_PON_TSB_BV_04)
                 */
                function f_GEONW_PON_TSB_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_geoNwTsbPacket(
                                    vc_localSeqNumber,
                                    v_longPosVectorNodeB,
                                    c_defaultHopLimit
                                ),
                                -,
                                c_defaultHopLimit
                            )
                        )
                    );
                    
                    tc_ac.start;
                    alt {
                        [] geoNetworkingPort.receive(
                                mw_geoNwInd(
                                    mw_geoNwPdu(
                                        mw_geoNwTsbPacket(
                                            ?,
                                            mw_longPosVectorPosition(v_longPosVectorNodeB)
                                        ),
                                        -,
                                        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);
                        }
                    }
                    
                    // Postamble
                    f_poNeighbour();
                    
                } // end f_GEONW_PON_TSB_BV_04_nodeB
                
                /**
                 * @desc    Behavior function for NodeD (TC_GEONW_PON_TSB_BV_04)
                 */
                function f_GEONW_PON_TSB_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_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);
                        }
                    }
                    
                    // Postamble
                    f_poNeighbour();
                    
                } // end f_GEONW_PON_TSB_BV_04_nodeD
                
            } // end GEONW_PON_TSB_BV_04
            
            group GEONW_PON_TSB_BO_05 {
                
                /**
                 * @desc    TP Function for TC_GEONW_PON_TSB_BO_05
                 */
                function f_GEONW_PON_TSB_BO_05() runs on ItsMtc {
                    
                    // Local variables
                    var ItsGeoNetworking v_nodeB;
                    var ItsGeoNetworking v_nodeD;
                    
                    // Test control
                    if (not PICS_GN_TSB_FWD) {
                        log("*** " & testcasename() & ": PICS_GN_TSB_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_TSB_BO_05_nodeB());
                    v_nodeD.start(f_GEONW_PON_TSB_BO_05_nodeD());
                    
                    // Synchronization
                    f_serverSync2ClientsAndStop({c_prDone, c_tbDone});
                    
                    // Cleanup
                    f_cf02Down();
                    
                } // end f_GEONW_PON_TSB_BO_05
                
                /**
                 * @desc    Behavior function for NodeB (TC_GEONW_PON_TSB_BO_05)
                 */
                function f_GEONW_PON_TSB_BO_05_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_geoNwTsbPacket(
                                    vc_localSeqNumber,
                                    v_longPosVectorNodeB
                                ),
                                -,
                                1
                            )
                        )
                    );
                    f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                    
                    // Postamble
                    f_poNeighbour();
                    
                } // end f_GEONW_PON_TSB_BO_05_nodeB
                
                /**
                 * @desc    Behavior function for NodeD (TC_GEONW_PON_TSB_BO_05)
                 */
                function f_GEONW_PON_TSB_BO_05_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 message was re-broadcasted  ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                        }
                        [] tc_noac.timeout {
                            log("*** " & testcasename() & ": PASS: TSB message was not re-broadcasted ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                        }
                    }
                    
                    // Postamble
                    f_poNeighbour();
                    
                } // end f_GEONW_PON_TSB_BO_05_nodeD
                
            } // end GEONW_PON_TSB_BO_05
            
            /**
             * @desc    TP Function for TC_GEONW_PON_TSB_BV_06
             */
            function f_GEONW_PON_TSB_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_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_06
            
            group GEONW_PON_TSB_BO_07 {
                
                /**
                 * @desc    TP Function for TC_GEONW_PON_TSB_BV_06
                 */
                function f_GEONW_PON_TSB_BO_07() runs on ItsMtc {
                    
                    // Local variables
                    var ItsGeoNetworking v_nodeB;
                    var ItsGeoNetworking v_nodeD;
                    
                    // 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_cf02Up(c_compNodeB);
                    
                    // Preamble
                    
                    // Start components
                    v_nodeB := f_getComponent(c_compNodeB);
                    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
                    f_cf02Down();
                    
                } // end f_GEONW_PON_TSB_BO_07
                
                /**
                 * @desc    Behavior function for NodeB (TC_GEONW_PON_TSB_BO_07)
                 */
                function f_GEONW_PON_TSB_BO_07_nodeB() runs on ItsGeoNetworking {
                    
                    // Local variables
                    var LongPosVector v_longPosVectorNodeB := f_getPosition(c_compNodeB);
                    var template (value) GeoNetworkingPdu v_gnPacket;
                    var integer i;
                    var GnRawPayload v_sentRawPayload;
                    
                    // Preamble
                    f_prNeighbour();
                    v_gnPacket := m_geoNwPdu(m_geoNwTsbPacket(
                                                vc_localSeqNumber,
                                                v_longPosVectorNodeB
                                            ),
                                            -,
                                            c_defaultHopLimit
                                        );
                    f_sendGeoNetMessage(m_geoNwReq_linkLayerBroadcast(valueof(v_gnPacket)));
                    
                    tc_ac.start;
                    alt {
                        [] geoNetworkingPort.receive(
                                mw_geoNwInd(
                                    mw_geoNwPdu(
                                        mw_geoNwTsbPacket(
                                            ?,
                                            mw_longPosVectorPosition(v_longPosVectorNodeB)
                                        )
                                    )
                                )
                            ) {
                            tc_ac.stop;
                            
                            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);
                            }
                        }
                        [] tc_ac.timeout {
                            log("*** " & testcasename() & ": INCONC: Pre-conditions: TSB not rebroadcasted ***");
                            f_selfOrClientSyncAndVerdict(c_prDone, e_timeout);
                        }
                    }
                    
                    // Test Body
                    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);
                    }
                    
                    // Postamble
                    f_poNeighbour();
                    
                } // end f_GEONW_PON_TSB_BO_07_nodeB
                
                /**
                 * @desc    Behavior function for NodeD (TC_GEONW_PON_TSB_BO_07)
                 */
                function f_GEONW_PON_TSB_BO_07_nodeD() runs on ItsGeoNetworking {
                    
                    // Local variables
                    var LongPosVector v_longPosVectorNodeB := f_getPosition(c_compNodeB);
                    var template (value) GeoNetworkingInd v_msgInd;
                    var integer i;
                    var template (value) GeoNetworkingPdu v_gnPacket;
                    
                    // Preamble
                    f_prNeighbour();
                    
                    tc_ac.start;
                    alt {
                        [] 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);
                        }
                        [] tc_ac.timeout {
                            log("*** " & testcasename() & ": INCONC: Pre-conditions: TSB not rebroadcasted ***");
                            f_selfOrClientSyncAndVerdict(c_prDone, e_timeout);
                        }
                    }
                    
                    // 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);
                    
                    // Postamble
                    f_poNeighbour();
                    
                } // end f_GEONW_PON_TSB_BO_07_nodeD
                
            } // end GEONW_PON_TSB_BO_07
            
        } // end geoTopologicallyScopedBroadcast
        
        // 6.2.2.11
        group geoSingleHopBroadcast {
            
            group GEONW_PON_SHB_BV_01 {
                
                /**
                 * @desc    TP Function for TC_GEONW_PON_SHB_BV_01
                 */
                function f_GEONW_PON_SHB_BV_01() runs on ItsMtc {
                    
                    // Local variables
                    var ItsGeoNetworking v_nodeB;
                    var ItsGeoNetworking v_nodeD;
                    
                    // 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_cf02Up();
                    
                    // Preamble
                    
                    // Start components
                    v_nodeB := f_getComponent(c_compNodeB);
                    v_nodeD := f_getComponent(c_compNodeD);
                    v_nodeB.start(f_GEONW_PON_SHB_BV_01_nodeB());
                    v_nodeD.start(f_GEONW_PON_SHB_BV_01_nodeD());
                    
                    // Synchronization
                    f_serverSync2ClientsAndStop({c_prDone, c_tbDone});
                    
                    // Cleanup
                    f_cf02Down();
                    
                } // end f_GEONW_PON_SHB_BV_01
                
                /**
                 * @desc    Behavior function for NodeB (TC_GEONW_PON_SHB_BV_01)
                 */
                function f_GEONW_PON_SHB_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_generateShbMessage) ) {
                        log("*** " & testcasename() & ": INCONC: Trigger failed ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
                    }
                    
                    tc_ac.start;
                    alt {
                        [] geoNetworkingPort.receive(
                                mw_geoNwInd(
                                    mw_geoNwPdu(
garciay's avatar
garciay committed
                                        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);
                        }
                    }
                    
                    // Postamble
                    f_poNeighbour();
                    
                } // end f_GEONW_PON_SHB_BV_01_nodeB
                
                /**
                 * @desc    Behavior function for NodeD (TC_GEONW_PON_SHB_BV_01)
                 */
                function f_GEONW_PON_SHB_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 {
                        [] geoNetworkingPort.receive(
                                mw_geoNwInd(
                                    mw_geoNwPdu(
garciay's avatar
garciay committed
                                        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);
                        }
                    }
                    
                    // 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_02
             */
            function f_GEONW_PON_SHB_BV_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_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_02
            
        } // end geoSingleHopBroadcast
        
        // 6.2.2.12
        group geoGeoAnycast {
            
            group GEONW_PON_GAC_BV_01 {
                
                /**
                 * @desc    TP Function for TC_GEONW_PON_GAC_BV_01
                 */
                function f_GEONW_PON_GAC_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_BV_01_nodeB());
                    v_nodeD.start(f_GEONW_PON_GAC_BV_01_nodeD());
                    
                    // Synchronization
                    f_serverSync2ClientsAndStop({c_prDone, c_tbDone});
                    
                    // Cleanup
                    f_cf02Down();
                    
                } // end f_GEONW_PON_GAC_BV_01
                
                /**
                 * @desc    Behavior function for NodeB (TC_GEONW_PON_GAC_BV_01)
                 */
                function f_GEONW_PON_GAC_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);
                    }
                    
                    tc_ac.start;
                    alt {
                        [] a_receiveGeoAnycastWithArea(
garciay's avatar
garciay committed
                                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_BV_01_nodeB
                
                /**
                 * @desc    Behavior function for NodeD (TC_GEONW_PON_GAC_BV_01)
                 */
                function f_GEONW_PON_GAC_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(
garciay's avatar
garciay committed
                                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_BV_01_nodeD
                
            } // end GEONW_PON_GAC_BV_01
            
            group GEONW_PON_GAC_BV_02 {
                
                /**
                 * @desc    TP Function for TC_GEONW_PON_GAC_BV_02
                 */
                function f_GEONW_PON_GAC_BV_02() 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_getGeoBroadcastForwardingAlgorithm() != e_simple) and (f_getGeoBroadcastForwardingAlgorithm() != e_unspecified)) {
                        log("*** " & testcasename() & ": PICS_GN_GEOBROADCAST_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_GAC_BV_02_nodeB());
                    v_nodeD.start(f_GEONW_PON_GAC_BV_02_nodeD());
                    
                    // Synchronization
                    f_serverSync2ClientsAndStop({c_prDone, c_tbDone});
                    
                    // Cleanup
                    f_cf02Down();
                    
                } // end f_GEONW_PON_GAC_BV_02
                
                /**
                 * @desc    Behavior function for NodeB (TC_GEONW_PON_GAC_BV_02)
                 */
                function f_GEONW_PON_GAC_BV_02_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(
garciay's avatar
garciay committed
                                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_BV_02_nodeB
                
                /**
                 * @desc    Behavior function for NodeD (TC_GEONW_PON_GAC_BV_02)
                 */
                function f_GEONW_PON_GAC_BV_02_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(
garciay's avatar
garciay committed
                                mw_longPosVectorPosition(v_longPosVectorIut),
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 11227 11228 11229 11230 11231 11232 11233 11234 11235 11236 11237 11238 11239 11240 11241 11242 11243 11244 11245 11246 11247 11248 11249 11250 11251 11252 11253 11254 11255 11256 11257 11258 11259 11260 11261 11262 11263 11264 11265 11266 11267 11268 11269 11270 11271 11272 11273 11274 11275 11276 11277 11278 11279 11280 11281 11282 11283 11284 11285 11286 11287 11288 11289 11290 11291 11292 11293 11294 11295 11296 11297 11298 11299 11300 11301 11302 11303 11304 11305 11306 11307 11308 11309 11310 11311 11312 11313 11314 11315 11316 11317 11318 11319 11320 11321 11322 11323 11324 11325 11326 11327 11328 11329 11330 11331 11332 11333 11334 11335 11336 11337 11338 11339 11340 11341 11342 11343 11344 11345 11346 11347 11348 11349 11350 11351 11352 11353 11354 11355 11356 11357 11358 11359 11360 11361 11362 11363 11364 11365 11366 11367 11368 11369 11370 11371 11372 11373 11374 11375 11376 11377 11378 11379 11380 11381 11382 11383 11384 11385 11386 11387 11388 11389 11390 11391 11392 11393 11394 11395 11396 11397 11398 11399 11400 11401 11402 11403 11404 11405 11406 11407 11408 11409 11410 11411 11412 11413 11414 11415 11416 11417 11418 11419 11420 11421 11422 11423 11424 11425 11426 11427 11428 11429 11430 11431 11432 11433 11434 11435 11436 11437 11438 11439 11440 11441 11442 11443 11444 11445 11446 11447 11448 11449 11450 11451 11452 11453 11454 11455 11456 11457 11458 11459 11460 11461 11462 11463 11464 11465 11466 11467 11468 11469 11470 11471 11472 11473 11474 11475 11476 11477 11478 11479 11480 11481 11482 11483 11484 11485 11486 11487 11488 11489 11490 11491 11492 11493 11494 11495 11496 11497 11498 11499 11500 11501 11502 11503 11504 11505 11506 11507 11508 11509 11510 11511 11512 11513 11514 11515 11516 11517 11518 11519 11520 11521 11522 11523 11524 11525 11526 11527 11528 11529 11530 11531 11532 11533 11534 11535 11536 11537 11538 11539 11540 11541 11542 11543 11544 11545 11546 11547 11548 11549 11550 11551 11552 11553 11554 11555 11556 11557 11558 11559 11560 11561 11562 11563 11564 11565 11566 11567 11568 11569 11570 11571 11572 11573 11574 11575 11576 11577 11578 11579 11580 11581 11582 11583 11584 11585 11586 11587 11588 11589 11590 11591 11592 11593 11594 11595 11596 11597 11598 11599 11600 11601 11602 11603 11604 11605 11606 11607 11608 11609 11610 11611 11612 11613 11614 11615 11616 11617 11618 11619 11620 11621 11622 11623 11624 11625 11626 11627 11628 11629 11630 11631 11632 11633 11634 11635 11636 11637 11638 11639 11640 11641 11642 11643 11644 11645 11646 11647 11648 11649 11650 11651 11652 11653 11654 11655 11656 11657 11658 11659 11660 11661 11662 11663 11664 11665 11666 11667 11668 11669 11670 11671 11672 11673 11674 11675 11676 11677 11678 11679 11680 11681 11682 11683 11684 11685 11686 11687 11688 11689 11690 11691 11692 11693 11694 11695 11696 11697 11698 11699 11700 11701 11702 11703 11704 11705 11706 11707 11708 11709 11710 11711 11712 11713 11714 11715 11716 11717 11718 11719 11720 11721 11722 11723 11724 11725 11726 11727 11728 11729 11730 11731 11732 11733 11734 11735 11736 11737 11738 11739 11740 11741 11742 11743 11744 11745 11746 11747 11748 11749 11750 11751 11752 11753 11754 11755 11756 11757 11758 11759 11760 11761 11762 11763 11764 11765 11766 11767 11768 11769 11770 11771 11772 11773 11774 11775 11776 11777 11778 11779 11780 11781 11782 11783 11784 11785 11786 11787 11788 11789
                                ?,
                                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_BV_02_nodeD
                
            } // end GEONW_PON_GAC_BV_02
            
            group GEONW_PON_GAC_BV_03 {
                
                /**
                 * @desc    TP Function for TC_GEONW_PON_GAC_BV_03
                 */
                function f_GEONW_PON_GAC_BV_03() 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_BV_03_nodeB());
                    v_nodeD.start(f_GEONW_PON_GAC_BV_03_nodeD());
                    
                    // Synchronization
                    f_serverSync2ClientsAndStop({c_prDone, c_tbDone});
                    
                    // Cleanup
                    f_cf02Down();
                    
                } // end f_GEONW_PON_GAC_BV_03
                
                /**
                 * @desc    Behavior function for NodeB (TC_GEONW_PON_GAC_BV_03)
                 */
                function f_GEONW_PON_GAC_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_geoNwAnycastPacket(
                                    v_longPosVectorNodeB,
                                    vc_localSeqNumber,
                                    f_getGeoAnycastArea(c_area1)
                                )
                            )
                        )
                    );
                    
                    tc_noac.start;
                    alt {
                        [] a_receiveGeoAnycastWithArea(
                                mw_longPosVectorPosition(v_longPosVectorNodeB),
                                ?,
                                f_getGeoAnycastArea(c_area1)) {
                            tc_noac.stop;
                            log("*** " & testcasename() & ": FAIL: GAC message re-forwarded ***");
                            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_BV_03_nodeB
                
                /**
                 * @desc    Behavior function for NodeD (TC_GEONW_PON_GAC_BV_03)
                 */
                function f_GEONW_PON_GAC_BV_03_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 re-forwarded ***");
                            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_BV_03_nodeD
                
            } // end GEONW_PON_GAC_BV_03
            
            group GEONW_PON_GAC_BV_04 {
                
                /**
                 * @desc    TP Function for TC_GEONW_PON_GAC_BV_03
                 */
                function f_GEONW_PON_GAC_BV_04() 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;
                    }
                    
                    // 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_BV_04_nodeB());
                    v_nodeC.start(f_GEONW_PON_GAC_BV_04_nodeC());
                    v_nodeD.start(f_GEONW_PON_GAC_BV_04_nodeD());
                    
                    // Synchronization
                    f_serverSync3ClientsAndStop({c_prDone, c_tbDone});
                    
                    // Cleanup
                    f_cf04Down();
                    
                } // end f_GEONW_PON_GAC_BV_04
                
                /**
                 * @desc    Behavior function for NodeB (TC_GEONW_PON_GAC_BV_04)
                 */
                function f_GEONW_PON_GAC_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_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_BV_04_nodeB
                
                /**
                 * @desc    Behavior function for NodeC (TC_GEONW_PON_GAC_BV_04)
                 */
                function f_GEONW_PON_GAC_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_geoNwAnycastPacket(
                                    v_longPosVectorNodeC,
                                    vc_localSeqNumber,
                                    f_getGeoAnycastArea(c_area2)
                                )
                            )
                        )
                    );
                    f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                    
                    // Postamble
                    f_poNeighbour();
                    
                } // end f_GEONW_PON_GAC_BV_04_nodeC
                
                /**
                 * @desc    Behavior function for NodeD (TC_GEONW_PON_GAC_BV_04)
                 */
                function f_GEONW_PON_GAC_BV_04_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_BV_04_nodeD
                
            } // end GEONW_PON_GAC_BV_04
            
            group GEONW_PON_GAC_BO_05 {
                
                /**
                 * @desc    TP Function for TC_GEONW_PON_GAC_BO_05
                 */
                function f_GEONW_PON_GAC_BO_05() 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;
                    }
                    
                    // 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_BO_05_nodeB());
                    v_nodeC.start(f_GEONW_PON_GAC_BO_05_nodeC(v_sequenceNumber));
                    v_nodeD.start(f_GEONW_PON_GAC_BO_05_nodeD(v_sequenceNumber));
                    
                    // Synchronization
                    f_serverSync3ClientsAndStop({c_prDone, c_tbDone});
                    
                    // Cleanup
                    f_cf04Down();
                    
                } // end f_GEONW_PON_GAC_BO_05
                
                /**
                 * @desc    Behavior function for NodeB (TC_GEONW_PON_GAC_BO_05)
                 */
                function f_GEONW_PON_GAC_BO_05_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_BO_05_nodeB
                
                /**
                 * @desc    Behavior function for NodeC (TC_GEONW_PON_GAC_BO_05)
                 */
                function f_GEONW_PON_GAC_BO_05_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
                            )
                        )
                    );
                    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_BO_05_nodeC
                
                /**
                 * @desc    Behavior function for NodeD (TC_GEONW_PON_GAC_BO_05)
                 */
                function f_GEONW_PON_GAC_BO_05_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_BO_05_nodeD
                
            } // end GEONW_PON_GAC_BO_05
            
            group GEONW_PON_GAC_BV_06 {
                
                /**
                 * @desc    TP Function for TC_GEONW_PON_GAC_BV_06
                 */
                function f_GEONW_PON_GAC_BV_06() 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_BV_06_nodeB());
                    v_nodeC.start(f_GEONW_PON_GAC_BV_06_nodeC());
                    
                    // Synchronization
                    f_serverSync2ClientsAndStop({c_prDone, c_tbDone});
                    
                    // Cleanup
                    f_cf03Down();
                    
                } // end f_GEONW_PON_GAC_BV_06
                
                /**
                 * @desc    Behavior function for NodeB (TC_GEONW_PON_GAC_BV_06)
                 */
                function f_GEONW_PON_GAC_BV_06_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 forwarded ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                        }
                        [] tc_ac.timeout {
                            log("*** " & testcasename() & ": FAIL: GAC message not forwarded ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                        }
                    }
                    
                    // Postamble
                    f_poNeighbour();
                    
                } // end f_GEONW_PON_GAC_BV_06_nodeB
                
                /**
                 * @desc    Behavior function for NodeC (TC_GEONW_PON_GAC_BV_06)
                 */
                function f_GEONW_PON_GAC_BV_06_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_BV_06_nodeC
                
            } // end GEONW_PON_GAC_BV_06
            
            group GEONW_PON_GAC_BO_07 {
                
                /**
                 * @desc    TP Function for TC_GEONW_PON_GAC_BO_07
                 */
                function f_GEONW_PON_GAC_BO_07() 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_BO_07_nodeB());
                    v_nodeC.start(f_GEONW_PON_GAC_BO_07_nodeC());
                    
                    // Synchronization
                    f_serverSync2ClientsAndStop({c_prDone, c_tbDone});
                    
                    // Cleanup
                    f_cf03Down();
                    
                } // end f_GEONW_PON_GAC_BO_07
                
                /**
                 * @desc    Behavior function for NodeB (TC_GEONW_PON_GAC_BO_07)
                 */
                function f_GEONW_PON_GAC_BO_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 {
                        [] a_receiveGeoAnycastWithArea(
                            mw_longPosVectorPosition(v_longPosVectorNodeC),
                            ?,
                            f_getGeoAnycastArea(c_area2)) {
                            tc_noac.stop;
                            log("*** " & testcasename() & ": FAIL: GAC message re-forwarded ***");
                            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_BO_07_nodeB
                
                /**
                 * @desc    Behavior function for NodeC (TC_GEONW_PON_GAC_BO_07)
                 */
                function f_GEONW_PON_GAC_BO_07_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
                            )
                        )
                    );
                    f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                    
                    // Postamble
                    f_poNeighbour();
                    
                } // end f_GEONW_PON_GAC_BO_07_nodeC
                
            } // end GEONW_PON_GAC_BO_07
            
            /**
             * @desc    TP Function for TC_GEONW_PON_GAC_BV_08
             */
            function f_GEONW_PON_GAC_BV_08() 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_DST) {
                    log("*** " & testcasename() & ": PICS_GN_GAC_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_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);
                }
                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);
                
                // Postamble
                f_poNeighbour();
                f_cf01Down();
                
            } // end f_GEONW_PON_GAC_BV_08
            
            group GEONW_PON_GAC_BO_09 {
                
                /**
                 * @desc    TP Function for TC_GEONW_PON_GAC_BO_09
                 */
                function f_GEONW_PON_GAC_BO_09() 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_BO_09_nodeB());
                    v_nodeD.start(f_GEONW_PON_GAC_BO_09_nodeD());
                    
                    // Synchronization
                    f_serverSync2ClientsAndStop({c_prDone, c_tbDone});
                    
                    // Cleanup
                    f_cf02Down();
                    
                } // end f_GEONW_PON_GAC_BO_09
                
                /**
                 * @desc    Behavior function for NodeB (TC_GEONW_PON_GAC_BO_09)
                 */
                function f_GEONW_PON_GAC_BO_09_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 ***");
                        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.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);
                    }
                    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_BO_09_nodeB
                
                /**
                 * @desc    Behavior function for NodeD (TC_GEONW_PON_GAC_BO_09)
                 */
                function f_GEONW_PON_GAC_BO_09_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_BO_09_nodeD
                
            } // end GEONW_PON_GAC_BO_09
            
            /**
             * @desc    TP Function for TC_GEONW_PON_GAC_BV_10
             */
            function f_GEONW_PON_GAC_BV_10() 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_DST) {
                    log("*** " & testcasename() & ": PICS_GN_GAC_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_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_BV_10
            
            group GEONW_PON_GAC_BO_11 {
                
                /**
                 * @desc    TP Function for TC_GEONW_PON_GAC_BO_11
                 */
                function f_GEONW_PON_GAC_BO_11() 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_BO_11_nodeB(v_distanceTooBig));
                    v_nodeC.start(f_GEONW_PON_GAC_BO_11_nodeC(v_distanceTooBig));
                    v_nodeD.start(f_GEONW_PON_GAC_BO_11_nodeD(v_distanceTooBig));
                    
                    // Synchronization
                    f_serverSync3ClientsAndStop({c_prDone, c_tbDone});
                    
                    // Cleanup
                    f_cf04Down();
                    
                } // end f_GEONW_PON_GAC_BO_11
                
                /**
                 * @desc    Behavior function for NodeB (TC_GEONW_PON_GAC_BO_11)
                 */
                function f_GEONW_PON_GAC_BO_11_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 forwarded ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                        }
                        [] tc_noac.timeout {
                            log("*** " & testcasename() & ": PASS: GAC message not forwarded ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                        }
                    }
                    
                    // Postamble
                    f_poNeighbour();
                    
                } // end f_GEONW_PON_GAC_BO_11_nodeB
                
                /**
                 * @desc    Behavior function for NodeC (TC_GEONW_PON_GAC_BO_11)
                 */
                function f_GEONW_PON_GAC_BO_11_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)
                                )
                            )
                        )
                    );
                    f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                    
                    // Test Body
                    f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                    
                    // Postamble
                    f_poNeighbour();
                    
                } // end f_GEONW_PON_GAC_BO_11_nodeC
                
                /**
                 * @desc    Behavior function for NodeD (TC_GEONW_PON_GAC_BO_11)
                 */
                function f_GEONW_PON_GAC_BO_11_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 forwarded ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                        }
                        [] tc_noac.timeout {
                            log("*** " & testcasename() & ": PASS: GAC message not forwarded ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                        }
                    }
                    
                    // Postamble
                    f_poNeighbour();
                    
                } // end f_GEONW_PON_GAC_BO_11_nodeD
                
            } // end GEONW_PON_GAC_BO_11

            group GEONW_PON_GAC_BV_13 {
                
                /**
                 * @desc    TP Function for TC_GEONW_PON_GAC_BV_13
                 */
                function f_GEONW_PON_GAC_BV_13() 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_getGeoBroadcastForwardingAlgorithm() != e_cbf) {
                        log("*** " & testcasename() & ": PICS_GN_GEOBROADCAST_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_BV_13_nodeB());
                    v_nodeD.start(f_GEONW_PON_GAC_BV_13_nodeD());
                    
                    // Synchronization
                    f_serverSync2ClientsAndStop({c_prDone, c_tbDone});
                    
                    // Cleanup
                    f_cf02Down();
                    
                } // end f_GEONW_PON_GAC_BV_13
                
                /**
                 * @desc    Behavior function for NodeB (TC_GEONW_PON_GAC_BV_13)
                 */
                function f_GEONW_PON_GAC_BV_13_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(
garciay's avatar
garciay committed
                                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_BV_13_nodeB
                
                /**
                 * @desc    Behavior function for NodeD (TC_GEONW_PON_GAC_BV_13)
                 */
                function f_GEONW_PON_GAC_BV_13_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(
garciay's avatar
garciay committed
                                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);
                        }
                    }
                    
                    // Postamble
                    f_poNeighbour();
                    
                } // end f_GEONW_PON_GAC_BV_13_nodeD
                
            } // end GEONW_PON_GAC_BV_13
            
        } // end geoGeoAnycast
        
        // 6.2.2.13
        group geoGeoBroadcastCbfAlgorithm {
            
            group GEONW_PON_BCA_BV_01 {
                 * @desc    TP Function for TC_GEONW_PON_BCA_BV_01
                function f_GEONW_PON_BCA_BV_01() 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_getGeoBroadcastForwardingAlgorithm() != e_cbf) {
                        log("*** " & testcasename() & ": PICS_GN_GEOBROADCAST_FORWARDING_ALGORITHM == e_cbf required for executing the TC ***");
                        setverdict(inconc);
                        stop;
                    }
                    
garciay's avatar
garciay committed
//                    if (f_getGeoBroadcastCbfMinTime() < 300) {
//                        log("*** " & testcasename() & ": PICS_GN_GEOBROADCAST_CBF_MIN_TIME >= 300 required for executing the TC ***");
//                        setverdict(inconc);
//                        stop;
//                    }
                                        
                    // Test component configuration
                    f_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_BCA_BV_01_nodeB());
                    v_nodeC.start(f_GEONW_PON_BCA_BV_01_nodeC(v_sequenceNumberC));
                    v_nodeD.start(f_GEONW_PON_BCA_BV_01_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_BCA_BV_01)
                function f_GEONW_PON_BCA_BV_01_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_BCA_BV_01_nodeB
                 * @desc    Behavior function for NodeC (TC_GEONW_PON_BCA_BV_01)
                function f_GEONW_PON_BCA_BV_01_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)
                                )
                            )
                        )
                    );
                    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_BCA_BV_01_nodeC
                 * @desc    Behavior function for NodeD (TC_GEONW_PON_BCA_BV_01)
                function f_GEONW_PON_BCA_BV_01_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_BCA_BV_01_nodeD
            } // end GEONW_PON_BCA_BV_01
            
            group GEONW_PON_BCA_BV_02 {
                
                /**
                 * @desc    TP Function for TC_GEONW_PON_BCA_BV_02
                 */
                function f_GEONW_PON_BCA_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_getGeoBroadcastForwardingAlgorithm() != e_cbf) {
                        log("*** " & testcasename() & ": PICS_GN_GEOBROADCAST_FORWARDING_ALGORITHM == e_cbf required for executing the TC ***");
                        setverdict(inconc);
                        stop;
                    }
                    
garciay's avatar
garciay committed
//                    if (f_getGeoBroadcastCbfMinTime() < 300) {
//                        log("*** " & testcasename() & ": PICS_GN_GEOBROADCAST_CBF_MIN_TIME >= 300 required for executing the TC ***");
//                        setverdict(inconc);
//                        stop;
//                    }
                    
                    // Test component configuration
                    f_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_BCA_BV_02_nodeB());
                    v_nodeC.start(f_GEONW_PON_BCA_BV_02_nodeC());
                    v_nodeD.start(f_GEONW_PON_BCA_BV_02_nodeD());
                    
                    // Synchronization
                    f_serverSync3ClientsAndStop({c_prDone, c_tbDone});
                    
                    // Cleanup
                    f_cf04Down();
                    
                } // end f_GEONW_PON_BCA_BV_02
                
                /**
                 * @desc    Behavior function for NodeB (TC_GEONW_PON_BCA_BV_02)
                 */
                function f_GEONW_PON_BCA_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_BCA_BV_02_nodeB
                
                /**
                 * @desc    Behavior function for NodeC (TC_GEONW_PON_BCA_BV_02)
                 */
                function f_GEONW_PON_BCA_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_getGeoBroadcastCbfMaxTime())
                        + (
                            int2float(f_getGeoBroadcastCbfMinTime() - f_getGeoBroadcastCbfMaxTime())
                            / 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)
                                )
                            )
                        )
                    );
                    
                    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_BCA_BV_02_nodeC
                
                /**
                 * @desc    Behavior function for NodeD (TC_GEONW_PON_BCA_BV_02)
                 */
                function f_GEONW_PON_BCA_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_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_BCA_BV_02_nodeD
                
            } // end GEONW_PON_BCA_BV_02
            
            group GEONW_PON_BCA_BV_03 {
                
                /**
                 * @desc    TP Function for TC_GEONW_PON_BCA_BV_03
                 */
                function f_GEONW_PON_BCA_BV_03() 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_getGeoBroadcastForwardingAlgorithm() != e_cbf) {
                        log("*** " & testcasename() & ": PICS_GN_GEOBROADCAST_FORWARDING_ALGORITHM == e_cbf required for executing the TC ***");
                        setverdict(inconc);
                        stop;
                    }
                    
garciay's avatar
garciay committed
//                    if (f_getGeoBroadcastCbfMinTime() < 300) {
//                        log("*** " & testcasename() & ": PICS_GN_GEOBROADCAST_CBF_MIN_TIME >= 300 required for executing the TC ***");
//                        setverdict(inconc);
//                        stop;
//                    }
                                        
                    // Test component configuration
                    f_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_BCA_BV_03_nodeB());
                    v_nodeC.start(f_GEONW_PON_BCA_BV_03_nodeC());
                    v_nodeD.start(f_GEONW_PON_BCA_BV_03_nodeD());
                    
                    // Synchronization
                    f_serverSync3ClientsAndStop({c_prDone, c_tbDone});
                    
                    // Cleanup
                    f_cf04Down();
                    
                } // end f_GEONW_PON_BCA_BV_03
                
                /**
                 * @desc    Behavior function for NodeB (TC_GEONW_PON_BCA_BV_03)
                 */
                function f_GEONW_PON_BCA_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 {
                        [] geoNetworkingPort.receive(mw_geoNwInd_withLinkLayerDestination(mw_geoNwPdu(mw_geoNwBroadcastPacketWithArea(
                                mw_longPosVectorPosition(v_longPosVectorNodeC),
                                ?,
                                f_getGeoBroadcastArea(c_area2)
                            )),
                            f_getTsGnLocalAddress(c_compNodeB).mid
                            )) {
                            tc_ac.stop;
                            log("*** " & testcasename() & ": PASS: GBC correctly forwarded ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                        }
                        [] tc_ac.timeout {
                            log("*** " & testcasename() & ": FAIL: GBC message not forwarded ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                        }
                    }
                    
                    // Postamble
                    f_poNeighbour();
                    
                } // end f_GEONW_PON_BCA_BV_03_nodeB
                
                /**
                 * @desc    Behavior function for NodeC (TC_GEONW_PON_BCA_BV_03)
                 */
                function f_GEONW_PON_BCA_BV_03_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)
                                )
                            )
                        )
                    );
                    
                    tc_noac.start;
                    alt {
                        [] geoNetworkingPort.receive(mw_geoNwInd(mw_geoNwPdu(?))) {
                            tc_noac.stop;
                            log("*** " & testcasename() & ": FAIL: Message was broadcasted ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                        }
                        [] tc_noac.timeout {
                            log("*** " & testcasename() & ": PASS: Message not broadcasted ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                        }
                    }
                    
                    // Postamble
                    f_poNeighbour();
                    
                } // end f_GEONW_PON_BCA_BV_03_nodeC
                
                /**
                 * @desc    Behavior function for NodeD (TC_GEONW_PON_BCA_BV_03)
                 */
                function f_GEONW_PON_BCA_BV_03_nodeD() 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 was broadcasted ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                        }
                        [] tc_noac.timeout {
                            log("*** " & testcasename() & ": PASS: Message not broadcasted ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                        }
                    }
                    
                    // Postamble
                    f_poNeighbour();
                    
                } // end f_GEONW_PON_BCA_BV_03_nodeD
                
            } // end GEONW_PON_BCA_BV_03
            
            group GEONW_PON_BCA_BO_04 {
                
                /**
                 * @desc    TP Function for TC_GEONW_PON_BCA_BO_04
                 */
                function f_GEONW_PON_BCA_BO_04() 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_getGeoBroadcastForwardingAlgorithm() != e_cbf) {
                        log("*** " & testcasename() & ": PICS_GN_GEOBROADCAST_FORWARDING_ALGORITHM == e_cbf required for executing the TC ***");
                        setverdict(inconc);
                        stop;
                    }
                    
garciay's avatar
garciay committed
//                    if (f_getGeoBroadcastCbfMinTime() < 300) {
//                        log("*** " & testcasename() & ": PICS_GN_GEOBROADCAST_CBF_MIN_TIME >= 300 required for executing the TC ***");
//                        setverdict(inconc);
//                        stop;
//                    }
                                                          
                    // Test component configuration
                    f_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_BCA_BO_04_nodeB());
                    v_nodeC.start(f_GEONW_PON_BCA_BO_04_nodeC());
                    v_nodeD.start(f_GEONW_PON_BCA_BO_04_nodeD());
                    
                    // Synchronization
                    f_serverSync3ClientsAndStop({c_prDone, c_tbDone});
                    
                    // Cleanup
                    f_cf04Down();
                    
                } // end f_GEONW_PON_BCA_BO_04
                
                /**
                 * @desc    Behavior function for NodeB (TC_GEONW_PON_BCA_BO_04)
                 */
                function f_GEONW_PON_BCA_BO_04_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_BCA_BO_04_nodeB
                
                /**
                 * @desc    Behavior function for NodeC (TC_GEONW_PON_BCA_BO_04)
                 */
                function f_GEONW_PON_BCA_BO_04_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_BCA_BO_04_nodeC
                
                /**
                 * @desc    Behavior function for NodeD (TC_GEONW_PON_BCA_BO_04)
                 */
                function f_GEONW_PON_BCA_BO_04_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)
                                )
                            )
                        )
                    );
                    
                    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_BCA_BO_04_nodeD
                
            } // end GEONW_PON_BCA_BO_04
            
            group GEONW_PON_BCA_BV_05 {
                
                /**
                 * @desc    TP Function for TC_GEONW_PON_BCA_BV_05
                 */
                function f_GEONW_PON_BCA_BV_05() 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_getGeoBroadcastForwardingAlgorithm() != e_cbf) {
                        log("*** " & testcasename() & ": PICS_GN_GEOBROADCAST_FORWARDING_ALGORITHM == e_cbf required for executing the TC ***");
                        setverdict(inconc);
                        stop;
                    }
                    
garciay's avatar
garciay committed
//                    if (f_getGeoBroadcastCbfMinTime() < 300) {
//                        log("*** " & testcasename() & ": PICS_GN_GEOBROADCAST_CBF_MIN_TIME >= 300 required for executing the TC ***");
//                        setverdict(inconc);
//                        stop;
//                    }
                    
                    // Test component configuration
                    f_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_BCA_BV_05_nodeB());
                    v_nodeC.start(f_GEONW_PON_BCA_BV_05_nodeC());
                    v_nodeD.start(f_GEONW_PON_BCA_BV_05_nodeD());
                    
                    // Synchronization
                    f_serverSync3ClientsAndStop({c_prDone, c_tbDone});
                    
                    // Cleanup
                    f_cf04Down();
                    
                } // end f_GEONW_PON_BCA_BV_05
                
                /**
                 * @desc    Behavior function for NodeB (TC_GEONW_PON_BCA_BV_05)
                 */
                function f_GEONW_PON_BCA_BV_05_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_BCA_BV_05_nodeB
                
                /**
                 * @desc    Behavior function for NodeC (TC_GEONW_PON_BCA_BV_05)
                 */
                function f_GEONW_PON_BCA_BV_05_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_BCA_BV_05_nodeC
                
                /**
                 * @desc    Behavior function for NodeD (TC_GEONW_PON_BCA_BV_05)
                 */
                function f_GEONW_PON_BCA_BV_05_nodeD() runs on ItsGeoNetworking {
                    
                    // Local variables
                    var LongPosVector v_longPosVectorNodeC := f_getPosition(c_compNodeC);
                    timer t_toCbf := int2float(f_getGeoBroadcastCbfMaxTime()) * 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)
                                )
                            )
                        )
                    );
                    
                    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_BCA_BV_05_nodeD
                
            } // end GEONW_PON_BCA_BV_05
            
            group GEONW_PON_BCA_BV_06 {
                
                /**
                 * @desc    TP Function for TC_GEONW_PON_BCA_BV_06
                 */
                function f_GEONW_PON_BCA_BV_06() 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_getGeoBroadcastForwardingAlgorithm() != e_cbf) {
                        log("*** " & testcasename() & ": PICS_GN_GEOBROADCAST_FORWARDING_ALGORITHM == e_cbf required for executing the TC ***");
                        setverdict(inconc);
                        stop;
                    }
                    
garciay's avatar
garciay committed
//                    if (f_getGeoBroadcastCbfMinTime() < 300) {
//                        log("*** " & testcasename() & ": PICS_GN_GEOBROADCAST_CBF_MIN_TIME >= 300 required for executing the TC ***");
//                        setverdict(inconc);
//                        stop;
//                    }
                    
                    // Test component configuration
                    f_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_BCA_BV_06_nodeB());
                    v_nodeC.start(f_GEONW_PON_BCA_BV_06_nodeC());
                    v_nodeD.start(f_GEONW_PON_BCA_BV_06_nodeD());
                    
                    // Synchronization
                    f_serverSync3ClientsAndStop({c_prDone, c_tbDone});
                    
                    // Cleanup
                    f_cf04Down();
                    
                } // end f_GEONW_PON_BCA_BV_06
                
                /**
                 * @desc    Behavior function for NodeB (TC_GEONW_PON_BCA_BV_06)
                 */
                function f_GEONW_PON_BCA_BV_06_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_BCA_BV_06_nodeB
                
                /**
                 * @desc    Behavior function for NodeC (TC_GEONW_PON_BCA_BV_06)
                 */
                function f_GEONW_PON_BCA_BV_06_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_BCA_BV_06_nodeC
                
                /**
                 * @desc    Behavior function for NodeD (TC_GEONW_PON_BCA_BV_06)
                 */
                function f_GEONW_PON_BCA_BV_06_nodeD() 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)
                                )
                            )
                        )
                    );
                    
                    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_poDefault();
                    
                } // end f_GEONW_PON_BCA_BV_06_nodeD
                
            } // end GEONW_PON_BCA_BV_06
            
            group GEONW_PON_BCA_BV_07 {
                
                /**
                 * @desc    TP Function for TC_GEONW_PON_BCA_BV_07
                 */
                function f_GEONW_PON_BCA_BV_07() 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_getGeoBroadcastForwardingAlgorithm() != e_cbf) {
                        log("*** " & testcasename() & ": PICS_GN_GEOBROADCAST_FORWARDING_ALGORITHM == e_cbf required for executing the TC ***");
                        setverdict(inconc);
                        stop;
                    }
                    
garciay's avatar
garciay committed
//                    if (f_getGeoBroadcastCbfMinTime() < 300) {
//                        log("*** " & testcasename() & ": PICS_GN_GEOBROADCAST_CBF_MIN_TIME >= 300 required for executing the TC ***");
//                        setverdict(inconc);
//                        stop;
//                    }
                    
                    // Test component configuration
                    f_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_BCA_BV_07_nodeB());
                    v_nodeC.start(f_GEONW_PON_BCA_BV_07_nodeC());
                    v_nodeD.start(f_GEONW_PON_BCA_BV_07_nodeD());
                    
                    // Synchronization
                    f_serverSync3ClientsAndStop({c_prDone, c_tbDone});
                    
                    // Cleanup
                    f_cf04Down();
                    
                } // end f_GEONW_PON_BCA_BV_07
                
                /**
                 * @desc    Behavior function for NodeB (TC_GEONW_PON_BCA_BV_07)
                 */
                function f_GEONW_PON_BCA_BV_07_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_BCA_BV_07_nodeB
                
                /**
                 * @desc    Behavior function for NodeC (TC_GEONW_PON_BCA_BV_07)
                 */
                function f_GEONW_PON_BCA_BV_07_nodeC() runs on ItsGeoNetworking {
                    
                    // Local variables
                    var LongPosVector v_longPosVectorNodeC := f_getPosition(c_compNodeC);
                    var LongPosVector v_longPosVectorNodeA := f_getPosition(c_compNodeA);
                    
                    // 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)
                                )
                            )
                        )
                    );                   
                    
                    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_BCA_BV_07_nodeC
                
                /**
                 * @desc    Behavior function for NodeD (TC_GEONW_PON_BCA_BV_07)
                 */
                function f_GEONW_PON_BCA_BV_07_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_BCA_BV_07_nodeD
                
            } // end GEONW_PON_BCA_BV_07

            group GEONW_PON_BCA_BV_08 {
                
                /**
                 * @desc    TP Function for TC_GEONW_PON_BCA_BV_08
                 */
                function f_GEONW_PON_BCA_BV_08() 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_getGeoBroadcastForwardingAlgorithm() != e_cbf) {
                        log("*** " & testcasename() & ": PICS_GN_GEOBROADCAST_FORWARDING_ALGORITHM == e_cbf required for executing the TC ***");
                        setverdict(inconc);
                        stop;
                    }
                    
garciay's avatar
garciay committed
//                    if (f_getGeoBroadcastCbfMinTime() < 300) {
//                        log("*** " & testcasename() & ": PICS_GN_GEOBROADCAST_CBF_MIN_TIME >= 300 required for executing the TC ***");
//                        setverdict(inconc);
//                        stop;
//                    }
                    
                    // Test component configuration
                    f_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_BCA_BV_08_nodeB());
                    v_nodeC.start(f_GEONW_PON_BCA_BV_08_nodeC());
                    v_nodeD.start(f_GEONW_PON_BCA_BV_08_nodeD());
                    
                    // Synchronization
                    f_serverSync3ClientsAndStop({c_prDone, c_tbDone});
                    
                    // Cleanup
                    f_cf04Down();
                    
                } // end f_GEONW_PON_BCA_BV_08
                
                /**
                 * @desc    Behavior function for NodeB (TC_GEONW_PON_BCA_BV_08)
                 */
                function f_GEONW_PON_BCA_BV_08_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_BCA_BV_08_nodeB
                
                /**
                 * @desc    Behavior function for NodeC (TC_GEONW_PON_BCA_BV_08)
                 */
                function f_GEONW_PON_BCA_BV_08_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_BCA_BV_08_nodeC
                
                /**
                 * @desc    Behavior function for NodeD (TC_GEONW_PON_BCA_BV_08)
                 */
                function f_GEONW_PON_BCA_BV_08_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_getGeoBroadcastCbfMaxTime()) * 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)
                                )
                            )
                        )
                    );
                    
                    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_BCA_BV_08_nodeD
                
            } // end GEONW_PON_BCA_BV_08

        } // end geoGeoBroadcastCbfAlgorithm
        
        // 6.2.2.13
        group geoGeoBroadcastAdvAlgorithm {
            
            group GEONW_PON_BAA_BV_01 {
                
                /**
                 * @desc    TP Function for TC_GEONW_PON_BAA_BV_01
                 */
                function f_GEONW_PON_BAA_BV_01() 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_getGeoBroadcastForwardingAlgorithm() != e_advanced) {
                        log("*** " & testcasename() & ": PICS_GN_GEOBROADCAST_FORWARDING_ALGORITHM == e_advanced required for executing the TC ***");
                        setverdict(inconc);
                        stop;
                    }
                    
garciay's avatar
garciay committed
//                    if (f_getGeoBroadcastCbfMinTime() < 300) {
//                        log("*** " & testcasename() & ": PICS_GN_GEOBROADCAST_CBF_MIN_TIME >= 300 required for executing the TC ***");
//                        setverdict(inconc);
//                        stop;
//                    }
                    
                    // Test component configuration
                    f_cf06Up();
                    
                    // Preamble
                    
                    // Start components
                    v_nodeB := f_getComponent(c_compNodeB);
                    v_nodeF := f_getComponent(c_compNodeF);
                    v_nodeB.start(f_GEONW_PON_BAA_BV_01_nodeB());
                    v_nodeF.start(f_GEONW_PON_BAA_BV_01_nodeF());
                    
                    // Synchronization
                    f_serverSync2ClientsAndStop({c_prDone, c_tbDone});
                    
                    // Cleanup
                    f_cf06Down();
                    
                } // end f_GEONW_PON_BAA_BV_01
                
                /**
                 * @desc    Behavior function for NodeB (TC_GEONW_PON_BAA_BV_01)
                 */
                function f_GEONW_PON_BAA_BV_01_nodeB() runs on ItsGeoNetworking {
                    
                    // Local variables
                    
                    // Preamble
                    f_prNeighbour();
                    f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                    
                    // 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_BAA_BV_01_nodeB
                
                /**
                 * @desc    Behavior function for NodeF (TC_GEONW_PON_BAA_BV_01)
                 */
                function f_GEONW_PON_BAA_BV_01_nodeF() runs on ItsGeoNetworking {
                    
                    // Local variables
                    var integer i;
                    var template (value) GeoNetworkingPdu v_gnPacket;
                    var LongPosVector v_longPosVectorNodeB := f_getPosition(c_compNodeB);
                    
                    // Preamble
                    f_prNeighbour();
                    v_gnPacket := m_geoNwPdu(m_geoNwBroadcastPacket(
                                            v_longPosVectorNodeB,
                                            vc_localSeqNumber,
                                            f_getGeoBroadcastArea(c_area1)
                                        )
                                    );
                    f_sendGeoNetMessage(m_geoNwReq_linkLayerBroadcast(v_gnPacket));
                    f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                    
                    // 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_BAA_BV_01_nodeF
                
            } // end GEONW_PON_BAA_BV_01
            
            group GEONW_PON_BAA_BV_02 {
                
                /**
                 * @desc    TP Function for TC_GEONW_PON_BAA_BV_02
                 */
                function f_GEONW_PON_BAA_BV_02() 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_getGeoBroadcastForwardingAlgorithm() != e_advanced) {
                        log("*** " & testcasename() & ": PICS_GN_GEOBROADCAST_FORWARDING_ALGORITHM == e_advanced required for executing the TC ***");
                        setverdict(inconc);
                        stop;
                    }
                    
garciay's avatar
garciay committed
//                    if (f_getGeoBroadcastCbfMinTime() < 300) {
//                        log("*** " & testcasename() & ": PICS_GN_GEOBROADCAST_CBF_MIN_TIME >= 300 required for executing the TC ***");
//                        setverdict(inconc);
//                        stop;
//                    }
                    
                    // Test component configuration
                    f_cf05Up();
                    
                    // Preamble
                                    
                    // Start components
                    v_nodeB := f_getComponent(c_compNodeB);
                    v_nodeE := f_getComponent(c_compNodeE);
                    v_nodeB.start(f_GEONW_PON_BAA_BV_02_nodeB());
                    v_nodeE.start(f_GEONW_PON_BAA_BV_02_nodeE());
                    
                    // Synchronization
                    f_serverSync2ClientsAndStop({c_prDone, c_tbDone});
                    
                    // Cleanup
                    f_cf05Down();
                    
                } // end f_GEONW_PON_BAA_BV_02
                
                /**
                 * @desc    Behavior function for NodeB (TC_GEONW_PON_BAA_BV_02)
                 */
                function f_GEONW_PON_BAA_BV_02_nodeB() runs on ItsGeoNetworking {
                    
                    // Local variables
                    var LongPosVector v_longPosVectorNodeB := f_getPosition(c_compNodeB);
                    
                    // Preamble
                    f_prNeighbour();
                    f_sendGeoNetMessage(m_geoNwReq_linkLayerBroadcast(
                        m_geoNwPdu(m_geoNwBroadcastPacket(
                                v_longPosVectorNodeB,
                                0,
                                f_getGeoBroadcastArea(c_area1)
                            )
                        )
                    ));
                    f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                    
                    // 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_BAA_BV_02_nodeB
                
                /**
                 * @desc    Behavior function for NodeE (TC_GEONW_PON_BAA_BV_02)
                 */
                function f_GEONW_PON_BAA_BV_02_nodeE() runs on ItsGeoNetworking {
                    
                    // Local variables
                    var LongPosVector v_longPosVectorNodeB := f_getPosition(c_compNodeB);
                    
                    // Preamble
                    f_prNeighbour();
                    f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                    
                    // 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);
                        }
                    }
                    
                    // Postamble
                    f_poNeighbour();
                    
                } // end f_GEONW_PON_BAA_BV_02_nodeE
                
            } // end GEONW_PON_BAA_BV_02
            
            group GEONW_PON_BAA_BV_03 {
                
                /**
                 * @desc    TP Function for TC_GEONW_PON_BAA_BV_03
                 */
                function f_GEONW_PON_BAA_BV_03() 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_getGeoBroadcastForwardingAlgorithm() != e_advanced) {
                        log("*** " & testcasename() & ": PICS_GN_GEOBROADCAST_FORWARDING_ALGORITHM == e_advanced required for executing the TC ***");
                        setverdict(inconc);
                        stop;
                    }
                    
garciay's avatar
garciay committed
//                    if (f_getGeoBroadcastCbfMinTime() < 300) {
//                        log("*** " & testcasename() & ": PICS_GN_GEOBROADCAST_CBF_MIN_TIME >= 300 required for executing the TC ***");
//                        setverdict(inconc);
//                        stop;
//                    }
                    
                    // Test component configuration
                    f_cf06Up();
                    
                    // Preamble
                                    
                    // Start components
                    v_nodeB := f_getComponent(c_compNodeB);
                    v_nodeF := f_getComponent(c_compNodeF);
                    v_nodeB.start(f_GEONW_PON_BAA_BV_03_nodeB());
                    v_nodeF.start(f_GEONW_PON_BAA_BV_03_nodeF());
                    
                    // Synchronization
                    f_serverSync2ClientsAndStop({c_prDone, c_tbDone});
                    
                    // Cleanup
                    f_cf06Down();
                    
                } // end f_GEONW_PON_BAA_BV_03
                
                /**
                 * @desc    Behavior function for NodeB (TC_GEONW_PON_BAA_BV_03)
                 */
                function f_GEONW_PON_BAA_BV_03_nodeB() runs on ItsGeoNetworking {
                    
                    // Local variables
                    var LongPosVector v_longPosVectorNodeB := f_getPosition(c_compNodeB);
                    
                    // Preamble
                    f_prNeighbour();
                    f_sendGeoNetMessage(m_geoNwReq_linkLayerBroadcast(
                        m_geoNwPdu(m_geoNwBroadcastPacket(
                                v_longPosVectorNodeB,
                                0,
                                f_getGeoBroadcastArea(c_area1)
                            )
                        )
                    ));
                    f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                    
                    // 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_BAA_BV_03_nodeB
                
                /**
                 * @desc    Behavior function for NodeF (TC_GEONW_PON_BAA_BV_03)
                 */
                function f_GEONW_PON_BAA_BV_03_nodeF() runs on ItsGeoNetworking {
                    
                    // Local variables
                    var LongPosVector v_longPosVectorNodeB := f_getPosition(c_compNodeB);
                    var LongPosVector v_longPosVectorNodeF := f_getPosition(c_compNodeF);                    
                    var LongPosVector v_longPosVectorIut := f_getPosition(c_compIut);
                    timer t_toCbf := (int2float(f_getGeoBroadcastCbfMaxTime())
                        + (
                            int2float(f_getGeoBroadcastCbfMinTime() - f_getGeoBroadcastCbfMaxTime())
                            / int2float(f_getCbfMaxCommunicationRange())
                        ) * f_distance(v_longPosVectorNodeF, v_longPosVectorIut)) * 0.95 / 1000.0;
                    
                    // Preamble
                    f_prNeighbour();
                    f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                    
                    // 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_BAA_BV_03_nodeF
                
            } // end GEONW_PON_BAA_BV_03
            
            group GEONW_PON_BAA_BV_04 {
                
                /**
                 * @desc    TP Function for TC_GEONW_PON_BAA_BV_04
                 */
                function f_GEONW_PON_BAA_BV_04() 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_getGeoBroadcastForwardingAlgorithm() != e_advanced) {
                        log("*** " & testcasename() & ": PICS_GN_GEOBROADCAST_FORWARDING_ALGORITHM == e_advanced required for executing the TC ***");
                        setverdict(inconc);
                        stop;
                    }
                    
garciay's avatar
garciay committed
//                    if (f_getGeoBroadcastCbfMinTime() < 300) {
//                        log("*** " & testcasename() & ": PICS_GN_GEOBROADCAST_CBF_MIN_TIME >= 300 required for executing the TC ***");
//                        setverdict(inconc);
//                        stop;
//                    }
                    
                    // Test component configuration
                    f_cf05Up();
                    
                    // Preamble
                    
                    // Start components
                    v_nodeB := f_getComponent(c_compNodeB);
                    v_nodeE := f_getComponent(c_compNodeE);
                    v_nodeB.start(f_GEONW_PON_BAA_BV_04_nodeB());
                    v_nodeE.start(f_GEONW_PON_BAA_BV_04_nodeE());
                    
                    // Synchronization
                    f_serverSync2ClientsAndStop({c_prDone, c_tbDone});
                    
                    // Cleanup
                    f_cf05Down();
                    
                } // end f_GEONW_PON_BAA_BV_04
                
                /**
                 * @desc    Behavior function for NodeB (TC_GEONW_PON_BAA_BV_04)
                 */
                function f_GEONW_PON_BAA_BV_04_nodeB() runs on ItsGeoNetworking {
                    
                    // Local variables
                    var LongPosVector v_longPosVectorNodeA := f_getPosition(c_compNodeA);
                    
                    // Preamble
                    f_prNeighbour();
                    f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                    
                    // 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_BAA_BV_04_nodeB
                
                /**
                 * @desc    Behavior function for NodeE (TC_GEONW_PON_BAA_BV_04)
                 */
                function f_GEONW_PON_BAA_BV_04_nodeE() runs on ItsGeoNetworking {
                    
                    // Local variables
                    var LongPosVector v_longPosVectorNodeA := f_getPosition(c_compNodeA);
                    
                    // Preamble
                    f_prNeighbour();
                    f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                    
                    // 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);
                    
                    // Postamble
                    f_poNeighbour();
                    
                } // end f_GEONW_PON_BAA_BV_04_nodeE
                
            } // end GEONW_PON_BAA_BV_04

            group GEONW_PON_BAA_BV_05 {
                
                /**
                 * @desc    TP Function for TC_GEONW_PON_BAA_BV_05
                 */
                function f_GEONW_PON_BAA_BV_05() 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_getGeoBroadcastForwardingAlgorithm() != e_advanced) {
                        log("*** " & testcasename() & ": PICS_GN_GEOBROADCAST_FORWARDING_ALGORITHM == e_advanced required for executing the TC ***");
                        setverdict(inconc);
                        stop;
                    }
                    
garciay's avatar
garciay committed
//                    if (f_getGeoBroadcastCbfMinTime() < 300) {
//                        log("*** " & testcasename() & ": PICS_GN_GEOBROADCAST_CBF_MIN_TIME >= 300 required for executing the TC ***");
//                        setverdict(inconc);
//                        stop;
//                    }
                    
                    // Test component configuration
                    f_cf05Up();
                    
                    // Preamble
                    
                    // Start components
                    v_nodeB := f_getComponent(c_compNodeB);
                    v_nodeE := f_getComponent(c_compNodeE);
                    v_nodeB.start(f_GEONW_PON_BAA_BV_05_nodeB());
                    v_nodeE.start(f_GEONW_PON_BAA_BV_05_nodeE());
                    
                    // Synchronization
                    f_serverSync2ClientsAndStop({c_prDone, c_tbDone});
                    
                    // Cleanup
                    f_cf05Down();
                    
                } // end f_GEONW_PON_BAA_BV_05
                
                /**
                 * @desc    Behavior function for NodeB (TC_GEONW_PON_BAA_BV_05)
                 */
                function f_GEONW_PON_BAA_BV_05_nodeB() runs on ItsGeoNetworking {
                    
                    // Local variables
                    var LongPosVector v_longPosVectorNodeA := f_getPosition(c_compNodeA);
                    
                    // Preamble
                    f_prNeighbour();
                    f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                    
                    // Test Body
                    tc_ac.start;
                    alt {                    	
                        [] geoNetworkingPort.receive(mw_geoNwInd(mw_geoNwPdu(mw_geoNwBroadcastPacketWithArea(
                                mw_longPosVectorPosition(v_longPosVectorNodeA),
                                ?,
                                f_getGeoBroadcastArea(c_area1)
                            )))) {
                            tc_ac.stop;
                            log("*** " & testcasename() & ": PASS: packet correctly broadcasted ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                        }
                        [] tc_ac.timeout {
                            log("*** " & testcasename() & ": FAIL: Expected message not received ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                        }
                    }
                    
                    // Postamble
                    f_poNeighbour();
                    
                } // end f_GEONW_PON_BAA_BV_05_nodeB
                
                /**
                 * @desc    Behavior function for NodeE (TC_GEONW_PON_BAA_BV_05)
                 */
                function f_GEONW_PON_BAA_BV_05_nodeE() runs on ItsGeoNetworking {
                    
                    // Local variables
                    var LongPosVector v_longPosVectorNodeA := f_getPosition(c_compNodeA);
                    
                    // Preamble
                    f_prNeighbour();
                    f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                    
                    // Test Body
                    f_sendGeoNetMessage(
                        m_geoNwReq_withLinkLayerDestination(
                            m_geoNwPdu(m_geoNwBroadcastPacket(
                                    v_longPosVectorNodeA,
                                    0,
                                    f_getGeoBroadcastArea(c_area1)
                                )
                            ),
                            f_getIutMacAddress()
                        )
                    );
                    tc_ac.start;
                    alt {                    	
                        [] geoNetworkingPort.receive(mw_geoNwInd(mw_geoNwPdu(mw_geoNwBroadcastPacketWithArea(
                                mw_longPosVectorPosition(v_longPosVectorNodeA),
                                ?,
                                f_getGeoBroadcastArea(c_area1)
                            )))) {
                            tc_ac.stop;
                            log("*** " & testcasename() & ": PASS: packet correctly broadcasted ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                        }
                        [] tc_ac.timeout {
                            log("*** " & testcasename() & ": FAIL: Expected message not received ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                        }
                    }
                    
                    // Postamble
                    f_poNeighbour();
                    
                } // end f_GEONW_PON_BAA_BV_05_nodeE
                
            } // end GEONW_PON_BAA_BV_05
                        
            group GEONW_PON_BAA_BV_06 {
                
                /**
                 * @desc    TP Function for TC_GEONW_PON_BAA_BV_06
                 */
                function f_GEONW_PON_BAA_BV_06() 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_getGeoBroadcastForwardingAlgorithm() != e_advanced) {
                        log("*** " & testcasename() & ": PICS_GN_GEOBROADCAST_FORWARDING_ALGORITHM == e_advanced required for executing the TC ***");
                        setverdict(inconc);
                        stop;
                    }
                    
garciay's avatar
garciay committed
//                    if (f_getGeoBroadcastCbfMinTime() < 300) {
//                        log("*** " & testcasename() & ": PICS_GN_GEOBROADCAST_CBF_MIN_TIME >= 300 required for executing the TC ***");
//                        setverdict(inconc);
//                        stop;
//                    }
                    
                    // Test component configuration
                    f_cf05Up();
                    
                    // Preamble
                    
                    // Start components
                    v_nodeB := f_getComponent(c_compNodeB);
                    v_nodeE := f_getComponent(c_compNodeE);
                    v_nodeB.start(f_GEONW_PON_BAA_BV_06_nodeB());
                    v_nodeE.start(f_GEONW_PON_BAA_BV_06_nodeE());
                    
                    // Synchronization
                    f_serverSync2ClientsAndStop({c_prDone, c_tbDone});
                    
                    // Cleanup
                    f_cf05Down();
                    
                } // end f_GEONW_PON_BAA_BV_06
                
                /**
                 * @desc    Behavior function for NodeB (TC_GEONW_PON_BAA_BV_06)
                 */
                function f_GEONW_PON_BAA_BV_06_nodeB() runs on ItsGeoNetworking {
                    
                    // Local variables
                    var LongPosVector v_longPosVectorNodeE := f_getPosition(c_compNodeE);
                    var LongPosVector v_longPosVectorIut := f_getPosition(c_compIut);
                    timer t_toCbf := (int2float(f_getGeoBroadcastCbfMaxTime())
                        + (
                            int2float(f_getGeoBroadcastCbfMinTime() - f_getGeoBroadcastCbfMaxTime())
                            / int2float(f_getCbfMaxCommunicationRange())
                        ) * f_distance(v_longPosVectorNodeE, v_longPosVectorIut)) * 0.95 / 1000.0;
                    
                    // Preamble
                    f_prNeighbour();
                    f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                    
                    // 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_BAA_BV_06_nodeB
                
                /**
                 * @desc    Behavior function for NodeE (TC_GEONW_PON_BAA_BV_06)
                 */
                function f_GEONW_PON_BAA_BV_06_nodeE() runs on ItsGeoNetworking {
                    
                    // Local variables
                    var LongPosVector v_longPosVectorNodeE := f_getPosition(c_compNodeE);
                    var LongPosVector v_longPosVectorIut := f_getPosition(c_compIut);
                    timer t_toCbf := (int2float(f_getGeoBroadcastCbfMaxTime())
                        + (
                            int2float(f_getGeoBroadcastCbfMinTime() - f_getGeoBroadcastCbfMaxTime())
                            / int2float(f_getCbfMaxCommunicationRange())
                        ) * f_distance(v_longPosVectorNodeE, v_longPosVectorIut)) * 0.95 / 1000.0;
                    
                    // Preamble
                    f_prNeighbour();
                    f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                    
                    // Test Body
                    f_sendGeoNetMessage(
                        m_geoNwReq_linkLayerBroadcast(
                            m_geoNwPdu(m_geoNwBroadcastPacket(
                                    v_longPosVectorNodeE,
                                    0,
                                    f_getGeoBroadcastArea(c_area1)
                                )
                            )
                        )
                    );
                    
                    t_toCbf.start;
                    tc_ac.start;
                    alt {                        
                        [] geoNetworkingPort.receive(mw_geoNwInd(mw_geoNwPdu(mw_geoNwBroadcastPacketWithArea(
                                mw_longPosVectorPosition(v_longPosVectorNodeE),
                                ?,
                                f_getGeoBroadcastArea(c_area1)
                            )))) {
                            tc_ac.stop;
                            
                            if(t_toCbf.running) {
                                t_toCbf.stop;
                                log("*** " & testcasename() & ": FAIL: GBC retransmitted before CBF timer expiration ***");
                                f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                            }
                            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_BAA_BV_06_nodeE
                
            } // end GEONW_PON_BAA_BV_06
            
            group GEONW_PON_BAA_BV_07 {
                
                /**
                 * @desc    TP Function for TC_GEONW_PON_BAA_BV_07
                 */
                function f_GEONW_PON_BAA_BV_07() 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_getGeoBroadcastForwardingAlgorithm() != e_advanced) {
                        log("*** " & testcasename() & ": PICS_GN_GEOBROADCAST_FORWARDING_ALGORITHM == e_advanced required for executing the TC ***");
                        setverdict(inconc);
                        stop;
                    }
                    
garciay's avatar
garciay committed
//                    if (f_getGeoBroadcastCbfMinTime() < 300) {
//                        log("*** " & testcasename() & ": PICS_GN_GEOBROADCAST_CBF_MIN_TIME >= 300 required for executing the TC ***");
//                        setverdict(inconc);
//                        stop;
//                    }
                    
                    // Test component configuration
                    f_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_BAA_BV_07_nodeB());
                    v_nodeC.start(f_GEONW_PON_BAA_BV_07_nodeC());
                    v_nodeD.start(f_GEONW_PON_BAA_BV_07_nodeD());
                    
                    // Synchronization
                    f_serverSync3ClientsAndStop({c_prDone, c_tbDone});
                    
                    // Cleanup
                    f_cf04Down();
                    
                } // end f_GEONW_PON_BAA_BV_07
                
                /**
                 * @desc    Behavior function for NodeB (TC_GEONW_PON_BAA_BV_07)
                 */
                function f_GEONW_PON_BAA_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_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: 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_BAA_BV_07_nodeB
                
                /**
                 * @desc    Behavior function for NodeC (TC_GEONW_PON_BAA_BV_07)
                 */
                function f_GEONW_PON_BAA_BV_07_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,
                                    0,
                                    f_getGeoBroadcastArea(c_area2)
                                )
                            )
                        )
                    );
                    f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                    
                    // Postamble
                    f_poNeighbour();
                    
                } // end f_GEONW_PON_BAA_BV_07_nodeC
                
                /**
                 * @desc    Behavior function for NodeD (TC_GEONW_PON_BAA_BV_07)
                 */
                function f_GEONW_PON_BAA_BV_07_nodeD() 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_BAA_BV_07_nodeD
                
            } // end GEONW_PON_BAA_BV_07
            
            group GEONW_PON_BAA_BO_08 {
                
                /**
                 * @desc    TP Function for TC_GEONW_PON_BAA_BO_08
                 */
                function f_GEONW_PON_BAA_BO_08() 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_getGeoBroadcastForwardingAlgorithm() != e_advanced) {
                        log("*** " & testcasename() & ": PICS_GN_GEOBROADCAST_FORWARDING_ALGORITHM == e_advanced required for executing the TC ***");
                        setverdict(inconc);
                        stop;
                    }
                    
garciay's avatar
garciay committed
//                    if (f_getGeoBroadcastCbfMinTime() < 300) {
//                        log("*** " & testcasename() & ": PICS_GN_GEOBROADCAST_CBF_MIN_TIME >= 300 required for executing the TC ***");
//                        setverdict(inconc);
//                        stop;
//                    }
                    
                    // Test component configuration
                    f_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_BAA_BO_08_nodeB());
                    v_nodeC.start(f_GEONW_PON_BAA_BO_08_nodeC());
                    v_nodeD.start(f_GEONW_PON_BAA_BO_08_nodeD());
                    
                    // Synchronization
                    f_serverSync3ClientsAndStop({c_prDone, c_tbDone});
                    
                    // Cleanup
                    f_cf04Down();
                    
                } // end f_GEONW_PON_BAA_BO_08
                
                /**
                 * @desc    Behavior function for NodeB (TC_GEONW_PON_BAA_BO_08)
                 */
                function f_GEONW_PON_BAA_BO_08_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_BAA_BO_08_nodeB
                
                /**
                 * @desc    Behavior function for NodeC (TC_GEONW_PON_BAA_BO_08)
                 */
                function f_GEONW_PON_BAA_BO_08_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: 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_BAA_BO_08_nodeC
                
                /**
                 * @desc    Behavior function for NodeD (TC_GEONW_PON_BAA_BO_08)
                 */
                function f_GEONW_PON_BAA_BO_08_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,
                                    0,
                                    f_getGeoBroadcastArea(c_area2)
                                )
                            )
                        )
                    );
                    f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                    
                    // Postamble
                    f_poNeighbour();
                    
                } // end f_GEONW_PON_BAA_BO_08_nodeD
                
            } // end GEONW_PON_BAA_BO_08
            
            group GEONW_PON_BAA_BV_09 {
                
                /**
                 * @desc    TP Function for TC_GEONW_PON_BAA_BV_09
                 */
                function f_GEONW_PON_BAA_BV_09() 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_getGeoBroadcastForwardingAlgorithm() != e_advanced) {
                        log("*** " & testcasename() & ": PICS_GN_GEOBROADCAST_FORWARDING_ALGORITHM == e_advanced required for executing the TC ***");
                        setverdict(inconc);
                        stop;
                    }
                    
garciay's avatar
garciay committed
//                    if (f_getGeoBroadcastCbfMinTime() < 300) {
//                        log("*** " & testcasename() & ": PICS_GN_GEOBROADCAST_CBF_MIN_TIME >= 300 required for executing the TC ***");
//                        setverdict(inconc);
//                        stop;
//                    }
                    
                    // Test component configuration
                    f_cf05Up();
                    
                    // Preamble
                    
                    // Start components
                    v_nodeB := f_getComponent(c_compNodeB);
                    v_nodeE := f_getComponent(c_compNodeE);
                    v_nodeB.start(f_GEONW_PON_BAA_BV_09_nodeB());
                    v_nodeE.start(f_GEONW_PON_BAA_BV_09_nodeE());
                    
                    // Synchronization
                    f_serverSync2ClientsAndStop({c_prDone, c_tbDone});
                    
                    // Cleanup
                    f_cf05Down();
                    
                } // end f_GEONW_PON_BAA_BV_09
                
                /**
                 * @desc    Behavior function for NodeB (TC_GEONW_PON_BAA_BV_09)
                 */
                function f_GEONW_PON_BAA_BV_09_nodeB() runs on ItsGeoNetworking {
                    
                    // Local variables
                    var LongPosVector v_longPosVectorNodeB := f_getPosition(c_compNodeB);
                    timer t_toCbf := int2float(f_getGeoBroadcastCbfMaxTime()) * 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_BAA_BV_06_nodeB
                
                /**
                 * @desc    Behavior function for NodeE (TC_GEONW_PON_BAA_BV_09)
                 */
                function f_GEONW_PON_BAA_BV_09_nodeE() runs on ItsGeoNetworking {
                    
                    // Local variables
                    var LongPosVector v_longPosVectorNodeB := f_getPosition(c_compNodeB);
                    timer t_toCbf := int2float(f_getGeoBroadcastCbfMaxTime()) * 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_BAA_BV_09_nodeE
                
            } // end GEONW_PON_BAA_BV_09
            
            group GEONW_PON_BAA_BV_10 {
                
                /**
                 * @desc    TP Function for TC_GEONW_PON_BAA_BV_10
                 */
                function f_GEONW_PON_BAA_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_GBC_FWD) {
                        log("*** " & testcasename() & ": PICS_GN_GBC_FWD required for executing the TC ***");
                        setverdict(inconc);
                        stop;
                    }
                    if (f_getGeoBroadcastForwardingAlgorithm() != e_advanced) {
                        log("*** " & testcasename() & ": PICS_GN_GEOBROADCAST_FORWARDING_ALGORITHM == e_advanced required for executing the TC ***");
                        setverdict(inconc);
                        stop;
                    }
                    
garciay's avatar
garciay committed
//                    if (f_getGeoBroadcastCbfMinTime() < 300) {
//                        log("*** " & testcasename() & ": PICS_GN_GEOBROADCAST_CBF_MIN_TIME >= 300 required for executing the TC ***");
//                        setverdict(inconc);
//                        stop;
//                    }
                    
                    // Test component configuration
                    f_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_BAA_BV_10_nodeB());
                    v_nodeC.start(f_GEONW_PON_BAA_BV_10_nodeC());
                    v_nodeD.start(f_GEONW_PON_BAA_BV_10_nodeD());
                    
                    // Synchronization
                    f_serverSync3ClientsAndStop({c_prDone, c_tbDone});
                    
                    // Cleanup
                    f_cf04Down();
                    
                } // end f_GEONW_PON_BAA_BV_10
                
                /**
                 * @desc    Behavior function for NodeB (TC_GEONW_PON_BAA_BV_10)
                 */
                function f_GEONW_PON_BAA_BV_10_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: 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_BAA_BV_10_nodeB
                
                /**
                 * @desc    Behavior function for NodeC (TC_GEONW_PON_BAA_BV_10)
                 */
                function f_GEONW_PON_BAA_BV_10_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,
                                    0,
                                    f_getGeoBroadcastArea(c_area2)
                                )
                            )
                        )
                    );
                    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: 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_BAA_BV_10_nodeC
                
                /**
                 * @desc    Behavior function for NodeD (TC_GEONW_PON_BAA_BV_10)
                 */
                function f_GEONW_PON_BAA_BV_10_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: 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_BAA_BV_10_nodeD
                
            } // end GEONW_PON_BAA_BV_10
            
            group GEONW_PON_BAA_BV_11 {
                
                /**
                 * @desc    TP Function for TC_GEONW_PON_BAA_BV_11
                 */
                function f_GEONW_PON_BAA_BV_11() 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_getGeoBroadcastForwardingAlgorithm() != e_advanced) {
                        log("*** " & testcasename() & ": PICS_GN_GEOBROADCAST_FORWARDING_ALGORITHM == e_advanced required for executing the TC ***");
                        setverdict(inconc);
                        stop;
                    }
                    
garciay's avatar
garciay committed
//                    if (f_getGeoBroadcastCbfMinTime() < 300) {
//                        log("*** " & testcasename() & ": PICS_GN_GEOBROADCAST_CBF_MIN_TIME >= 300 required for executing the TC ***");
//                        setverdict(inconc);
//                        stop;
//                    }
15181 15182 15183 15184 15185 15186 15187 15188 15189 15190 15191 15192 15193 15194 15195 15196 15197 15198 15199 15200 15201 15202 15203 15204 15205 15206 15207 15208 15209 15210 15211 15212 15213 15214 15215 15216 15217 15218 15219 15220 15221 15222 15223 15224 15225 15226 15227 15228 15229 15230 15231 15232 15233 15234 15235 15236 15237 15238 15239 15240 15241 15242 15243 15244 15245 15246 15247 15248 15249 15250 15251 15252 15253 15254 15255 15256 15257 15258 15259 15260 15261 15262 15263 15264 15265 15266 15267 15268 15269 15270 15271 15272 15273 15274 15275 15276 15277 15278 15279 15280 15281 15282 15283 15284 15285 15286 15287 15288 15289 15290 15291 15292 15293 15294 15295 15296 15297 15298 15299 15300 15301 15302 15303 15304 15305 15306 15307 15308 15309 15310 15311 15312 15313 15314 15315 15316 15317 15318 15319 15320 15321 15322 15323 15324 15325 15326 15327 15328 15329 15330 15331 15332 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
                    
                    // 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_BAA_BV_11_nodeB());
                    v_nodeD.start(f_GEONW_PON_BAA_BV_11_nodeD());
                    
                    // Synchronization
                    f_serverSync2ClientsAndStop({c_prDone, c_tbDone});
                    
                    // Cleanup
                    f_cf06Down();
                    
                } // end f_GEONW_PON_BAA_BV_11
                
                /**
                 * @desc    Behavior function for NodeB (TC_GEONW_PON_BAA_BV_11)
                 */
                function f_GEONW_PON_BAA_BV_11_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_BAA_BV_11_nodeB
                
                /**
                 * @desc    Behavior function for NodeD (TC_GEONW_PON_BAA_BV_11)
                 */
                function f_GEONW_PON_BAA_BV_11_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_getGeoBroadcastCbfMaxTime())
                        + (
                            int2float(f_getGeoBroadcastCbfMinTime() - f_getGeoBroadcastCbfMaxTime())
                            / 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_BAA_BV_11_nodeD
                
            } // end GEONW_PON_BAA_BV_11
            
        } // end geoGeoBroadcastCbfAlgorithm
        
    } // 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