Skip to content
ItsGeoNetworking_TpFunctions.ttcn 718 KiB
Newer Older
                var LongPosVector v_longPosVectorNodeB;
                
                // Test control
                if (not PICS_GN_GUC_SRC or not PICS_GN_BEACON_DST) {
                    log("*** " & testcasename() & ": PICS_GN_GUC_SRC and PICS_GN_BEACON_DST required for executing the TC ***");
                    setverdict(inconc);
                    stop;
                }
                
                // Test component configuration
                f_cf01Up();
                v_longPosVectorNodeB := f_getPosition(c_compNodeB);
                
                // Test adapter configuration
                
                // Preamble
                f_prNeighbour();
                f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                
                // Test Body
                if ( not f_utTriggerEvent(m_generateGeoUnicastMessage(v_longPosVectorNodeB.gnAddr)) ) {
                    log("*** " & testcasename() & ": INCONC: Trigger failed ***");
                    f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
                }
                
                tc_ac.start;
                alt {
                    [] a_receiveGeoUnicastWithDestination(mw_shortPosVectorPosition(f_longPosVector2ShortPosVector(v_longPosVectorNodeB))) {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": PASS: GUC packet received correctly ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                    }
                    [] a_receiveGeoUnicastWithDestination(?) {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": FAIL: GUC packet has some inconsistence ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                    }
                    [] a_receiveAnyLsRequest() {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": FAIL: Received Location Service Request ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": TIMEOUT: Expected message not received ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
                    }
                }
                    
                // Postamble
                f_poNeighbour();
                f_cf01Down();
                
            } // end f_GEONW_PON_LOT_BV_01
            
            /**
             * @desc    TP Function for TC_GEONW_PON_LOT_BV_02
             */
            function f_GEONW_PON_LOT_BV_02() runs on ItsGeoNetworking {
                
                // Local variables
                var LongPosVector v_longPosVectorNodeA;
                var LongPosVector v_longPosVectorNodeB;
                var LongPosVector v_longPosVectorIut;
                var GN_Address v_gnAddressNodeA;
                var boolean v_lsRequestReceived := false;
                
                // Test control
                if (not PICS_GN_LS_REQ_SRC or not PICS_GN_LS_REP_DST) {
                    log("*** " & testcasename() & ": PICS_GN_LS_REQ_SRC AND PICS_GN_LS_REP_DST required for executing the TC ***");
                    setverdict(inconc);
                    stop;
                }
                
                // Test component configuration
                f_cf01Up();
                v_longPosVectorNodeA := f_getPosition(c_compNodeA);
                v_longPosVectorNodeB := f_getPosition(c_compNodeB);
                v_gnAddressNodeA := v_longPosVectorNodeA.gnAddr;
                
                // Test adapter configuration
                
                // Preamble
                f_prNeighbour();
                
                if ( not  f_utTriggerEvent(m_generateGeoUnicastMessage(v_longPosVectorNodeA.gnAddr)) ) {
                    log("*** " & testcasename() & ": INCONC: Trigger failed ***");
                    f_selfOrClientSyncAndVerdict(c_prDone, e_timeout);
                }
                tc_ac.start;
                alt {
                    [] a_receiveLsRequestAndReply(
                            ?, v_gnAddressNodeA.mid,
                            v_longPosVectorNodeA, v_longPosVectorNodeB
                        ) {
                        v_lsRequestReceived := true;
                        log("*** " & testcasename() & ": Pre-conditions: Received and answered Location Service Request ***");
                        repeat;
                    }
                    [] a_receiveGeoUnicastWithDestination(mw_shortPosVectorPosition(f_longPosVector2ShortPosVector(v_longPosVectorNodeA))) {
                        tc_ac.stop;
                        if(v_lsRequestReceived == true) {
                            log("*** " & testcasename() & ": Pre-conditions: First GUC message received correctly ***");
                        }
                        else {
                            log("*** " & testcasename() & ": Pre-conditions: GUC packet received without LS Request ***");
                            f_selfOrClientSyncAndVerdict(c_prDone, e_error);
                        }
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": Pre-conditions: Initial conditions not satisfied. ***");
                        f_selfOrClientSyncAndVerdict(c_prDone, e_timeout);
                    }
                }
                f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                
                // Test Body
                if ( not  f_utTriggerEvent(m_generateGeoUnicastMessage(v_longPosVectorNodeA.gnAddr)) ) {
                    log("*** " & testcasename() & ": INCONC: Trigger failed ***");
                    f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
                }
                tc_ac.start;
                alt {
                    [] a_receiveLsRequest(?, v_gnAddressNodeA.mid, v_longPosVectorIut) {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": FAIL: Received Location Service Request ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                    }
                    [] a_receiveGeoUnicastWithDestination(mw_shortPosVectorPosition(f_longPosVector2ShortPosVector(v_longPosVectorNodeA))) {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": PASS: Received second GUC packet without LS Request ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                        
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: Expected message not received ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
                    }
                }
                
                // Postamble
                f_poNeighbour();
                f_cf01Down();
                
            } // end f_GEONW_PON_LOT_BV_02
            
            group GEONW_PON_LOT_BV_03 {
                
                /**
                 * @desc    TP Function for TC_GEONW_PON_LOT_BV_03_01
                 */
                function f_GEONW_PON_LOT_BV_03_01() runs on ItsGeoNetworking {
                    
                    // Local variables
                    var LongPosVector v_longPosVectorNode := f_TP_GEONW_PON_LOT_BV_03_pre_1(c_compNodeB);

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

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

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

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

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

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

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

                    // Test control
                    if (not PICS_GN_LS_REP_DST) {
                        log("*** " & testcasename() & ": PICS_GN_LS_REP_DST required for executing the TC ***");
                        setverdict(inconc);
                        stop;
                    }
                                        
                    f_TP_GEONW_PON_LOT_BV_03_pre_2(
                        m_geoNwLsReplyPacket(
                            f_getIutShortPosVector(),
                            vc_localSeqNumber
                        )
                    );
                    
                    f_TP_GEONW_PON_LOT_BV_03_main(v_longPosVectorNode);
                    
                } // end f_GEONW_PON_LOT_BV_03_08
                
                /**
                 * @desc    Function including first preamble part (TC_GEONW_PON_LOT_BV_03)
                 */
                function f_TP_GEONW_PON_LOT_BV_03_pre_1(in charstring p_nodeName) runs on ItsGeoNetworking return LongPosVector {
                    var LongPosVector v_longPosVectorNode;
                    
                    // Test control
                    
                    // Test component configuration
                    f_cf01Up();
                    v_longPosVectorNode := f_getPosition(p_nodeName);
                    
                    // Test adapter configuration
                    
                    // Preamble part I
                    if(p_nodeName == c_compNodeA) {
                        f_prNeighbour();
                    }
                    else {
						f_prNonNeighbour();
                    }
                    return v_longPosVectorNode;
                } // end f_TP_GEONW_PON_LOT_BV_03_pre_1
                
                /**
                 * @desc    Function including second preamble part (TC_GEONW_PON_LOT_BV_03)
                 */
                function f_TP_GEONW_PON_LOT_BV_03_pre_2(in template (value) GnNonSecuredPacket p_packet) runs on ItsGeoNetworking {
                    
                    //preamble part II
                    f_sendGeoNetMessage(
                        m_geoNwReq_linkLayerBroadcast(m_geoNwPdu(p_packet, -, c_hopLimit1))
                    );
                    f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                } // end f_TP_GEONW_PON_LOT_BV_03_pre_2
                
                /**
                 * @desc    Function including test body and postamble part (TC_GEONW_PON_LOT_BV_03)
                 */
                function f_TP_GEONW_PON_LOT_BV_03_main(in template (value) LongPosVector p_longPosVectorNode) runs on ItsGeoNetworking {
                    if ( not  f_utTriggerEvent(m_generateGeoUnicastMessage(valueof(p_longPosVectorNode.gnAddr))) ) {
                        log("*** " & testcasename() & ": INCONC: Trigger failed ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
                    }
                    
                    tc_ac.start;
                    alt {
                        [] a_receiveAnyLsRequest() {
                            tc_ac.stop;
                            log("*** " & testcasename() & ": FAIL: Received Location Service Request ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                        }
                        [] a_receiveGeoUnicastWithDestination(mw_shortPosVectorPosition(f_longPosVector2ShortPosVector(valueof(p_longPosVectorNode)))) {
                            tc_ac.stop;
                            log("*** " & testcasename() & ": PASS: GUC packet received correctly ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                        }
                        [] tc_ac.timeout {
                            log("*** " & testcasename() & ": INCONC: Expected message not received ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
                        }
                    }
                        
                    // Postamble
                    f_poNeighbour();
                    f_cf01Down();
                    
                } // end f_TP_GEONW_PON_LOT_BV_03_main
                
            } //end GEONW_PON_LOT_BV_03
            
            /**
             * @desc    TP Function for TC_GEONW_PON_LOT_BV_04
             */
            function f_GEONW_PON_LOT_BV_04() runs on ItsGeoNetworking {
                
                // Local variables
                var LongPosVector v_longPosVectorNodeB;
                var LongPosVector v_longPosVectorIut;
                
                // Test control
                if (not PICS_GN_LS_REQ_SRC) {
                    log("*** " & testcasename() & ": PICS_GN_LS_REQ_SRC required for executing the TC ***");
                    setverdict(inconc);
                    stop;
                }
                 
                // Test component configuration
                f_cf01Up();
                v_longPosVectorNodeB := f_getPosition(c_compNodeB);
                
                // Preamble
                f_prDefault(); // NodeB will send Beacon only once
                f_sendGeoNetMessage(m_geoNwReq_linkLayerBroadcast(m_geoNwPdu(m_geoNwBeaconPacket(f_getPosition(c_compNodeB)), -, c_hopLimit1)));
                f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                
                // Test Body
                f_sleep(f_getLifetimeLocTableEntry() + PX_T_DELTA);
                if ( not  f_utTriggerEvent(m_generateGeoUnicastMessage(v_longPosVectorNodeB.gnAddr)) ) {
                    log("*** " & testcasename() & ": INCONC: Trigger failed ***");
                    f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
                }
                
                tc_ac.start;
                alt {
                    [] a_receiveLsRequest(?, v_longPosVectorNodeB.gnAddr.mid, v_longPosVectorIut ) {
                        log("*** " & testcasename() & ": PASS: LS Request received correctly ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: LS Request not received ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
                    }
                }
                
                // Postamble
                f_poDefault();
                f_cf01Down();
                
            } // end f_GEONW_PON_LOT_BV_04
            
            group GEONW_PON_LOT_BV_05 {
                
                /**
                 * @desc    TP Function for TC_GEONW_PON_LOT_BV_05_01
                 */
                function f_GEONW_PON_LOT_BV_05_01() runs on ItsGeoNetworking {
                    
                    // Local variables
                    var LongPosVector v_longPosVectorNodeB;
                    var LongPosVector v_obsoleteLongPosVectorNodeB;
                
                    // Test control
                    if (not PICS_GN_GUC_DST) {
                        log("*** " & testcasename() & ": PICS_GN_GUC_DST required for executing the TC ***");
                        setverdict(inconc);
                        stop;
                    }
                     
                    f_TP_GEONW_PON_LOT_BV_05_pre_1(v_longPosVectorNodeB, v_obsoleteLongPosVectorNodeB);
                    
                    f_TP_GEONW_PON_LOT_BV_05_pre_2(
                        m_geoNwUnicastPacket(
                            v_obsoleteLongPosVectorNodeB,
                            f_getIutShortPosVector(),
                            vc_localSeqNumber
                        )
                    );
                    
                    f_TP_GEONW_PON_LOT_BV_05_main(v_longPosVectorNodeB, v_obsoleteLongPosVectorNodeB);
                    
                } // end f_GEONW_PON_LOT_BV_05_01
                
                /**
                 * @desc    TP Function for TC_GEONW_PON_LOT_BV_05_02
                 */
                function f_GEONW_PON_LOT_BV_05_02() runs on ItsGeoNetworking {
                    
                    // Local variables
                    var LongPosVector v_longPosVectorNodeB;
                    var LongPosVector v_obsoleteLongPosVectorNodeB;
                
                    // Test control
                    if (not PICS_GN_GAC_DST) {
                        log("*** " & testcasename() & ": PICS_GN_GAC_DST required for executing the TC ***");
                        setverdict(inconc);
                        stop;
                    }
                    
                    f_TP_GEONW_PON_LOT_BV_05_pre_1(v_longPosVectorNodeB, v_obsoleteLongPosVectorNodeB);
                    
                    f_TP_GEONW_PON_LOT_BV_05_pre_2(
                        m_geoNwAnycastPacket(
                            v_obsoleteLongPosVectorNodeB,
                            vc_localSeqNumber,
                            f_getGeoAnycastArea(c_area1)
                        )
                    );
                    
                    f_TP_GEONW_PON_LOT_BV_05_main(v_longPosVectorNodeB, v_obsoleteLongPosVectorNodeB);
                    
                } // end f_GEONW_PON_LOT_BV_05_02
                
                /**
                 * @desc    TP Function for TC_GEONW_PON_LOT_BV_05_03
                 */
                function f_GEONW_PON_LOT_BV_05_03() runs on ItsGeoNetworking {
                    
                    // Local variables
                    var LongPosVector v_longPosVectorNodeB;
                    var LongPosVector v_obsoleteLongPosVectorNodeB;
                
                    // Test control
                    if (not PICS_GN_GBC_DST) {
                        log("*** " & testcasename() & ": PICS_GN_GBC_DST required for executing the TC ***");
                        setverdict(inconc);
                        stop;
                    }
                    
                    f_TP_GEONW_PON_LOT_BV_05_pre_1(v_longPosVectorNodeB, v_obsoleteLongPosVectorNodeB);
                    
                    f_TP_GEONW_PON_LOT_BV_05_pre_2(
                        m_geoNwBroadcastPacket(
                            v_obsoleteLongPosVectorNodeB,
                            vc_localSeqNumber,
                            f_getGeoBroadcastArea(c_area1)
                        )
                    );
                    
                    f_TP_GEONW_PON_LOT_BV_05_main(v_longPosVectorNodeB, v_obsoleteLongPosVectorNodeB);
                    
                } // end f_GEONW_PON_LOT_BV_05_03
                
                /**
                 * @desc    TP Function for TC_GEONW_PON_LOT_BV_05_04
                 */
                function f_GEONW_PON_LOT_BV_05_04() runs on ItsGeoNetworking {
                    
                    // Local variables
                    var LongPosVector v_longPosVectorNodeB;
                    var LongPosVector v_obsoleteLongPosVectorNodeB;
                
                    // Test control
                    if (not PICS_GN_TSB_DST) {
                        log("*** " & testcasename() & ": PICS_GN_TSB_DST required for executing the TC ***");
                        setverdict(inconc);
                        stop;
                    }
                    
                    f_TP_GEONW_PON_LOT_BV_05_pre_1(v_longPosVectorNodeB, v_obsoleteLongPosVectorNodeB);
                    
                    f_TP_GEONW_PON_LOT_BV_05_pre_2(
                        m_geoNwTsbPacket(
                            vc_localSeqNumber,
                            v_obsoleteLongPosVectorNodeB
                        )
                    );
                    
                    f_TP_GEONW_PON_LOT_BV_05_main(v_longPosVectorNodeB, v_obsoleteLongPosVectorNodeB);
                    
                } // end f_GEONW_PON_LOT_BV_05_04
                
                /**
                 * @desc    TP Function for TC_GEONW_PON_LOT_BV_05_05
                 */
                function f_GEONW_PON_LOT_BV_05_05() runs on ItsGeoNetworking {
                    
                    // Local variables
                    var LongPosVector v_longPosVectorNodeB;
                    var LongPosVector v_obsoleteLongPosVectorNodeB;
                
                    // Test control
                    if (not PICS_GN_SHB_DST) {
                        log("*** " & testcasename() & ": PICS_GN_SHB_DST required for executing the TC ***");
                        setverdict(inconc);
                        stop;
                    }
                    
                    f_TP_GEONW_PON_LOT_BV_05_pre_1(v_longPosVectorNodeB, v_obsoleteLongPosVectorNodeB);
                    
                    f_TP_GEONW_PON_LOT_BV_05_pre_2(
                        m_geoNwShbPacket(
                            v_obsoleteLongPosVectorNodeB
                        )
                    );
                    
                    f_TP_GEONW_PON_LOT_BV_05_main(v_longPosVectorNodeB, v_obsoleteLongPosVectorNodeB);
                    
                } // end f_GEONW_PON_LOT_BV_05_05
                
                /**
                 * @desc    TP Function for TC_GEONW_PON_LOT_BV_05_06
                 */
                function f_GEONW_PON_LOT_BV_05_06() runs on ItsGeoNetworking {
                    
                    // Local variables
                    var LongPosVector v_longPosVectorNodeB;
                    var LongPosVector v_obsoleteLongPosVectorNodeB;
                
                    // Test control
                    if (not PICS_GN_LS_REQ_DST) {
                        log("*** " & testcasename() & ": PICS_GN_LS_REQ_DST required for executing the TC ***");
                        setverdict(inconc);
                        stop;
                    }
                    
                    f_TP_GEONW_PON_LOT_BV_05_pre_1(v_longPosVectorNodeB, v_obsoleteLongPosVectorNodeB);
                    
                    activate(a_receiveAnyLsReply());
                    
                    f_TP_GEONW_PON_LOT_BV_05_pre_2(
                        m_geoNwLsRequestPacket(
                            v_obsoleteLongPosVectorNodeB,
                            vc_localSeqNumber,
                            f_getIutGnLocalAddress()
                        )
                    );
                    
                    f_TP_GEONW_PON_LOT_BV_05_main(v_longPosVectorNodeB, v_obsoleteLongPosVectorNodeB);
                    
                } // end f_GEONW_PON_LOT_BV_05_06
                
                /**
                 * @desc    TP Function for TC_GEONW_PON_LOT_BV_05_07
                 */
                function f_GEONW_PON_LOT_BV_05_07() runs on ItsGeoNetworking {
                    
                    // Local variables
                    var LongPosVector v_longPosVectorNodeB;
                    var LongPosVector v_obsoleteLongPosVectorNodeB;
                
                    // Test control
                    if (not PICS_GN_LS_REQ_DST) {
                        log("*** " & testcasename() & ": PICS_GN_LS_REQ_DST required for executing the TC ***");
                        setverdict(inconc);
                        stop;
                    }
                    
                    f_TP_GEONW_PON_LOT_BV_05_pre_1(v_longPosVectorNodeB, v_obsoleteLongPosVectorNodeB);
                    
                    f_TP_GEONW_PON_LOT_BV_05_pre_2(
                        m_geoNwLsReplyPacket(
                            v_obsoleteLongPosVectorNodeB,
                            f_getIutShortPosVector(),
                            vc_localSeqNumber
                        )
                    );
                    
                    f_TP_GEONW_PON_LOT_BV_05_main(v_longPosVectorNodeB, v_obsoleteLongPosVectorNodeB);
                    
                } // end f_GEONW_PON_LOT_BV_05_07
                
                /**
                 * @desc    Function including first preamble part (TC_GEONW_PON_LOT_BV_05)
                 */
                function f_TP_GEONW_PON_LOT_BV_05_pre_1(out LongPosVector p_longPosVectorNodeB, out LongPosVector p_obsoleteLongPosVectorNodeB) runs on ItsGeoNetworking {
                    
                    // Local variables
                    
                    // Test control
                    
                    // Test component configuration
                    f_cf01Up();
                    p_longPosVectorNodeB := f_getPosition(c_compNodeB);
                    p_obsoleteLongPosVectorNodeB := p_longPosVectorNodeB;
                    p_obsoleteLongPosVectorNodeB.timestamp_ := p_obsoleteLongPosVectorNodeB.timestamp_ - 1000;
                    p_obsoleteLongPosVectorNodeB.latitude := p_obsoleteLongPosVectorNodeB.latitude - 1;
                    
                    // Test adapter configuration
                    
                    // Preamble
                    f_prDefault();
                    
                    // Act as a neighbor and send one beacon
                    f_sendGeoNetMessage(m_geoNwReq_linkLayerBroadcast(m_geoNwPdu(m_geoNwBeaconPacket(f_getPosition(c_compNodeB)), -, c_hopLimit1)));
                } // end f_TP_GEONW_PON_LOT_BV_05_pre_1
                
                /**
                 * @desc    Function including second preamble part (TC_GEONW_PON_LOT_BV_05)
                 */
                function f_TP_GEONW_PON_LOT_BV_05_pre_2(in template (value) GnNonSecuredPacket p_packet) runs on ItsGeoNetworking {
                    
                    //preamble part II
                    f_sendGeoNetMessage(
                        m_geoNwReq_linkLayerBroadcast(m_geoNwPdu(p_packet))
                    );
                    f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                } // end f_TP_GEONW_PON_LOT_BV_05_pre_2
                
                /**
                 * @desc    Function including test body and postamble part (TC_GEONW_PON_LOT_BV_05)
                 */
                function f_TP_GEONW_PON_LOT_BV_05_main(in template (value) LongPosVector p_longPosVectorNodeB, in template (value) LongPosVector p_obsoleteLongPosVectorNodeB) runs on ItsGeoNetworking {
                    
                    // Test Body
                    if ( not  f_utTriggerEvent(m_generateGeoUnicastMessage(valueof(p_longPosVectorNodeB.gnAddr)))) {
                        log("*** " & testcasename() & ": INCONC: Trigger failed ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
                    }
                    
                    tc_ac.start;
                    alt {
                        [] a_receiveAnyLsRequest() {
                            tc_ac.stop;
                            log("*** " & testcasename() & ": FAIL: Received Location Service Request ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                        }
                        [] a_receiveGeoUnicastWithDestination(mw_shortPosVectorPosition(f_longPosVector2ShortPosVector(valueof(p_obsoleteLongPosVectorNodeB)))) {
                            tc_ac.stop;
                            log("*** " & testcasename() & ": FAIL: GN packet received with obsolete Destination Position Vector ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                        }
                        [] a_receiveGeoUnicastWithDestination(mw_shortPosVectorPosition(f_longPosVector2ShortPosVector(valueof(p_longPosVectorNodeB)))) {
                            tc_ac.stop;
                            log("*** " & testcasename() & ": PASS: GN packet packet received correctly ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                        }
                        [] tc_ac.timeout {
                            log("*** " & testcasename() & ": INCONC: Expected message not received ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
                        }
                    }
                    
                    // Postamble
                    f_poDefault();
                    f_cf01Down();
                    
                } // end f_TP_GEONW_PON_LOT_BV_05_main
                
            } // end group GEONW_PON_LOT_BV_05
            
        } // end geoLocationTable
        
        // 6.2.2.2
        group geoLocalPositionVector {
            
            /**
             * @desc    TP Function for TC_GEONW_PON_LPV_BV_01
             */
            function f_GEONW_PON_LPV_BV_01() runs on ItsGeoNetworking {
                
                // Local variables
                var LongPosVector v_longPosVectorIut;
                var template LongPosVector v_previouslongPosVectorIut;
                var GeoNetworkingInd v_geoNwInd;
                
                // Test control
                if (not PICS_GN_BEACON_SRC) {
                    log("*** " & testcasename() & ": PICS_GN_BEACON_SRC required for executing the TC ***");
                    setverdict(inconc);
                    stop;
                }
                
                // Test component configuration
                f_cf01Up();//FIXME ac change position, not used by C2C
                v_longPosVectorIut := f_getPosition(c_compIut);
                v_previouslongPosVectorIut := v_longPosVectorIut;
                v_previouslongPosVectorIut.timestamp_ := ?;
                
                // Test adapter configuration
                
                // Preamble
                f_prNeighbour();
                f_acTriggerEvent(m_startPassBeaconing(m_beaconHeader(v_longPosVectorIut).beaconHeader));
                tc_ac.start;
                alt {
                    [] geoNetworkingPort.receive(mw_geoNwInd(mw_geoNwPdu(
                            mw_geoNwBeaconPacket(
                                mw_longPosVectorAny(v_longPosVectorIut.gnAddr)
                            )
                        ))) -> value v_geoNwInd {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": Pre-conditions: Beacon received ***");
                        v_longPosVectorIut := v_geoNwInd.msgIn.gnPacket.packet.extendedHeader.beaconHeader.srcPosVector;
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": Pre-conditions: Expected message not received ***");
                        f_selfOrClientSyncAndVerdict(c_prDone, e_timeout);
                    }
                }
                f_utChangePosition();
                f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                
                // Test Body
                geoNetworkingPort.clear;
                tc_ac.start;
                alt {
                    [] geoNetworkingPort.receive(mw_geoNwInd(mw_geoNwPdu(
                            mw_geoNwBeaconPacket(
                                mw_longPosVectorAny(v_longPosVectorIut.gnAddr)
                            )
                        ))) -> value v_geoNwInd {
                        tc_ac.stop;
                        //check if the position vector has changed
                        if (match(v_geoNwInd.msgIn.gnPacket.packet.extendedHeader.beaconHeader.srcPosVector, v_previouslongPosVectorIut)) {
                            log("*** " & testcasename() & ": FAIL: Sender Postion Vector not correctly updated ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                        }
                        else {
                            log("*** " & testcasename() & ": PASS: Sender Postion Vector correctly updated ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                        }
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: Expected message not received ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
                    }
                }
                f_acTriggerEvent(m_stopPassBeaconing);
                
                // Postamble
                f_poNeighbour();
                f_cf01Down();
                
            } // end f_GEONW_PON_LPV_BV_01
            
        } // end geoLocalPositionVector
        
        // 6.2.2.3
        group geoSequenceNumber {
            
            /**
             * @desc    TP Function for TC_GEONW_PON_SQN_BV_01
             */
            function f_GEONW_PON_SQN_BV_01() runs on ItsGeoNetworking {
                
                // Local variables
                var UInt16 v_expectedSequenceNumber := 0;
                var LongPosVector v_longPosVectorIut;
                
                // Test control
                if (not PICS_GN_GBC_SRC) {
                    log("*** " & testcasename() & ": PICS_GN_GBC_SRC required for executing the TC ***");
                    setverdict(inconc);
                    stop;
                }
                
                // Test component configuration
                f_cf01Up();
                v_longPosVectorIut := f_getPosition(c_compIut);
                
                // Test adapter configuration
                
                // Preamble
                f_prNeighbour();
                f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                
                // Test Body
                if ( not  f_utTriggerEvent(m_generateGeoBroadcastMessage(f_getArea(c_area1))) ) {
                    log("*** " & testcasename() & ": INCONC: Trigger failed ***");
                    f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
                }
                
                tc_ac.start;
                alt {
                    [] a_receiveGeoBroadcast(
garciay's avatar
garciay committed
                        mw_longPosVectorPosition(v_longPosVectorIut),
                        v_expectedSequenceNumber) {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": PASS: GBC packet received correctly ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                    }
                    [] a_receiveGeoBroadcast(
garciay's avatar
garciay committed
                    mw_longPosVectorPosition(v_longPosVectorIut),
                    v_expectedSequenceNumber) {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": FAIL: GBC packet received with incorrect sequence number ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": INCONC: Expected message not received ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
                    }
                }
                
                // Postamble
                f_poNeighbour();
                f_cf01Down();
                
            } // end f_GEONW_PON_SQN_BV_01
            
            /**
             * @desc    TP Function for TC_GEONW_PON_SQN_BV_02
             */
            function f_GEONW_PON_SQN_BV_02() runs on ItsGeoNetworking {
                
                // Local variables
                var UInt16 v_expectedSequenceNumber := 0;
                var integer v_nbReceivedPackets := 0;
                var GeoNetworkingInd v_geoNwInd;
                var LongPosVector v_longPosVectorIut;
                
                // Test control
                if (not PICS_GN_GBC_SRC) {
                    log("*** " & testcasename() & ": PICS_GN_GBC_SRC required for executing the TC ***");
                    setverdict(inconc);
                    stop;
                }
                
                // Test component configuration
                f_cf01Up();
                v_longPosVectorIut := f_getPosition(c_compIut);
                
                // Test adapter configuration
                
                // Preamble
                f_prNeighbour();
                f_sleep(10.0);
                // receive first packet
                if ( not  f_utTriggerEvent(m_generateGeoBroadcastMessage(f_getArea(c_area1))) ) {
                    log("*** " & testcasename() & ": INCONC: Trigger failed ***");
                    f_selfOrClientSyncAndVerdict(c_prDone, e_timeout);
                }
                tc_ac.start;
                alt {
                    
                    [] geoNetworkingPort.receive(mw_geoNwInd(mw_geoNwPdu(mw_geoNwBroadcastPacket(
garciay's avatar
garciay committed
                        mw_longPosVectorPosition(v_longPosVectorIut),
                        ?
                    )))) -> value v_geoNwInd {
                        tc_ac.stop;
                        log("*** " & testcasename() & ": Pre-conditions: First GUC packet received  ***");
                        v_expectedSequenceNumber := v_geoNwInd.msgIn.gnPacket.packet.extendedHeader.geoBroadcastHeader.seqNumber + 1;
                    }
                    [] tc_ac.timeout {
                        log("*** " & testcasename() & ": Pre-conditions: Expected message not received ***");
                        f_selfOrClientSyncAndVerdict(c_prDone, e_timeout);
                    }
                }
                f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                
                // Test Body
                if ( not  f_utTriggerEvent(m_generateGeoBroadcastMessage(f_getArea(c_area1))) ) {
                    log("*** " & testcasename() & ": INCONC: Trigger failed ***");
                    f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
                }
                tc_ac.start;
                alt {
                    [] a_receiveGeoBroadcast(
garciay's avatar
garciay committed
                        mw_longPosVectorPosition(v_longPosVectorIut),
                        v_expectedSequenceNumber) {
                        tc_ac.stop;
                        v_nbReceivedPackets := v_nbReceivedPackets + 1;
                        if(v_nbReceivedPackets >= vc_multipleMessagesCount) {
                            log("*** " & testcasename() & ": PASS: GBC packets received with correct sequence numbers ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                        }
                        else {
                            v_expectedSequenceNumber := v_expectedSequenceNumber + 1;
				            if ( not  f_utTriggerEvent(m_generateGeoBroadcastMessage(f_getArea(c_area1))) ) {
				                log("*** " & testcasename() & ": INCONC: Trigger failed ***");
				                f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
				            }
                            tc_ac.start;
                            repeat;