ItsGeoNetworking_TestCases.ttcn 913 KB
Newer Older
filatov's avatar
filatov committed
                        log("*** " & testcasename() & ": PASS: LS Request received correctly ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
filatov's avatar
filatov committed
                    }
                    [] a_receiveAnyLsRequest() {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": FAIL: LS Request does not contain GN Address of nodeA ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
filatov's avatar
filatov committed
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: Expected message not received ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
filatov's avatar
filatov committed
                    }
                }
                
                // Postamble
                f_poNeighbour();
                f_cf01Down();
                
            } // end TC_GEONW_PON_LOS_BV_01
            
            /**
             * @desc    Test of no LS invocation for unknown Destination nodes when LS procedure is already active
             * <pre>
             * Pics Selection: none
             * Config Id: CF01
             * Initial conditions:
             *  with {
             *      the IUT being in the "initial state" and
             *      the IUT having no Location Table Entry for ItsNodeA and
             *      the IUT having been requested to send a first GeoUnicast packet to ItsNodeA and
             *      the IUT having sent a GeoNetworking packet
             *          containing a LS_REQUEST
             *              containing Request field
             *                  containing GN_ADDR
             *                      containing M_ID
             *                          indicating ItsNodeA
             *  }
             * Expected behaviour:
             *  ensure that {
             *      when {
             *            the IUT is requested to send a new GeoUnicast packet to ItsNodeA
             *      }
             *      then {
             *          IUT does not send a second LS_REQUEST packet (see note)
             *      }
             *  }
             *  NOTE: at least not before the LS_REQUEST retransmission timer expires
             *  
             * </pre>
             *
             * @see         ETSI TS 102 871-2 v1.3.1 TP/GEONW/PON/LOS/BV/02
filatov's avatar
filatov committed
             * @reference   EN 302 636-4-1 [1], clauses 9.3.8.2, 9.2.4 and 9.3.7.1.2
             */
            testcase TC_GEONW_PON_LOS_BV_02() runs on ItsGeoNetworking system ItsGeoNetworkingSystem {
                
                // Local variables
                var LongPosVector v_longPosVectorIut;
                var GN_Address v_gnAddressNodeA;
                
                // Test control
                
                // 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);
filatov's avatar
filatov committed
                }
                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);
filatov's avatar
filatov committed
                
                // Test Body
                 if ( not  f_utTriggerEvent(m_generateGeoUnicastMessage(v_gnAddressNodeA)) ) {
                    log("*** " & testcasename() & ": INCONC: Trigger failed ***");
                    f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
filatov's avatar
filatov committed
                }
                
                alt {                    
                    [] a_receiveLsRequest(?, v_gnAddressNodeA.mid, v_longPosVectorIut) {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": Second LS_REQUEST received ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
filatov's avatar
filatov committed
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": No second LS_REQUEST received ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
filatov's avatar
filatov committed
                    }
                }
                
                // Postamble
                f_poNeighbour();
                f_cf01Down();
                
            } // end TC_GEONW_PON_LOS_BV_02
            
            /**
             * @desc    Test of packet buffering into LS buffer during Location service procedure,
             *          including handling of LT fields in the LT packet buffer
             * <pre>
             * Pics Selection: none
             * Config Id: CF01
             * Initial conditions:
             *  with {
             *      the IUT being in the "initial state" and
             *      the IUT having no Location Table Entry for ItsNodeA and
             *      the IUT having been requested to send a GeoUnicast packet to ItsNodeA
             *          containing TrafficClass.SCF set to 1 and
             *      the IUT having sent a LS_REQUEST packet
             *  }
             * Expected behaviour:
             *  ensure that {
             *      when {
             *          the IUT receives the LS_REPLY packet from ItsNodeA
             *      }
             *      then {
             *          the IUT sends the GeoUnicast packet addressed to ItsNodeA
             *              containing GeoUnicast Extended Header
             *                  containing LT field
             *                      indicating value (default LT value – WaitingTime (see note))
             *      }
             *  }
             *  NOTE: Waiting Time == time difference between LS_REQUEST sending and LS_REPLY reception.
             *  
             * </pre>
             *
             * @see         ETSI TS 102 871-2 v1.3.1 TP/GEONW/PON/LOS/BV/03
             * @reference   EN 302 636-4-1 [1], clauses 7.4.3, 9.3.7.1.4, 9.3.8.2, 9.2.4 and 9.3.7.1.2
filatov's avatar
filatov committed
             */
            testcase TC_GEONW_PON_LOS_BV_03() runs on ItsGeoNetworking system ItsGeoNetworkingSystem {
                
                // Local variables
                var LongPosVector v_longPosVectorNodeA;
                var LongPosVector v_longPosVectorIut;
                var GeoNetworkingInd v_geoNetInd;
                
                // Test control
                
                // 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);
filatov's avatar
filatov committed
                }
                tc_ac.start;
                alt {
                    [] a_receiveLsRequest(?, v_longPosVectorNodeA.gnAddr.mid, v_longPosVectorIut) {
                        tc_ac.stop;
                    }
                }
                f_selfOrClientSyncAndVerdict(c_prDone, e_success);
