ItsAutoInterop_TestCases.ttcn 131 KB
Newer Older
garciay's avatar
garciay committed
        } // End of f_TC_AUTO_IOT_CAM_CRW_BV_02_eut
        
    } // End of group g_TC_AUTO_IOT_CAM_CRW_BV_02 
    
    /**
     * @desc    Verify complete resolution of duplicate address conflict scenario based on GN messages
     * <pre>
     * Pics Selection: 
     * Config Id: CF-01
     * Initial conditions:
     *  with {
     *      EUT1 and EUT2 being configured with the same GN address
     *      and EUT1 and EUT2 being off-link
     *  }
     * Expected behaviour:
     *  ensure that {
     *      when {
     *          EUT1 and EUT2 become on-link
     *      }
     *      then {
     *          EUT1 changes its GN address
     *          and EUT2 changes its GN address
     *      }
     *      when {
     *          EUT1 sends CA messages
     *              containing cam
     *                  containing camParameters
     *                  containing basicContainer 
     *                      containing referencePosition
     *      }
     *      then {
     *          EUT2 indicates EUT1 as neighbour
     *      }
     *      when {
     *          EUT2 sends CA messages 
     *          containing cam
     *              containing camParameters
     *                  containing basicContainer 
     *                      containing referencePosition
     *      }
     *      then {
     *          EUT1 indicates EUT2 as neighbour
     *      }
     *  }
     * </pre>
     *
     * @see         Draft ETSI TS yyy xxx-2 V0.0.8 (2017-03) TD_AUTO_IOT_GN_DAD_BV_01
     * @reference   ETSI EN 302 636-4-1 [2] Clause 9.2.1.5
     */
    testcase TC_AUTO_IOT_GN_DAD_BV_01() runs on ItsMtc system ItsAutoInteropGeoNetworkingSystem {
        
        // Local variables
        var ItsAutoInteropGeonetworking v_eut1 := null;
        var ItsAutoInteropGeonetworking v_eut2 := null;
        
        // Test control
        /*if (not PICS_GN_LS_FWD) {
            log("*** " & testcasename() & ": PICS_GN_LS_FWD required for executing the TC ***");
            setverdict(inconc);
            stop;
        }*/
        
        // Test component configuration
        f_mtcCf02Up(v_eut1, v_eut2);
        
        // Preamble
        
        // Start components
        v_eut1.start(f_TC_AUTO_IOT_GN_DAD_BV_01_eut(v_eut1, PX_EUT1_ID, PX_EUT2_ID));
        v_eut2.start(f_TC_AUTO_IOT_GN_DAD_BV_01_eut(v_eut2, PX_EUT2_ID, PX_EUT1_ID));
        
        // Synchronization
        f_serverSyncNClientsAndStop(2, {c_prDone, c_tbDone});
        
        // Cleanup
        f_mtcCf02Down(v_eut1, v_eut2);
        
    } // End of TC_AUTO_IOT_GN_DAD_BV_01
    
    group g_TC_AUTO_IOT_GN_DAD_BV_01 { 
        
        /**
         * @desc    Behavior function for EUTs (TC_AUTO_IOT_GN_DAD_BV_01)
         */
        function f_TC_AUTO_IOT_GN_DAD_BV_01_eut(
                                                in ItsAutoInteropGeonetworking p_eut,
                                                in integer p_eut_id,
                                                in integer p_eut_id_neighbour
        ) runs on ItsAutoInteropGeonetworking {
            
            // Local variables
            var GeoNetworkingInd v_gnInd;
            var GN_Address v_gnAddr;
            var boolean v_getFirstCam := false;
            var HmiNeighborEventInds v_hmiNeighborEventInds;
            
            // Test component configuration
            f_cfPtcUp(p_eut);
            
            // Preamble
            f_prDefault();
            // EUT1 and EUT2 become on-link
            ItsAutoInterop_Functions.f_utTriggerEvent(UtAutoInteropTrigger:{utRadioOnOff := true});
            f_selfOrClientSyncAndVerdict(c_prDone, e_success);
            
            // Test Body
            tc_wait.start;
            alt {
                [v_getFirstCam == false] geoNetworkingPort.receive(
                    mw_geoNwInd(
                        mw_geoNwPdu(
                            mw_geoNwShbPacketWithNextHeader_cam(
                                ?,
                                ?,
                                e_btpB,
                                mw_cam_stationId(
                                    -,
                                    PX_EUT_DESC[p_eut_id].stationId
                ))))) -> value v_gnInd { // Receive a CAM message
                    v_gnAddr := v_gnInd.msgIn.gnPacket.packet.extendedHeader.shbHeader.srcPosVector.gnAddr;
                    v_getFirstCam := true;
                    // Re-send CAM message to the other EUTs
                    eutGeoNetworkingPort.send(
                                              m_forward_geoNetworkingInd(
                                                  v_gnInd
                    ));
                    repeat;
                }
                [] geoNetworkingPort.receive(
                    mw_geoNwInd(
                        mw_geoNwPdu(
                            mw_geoNwShbPacketWithNextHeader_cam(
                                mw_longPosVectorAny(
                                    ? /* FIXME complement(
                                        v_gnAddr
                                )*/),
                                ?,
                                e_btpB,
                                mw_cam_stationId(
                                    -,
                                    PX_EUT_DESC[p_eut_id].stationId
                ))))) -> value v_gnInd { // Receive a CAM message
                    // Re-send CA message to the other EUTs
                    eutGeoNetworkingPort.send(
                                              m_forward_geoNetworkingInd(
                                                  v_gnInd
                    ));
                    tc_wait.stop;
                    log("*** " & testcasename() & ": INFO: GN duplicated address conflict resolved ***");
                    hmiPort.clear;
                }
                [] tc_wait.timeout {
                    log("*** " & testcasename() & ": INCONC: GN duplicate address conflict scenario is incomplete ***");
                    f_selfOrClientSyncAndVerdict(c_tbDone, e_timeout);
                }
            } // End of 'alt' statement
            tc_ac.start;
            alt { // Check neighbours
                [] hmiPort.receive(
                    HmiNeighborEventInds:?
                ) -> value v_hmiNeighborEventInds {
                    var boolean v_found := false;
                    tc_ac.stop;
                    for (var integer v_i := 0; v_i < lengthof(v_hmiNeighborEventInds); v_i := v_i + 1) {
                        if (
                            (PX_EUT_DESC[p_eut_id_neighbour].mid == v_hmiNeighborEventInds[v_i].mid) and 
                            (PX_EUT_DESC[p_eut_id_neighbour].stationId == v_hmiNeighborEventInds[v_i].stationId)
                        ) {
                            v_found := true;
                            break; // Got it, leave the loop
                        } // else, continue
                    } // End of 'for' statement
                    if (v_found) {
                        log("*** " & testcasename() & ": PASS: GN duplicate address conflict scenario compeleted for EUT ", PX_EUT_DESC[p_eut_id].stationId, "***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_success);
                    } else {
                        log("*** " & testcasename() & ": FAIL: GN duplicate address conflict scenario is incomplete ***");
                        f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                    }
                }
                [] tc_ac.timeout {
                    log("*** " & testcasename() & ": FAIL: Expected message not received ***");
                    f_selfOrClientSyncAndVerdict(c_tbDone, e_error);
                }
            }
            
            // Postamble
            f_poDefault();
            f_cfPtcDown(p_eut);
            
        } // End of f_TC_AUTO_IOT_GN_DAD_BV_01_eut
        
    } // End of group g_TC_AUTO_IOT_GN_DAD_BV_01 
    
} // End of module AtsInterop_TestCases