Skip to content
ItsGeoNetworking_TpFunctions.ttcn 718 KiB
Newer Older
            group GEONW_PON_BCA_BV_05 {
                
                /**
                 * @desc    TP Function for TC_GEONW_PON_BCA_BV_05
                 */
                function f_GEONW_PON_BCA_BV_05() runs on ItsMtc {
                    
                    // Local variables
                    var ItsGeoNetworking v_nodeB;
                    var ItsGeoNetworking v_nodeC;
                    var ItsGeoNetworking v_nodeD;
                    
                    // Test control
                    if (not PICS_GN_GBC_FWD) {
                        log("*** " & testcasename() & ": PICS_GN_GBC_FWD required for executing the TC ***");
                        setverdict(inconc);
                        stop;
                    }
                    if (f_getGeoBroadcastForwardingAlgorithm() != e_cbf) {
                        log("*** " & testcasename() & ": PICS_GN_GEOBROADCAST_FORWARDING_ALGORITHM == e_cbf required for executing the TC ***");
                        setverdict(inconc);
                        stop;
                    }
                    
garciay's avatar
garciay committed
//                    if (f_getGeoBroadcastCbfMinTime() < 300) {
//                        log("*** " & testcasename() & ": PICS_GN_GEOBROADCAST_CBF_MIN_TIME >= 300 required for executing the TC ***");
//                        setverdict(inconc);
//                        stop;
//                    }
                    
                    // Test component configuration
                    f_cf04Up();
                    
                    // Preamble
                    
                    // Start components
                    v_nodeB := f_getComponent(c_compNodeB);
                    v_nodeC := f_getComponent(c_compNodeC);
                    v_nodeD := f_getComponent(c_compNodeD);
                    v_nodeB.start(f_GEONW_PON_BCA_BV_05_nodeB());
                    v_nodeC.start(f_GEONW_PON_BCA_BV_05_nodeC());
                    v_nodeD.start(f_GEONW_PON_BCA_BV_05_nodeD());
                    
                    // Synchronization
                    f_serverSync3ClientsAndStop({c_prDone, c_tbDone});
                    
                    // Cleanup
                    f_cf04Down();
                    
                } // end f_GEONW_PON_BCA_BV_05
                
                /**
                 * @desc    Behavior function for NodeB (TC_GEONW_PON_BCA_BV_05)
                 */
                function f_GEONW_PON_BCA_BV_05_nodeB() runs on ItsGeoNetworking {
                    
                    // Local variables
                    var LongPosVector v_longPosVectorNodeC := f_getPosition(c_compNodeC);
                    
                    // Preamble
                    f_prNeighbour();
                    f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                    
                    // Test Body                    
                    tc_ac.start;
                    alt {
                        [] geoNetworkingPort.receive(mw_geoNwInd(mw_geoNwPdu(mw_geoNwBroadcastPacketWithArea(
                                mw_longPosVectorPosition(v_longPosVectorNodeC),
                                ?,
                                f_getGeoBroadcastArea(c_area1)
                            )))) {
                            tc_ac.stop;
                            log("*** " & testcasename() & ": PASS: GBC message broadcasted ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                        }
                        [] tc_ac.timeout {
                            log("*** " & testcasename() & ": FAIL: GBC message not broadcasted ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                        }
                    }
                    
                    // Postamble
                    f_poNeighbour();
                    
                } // end f_GEONW_PON_BCA_BV_05_nodeB
                
                /**
                 * @desc    Behavior function for NodeC (TC_GEONW_PON_BCA_BV_05)
                 */
                function f_GEONW_PON_BCA_BV_05_nodeC() runs on ItsGeoNetworking {
                    
                    // Local variables
                    var LongPosVector v_longPosVectorNodeC := f_getPosition(c_compNodeC);
                    
                    // Preamble
                    f_prNeighbour();
                    f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                    
                    // Test Body
                    tc_ac.start;
                    alt {
                        [] geoNetworkingPort.receive(mw_geoNwInd(mw_geoNwPdu(mw_geoNwBroadcastPacketWithArea(
                                mw_longPosVectorPosition(v_longPosVectorNodeC),
                                ?,
                                f_getGeoBroadcastArea(c_area1)
                            )))) {
                            tc_ac.stop;
                            log("*** " & testcasename() & ": PASS: GBC message broadcasted ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                        }
                        [] tc_ac.timeout {
                            log("*** " & testcasename() & ": FAIL: GBC message not broadcasted ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                        }
                    }
                    
                    // Postamble
                    f_poNeighbour();
                    
                } // end f_GEONW_PON_BCA_BV_05_nodeC
                
                /**
                 * @desc    Behavior function for NodeD (TC_GEONW_PON_BCA_BV_05)
                 */
                function f_GEONW_PON_BCA_BV_05_nodeD() runs on ItsGeoNetworking {
                    
                    // Local variables
                    var LongPosVector v_longPosVectorNodeC := f_getPosition(c_compNodeC);
                    timer t_toCbf := int2float(f_getGeoBroadcastCbfMaxTime()) * 0.95 / 1000.0;
                    
                    // Preamble
                    f_prNonNeighbour();
                    f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                    
                    // Test Body
                    f_sendGeoNetMessage(
                        m_geoNwReq_linkLayerBroadcast(
                            m_geoNwPdu(
                                m_geoNwBroadcastPacket(
                                    v_longPosVectorNodeC,
                                    vc_localSeqNumber,
                                    f_getGeoBroadcastArea(c_area1)
                                )
                            )
                        )
                    );
                    
                    t_toCbf.start;                    
                    tc_ac.start;
                    alt {
                        [] geoNetworkingPort.receive(mw_geoNwInd(mw_geoNwPdu(mw_geoNwBroadcastPacketWithArea(
                                mw_longPosVectorPosition(v_longPosVectorNodeC),
                                ?,
                                f_getGeoBroadcastArea(c_area1)
                            )))) {
                            tc_ac.stop;                           
                            
                            if(t_toCbf.running) {                               
                                t_toCbf.stop;
                                log("*** " & testcasename() & ": FAIL: GBC retransmitted before CBF timer expiration ***");
                                f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                            }
                            else {
                                log("*** " & testcasename() & ": PASS: GBC message received ***");
                                f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                            }
                        }
                        [] t_toCbf.timeout {
                            log("*** " & testcasename() & ": INFO: CBF timer elapsed ***");
                            repeat;
                        }
                        [] tc_ac.timeout {
                            log("*** " & testcasename() & ": FAIL: GBC message not received ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                        }
                    }
                    
                    // Postamble
                    f_poDefault();
                    
                } // end f_GEONW_PON_BCA_BV_05_nodeD
                
            } // end GEONW_PON_BCA_BV_05
            
            group GEONW_PON_BCA_BV_06 {
                
                /**
                 * @desc    TP Function for TC_GEONW_PON_BCA_BV_06
                 */
                function f_GEONW_PON_BCA_BV_06() runs on ItsMtc {
                    
                    // Local variables
                    var ItsGeoNetworking v_nodeB;
                    var ItsGeoNetworking v_nodeC;
                    var ItsGeoNetworking v_nodeD;
                    
                    // Test control
                    if (not PICS_GN_GBC_FWD) {
                        log("*** " & testcasename() & ": PICS_GN_GBC_FWD required for executing the TC ***");
                        setverdict(inconc);
                        stop;
                    }
                    if (f_getGeoBroadcastForwardingAlgorithm() != e_cbf) {
                        log("*** " & testcasename() & ": PICS_GN_GEOBROADCAST_FORWARDING_ALGORITHM == e_cbf required for executing the TC ***");
                        setverdict(inconc);
                        stop;
                    }
                    
garciay's avatar
garciay committed
//                    if (f_getGeoBroadcastCbfMinTime() < 300) {
//                        log("*** " & testcasename() & ": PICS_GN_GEOBROADCAST_CBF_MIN_TIME >= 300 required for executing the TC ***");
//                        setverdict(inconc);
//                        stop;
//                    }
                    
                    // Test component configuration
                    f_cf04Up();
                    
                    // Preamble
                    
                    // Start components
                    v_nodeB := f_getComponent(c_compNodeB);
                    v_nodeC := f_getComponent(c_compNodeC);
                    v_nodeD := f_getComponent(c_compNodeD);
                    v_nodeB.start(f_GEONW_PON_BCA_BV_06_nodeB());
                    v_nodeC.start(f_GEONW_PON_BCA_BV_06_nodeC());
                    v_nodeD.start(f_GEONW_PON_BCA_BV_06_nodeD());
                    
                    // Synchronization
                    f_serverSync3ClientsAndStop({c_prDone, c_tbDone});
                    
                    // Cleanup
                    f_cf04Down();
                    
                } // end f_GEONW_PON_BCA_BV_06
                
                /**
                 * @desc    Behavior function for NodeB (TC_GEONW_PON_BCA_BV_06)
                 */
                function f_GEONW_PON_BCA_BV_06_nodeB() runs on ItsGeoNetworking {
                    
                    // Local variables
                    var LongPosVector v_longPosVectorNodeC := f_getPosition(c_compNodeC);
                    
                    // Preamble
                    f_prNeighbour();
                    f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                    
                    // Test Body                    
                    tc_ac.start;
                    alt {
                        [] geoNetworkingPort.receive(mw_geoNwInd(mw_geoNwPdu(mw_geoNwBroadcastPacketWithArea(
                                mw_longPosVectorPosition(v_longPosVectorNodeC),
                                ?,
                                f_getGeoBroadcastArea(c_area2)
                            )))) {
                            tc_ac.stop;
                            log("*** " & testcasename() & ": PASS: GBC broadcasted ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                        }
                        [] tc_ac.timeout {
                            log("*** " & testcasename() & ": FAIL: GBC not broadcasted ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                        }
                    }
                    
                    // Postamble
                    f_poNeighbour();
                    
                } // end f_GEONW_PON_BCA_BV_06_nodeB
                
                /**
                 * @desc    Behavior function for NodeC (TC_GEONW_PON_BCA_BV_06)
                 */
                function f_GEONW_PON_BCA_BV_06_nodeC() runs on ItsGeoNetworking {
                    
                    // Local variables
                    
                    // Preamble
                    f_prNeighbour();
                    f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                    
                    // Test Body                    
                    tc_ac.start;
                    alt {
                        [] geoNetworkingPort.receive(mw_geoNwInd(mw_geoNwPdu(?))) {
                            tc_ac.stop;
                            log("*** " & testcasename() & ": PASS: GBC message re-broadcasted ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                        }
                        [] tc_ac.timeout {
                            log("*** " & testcasename() & ": FAIL: GBC message not re-broadcasted ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                        }
                    }
                    
                    // Postamble
                    f_poNeighbour();
                    
                } // end f_GEONW_PON_BCA_BV_06_nodeC
                
                /**
                 * @desc    Behavior function for NodeD (TC_GEONW_PON_BCA_BV_06)
                 */
                function f_GEONW_PON_BCA_BV_06_nodeD() runs on ItsGeoNetworking {
                    
                    // Local variables
                    var LongPosVector v_longPosVectorNodeC := f_getPosition(c_compNodeC);
                    
                    // Preamble
                    f_prNonNeighbour();
                    f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                    
                    // Test Body
                    f_sendGeoNetMessage(
                        m_geoNwReq_linkLayerBroadcast(
                            m_geoNwPdu(
                                m_geoNwBroadcastPacket(
                                    v_longPosVectorNodeC,
                                    vc_localSeqNumber,
                                    f_getGeoBroadcastArea(c_area2)
                                )
                            )
                        )
                    );
                    
                    tc_ac.start;
                    alt {
                        [] geoNetworkingPort.receive(mw_geoNwInd(mw_geoNwPdu(?))) {
                            tc_ac.stop;
                            log("*** " & testcasename() & ": PASS: GBC message re-broadcasted ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                        }
                        [] tc_ac.timeout {
                            log("*** " & testcasename() & ": FAIL: GBC message not re-broadcasted ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                        }
                    }
                    
                    // Postamble
                    f_poDefault();
                    
                } // end f_GEONW_PON_BCA_BV_06_nodeD
                
            } // end GEONW_PON_BCA_BV_06
            
            group GEONW_PON_BCA_BV_07 {
                
                /**
                 * @desc    TP Function for TC_GEONW_PON_BCA_BV_07
                 */
                function f_GEONW_PON_BCA_BV_07() runs on ItsMtc {
                    
                    // Local variables
                    var ItsGeoNetworking v_nodeB;
                    var ItsGeoNetworking v_nodeC;
                    var ItsGeoNetworking v_nodeD;
                    
                    // Test control
                    if (not PICS_GN_GBC_FWD) {
                        log("*** " & testcasename() & ": PICS_GN_GBC_FWD required for executing the TC ***");
                        setverdict(inconc);
                        stop;
                    }
                    if (f_getGeoBroadcastForwardingAlgorithm() != e_cbf) {
                        log("*** " & testcasename() & ": PICS_GN_GEOBROADCAST_FORWARDING_ALGORITHM == e_cbf required for executing the TC ***");
                        setverdict(inconc);
                        stop;
                    }
                    
garciay's avatar
garciay committed
//                    if (f_getGeoBroadcastCbfMinTime() < 300) {
//                        log("*** " & testcasename() & ": PICS_GN_GEOBROADCAST_CBF_MIN_TIME >= 300 required for executing the TC ***");
//                        setverdict(inconc);
//                        stop;
//                    }
                    
                    // Test component configuration
                    f_cf04Up();
                    
                    // Preamble
                    
                    // Start components
                    v_nodeB := f_getComponent(c_compNodeB);
                    v_nodeC := f_getComponent(c_compNodeC);
                    v_nodeD := f_getComponent(c_compNodeD);
                    v_nodeB.start(f_GEONW_PON_BCA_BV_07_nodeB());
                    v_nodeC.start(f_GEONW_PON_BCA_BV_07_nodeC());
                    v_nodeD.start(f_GEONW_PON_BCA_BV_07_nodeD());
                    
                    // Synchronization
                    f_serverSync3ClientsAndStop({c_prDone, c_tbDone});
                    
                    // Cleanup
                    f_cf04Down();
                    
                } // end f_GEONW_PON_BCA_BV_07
                
                /**
                 * @desc    Behavior function for NodeB (TC_GEONW_PON_BCA_BV_07)
                 */
                function f_GEONW_PON_BCA_BV_07_nodeB() runs on ItsGeoNetworking {
                    
                    // Local variables
                    var LongPosVector v_longPosVectorNodeA := f_getPosition(c_compNodeA);
                    
                    // Preamble
                    f_prNeighbour();
                    f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                    
                    // Test Body                    
                    tc_ac.start;
                    alt {
                        [] geoNetworkingPort.receive(mw_geoNwInd(mw_geoNwPdu(mw_geoNwBroadcastPacketWithArea(
                                mw_longPosVectorPosition(v_longPosVectorNodeA),
                                ?,
                                f_getGeoBroadcastArea(c_area2)
                            )))) {
                            tc_ac.stop;
                            log("*** " & testcasename() & ": PASS: GBC broadcasted ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                        }
                        [] tc_ac.timeout {
                            log("*** " & testcasename() & ": FAIL: GBC not broadcasted ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                        }
                    }
                    
                    // Postamble
                    f_poNeighbour();
                    
                } // end f_GEONW_PON_BCA_BV_07_nodeB
                
                /**
                 * @desc    Behavior function for NodeC (TC_GEONW_PON_BCA_BV_07)
                 */
                function f_GEONW_PON_BCA_BV_07_nodeC() runs on ItsGeoNetworking {
                    
                    // Local variables
                    var LongPosVector v_longPosVectorNodeC := f_getPosition(c_compNodeC);
                    var LongPosVector v_longPosVectorNodeA := f_getPosition(c_compNodeA);
                    
                    // Preamble
                    v_longPosVectorNodeC.pai := int2bit(0,1);
                    f_changePositon(c_compNodeC, v_longPosVectorNodeC); 
                    f_prNeighbour();
                    f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                    
                    // Test Body 
                    f_sendGeoNetMessage(
                        m_geoNwReq_linkLayerBroadcast(
                            m_geoNwPdu(
                                m_geoNwBroadcastPacket(
                                    v_longPosVectorNodeA,
                                    vc_localSeqNumber,
                                    f_getGeoBroadcastArea(c_area2)
                                )
                            )
                        )
                    );                   
                    
                    tc_ac.start;
                    alt {
                        [] geoNetworkingPort.receive(mw_geoNwInd(mw_geoNwPdu(mw_geoNwBroadcastPacketWithArea(
                                mw_longPosVectorPosition(v_longPosVectorNodeA),
                                ?,
                                f_getGeoBroadcastArea(c_area2)
                            )))) {
                            tc_ac.stop;
                            log("*** " & testcasename() & ": PASS: GBC broadcasted ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                        }
                        [] tc_ac.timeout {
                            log("*** " & testcasename() & ": FAIL: GBC not broadcasted ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                        }
                    }
                    
                    // Postamble
                    f_poNeighbour();
                    
                } // end f_GEONW_PON_BCA_BV_07_nodeC
                
                /**
                 * @desc    Behavior function for NodeD (TC_GEONW_PON_BCA_BV_07)
                 */
                function f_GEONW_PON_BCA_BV_07_nodeD() runs on ItsGeoNetworking {
                    
                    // Local variables
                    var LongPosVector v_longPosVectorNodeA := f_getPosition(c_compNodeA);
                    
                    // Preamble
                    f_prNeighbour();
                    f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                    
                    // Test Body
                    tc_ac.start;
                    alt {
                        [] geoNetworkingPort.receive(mw_geoNwInd(mw_geoNwPdu(mw_geoNwBroadcastPacketWithArea(
                                mw_longPosVectorPosition(v_longPosVectorNodeA),
                                ?,
                                f_getGeoBroadcastArea(c_area2)
                            )))) {
                            tc_ac.stop;
                            log("*** " & testcasename() & ": PASS: GBC broadcasted ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                        }
                        [] tc_ac.timeout {
                            log("*** " & testcasename() & ": FAIL: GBC not broadcasted ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                        }
                    }
                    
                    // Postamble
                    f_poNeighbour();
                    
                } // end f_GEONW_PON_BCA_BV_07_nodeD
                
            } // end GEONW_PON_BCA_BV_07

            group GEONW_PON_BCA_BV_08 {
                
                /**
                 * @desc    TP Function for TC_GEONW_PON_BCA_BV_08
                 */
                function f_GEONW_PON_BCA_BV_08() runs on ItsMtc {
                    
                    // Local variables
                    var ItsGeoNetworking v_nodeB;
                    var ItsGeoNetworking v_nodeC;
                    var ItsGeoNetworking v_nodeD;
                    
                    // Test control
                    if (not PICS_GN_GBC_FWD) {
                        log("*** " & testcasename() & ": PICS_GN_GBC_FWD required for executing the TC ***");
                        setverdict(inconc);
                        stop;
                    }
                    if (f_getGeoBroadcastForwardingAlgorithm() != e_cbf) {
                        log("*** " & testcasename() & ": PICS_GN_GEOBROADCAST_FORWARDING_ALGORITHM == e_cbf required for executing the TC ***");
                        setverdict(inconc);
                        stop;
                    }
                    
garciay's avatar
garciay committed
//                    if (f_getGeoBroadcastCbfMinTime() < 300) {
//                        log("*** " & testcasename() & ": PICS_GN_GEOBROADCAST_CBF_MIN_TIME >= 300 required for executing the TC ***");
//                        setverdict(inconc);
//                        stop;
//                    }
                    
                    // Test component configuration
                    f_cf04Up();
                    
                    // Preamble
                    
                    // Start components
                    v_nodeB := f_getComponent(c_compNodeB);
                    v_nodeC := f_getComponent(c_compNodeC);
                    v_nodeD := f_getComponent(c_compNodeD);
                    v_nodeB.start(f_GEONW_PON_BCA_BV_08_nodeB());
                    v_nodeC.start(f_GEONW_PON_BCA_BV_08_nodeC());
                    v_nodeD.start(f_GEONW_PON_BCA_BV_08_nodeD());
                    
                    // Synchronization
                    f_serverSync3ClientsAndStop({c_prDone, c_tbDone});
                    
                    // Cleanup
                    f_cf04Down();
                    
                } // end f_GEONW_PON_BCA_BV_08
                
                /**
                 * @desc    Behavior function for NodeB (TC_GEONW_PON_BCA_BV_08)
                 */
                function f_GEONW_PON_BCA_BV_08_nodeB() runs on ItsGeoNetworking {
                    
                    // Local variables
                    var LongPosVector v_longPosVectorNodeC := f_getPosition(c_compNodeC);
                    
                    // Preamble
                    f_prNeighbour();
                    f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                    
                    // Test Body                    
                    tc_ac.start;
                    alt {
                        [] geoNetworkingPort.receive(mw_geoNwInd(mw_geoNwPdu(mw_geoNwBroadcastPacketWithArea(
                                mw_longPosVectorPosition(v_longPosVectorNodeC),
                                ?,
                                f_getGeoBroadcastArea(c_area1)
                            )))) {
                            tc_ac.stop;
                            log("*** " & testcasename() & ": PASS: GBC message broadcasted ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                        }
                        [] tc_ac.timeout {
                            log("*** " & testcasename() & ": FAIL: GBC message not broadcasted ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                        }
                    }
                    
                    // Postamble
                    f_poNeighbour();
                    
                } // end f_GEONW_PON_BCA_BV_08_nodeB
                
                /**
                 * @desc    Behavior function for NodeC (TC_GEONW_PON_BCA_BV_08)
                 */
                function f_GEONW_PON_BCA_BV_08_nodeC() runs on ItsGeoNetworking {
                    
                    // Local variables
                    var LongPosVector v_longPosVectorNodeC := f_getPosition(c_compNodeC);
                    
                    // Preamble
                    f_prNeighbour();
                    f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                    
                    // Test Body
                    tc_ac.start;
                    alt {
                        [] geoNetworkingPort.receive(mw_geoNwInd(mw_geoNwPdu(mw_geoNwBroadcastPacketWithArea(
                                mw_longPosVectorPosition(v_longPosVectorNodeC),
                                ?,
                                f_getGeoBroadcastArea(c_area1)
                            )))) {
                            tc_ac.stop;
                            log("*** " & testcasename() & ": PASS: GBC message broadcasted ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                        }
                        [] tc_ac.timeout {
                            log("*** " & testcasename() & ": FAIL: GBC message not broadcasted ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                        }
                    }
                    
                    // Postamble
                    f_poNeighbour();
                    
                } // end f_GEONW_PON_BCA_BV_08_nodeC
                
                /**
                 * @desc    Behavior function for NodeD (TC_GEONW_PON_BCA_BV_08)
                 */
                function f_GEONW_PON_BCA_BV_08_nodeD() runs on ItsGeoNetworking {
                    
                    // Local variables
                    var LongPosVector v_longPosVectorNodeC := f_getPosition(c_compNodeC);
                    var LongPosVector v_longPosVectorNodeD := f_getPosition(c_compNodeD);
                    timer t_toCbf := int2float(f_getGeoBroadcastCbfMaxTime()) * 0.95 / 1000.0;
                    
                    // Preamble                    
                    v_longPosVectorNodeD.pai := int2bit(0,1);
                    f_changePositon(c_compNodeD, v_longPosVectorNodeD); 
                    f_prNeighbour();
                    f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                    
                    // Test Body
                    f_sendGeoNetMessage(
                        m_geoNwReq_linkLayerBroadcast(
                            m_geoNwPdu(
                                m_geoNwBroadcastPacket(
                                    v_longPosVectorNodeC,
                                    vc_localSeqNumber,
                                    f_getGeoBroadcastArea(c_area1)
                                )
                            )
                        )
                    );
                    
                    t_toCbf.start;                    
                    tc_ac.start;
                    alt {
                        [] geoNetworkingPort.receive(mw_geoNwInd(mw_geoNwPdu(mw_geoNwBroadcastPacketWithArea(
                                mw_longPosVectorPosition(v_longPosVectorNodeC),
                                ?,
                                f_getGeoBroadcastArea(c_area1)
                            )))) {
                            tc_ac.stop;                           
                            
                            if(t_toCbf.running) {                               
                                t_toCbf.stop;
                                log("*** " & testcasename() & ": FAIL: GBC retransmitted before CBF timer expiration ***");
                                f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                            }
                            else {
                                log("*** " & testcasename() & ": PASS: GBC message received ***");
                                f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                            }
                        }
                        [] t_toCbf.timeout {
                            log("*** " & testcasename() & ": INFO: CBF timer elapsed ***");
                            repeat;
                        }
                        [] tc_ac.timeout {
                            log("*** " & testcasename() & ": FAIL: GBC message not received ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                        }
                    }
                    
                    // Postamble
                    f_poDefault();
                    
                } // end f_GEONW_PON_BCA_BV_08_nodeD
                
            } // end GEONW_PON_BCA_BV_08

        } // end geoGeoBroadcastCbfAlgorithm
        
        // 6.2.2.13
        group geoGeoBroadcastAdvAlgorithm {
            
            group GEONW_PON_BAA_BV_01 {
                
                /**
                 * @desc    TP Function for TC_GEONW_PON_BAA_BV_01
                 */
                function f_GEONW_PON_BAA_BV_01() runs on ItsMtc {
                    
                    // Local variables
                    var ItsGeoNetworking v_nodeB;
                    var ItsGeoNetworking v_nodeF;
                    
                    // Test control
                    if (not PICS_GN_GBC_FWD) {
                        log("*** " & testcasename() & ": PICS_GN_GBC_FWD required for executing the TC ***");
                        setverdict(inconc);
                        stop;
                    }
                    if (f_getGeoBroadcastForwardingAlgorithm() != e_advanced) {
                        log("*** " & testcasename() & ": PICS_GN_GEOBROADCAST_FORWARDING_ALGORITHM == e_advanced required for executing the TC ***");
                        setverdict(inconc);
                        stop;
                    }
                    
garciay's avatar
garciay committed
//                    if (f_getGeoBroadcastCbfMinTime() < 300) {
//                        log("*** " & testcasename() & ": PICS_GN_GEOBROADCAST_CBF_MIN_TIME >= 300 required for executing the TC ***");
//                        setverdict(inconc);
//                        stop;
//                    }
                    
                    // Test component configuration
                    f_cf06Up();
                    
                    // Preamble
                    
                    // Start components
                    v_nodeB := f_getComponent(c_compNodeB);
                    v_nodeF := f_getComponent(c_compNodeF);
                    v_nodeB.start(f_GEONW_PON_BAA_BV_01_nodeB());
                    v_nodeF.start(f_GEONW_PON_BAA_BV_01_nodeF());
                    
                    // Synchronization
                    f_serverSync2ClientsAndStop({c_prDone, c_tbDone});
                    
                    // Cleanup
                    f_cf06Down();
                    
                } // end f_GEONW_PON_BAA_BV_01
                
                /**
                 * @desc    Behavior function for NodeB (TC_GEONW_PON_BAA_BV_01)
                 */
                function f_GEONW_PON_BAA_BV_01_nodeB() runs on ItsGeoNetworking {
                    
                    // Local variables
                    
                    // Preamble
                    f_prNeighbour();
                    f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                    
                    // Test Body
                    tc_noac.start;
                    alt {
                        [] geoNetworkingPort.receive(mw_geoNwInd(mw_geoNwPdu(?))) {
                            tc_noac.stop;
                            log("*** " & testcasename() & ": FAIL: Message not discarded ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                        }
                        [] tc_noac.timeout {
                            log("*** " & testcasename() & ": PASS: No message received ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                        }
                    }
                    
                    // Postamble
                    f_poNeighbour();
                    
                } // end f_GEONW_PON_BAA_BV_01_nodeB
                
                /**
                 * @desc    Behavior function for NodeF (TC_GEONW_PON_BAA_BV_01)
                 */
                function f_GEONW_PON_BAA_BV_01_nodeF() runs on ItsGeoNetworking {
                    
                    // Local variables
                    var integer i;
                    var template (value) GeoNetworkingPdu v_gnPacket;
                    var LongPosVector v_longPosVectorNodeB := f_getPosition(c_compNodeB);
                    
                    // Preamble
                    f_prNeighbour();
                    v_gnPacket := m_geoNwPdu(m_geoNwBroadcastPacket(
                                            v_longPosVectorNodeB,
                                            vc_localSeqNumber,
                                            f_getGeoBroadcastArea(c_area1)
                                        )
                                    );
                    f_sendGeoNetMessage(m_geoNwReq_linkLayerBroadcast(v_gnPacket));
                    f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                    
                    // Test Body
                    for(i:=1; i < f_getAdvancedGbcForwardingMaxCounter(); i:=i+1) {
                        f_sendGeoNetMessage(m_geoNwReq_linkLayerBroadcast(v_gnPacket));
                        f_sleepIgnoreDef(0.5);
                    }
                    tc_noac.start;
                    alt {
                        [] geoNetworkingPort.receive(mw_geoNwInd(mw_geoNwPdu(?))) {
                            tc_noac.stop;
                            log("*** " & testcasename() & ": FAIL: Message not discarded ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                        }
                        [] tc_noac.timeout {
                            log("*** " & testcasename() & ": PASS: No message received ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                        }
                    }
                    
                    // Postamble
                    f_poNeighbour();
                    
                } // end f_GEONW_PON_BAA_BV_01_nodeF
                
            } // end GEONW_PON_BAA_BV_01
            
            group GEONW_PON_BAA_BV_02 {
                
                /**
                 * @desc    TP Function for TC_GEONW_PON_BAA_BV_02
                 */
                function f_GEONW_PON_BAA_BV_02() runs on ItsMtc {
                    
                    // Local variables
                    var ItsGeoNetworking v_nodeB;
                    var ItsGeoNetworking v_nodeE;
                                                    
                    // Test control
                    if (not PICS_GN_GBC_FWD) {
                        log("*** " & testcasename() & ": PICS_GN_GBC_FWD required for executing the TC ***");
                        setverdict(inconc);
                        stop;
                    }
                    if (f_getGeoBroadcastForwardingAlgorithm() != e_advanced) {
                        log("*** " & testcasename() & ": PICS_GN_GEOBROADCAST_FORWARDING_ALGORITHM == e_advanced required for executing the TC ***");
                        setverdict(inconc);
                        stop;
                    }
                    
garciay's avatar
garciay committed
//                    if (f_getGeoBroadcastCbfMinTime() < 300) {
//                        log("*** " & testcasename() & ": PICS_GN_GEOBROADCAST_CBF_MIN_TIME >= 300 required for executing the TC ***");
//                        setverdict(inconc);
//                        stop;
//                    }
                    
                    // Test component configuration
                    f_cf05Up();
                    
                    // Preamble
                                    
                    // Start components
                    v_nodeB := f_getComponent(c_compNodeB);
                    v_nodeE := f_getComponent(c_compNodeE);
                    v_nodeB.start(f_GEONW_PON_BAA_BV_02_nodeB());
                    v_nodeE.start(f_GEONW_PON_BAA_BV_02_nodeE());
                    
                    // Synchronization
                    f_serverSync2ClientsAndStop({c_prDone, c_tbDone});
                    
                    // Cleanup
                    f_cf05Down();
                    
                } // end f_GEONW_PON_BAA_BV_02
                
                /**
                 * @desc    Behavior function for NodeB (TC_GEONW_PON_BAA_BV_02)
                 */
                function f_GEONW_PON_BAA_BV_02_nodeB() runs on ItsGeoNetworking {
                    
                    // Local variables
                    var LongPosVector v_longPosVectorNodeB := f_getPosition(c_compNodeB);
                    
                    // Preamble
                    f_prNeighbour();
                    f_sendGeoNetMessage(m_geoNwReq_linkLayerBroadcast(
                        m_geoNwPdu(m_geoNwBroadcastPacket(
                                v_longPosVectorNodeB,
                                0,
                                f_getGeoBroadcastArea(c_area1)
                            )
                        )
                    ));
                    f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                    
                    // Test Body
                    tc_noac.start;
                    alt {
                        [] geoNetworkingPort.receive(mw_geoNwInd(mw_geoNwPdu(?))) {
                            tc_noac.stop;
                            log("*** " & testcasename() & ": FAIL: Message not discarded ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                        }
                        [] tc_noac.timeout {
                            log("*** " & testcasename() & ": PASS: No message received ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                        }
                    }
                    
                    // Postamble
                    f_poNeighbour();
                    
                } // end f_GEONW_PON_BAA_BV_02_nodeB
                
                /**
                 * @desc    Behavior function for NodeE (TC_GEONW_PON_BAA_BV_02)
                 */
                function f_GEONW_PON_BAA_BV_02_nodeE() runs on ItsGeoNetworking {
                    
                    // Local variables
                    var LongPosVector v_longPosVectorNodeB := f_getPosition(c_compNodeB);
                    
                    // Preamble
                    f_prNeighbour();
                    f_selfOrClientSyncAndVerdict(c_prDone, e_success);
                    
                    // Test Body
                    f_sendGeoNetMessage(m_geoNwReq_linkLayerBroadcast(
                        m_geoNwPdu(m_geoNwBroadcastPacket(
                                v_longPosVectorNodeB,
                                0,
                                f_getGeoBroadcastArea(c_area1)
                            )
                        )
                    ));
                    tc_noac.start;
                    alt {
                        [] geoNetworkingPort.receive (mw_geoNwInd(mw_geoNwPdu(?))){
                            tc_noac.stop;
                            log("*** " & testcasename() & ": FAIL: Message not discarded ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                        }
                        [] tc_noac.timeout {
                            log("*** " & testcasename() & ": PASS: No message received ***");
                            f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                        }
                    }
                    
                    // Postamble
                    f_poNeighbour();
                    
                } // end f_GEONW_PON_BAA_BV_02_nodeE
                
            } // end GEONW_PON_BAA_BV_02
            
            group GEONW_PON_BAA_BV_03 {
                
                /**
                 * @desc    TP Function for TC_GEONW_PON_BAA_BV_03
                 */
                function f_GEONW_PON_BAA_BV_03() runs on ItsMtc {
                    
                    // Local variables
                    var ItsGeoNetworking v_nodeB;
                    var ItsGeoNetworking v_nodeF;
                        
                    // Test control
                    if (not PICS_GN_GBC_FWD) {
                        log("*** " & testcasename() & ": PICS_GN_GBC_FWD required for executing the TC ***");
                        setverdict(inconc);
                        stop;
                    }
                    if (f_getGeoBroadcastForwardingAlgorithm() != e_advanced) {
                        log("*** " & testcasename() & ": PICS_GN_GEOBROADCAST_FORWARDING_ALGORITHM == e_advanced required for executing the TC ***");
                        setverdict(inconc);
                        stop;
                    }
                    
garciay's avatar
garciay committed
//                    if (f_getGeoBroadcastCbfMinTime() < 300) {
//                        log("*** " & testcasename() & ": PICS_GN_GEOBROADCAST_CBF_MIN_TIME >= 300 required for executing the TC ***");
//                        setverdict(inconc);
//                        stop;
//                    }
                    
                    // Test component configuration
                    f_cf06Up();
                    
                    // Preamble
                                    
                    // Start components
                    v_nodeB := f_getComponent(c_compNodeB);
                    v_nodeF := f_getComponent(c_compNodeF);
                    v_nodeB.start(f_GEONW_PON_BAA_BV_03_nodeB());