filatov's avatar
filatov committed
                
                // 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);
filatov's avatar
filatov committed
                        }
                        else {
                            log("*** " & testcasename() & ": Lifetime was not handled properly ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
filatov's avatar
filatov committed
                        }
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": Expected message not received ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
filatov's avatar
filatov committed
                    }
                    
                }
                
                // Postamble
                f_poNeighbour();
                f_cf01Down();
                
            } // end TC_GEONW_PON_LOS_BV_03
            
            /**
             * @desc    Test of LS buffer characteristics: FIFO type
             * <pre>
             * Pics Selection: none
             * Config Id: CF01
             * Initial conditions:
             *  with {
             *      the IUT being in the "initial state" and
             *      the IUT having no Location Table Entry for ItsNodeA and
             *      the IUT having been requested to send a GeoUnicast packet to ItsNodeA
             *          containing TrafficClass.SCF set to 1 
             *          containing LT field
             *              indicating value LT1
             *          containing payload field
             *              indicating value PL1 and
             *      the IUT having sent a LS_REQUEST packet and
             *      the IUT having been requested to send a second GeoUnicast packet to ItsNodeA
             *          containing TrafficClass.SCF set to 1
             *          containing LT field
             *              indicating LT2
             *          containing payload field
             *              indicating value PL2
             *  }
             * Expected behaviour:
             *  ensure that {
             *      when {
             *          the IUT receives the LS_REPLY packet from ItsNodeA and
             *          before expiry of LT1 and LT2
             *      }
             *      then {
             *          the IUT sends GeoUnicast packet addressed to ItsNodeA
             *              containing payload field
             *                  indicating value PL1 and
             *          the IUT sends GeoUnicast packet addressed to ItsNodeA
             *              containing payload field
             *                  indicating value PL2
             *      }
             *  }
             * </pre>
             *
             * @see         ETSI TS 102 871-2 v1.3.1 TP/GEONW/PON/LOS/BV/04
             * @reference   EN 302 636-4-1 [1], clauses 7.4.3, 9.3.8.2, 9.2.4 and 9.3.7.1.2
filatov's avatar
filatov committed
             */
            testcase TC_GEONW_PON_LOS_BV_04() runs on ItsGeoNetworking system ItsGeoNetworkingSystem {
                
                // 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
                
                // 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);
filatov's avatar
filatov committed
                }
                
                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);
filatov's avatar
filatov committed
                        }
                        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);
filatov's avatar
filatov committed
                            }
                            tc_ac.start;
                            repeat;
                        }
                    }
                    [] tc_ac.timeout{
                        log("*** " & testcasename() & ": Pre-conditions: Expected message not received ***");
                        f_selfOrClientSyncAndVerdict(c_prDone, e_timeout);
filatov's avatar
filatov committed
                    }
                }
                
                // 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);
