/******************************************************************************/
// @copyright   Copyright Notification
//   No part may be reproduced except as authorized by written permission.
//   The copyright and the foregoing restriction extend to reproduction in all media.
//   Trademark 2010, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TTA, TTC).
//   All rights reserved.
// @version: IWD_10wk37
// $Date: 2010-09-10 11:12:18 +0200 (Fri, 10 Sep 2010) $
// $Rev: 3837 $
/******************************************************************************/

module InterRat_Handover_to_UTRA_UTRAN {

//----------------------------------------------------------------------
// Import part
//----------------------------------------------------------------------

  import from CommonIratDefs all;

  import from UTRAN_RRC_ASN1_Definitions language "ASN.1:1997" all;
  import from UTRAN_ASP_Definitions language "ASN.1:1997" all;
  import from UTRAN_Component all;
  import from UTRAN_CommonFunctions all;
  import from UTRAN_Templates all;
  import from UTRAN_RAB_Functions all;
  import from UTRAN_TypeDefs all;
  import from UTRAN_ConfigurationSteps all;

//----------------------------------------------------------------------
// Test case specific templates
//----------------------------------------------------------------------

//----------------------------------------------------------------------
// Test case
//----------------------------------------------------------------------

  //* @desc Test case 8.4.1.2 Inter-RAT Handover / from E-UTRA to UTRA(PS) / Data
  function f_TC_8_4_1_2_UTRAN() runs on UTRAN_PTC {

    var boolean v_TriggerRxd := false;

    //* @desc Initialise all cells
    f_UTRAN_Init ( EUTRA_UTRAN );

    //* @desc Create and configure Cell 5
    //* Cell started switched on with default power level, -60 and max attenuation
    f_SS_CreateCellDCH ( utran_Cell5 );

    //* @desc Start sending System Information
    f_UTRAN_SendDefSysInfo ( utran_Cell5 );

    //UE starts registered in EUTRA, wait its Auth Params
    f_UTRAN_InterRAT_InitialiseAuthParams();

    //* @desc Send relevant UTRAN cell info to EUTRA PTC
    f_UTRAN_Send_IR_SysInfoToEUTRA ( utran_Cell5 );

    f_UTRAN_TestBody_Set( true );

    //@siclog "Step 1" siclog@
    //Configure a dedicated channel in the UTRAN FDD with configuration
    //* according to 34.108 cl. 6.10.2.4.1.26
    f_SS_Config_64kPS_RAB ( utran_Cell5 );

    //@siclog "Step 3" siclog@
    //* @desc Trigger: Receive HANDOVER TO UTRAN COMPLETE message
    v_TriggerRxd := f_WaitForIRATCoOrd_Trigger (EUTRA);
    U_AM.receive ( car_RLC_Data_Ind ( utran_Cell5,
                                      tsc_RB2,
                                      cr_HandoverToUTRANComplete ) );

    f_UTRAN_PreliminaryPass(__FILE__, __LINE__, "Test Case 8.4.1.2 Step 3");

    f_UTRAN_TestBody_Set( false );

    f_SendIRATCoOrd (EUTRA, cms_IRAT_Trigger); // Tell to EUTRA PTC Test case is now finished on UTRAN side

    //* @desc Switch off UE and release cell
    f_UTRA_Postamble ( utran_Cell5, U3_HANDOVER );
  }


  //* @desc Test case 8.4.1.4 Inter-RAT Handover / from E-UTRA to UTRA (HSPA) / Data
  function f_TC_8_4_1_4_UTRAN() runs on UTRAN_PTC {

    var boolean v_TriggerRxd := false;

    //* @desc Initialise all cells
    f_UTRAN_Init ( EUTRA_UTRAN );

    //* @desc Create and configure Cell 5
    //* Cell started switched on with default power level, -60 and max attenuation
    f_SS_CreateCellDCH ( utran_Cell5 );

    //* @desc Start sending System Information
    f_UTRAN_SendDefSysInfo ( utran_Cell5 );

    //UE starts registered in EUTRA, wait its Auth Params
    f_UTRAN_InterRAT_InitialiseAuthParams();

    //* @desc Send relevant UTRAN cell info to EUTRA PTC
    f_UTRAN_Send_IR_SysInfoToEUTRA ( utran_Cell5 );

    f_UTRAN_TestBody_Set( true );

    //@siclog "Step 1" siclog@
    //Configure a dedicated channel in the UTRAN FDD with configuration
    //* according to 36.508 table 4.8.3-1, condition UTRA HSDPA RB
    f_SS_Config_HSDPA_64kUL_RAB ( utran_Cell5 );

    //@siclog "Step 3" siclog@
    //* @desc Trigger: Receive HANDOVER TO UTRAN COMPLETE message
    v_TriggerRxd := f_WaitForIRATCoOrd_Trigger (EUTRA);
    U_AM.receive ( car_RLC_Data_Ind ( utran_Cell5,
                                      tsc_RB2,
                                      cr_HandoverToUTRANComplete ) );

    f_UTRAN_PreliminaryPass(__FILE__, __LINE__, "Test Case 8.4.1.4 Step 3");

    f_UTRAN_TestBody_Set( false );

    f_SendIRATCoOrd (EUTRA, cms_IRAT_Trigger); // Tell to EUTRA PTC Test case is now finished on UTRAN side

    //* @desc Switch off UE and release cell
    f_UTRA_Postamble ( utran_Cell5, U3_HANDOVER );
  }
}
