ItsGeoNetworking_TpFunctions.ttcn 721 KB
Newer Older
				                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),
                        ?) {
                        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(
                    valueof(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 ( valueof( 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)),
                                        ?
                                    )
                                )
                            ),
                            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)),
                                        ?
                                    )
                                )
                            ),
                            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());
                    }
                    [] 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(
                    valueof(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(
                        valueof(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),
                                            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(
                        valueof(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);
                        }
                    }