filatov's avatar
filatov committed
                        }
                        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);
filatov's avatar
filatov committed
                        }
                        else {
                            log("*** " & testcasename() & ": Second Message received ***");
                            repeat;
                        }
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": Expected messages not received ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
filatov's avatar
filatov committed
                    }
                }
                
                // Postamble
                f_poNeighbour();
                f_cf01Down();
                
            } // end TC_GEONW_PON_LOS_BV_04
            
            /**
             * @desc    Test of LS buffer characteristics: discarding upon LT expiration
             * <pre>
             * Pics Selection: none
             * Config Id: CF01
             * Initial conditions:
             *  with {
             *      the IUT being in the "initial state" and
             *      the IUT having no Location Table Entry for ItsNodeA and
             *      the IUT having been requested to send multiple GeoUnicast packets to ItsNodeA
             *          containing TrafficClass.SCF set to 1
             *          containing LT field
             *              indicating values LTx and
             *      the IUT having sent a LS_REQUEST packet
             *  }
             * Expected behaviour:
             *  ensure that {
             *      when {
             *          the IUT receives the LS_REPLY packet from ItsNodeA after expiry of LTs
             *      }
             *      then {
             *          the IUT does not send any packet to ItsNodeA
             *      }
             *  }
             * </pre>
             *
             * @see         ETSI TS 102 871-2 v1.3.1 TP/GEONW/PON/LOS/BV/05
             * @reference   EN 302 636-4-1 [1], clauses 7.4.3, 9.3.8.2, 9.2.4 and 9.3.7.1.2
filatov's avatar
filatov committed
             */
            testcase TC_GEONW_PON_LOS_BV_05() runs on ItsGeoNetworking system ItsGeoNetworkingSystem {
                
                // 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
                
                // 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);
filatov's avatar
filatov committed
                }
                 if ( not f_utTriggerEvent(m_generateGeoUnicastMessageWithPayload(v_longPosVectorNodeA.gnAddr, v_payload2)) ) {
                    log("*** " & testcasename() & ": INCONC: Trigger failed ***");
                    f_selfOrClientSyncAndVerdict(c_prDone, e_timeout);
filatov's avatar
filatov committed
                }
                
                tc_ac.start;
                alt {
                    [] a_receiveLsRequest(?, v_longPosVectorNodeA.gnAddr.mid, v_longPosVectorIut) {
                        tc_ac.stop;
                        f_selfOrClientSyncAndVerdict(c_prDone, e_success);
filatov's avatar
filatov committed
                        //start retransmission timer
                        tc_ac.start(f_getMaxPacketLifeTime() + f_getDeltaTimer());
                    }
                    [] tc_ac.timeout{
                        log("*** " & testcasename() & ": Pre-conditions: Expected message not received ***");
                        f_selfOrClientSyncAndVerdict(c_prDone, e_timeout);
filatov's avatar
filatov committed
                    }
                }
                
                // 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);
filatov's avatar
filatov committed
                    }
                    [] tc_noac.timeout {
                        log("*** " & testcasename() & ": No message received ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
filatov's avatar
filatov committed
                    }
                }
                
                // Postamble
                f_poNeighbour();
                f_cf01Down();
                
            } // end TC_GEONW_PON_LOS_BV_05
            
            /**
             * @desc    Test of LS Request retransmission if no answer is received
             * <pre>
             * Pics Selection: none
             * Config Id: CF01
             * Initial conditions:
             *  with {
             *      the IUT being in the "initial state" and
             *      the IUT having no Location Table Entry for ItsNodeA and
             *      the IUT having been requested to send a GeoUnicast packet to ItsNodeA
             *          containing TrafficClass.SCF set to 1
             *          containing LT field
             *              indicating value LT1 higher than itsGnLocationServiceTimer and
             *      the IUT having sent a LS_REQUEST packet
             *  }
             * Expected behaviour:
             *  ensure that {
             *      when {
             *          the IUT does not receive LS_REPLY packet from ItsNodeA and
             *          before expiration of LT1
             *      }
             *      then {
             *          the IUT retransmits the LS_REQUEST packet
             *              upon expiry of itsGnLocationServiceTimer
             * @see         ETSI TS 102 871-2 v1.3.1 TP/GEONW/PON/LOS/BV/06
filatov's avatar
filatov committed
             * @reference   EN 302 636-4-1 [1], clauses 9.3.7.1.3, 9.3.7.1.2 and 9.3.8.2
             */
            testcase TC_GEONW_PON_LOS_BV_06() runs on ItsGeoNetworking system ItsGeoNetworkingSystem {
                
                // 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
                
                // 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);
filatov's avatar
filatov committed
                }
                    
                tc_ac.start;
                alt {
                    [] a_receiveLsRequest(?, v_longPosVectorNodeA.gnAddr.mid, v_longPosVectorIut) {
                        tc_ac.stop;
                        f_selfOrClientSyncAndVerdict(c_prDone, e_success);
filatov's avatar
filatov committed
                        //start retransmission timer
                        t_minRetrans.start;
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": Pre-conditions: Expected message not received ***");
                        f_selfOrClientSyncAndVerdict(c_prDone, e_timeout);
filatov's avatar
filatov committed
                    }
                }
                
                // 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);
filatov's avatar
filatov committed
                        }
                        else {
                            log("*** " & testcasename() & ": LS_REQUEST retransmitted too early ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
filatov's avatar
filatov committed
                        }
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": No LS_REQUEST retransmitted ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
filatov's avatar
filatov committed
                    }
                }
                
                // Postamble
                f_poNeighbour();
                f_cf01Down();
                
            } // end TC_GEONW_PON_LOS_BV_06
            
            /**
             * @desc    Test of LS Request retransmission if no answer is received
             * <pre>
             * Pics Selection: none
             * Config Id: CF01
             * Initial conditions:
             *  with {
             *      the IUT being in the "initial state" and
             *      the IUT having no Location Table Entry for ItsNodeA and
             *      the IUT having been requested to send a GeoUnicast packet to ItsNodeA
             *          containing TrafficClass.SCF set to 1
             *          containing LT field
             *              indicating value LT1 higher than (itsGnLocationServiceTimer * itsGnLocationServiceMaxRetrans) and
             *      the IUT having sent a LS_REQUEST packet
             *  }
             * Expected behaviour:
             *  ensure that {
             *      when {
             *          the IUT does not receive LS_REPLY packet from ItsNodeA and
             *          before expiration of LT1
             *      }
             *      then {
             *          the IUT retransmits the LS_REQUEST packet itsGnLocationServiceMaxRetrans times
             *      }
             *  }
             * </pre>
             *
             * @see         ETSI TS 102 871-2 v1.3.1 TP/GEONW/PON/LOS/BV/07
filatov's avatar
filatov committed
             * @reference   EN 302 636-4-1 [1], clauses 9.3.7.1.2, 9.3.7.1.3 and 9.3.8.2
             */
            testcase TC_GEONW_PON_LOS_BV_07() runs on ItsGeoNetworking system ItsGeoNetworkingSystem {
                
                // Local variables
                var LongPosVector v_longPosVectorNodeA;
                var LongPosVector v_longPosVectorIut;
                var integer v_maxNbrRetrans := f_getLsMaxRetrans();
                var integer v_nbLsReceived := 0;
                
                // Test control
                
                // 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);
filatov's avatar
filatov committed
                }
                
                tc_ac.start;
                alt {
                    [] a_receiveLsRequest(?, v_longPosVectorNodeA.gnAddr.mid, v_longPosVectorIut) {
                        tc_ac.stop;
                        f_selfOrClientSyncAndVerdict(c_prDone, e_success);
filatov's avatar
filatov committed
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": Pre-conditions: Expected message not received ***");
                        f_selfOrClientSyncAndVerdict(c_prDone, e_timeout);
filatov's avatar
filatov committed
                    }
                }
                
                // 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);
filatov's avatar
filatov committed
                        }
                        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);
filatov's avatar
filatov committed
                        }
                        else {
                            log("*** " & testcasename() & ": LS_REQUEST retransmitted less than itsGnLocationServiceMaxRetrans times ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
filatov's avatar
filatov committed
                        }
                    }
                }
                
                // Postamble
                f_poNeighbour();
                f_cf01Down();
                
            } // end TC_GEONW_PON_LOS_BV_07
            
            /**
             * @desc    Test of LS Reply generation by destination node
             * <pre>
             * Pics Selection: none
             * Config Id: CF01
             * Initial conditions:
             *  with {
             *      the IUT being in the "initial state"
             *  }
             * Expected behaviour:
             *  ensure that {
             *      when {
             *          the IUT receives a LS_REQUEST packet
             *          containing Request field
             *              indicating the IUT's GN_ADDR
             *      }
             *      then {
             *          the IUT replies with a LS_REPLY packet
             *              containing Common Header
             *                  containing NH field
             *                      set to '0' (UNSPECIFIED)
             *                  containing LS_REPLY Extended Header
             *                      containing DEPV field
             *                          indicating same position as the SOPV value of the received LS_REQUEST
             *      }
             *  }
             * </pre>
             *
             * @see         ETSI TS 102 871-2 v1.3.1 TP/GEONW/PON/LOS/BV/08
             * @reference   EN 302 636-4-1 [1], clauses 9.3.7.3 and 9.3.5
filatov's avatar
filatov committed
             */
            testcase TC_GEONW_PON_LOS_BV_08() runs on ItsGeoNetworking system ItsGeoNetworkingSystem {
                
                // 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
                
                // 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);
filatov's avatar
filatov committed
                
                // 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);
filatov's avatar
filatov committed
                }
                else {
                    log("*** " & testcasename() & ": LS_REPLY packet not received correctly ***");
                    f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
filatov's avatar
filatov committed
                }
                
                // Postamble
                f_poNeighbour();
                f_cf01Down();
                
            } // end TC_GEONW_PON_LOS_BV_08
            
            group GEONW_PON_LOS_BV_09 {
                
                /**
                 * @desc    Test of no LS Reply generation for already answered LS Request packets
                 * <pre>
                 * Pics Selection: none
                 * Config Id: CF02
                 * Initial conditions:
                 *  with {
                 *      the IUT being in the "initial state" and
                 *      the IUT having received a LS_REQUEST packet generated by ItsNodeB from ItsNodeB
                 *      the IUT having sent a LS_REPLY packet to ItsNodeB
                 *  }
                 * Expected behaviour:
                 *  ensure that {
                 *      when {
                 *          the IUT receives the same LS_REQUEST packet from ItsNodeD
                 *      }
                 *      then {
                 *          the IUT does not reply with a LS_REPLY packet
                 *      }
                 *  }
                 * </pre>
                 *
                 * @see         ETSI TS 102 871-2 v1.3.1 TP/GEONW/PON/LOS/BV/09
                 * @reference   EN 302 636-4-1 [1], clauses 9.3.7.3 and 9.3.5
filatov's avatar
filatov committed
                 */
                testcase TC_GEONW_PON_LOS_BV_09() runs on ItsMtc system ItsGeoNetworkingSystem {
                    
                    // Local variables
                    var ItsGeoNetworking v_nodeB;
                    var ItsGeoNetworking v_nodeD;
                    
                    // Test control
                    
                    // Test component configuration
                    f_cf02Up();
                    
                    // Preamble
                    
                    // Start components
                    v_nodeB := f_getComponent(c_compNodeB);
                    v_nodeD := f_getComponent(c_compNodeD);
                    v_nodeB.start(f_GEONW_PON_LOS_BV_09_nodeB());
                    v_nodeD.start(f_GEONW_PON_LOS_BV_09_nodeD());
                    
                    // Synchronization
                    f_serverSync2ClientsAndStop({c_prDone, c_tbDone});
                    
                    // Cleanup
                    f_cf02Down();
                    
                } // end TC_GEONW_PON_LOS_BV_09
                
                /**
                 * @desc    Behavior function for NodeB (TC_GEONW_PON_LOS_BV_09)
                 */
                function f_GEONW_PON_LOS_BV_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);
                        f_selfOrClientSyncAndVerdict(c_prDone, e_success);
filatov's avatar
filatov committed
                    }
                    
                    // Test Body
                    tc_noac.start;
                    alt {
                        [] geoNetworkingPort.receive(
                                mw_geoNwInd(
                                    mw_geoNwPdu(
                                        mw_geoNwLsReplyPacket(
                                            mw_longPosVectorPosition_withDelta(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);
filatov's avatar
filatov committed
                        }
                        [] tc_noac.timeout {
                            log("*** " & testcasename() & ": PASS: LS_REQUEST discarded ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
filatov's avatar
filatov committed
                        }
                    }
                    
                    // Postamble
                    f_poNeighbour();
                    
                } // end f_GEONW_PON_LOS_BV_09_nodeB
                
                /**
                 * @desc    Behavior function for NodeD (TC_GEONW_PON_LOS_BV_09)
                 */
                function f_GEONW_PON_LOS_BV_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);
filatov's avatar
filatov committed
                    
                    // 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(
                                            mw_longPosVectorPosition_withDelta(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);
filatov's avatar
filatov committed
                        }
                        [] tc_noac.timeout {
                            log("*** " & testcasename() & ": PASS: LS_REQUEST discarded ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
filatov's avatar
filatov committed
                        }
                    }
                    
                    // Postamble
                    f_poNeighbour();
                    
                } // end f_GEONW_PON_LOS_BV_09_nodeD
                
            } // end GEONW_PON_LOS_BV_09
            
            group GEONW_PON_LOS_BV_10 {
                
                /**
                 * @desc    Test of LS Request forwarding
                 * <pre>
                 * Pics Selection: none
                 * Config Id: CF03
                 * Initial conditions:
                 *  with {
                 *      the IUT being in the "initial state" and
                 *      the IUT having received Beacon information from ItsNodeB and
                 *      the IUT having received Beacon information from ItsNodeC
                 *  }
                 * Expected behaviour:
                 *  ensure that {
                 *      when {
                 *          the IUT receives a LS_REQUEST packet from ItsNodeC
                 *              containing Basic Header
                 *                  containing RHL field
                 *                      indicating value greater than 1
                 *              containing LS_REQUEST Extended Header
                 *                  containing Request field
                 *                      containing GN_ADDR
                 *                          containing M_ID
                 *                              indicating value differing from the M_ID part of the GN_ADDR of the IUT
                 *      }
                 *      then {
                 *          the IUT re-broadcasts the received LS_REQUEST packet
                 *              containing Basic Header
                 *                  containing RHL field
                 *                      indicating value decreased by 1
                 *      }
                 *  }
                 * </pre>
                 *
                 * @see     ETSI TS 102 871-2 v1.3.1 TP/GEONW/PON/LOS/BV/10
filatov's avatar
filatov committed
                 * @reference   EN 302 636-4-1 [1], clauses 9.3.7.2
                 */
                testcase TC_GEONW_PON_LOS_BV_10() runs on ItsMtc system ItsGeoNetworkingSystem {
                    
                    // Local variables
                    var ItsGeoNetworking v_nodeB;
                    var ItsGeoNetworking v_nodeC;
                    
                    // Test control
                    
                    // Test component configuration
                    f_cf03Up();
                    
                    // Preamble
                    
                    // Start components
                    v_nodeB := f_getComponent(c_compNodeB);
                    v_nodeC := f_getComponent(c_compNodeC);
                    v_nodeB.start(f_GEONW_PON_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 TC_GEONW_PON_LOS_BV_10
                
                /**