/******************************************************************************/
// @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-16 17:29:51 +0200 (Thu, 16 Sep 2010) $
// $Rev: 3941 $
/******************************************************************************/

module RRC_ConnEst {

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

    import from CommonDefs all;
    import from EPS_NAS_Constants all;
    import from EPS_NAS_MsgContainers all;
    import from EPS_NAS_Templates all;
    import from EPS_NAS_TypeDefs all;
    import from EUTRA_ASP_SrbDefs all;
    import from EUTRA_ASP_TypeDefs all;
    import from EUTRA_AspCommon_Templates all;
    import from EUTRA_CellInfo all;
    import from EUTRA_CommonDefs all;
    import from EUTRA_CommonProcedures all;
    import from EUTRA_Component all;
    import from EUTRA_ConfigurationSteps all;
    import from EUTRA_IdleMode all;
    import from EUTRA_LoopBack all;
    import from EUTRA_NASSteps all;
    import from EUTRA_Paging all;
    import from EUTRA_RRC_ASN1_Definitions language "ASN.1:1997" all;
    import from EUTRA_RRC_Templates all;
    import from EUTRA_RRCSteps all;
    import from EUTRA_SecurityFunctions all;
    import from EUTRA_SecuritySteps all;
    import from EUTRA_SRB_Templates all;
    import from EUTRA_DRB_Templates all;
    import from Parameters all;
    import from UpperTesterFunctions all;
    import from EUTRA_Timing all;
    import from CommonIP all;


//----------------------------------------------------------------------
// Templates
//----------------------------------------------------------------------

  template (value) AccessBarringInformation_Type cs_AccessBarringInformation_TC_8_1_2_5 :=
  { /* @status    APPROVED */
    ac_BarringForEmergency := false,
    ac_BarringForMO_Signalling := omit,
    ac_BarringForMO_Data := {
      ac_BarringFactor := p00,
      ac_BarringTime := s512,
      ac_BarringForSpecialAC := '11111'B //@sic R5-104265 sic@
    }
  };
  
  template (value) AccessBarringInformation_Type cs_AccessBarringInformation_TC_8_1_2_7 :=
  { /* @status    APPROVED */
    ac_BarringForEmergency := true,
    ac_BarringForMO_Signalling := {
      ac_BarringFactor := p00,
      ac_BarringTime := s4,
      ac_BarringForSpecialAC := '00000'B
    },
    ac_BarringForMO_Data := {
      ac_BarringFactor := p00,
      ac_BarringTime := s4,
      ac_BarringForSpecialAC := '00000'B
    }
  };
  
  template (value) DL_CCCH_Message cs_RRCConnectionSetup_DeltaMCS ( RRC_TransactionIdentifier p_RRC_TI,
                                                                    template (value) PUCCH_ConfigDedicated p_PUCCH_ConfigDedicated,
                                                                    SR_PUCCH_ResourceIndex_Type p_SR_PUCCH_ResourceIndex,
                                                                    template (value) PhysicalConfigDedicated_AntennaInfo_Type p_AntennaInfo, // @sic R5-100786 sic@
                                                                    SR_ConfigIndex_Type p_SR_ConfigIndex // @sic R5-102177 sic@
                                                                    ) :=
  { /* @status    APPROVED */
    message_ := {
      c1 := {
        rrcConnectionSetup := {
          rrc_TransactionIdentifier := p_RRC_TI,
          criticalExtensions := {
            c1 := {
              rrcConnectionSetup_r8 := {
                radioResourceConfigDedicated :=
                cs_508_RadioResourceConfigDedicated_SRB1 ( cs_MAC_MainConfig_SRB1,
                                                           cds_PhysicalConfigDedicated_SRB1_DeltaMCS(p_PUCCH_ConfigDedicated, p_SR_PUCCH_ResourceIndex, p_AntennaInfo, p_SR_ConfigIndex) ),// @sic R5-102177 sic@
                nonCriticalExtension := omit
              }
            }
          }
        }
      }
    }
  };
  
  template (value) PhysicalConfigDedicated cds_PhysicalConfigDedicated_SRB1_DeltaMCS ( template (value) PUCCH_ConfigDedicated p_PUCCH_ConfigDedicated,
                                                                                       SR_PUCCH_ResourceIndex_Type p_SR_PUCCH_ResourceIndex,
                                                                                       template (value) PhysicalConfigDedicated_AntennaInfo_Type p_AntennaInfo, // @sic R5-100786 sic@
                                                                                       SR_ConfigIndex_Type p_SR_ConfigIndex // @sic R5-102177 sic@
                                                                                       )
    modifies cs_508_PhysicalConfigDedicated_Default_SRB1 :=
  { /* @status    APPROVED */
    //pdsch_ConfigDedicated := cs_508_PDSCH_ConfigDedicated_Default,
    //pucch_ConfigDedicated := p_PUCCH_ConfigDedicated,
    //pusch_ConfigDedicated := cs_508_PUSCH_ConfigDedicated_Default,
    uplinkPowerControlDedicated := cds_UplinkPowerControlDedicated_DeltaMCS
    //tpc_PDCCH_ConfigPUCCH := omit,
    //tpc_PDCCH_ConfigPUSCH := omit,
    //cqi_ReportConfig := cs_508_CQI_ReportConfig_Default(omit),
    //soundingRS_UL_ConfigDedicated := omit,
    //antennaInfo := p_AntennaInfo, //@sic R5-100786 sic@
    //schedulingRequestConfig := cs_508_SchedulingRequest_Config_Default ( p_SR_PUCCH_ResourceIndex, p_SR_ConfigIndex)
  };

  template (value) UplinkPowerControlDedicated cds_UplinkPowerControlDedicated_DeltaMCS
    modifies cs_508_UplinkPowerControlDedicated_Default :=
  { /* @status    APPROVED */
    //p0_UE_PUSCH := 0,
    deltaMCS_Enabled := en1
    //accumulationEnabled := true,
    //p0_UE_PUCCH := 0,
    //pSRS_Offset := 3,
    //filterCoefficient := fc4
  };
  
  template (value) SYSTEM_CTRL_REQ cas_CellConfig_Update_DeltaMCS_Info_REQ ( CellId_Type  p_CellId,
                                                                             template (value) TimingInfo_Type p_TimingInfo,
                                                                             template (value) UplinkPowerControlDedicated p_UplinkPowerControlDedicated ) :=
  { /* @status    APPROVED */
    Common := cs_ReqAspCommonPart_CellCfg(p_CellId, p_TimingInfo),
    Request := {
      Cell := {
        AddOrReconfigure := {
          Basic := omit,
          Active := {
            C_RNTI := omit,
            PhysicalLayerConfigUL := {
              Prach := omit,
              Pucch := omit,
              Pusch := omit,
              TimingAdvance := omit,
              SRS_UL_Config := omit,
              SR_Config := omit,
              CQI_ReportConfig := omit,
              UplinkPowerControlCommon := omit,
              UplinkPowerControlDedicated := cs_UplinkPowerControlDedicated_r8 ( p_UplinkPowerControlDedicated )
            },
            RachProcedureConfig := omit,
            CcchDcchDtchConfig := omit
          }
        }
      }
    }
  };

  template (value) AccessBarringInformation_Type cs_AccessBarringInformation_TC_8_1_2_8 := {
    ac_BarringForEmergency := false,
    ac_BarringForMO_Signalling := {
      ac_BarringFactor := p00,
      ac_BarringTime := s16,
      ac_BarringForSpecialAC := '11111'B
    },
    ac_BarringForMO_Data := {
      ac_BarringFactor := p00,
      ac_BarringTime := s16,
      ac_BarringForSpecialAC := '11111'B
    }
  };


//----------------------------------------------------------------------
// Functions
//----------------------------------------------------------------------
  /*
   * @desc      send RRCConnectionSetup with modified uplinkPowerControlDedicated
   * @param     p_CellId
   * @param     p_TimingInfo
   * @param     p_RRC_TI
   * @status    APPROVED
   */
  function fl_EUTRA_RRC_ConnectionSetup_DeltaMCS (CellId_Type p_CellId,
                                                  template (value) TimingInfo_Type p_TimingInfo,
                                                  RRC_TransactionIdentifier p_RRC_TI) runs on EUTRA_PTC
  {
    // Get FDD or TDD mode from Cell-configuration:
    var template (value) EUTRA_FDD_TDD_CellInfo_Type  v_EUTRA_FDD_TDD_Info := f_EUTRA_CellInfo_GetFDD_TDD_Info(p_CellId);
    var SR_PUCCH_ResourceIndex_Type v_Sr_PUCCH_ResourceIndex := f_EUTRA_CellInfo_GetSR_PUCCH_ResourceIndex ( p_CellId );
    var template (value) PhysicalConfigDedicated_AntennaInfo_Type v_AntennaInfo := f_EUTRA_CellInfo_GetAntennaInfoDedicated (p_CellId);
    var SR_ConfigIndex_Type v_SR_ConfigIndex := f_EUTRA_CellInfo_GetSR_ConfigIndex ( eutra_Cell1 );
    
    // switch on UL grant assignments
    f_EUTRA_StartDefULGrantTransmission ( p_CellId, cs_TimingInfo_Now );

    SRB.send ( cas_SRB0_RrcPdu_REQ ( p_CellId,
                                     p_TimingInfo,
                                     cs_RRCConnectionSetup_DeltaMCS ( p_RRC_TI,
                                                                      v_EUTRA_FDD_TDD_Info.pucch_Config,
                                                                      v_Sr_PUCCH_ResourceIndex,
                                                                      v_AntennaInfo,
                                                                      v_SR_ConfigIndex // @sic R5-102177 sic@
                                                                      ) ) );
  };
 

  /*
   * @desc      RRC Connection Establishment / Ks=1.25: Success
   * @status    APPROVED
   */
  function f_TC_8_1_2_1_EUTRA()
      runs on EUTRA_PTC
  {
    
    var RRC_TransactionIdentifier v_RRC_TI := tsc_RRC_TI_Def;
    var B3_Type v_KsiValue;
    var SRB_COMMON_IND v_ReceivedAsp; //@sic R5-102180 sic@
    var NAS_MSG_Indication_Type v_NAS_Ind; //@sic R5-102180 sic@

    f_EUTRA_Init ( c1 );

    //Create and configure cell
    f_EUTRA_CellConfig_Def ( eutra_Cell1 );

    /* Preamble to enter UE in E-UTRA RRC_IDLE (state 2) */
    f_EUTRA_Preamble (eutra_Cell1, STATE2_IDLEUPDATE);
    v_KsiValue := f_EUTRA_SecurityKSIasme_Get ( );

    f_EUTRA_TestBody_Set ( true );

    //@siclog "Step 1" siclog@
    //SS sends a Paging message to the UE on the appropriate paging block, and including the UE identity in one entry of the IE pagingRecordLists
    f_EUTRA_UE_Page_Def ( eutra_Cell1 ); // @sic R5-101114 sic@

    //@siclog "Step 2" siclog@
    //Check: UE transmits an RRCConnectionRequest message
    SRB.receive( car_SRB0_RrcPdu_IND( eutra_Cell1,
                                      cr_RRCConnectionRequest ( cr_EstablishmentCause_mt_Access ) ) ); // @sic R5-101114 sic@
    f_EUTRA_PreliminaryPass(__FILE__, __LINE__, "Test Case 8.1.2.1 Step 2");

    //Configure SS with same UplinkPowerControlDedicated as UE is configured in Step 3
    f_EUTRA_SS_CommonCellConfig ( eutra_Cell1,
                                  cas_CellConfig_Update_DeltaMCS_Info_REQ ( eutra_Cell1,
                                                                            cs_TimingInfo_Now,
                                                                            cds_UplinkPowerControlDedicated_DeltaMCS)); // @sic R5-101114 sic@
    
    //@siclog "Step 3" siclog@
    //SS transmit a RRCConnectionSetup message with SRB1 configuration.
    fl_EUTRA_RRC_ConnectionSetup_DeltaMCS ( eutra_Cell1,
                                            cs_TimingInfo_Now,
                                            v_RRC_TI ); // @sic R5-101114 sic@

    //@siclog "Step 4" siclog@
    //Check: Does the UE transmit an RRCConnectionSetupComplete including SERVICE REQUEST message to confirm the successful completion of the connection establishment?
    SRB.receive ( car_SRB1_RrcNasPdu_IND ( eutra_Cell1,
                                           cr_508_RRCConnectionSetupComplete ( v_RRC_TI, ? ),
                                           cr_NAS_Indication ( tsc_SHT_IntegrityProtected,
                                                               cr_508_SERVICE_REQUEST ( v_KsiValue ) ) ) )
    -> value v_ReceivedAsp; //@sic R5-102180 sic@
    f_EUTRA_PreliminaryPass(__FILE__, __LINE__, "Test Case 8.1.2.1 Step 4");
    
    //@siclog "Step 4A - 4D" siclog@
    //Steps 6 to 9 of the generic radio bearer establishment procedure (TS 36.508 4.5.3.3-1) are executed to successfully complete the service request procedure.
    v_NAS_Ind := v_ReceivedAsp.Signalling.Nas[0]; //@sic R5-102180 sic@
    f_EUTRA_ServiceReqPostamble_508Steps6_9( eutra_Cell1, v_NAS_Ind ); //@sic R5-102180 sic@

    //@siclog "Step 5" siclog@
    //Check: Does the test result of generic test procedure in TS 36.508 subclause 6.4.2.3 indicate that the UE is in E-UTRA RRC_CONNECTED state on Cell 1?
    f_EUTRA_508Check_ConnectedState ( eutra_Cell1 );

    f_EUTRA_TestBody_Set ( false );

    /* Postamble */
    f_EUTRA_Postamble ( eutra_Cell1, E2_CONNECTED ); //@sic R5-103875 sic@

  }

  //-------------------------------------------------------------------------
  // Default behaviour to be used in TC 8.1.2.2
  //-------------------------------------------------------------------------

  altstep a_EUTRA_TC_8_1_2_2_Default_Behaviour(CellId_Type p_CellId) runs on EUTRA_PTC {
    [] SRB.receive( car_SRB0_RrcPdu_IND( p_CellId,
                                         cr_508_RRCConnectionRequest ) )
         {
            f_EUTRA_SetVerdictFailOrInconc(__FILE__, __LINE__, "Test Case 8.1.2.2 Step 1 of parallel behaviour.");
         }
   };

  function f_TC_8_1_2_2_EUTRA()
      runs on EUTRA_PTC {
  /* RRC Connection Establishment in RRC Idle state: Reject with wait time */

    var SRB_COMMON_IND v_ReceivedAsp;
    var BEARER_RESOURCE_ALLOCATION_REQUEST v_BEARER_RESOURCE_ALLOCATION_Req;
    var ProcedureTransactionIdentifier v_EpsTi := tsc_PTI_Unassigned;
    var NasCount_Type v_NasCountUL;
    var GutiParameters_Type v_GutiParameters;
    var default v_MyDefaultVar := null;
    var EUTRA_SecurityParams_Type v_SecurityParams;
    var template (value) EUTRA_FDD_TDD_CellInfo_Type v_EUTRA_FDD_TDD_Info;
    var float v_Timer_1 := 5.0;  //@sic R5-104793 : value of Timer_1 added sic@
    timer t_WaitTime, t_Timer_1; //@sic R5-104793 : timer Timer_1 added sic@

    f_EUTRA_Init (c1);

    v_GutiParameters := f_EUTRA_CellInfo_GetGuti (eutra_Cell1);

    //Create and configure cell
    f_EUTRA_CellConfig_Def (eutra_Cell1);

    /* Preamble to enter UE in E-UTRA RRC_IDLE (state 2) */
    f_EUTRA_Preamble (eutra_Cell1, STATE2_IDLEUPDATE);
    
    v_SecurityParams := f_EUTRA_Security_Get();
    v_EUTRA_FDD_TDD_Info := f_EUTRA_CellInfo_GetFDD_TDD_Info (eutra_Cell1);

    f_EUTRA_TestBody_Set (true);

    //@siclog "Step 1" siclog@
    //Make the UE attempt an outgoing call
    f_UT_RequestActivateDedicatedBearer (UT, hex2int(tsc_EpsDedicatedBearerId), hex2int(tsc_EpsDefaultBearerId), cs_508_EPS_QoS_Dedicated_1, cs_508_Tft_Dedicated_1);

    //@siclog "Step 2" siclog@
    //Step 2: The UE transmit an RRCConnectionRequest message.
    SRB.receive( car_SRB0_RrcPdu_IND( eutra_Cell1,
                                      cr_RRCConnectionRequest (cr_EstablishmentCause_MoData )));

    //@siclog "Step 3" siclog@
    //Step 3: The SS responds with RRCConnectionReject message with IE waitTime set to 10s.
    SRB.send ( cas_SRB0_RrcPdu_REQ ( eutra_Cell1,
                                     cs_TimingInfo_Now,
                                     cs_RRCConnectionReject ) );

    //EXCEPTION: the behaviour in table 8.1.2.2.3.2-2 runs in parallel with steps 4 and 5 below.
    //Parallel behaviour Step 1: Check: Does the UE transmit an RRCConnectionRequest message within 10s.
    t_WaitTime.start(f_EUTRA_SetTimerToleranceMin ( eutra_Cell1, 10.0 ));
    v_MyDefaultVar := activate(a_EUTRA_TC_8_1_2_2_Default_Behaviour ( eutra_Cell1 ) );        /* NOTE! If the timer expires during step 4 or */
                                                                                              /* step 5 default behaviour takes place.       */

    //@siclog "Step 4" siclog@
    //Make the UE attempt an outgoing call.
    f_UT_RequestActivateDedicatedBearer (UT, hex2int(tsc_EpsDedicatedBearerId), hex2int(tsc_EpsDefaultBearerId), cs_508_EPS_QoS_Dedicated_1, cs_508_Tft_Dedicated_1);

    //@siclog "Step 5" siclog@
    //The SS transmits a Paging message with a matching UE identity.
    f_EUTRA_UE_Page ( eutra_Cell1,
                      cs_NasPaging_OneRecord ( cs_PagingUE_Identity_S_TMSI ( v_GutiParameters.MME_Code, v_GutiParameters.M_TMSI ) ) );

    t_WaitTime.timeout;

    deactivate(v_MyDefaultVar);

    //@sic R5-104793 : Step 6 is modified sic@
    //@siclog "Step 6" siclog@
    //Start timer Timer_1 of 5 seconds
    t_Timer_1.start(f_EUTRA_SetTimerToleranceMax (eutra_Cell1, v_Timer_1));
    
    //@sic R5-104793 : Step 7a1 is added sic@
    //@siclog "Step 7a1" siclog@
    //Receive RRCConnectionRequest message if UE treats the Cell as normal and access is granted for originating call?
    alt {
      [] SRB.receive(car_SRB0_RrcPdu_IND(eutra_Cell1, cr_508_RRCConnectionRequest))
      {
        t_Timer_1.stop;
        f_EUTRA_PreliminaryPass(__FILE__, __LINE__, "Test Case 8.1.2.2 Step 7a1");
        
        //@sic R5-104793 : Steps 7a2-7a11 are added sic@
        //@siclog "Step 7a2-7a11" siclog@
        //Perform Steps 2a2 to 6 of the generic test procedure in TS 36.508 subclause 6.4.3.1.
        
        //@siclog "Step 7a2" siclog@
        //send RRC Connection Setup on SRB0 (CCCH) and switch on UL grant assignments:
        f_EUTRA_RRC_ConnectionSetup_Def (eutra_Cell1, cs_TimingInfo_Now, tsc_RRC_TI_Def);
        
        //@siclog "Step 7a3" siclog@
        //receive RRC Connection Setup Complete with piggy-backed Service Request on SRB1 (DCCH):
        SRB.receive(car_SRB1_RrcNasPdu_IND(eutra_Cell1,
                                           cr_508_RRCConnectionSetupComplete(tsc_RRC_TI_Def, ?),
                                           cr_NAS_Indication (tsc_SHT_IntegrityProtected,
                                                              cr_508_SERVICE_REQUEST(f_EUTRA_SecurityKSIasme_Get())))) -> value v_ReceivedAsp;

        //@siclog "Step 7a4-7a5" siclog@
        //activate security in AS with parameters from AKA performed in preamble
        v_NasCountUL := v_ReceivedAsp.Signalling.Nas[0].SecurityProtection.NasCount;
        v_SecurityParams := f_EUTRA_Authentication_InitAS(v_SecurityParams, v_NasCountUL);
        v_SecurityParams := f_EUTRA_RRC_ActivateSecurity(eutra_Cell1, v_SecurityParams, v_NasCountUL);
        f_EUTRA_Security_Set(v_SecurityParams);
        
        //@siclog "Step 7a6" siclog@
        //SS transmits an RRCConnectionReconfiguration message to configure data radio bearer(s) associated with the existing EPS bearer context.
        SRB.send(cas_SRB1_RrcPdu_REQ(eutra_Cell1,
                                     cs_TimingInfo_Now,
                                     cs_RRCConnectionReconfiguration_Common(tsc_RRC_TI_Def, omit, omit,
                                                                            cs_508_RadioResourceConfigDedicated_Srb2( {cs_508_DRB_ToAddMod_DEFAULT_AM (tsc_DRB1)},
                                                                                                                      cs_508_MAC_MainConfig_Explicit_RBC_DrxL,
                                                                                                                      cs_508_PhysicalConfigDedicated_Default_RBC(v_EUTRA_FDD_TDD_Info.cqi_ReportConfig,
                                                                                                                                                                 v_EUTRA_FDD_TDD_Info.soundingRS_UL_Config,
                                                                                                                                                                 f_EUTRA_CellInfo_GetAntennaInfoDedicated (eutra_Cell1))),
                                                                            omit)));

        //@siclog "Step 7a7" siclog@
        //receive RRCConnectionReconfigurationComplete
        SRB.receive(car_SRB1_RrcPdu_IND(eutra_Cell1,
                                        cr_508_RRCConnectionReconfigurationComplete(tsc_RRC_TI_Def)));

        //@siclog "Step 7a8" siclog@
        //The UE transmits a BEARER RESOURCE ALLOCATION REQUEST message
        SRB.receive (car_SRB2_NasPdu_IND (eutra_Cell1,
                                          cr_NAS_Indication (tsc_SHT_IntegrityProtected_Ciphered,
                                                             cr_508_BearerResourceAllocReq(?, tsc_EpsDefaultBearerId)))) -> value v_ReceivedAsp;

        //store PTI received
        v_BEARER_RESOURCE_ALLOCATION_Req  := v_ReceivedAsp.Signalling.Nas[0].Pdu.Msg.bEARER_RESOURCE_ALLOCATION_REQUEST;
        v_EpsTi := v_BEARER_RESOURCE_ALLOCATION_Req.procedureTransactionIdentifier;
        
        //@siclog "Step 7a9-7a10" siclog@
        //The SS transmits an ACTIVATE DEDICATED EPS BEARER CONTEXT REQUEST message.
        f_EUTRA_TxDedicatedEpsBearerCtxtReq(eutra_Cell1,
                                            tsc_DRB2,
                                            tsc_EpsDedicatedBearerId,
                                            v_EpsTi,
                                            cs_LinkedId(hex2bit(tsc_EpsDefaultBearerId)),
                                            cs_508_EPS_QoS_Dedicated_1,
                                            cs_508_Tft_Dedicated_1(tsc_EpsDedicatedBearerId));
    
    
        //@siclog "Step 7a11" siclog@
        //The UE transmits an ACTIVATE DEDICATED EPS BEARER CONTEXT ACCEPT message
        SRB.receive(car_SRB2_NasPdu_IND(eutra_Cell1,
                                        cr_NAS_Indication(tsc_SHT_IntegrityProtected_Ciphered,
                                                          cr_508_ActDedicatedEPSBearerCxtAccept(tsc_EpsDedicatedBearerId))));
                                        
      }
      //@sic R5-104793 : Step 7b1 is added sic@
      //@siclog "Step 7b1" siclog@
      //Wait for Timer_1 to expire
      [] t_Timer_1.timeout {}
    }
    
    //@sic R5-104793 : Step 7b2 is added sic@
    //@siclog "Step 7b2" siclog@
    //Check if UE is in RRC_Idle state by applying generic test procedure in TS 36.508 subclause 6.4.2.2
    f_EUTRA_508Check_IdleState (eutra_Cell1);

    f_EUTRA_TestBody_Set (false);

    /* Postamble */
    f_EUTRA_Postamble (eutra_Cell1, E1_IDLE);

  }

  function f_TC_8_1_2_3_EUTRA()
      runs on EUTRA_PTC {
  /* RRC Connection Establishment in RRC_IDLE state: return to idle state after T300 timeout */

    f_EUTRA_Init ( c1 );

    //Create and configure cell
    f_EUTRA_CellConfig_Def ( eutra_Cell1 );

    /* Preamble to enter UE in E-UTRA RRC_IDLE (state 2) */
    f_EUTRA_Preamble (eutra_Cell1, STATE2_IDLEUPDATE);

    f_EUTRA_TestBody_Set ( true );

    //@siclog "Step 1" siclog@
    //Make the UE attempt an outgoing call
    f_UT_RequestActivateDedicatedBearer (UT, hex2int(tsc_EpsDedicatedBearerId), hex2int(tsc_EpsDefaultBearerId), cs_508_EPS_QoS_Dedicated_1, cs_508_Tft_Dedicated_1);

    //@siclog "Step 2" siclog@
    //The UE transmits an RRCConnectionRequest message.
    SRB.receive( car_SRB0_RrcPdu_IND( eutra_Cell1,
                                      cr_RRCConnectionRequest ( cr_EstablishmentCause_MoData ) ) );

    //@siclog "Step 3" siclog@
    //The SS waits for 2s. Note: the UE may transmit one or more RRCConnectionRequest messages but the SS does not answer to these messages.
    f_Delay ( f_EUTRA_SetTimerToleranceMax ( eutra_Cell1, 2.0 ) );

    //@siclog "Step 4" siclog@
    //Check: Does the test result of generic test procedure in TS 36.508 subclause 6.4.2.2 indicate that the UE is in E-UTRA RRC_IDLE state on Cell 1?
    f_EUTRA_508Check_IdleState ( eutra_Cell1 );

    f_EUTRA_TestBody_Set ( false );

    /* Postamble */
    f_EUTRA_Postamble ( eutra_Cell1, E1_IDLE );

  }

  /*
   * @desc      REFERENCE TS 36.523-1 clause 8.1.2.5
   * @status    APPROVED
   */

  function f_TC_8_1_2_5_EUTRA() runs on EUTRA_PTC
  { /* RRC Connection Establishment: 0% access probability for MO calls, no restriction for MO signalling. */

    var GutiParameters_Type v_GutiParameters; //@sic R5s100315 sic@
    var RRC_TransactionIdentifier v_RRC_TI := tsc_RRC_TI_Def; //@sic R5s100315 sic@
    var NAS_MSG_Indication_Type v_NAS_Ind; //@sic R5s100315 sic@
    var NAS_KsiValue v_KsiValue; //@sic R5s100315 sic@
    
    var boolean v_RrcMsgReceived; //@sic R5s100315 sic@
    var boolean v_DataPduReceived; //@sic R5s100315 sic@

    var template (value) CellPowerList_Type v_CellPowerList_AtT1;
    timer t_Wait; //@sic R5s100315 sic@

    f_EUTRA_Init ( c1 );

    //Set cell powel level for cell 1 and 11 to be used at creation
    f_EUTRA_CellInfo_InitMaxReferencePower ( eutra_Cell11, -79 );

    //Set Sys info for cell 11 to be used at creation
    f_EUTRA_CellInfo_SetSysInfo_AccessBarring ( eutra_Cell11, cs_AccessBarringInformation_TC_8_1_2_5 );

    //Create and configure cells
    f_EUTRA_CellConfig_Def ( eutra_Cell1 );
    f_EUTRA_CellConfig_Def ( eutra_Cell11 ); //@sic R5s100311 sic@

    // Preamble
    f_EUTRA_Preamble ( eutra_Cell1, STATE2A_TESTLOOP_ModeB );
    f_EUTRA_RbEst_Def ( eutra_Cell1 );
    f_EUTRA_CloseUE_TestLoopModeB ( eutra_Cell1, '05'O );

    //@sic R5-104788 : T0 removed from test case sic@

    f_EUTRA_TestBody_Set ( true );

    //@siclog "Step 1" siclog@
    //Void

    //@siclog "Step 2" siclog@
    //Void

    //@siclog "Step 2A" siclog@
    //The SS transmits an RRCConnectionRelease message on Cell 1.
    f_EUTRA_RRC_ConnectionRelease ( eutra_Cell1, tsc_RRC_TI_Def, other );
    
    //@siclog "Step 2B" siclog@
    //Wait for 5 s for the UE to enter E-UTRA RRC_IDLE state.
    f_Delay ( 5.0 );

    //@siclog "Step 3" siclog@
    //The SS changes Cell 1 and Cell 11 level according to the row "T1" in table 8.1.2.5.3.2-1.
    v_CellPowerList_AtT1 := {
      cs_CellPower ( eutra_Cell11, -79 )
    };
    f_EUTRA_SetCellPowerList ( v_CellPowerList_AtT1, cs_TimingInfo_Now );

    //@siclog "Step 3A" siclog@
    //Check: Does the UE transmit an RRCConnectionRequest on Cell 11?
    SRB.receive( car_SRB0_RrcPdu_IND( eutra_Cell11, //@sic R5s100311 sic@
                                      cr_RRCConnectionRequest ( cr_EstablishmentCause_MoSignalling ) ) );
    f_EUTRA_PreliminaryPass(__FILE__, __LINE__, "Test Case 8.1.2.5 Step 3A");
    
    //@siclog "Step 3B - 3F" siclog@
    //Steps 2 to 6 of the generic test procedure in TS 36.508 [18] subclause 6.4.2.7 are performed on Cell 11.
    //Note: The UE performs a TAU procedure and the RRC connection is released.
    f_EUTRA_TrackingAreaUpdate_WithoutRrcConnReq ( eutra_Cell11, tsc_RRC_TI_Def );
    
    //@siclog "Step 10" siclog@
    //Wait for 5 s for the UE to enter E-UTRA RRC_IDLE state.
    f_Delay ( 5.0 );
    
    //@siclog "Step 10A" siclog@
    //Generic test procedure in TS 36.508 subclause 4.5.3.3 is performed on Cell 11.
    //NOTE: The UE performs the establishment of the new data radio bearer associated with the default EPS bearer context.
    f_EUTRA_RbEst_Def ( eutra_Cell11 );
    
    //@siclog "Step 10B" siclog@
    //The SS transmits one IP packet to the UE on the DRB associated with the default EPS bearer context on Cell 11.
    DRB.send ( cas_DRB_COMMON_REQ_PDCP_SDU ( eutra_Cell11,
                                             tsc_RbId_DRB1,
                                             cs_TimingInfo_Now,
                                             { crs_IPv4_AnyIcmpEchoReply_1 ( px_IPv4_Address,
                                                                             px_IPv4_Address ) } ) );
    
    //@siclog "Step 10C" siclog@
    //Wait for 1 s after the IP packet has been transmitted in step 10B. (Note 1)
    f_Delay ( 1.0 );
    
    //@siclog "Step 11 - 13" siclog@
    //Void

    //@siclog "Step 14" siclog@
    //The SS transmits an RRCConnectionRelease message on Cell 11.
    f_EUTRA_RRC_ConnectionRelease ( eutra_Cell11, tsc_RRC_TI_Def, other );
    
    //@siclog "Step 15" siclog@
    //Check: Does the UE transmit an RRCConnectionRequest message on Cell 11 within 30s?
    t_Wait.start(30.0);
    alt {
      [] SRB.receive( car_SRB0_RrcPdu_IND( eutra_Cell11,
                                           cr_508_RRCConnectionRequest ) )
      {
        f_EUTRA_SetVerdictFailOrInconc(__FILE__, __LINE__, "Test Case 8.1.2.5 Step 15");
      }
      [] t_Wait.timeout
      {
      }
    }
    
    //@siclog "Step 17 - 26" siclog@
    //Check: Does the test result of steps 1 to 10 generic test procedure in TS 36.508 subclause 6.4.2.2 indicate that the UE is in E-UTRA RRC_IDLE state on Cell 11?
    v_GutiParameters := f_EUTRA_CellInfo_GetGuti ( eutra_Cell11 ); //@sic R5s100315 sic@
    f_EUTRA_UE_Page ( eutra_Cell11, //@sic R5s100315 sic@
                      cs_NasPaging_OneRecord ( cs_PagingUE_Identity_S_TMSI ( v_GutiParameters.MME_Code, v_GutiParameters.M_TMSI ) ) ); //@sic R5s100398 sic@

    v_KsiValue := f_EUTRA_SecurityKSIasme_Get ( ); //@sic R5s100315 sic@
    v_NAS_Ind := f_EUTRA_RRC_ConnEst_DefWithNas ( eutra_Cell11,
                                                  v_RRC_TI,
                                                  cr_EstablishmentCause_mt_Access,
                                                  cr_NAS_Indication(tsc_SHT_IntegrityProtected,
                                                                    cr_508_SERVICE_REQUEST ( v_KsiValue ))); //@sic R5s100315 sic@

    f_EUTRA_Activate_SRB2_DRB_SendRrcMsg ( eutra_Cell11,
                                           v_RRC_TI,
                                           v_NAS_Ind.SecurityProtection.NasCount);  //@sic R5s100315 sic@

    //EXCEPTION: Step 27a1 describes behaviour that depends on UE implementation; the "lower case letter" identifies a step sequence that takes place if the UE has user data pending.

    //@siclog "Step 27a1" siclog@
    //IF the UE has user data pending THEN the UE loop backs the IP packet received in step 10C on the DRB associated with the default EPS bearer context on Cell 11.
    t_Wait.start(10.0);  //@sic R5s100315 & R5-104265 sic@

    v_RrcMsgReceived := false; //@sic R5s100315 & R5-104145 sic@
    v_DataPduReceived := false; //@sic R5s100315 & R5-104145 sic@
    alt { //@sic R5s100315 & R5-104145 sic@
      [not v_DataPduReceived] DRB.receive ( car_DRB_COMMON_IND_PDCP_SDUList ( eutra_Cell11,
                                                                              tsc_RbId_DRB1,
                                                                              ?,
                                                                              { crs_IPv4_AnyIcmpEchoReply_1 ( px_IPv4_Address, px_IPv4_Address ) } ) )
        {
          if (not v_RrcMsgReceived) {
            v_DataPduReceived := true;
            repeat;
          }
        }
      [not v_RrcMsgReceived] SRB.receive ( car_SRB1_RrcPdu_IND ( eutra_Cell11,
                                                                 cr_508_RRCConnectionReconfigurationComplete ( tsc_RRC_TI_Def ) ) )
        {
          if (not v_DataPduReceived) {
            v_RrcMsgReceived := true;
            repeat;
          }
        }
      [] t_Wait.timeout
        {
          if (not v_RrcMsgReceived) {
            f_EUTRA_SetVerdictFailOrInconc(__FILE__, __LINE__, "Test Case 8.1.2.5 Step 26 or 27a");
          }
        }
    }
    t_Wait.stop; //@sic R5s100315 & R5-104265 sic@

    f_EUTRA_TestBody_Set ( false );

    //Switch off UE and expect Detach Request
    f_EUTRA_Postamble ( eutra_Cell11, E3_TESTMODE );
  }


  /*
   * @desc      REFERENCE TS 36.523-1 clause 8.1.2.7
   * @status    APPROVED
   */
  function f_TC_8_1_2_7_EUTRA() runs on EUTRA_PTC
  { /*  RRC Connection Establishment: 0% access probability for AC 0..9, AC 10 is barred, AC 11..15 are not barred, access for UE with the access class is in the range 11..15 is allowed. */

    var SRB_COMMON_IND v_ReceivedAsp;
    var template (value) CellPowerList_Type v_CellPowerList_AtT0, v_CellPowerList_AtT1;
    var EUTRA_SecurityParams_Type v_AuthParams;
    var O4_Type v_NasCountUL;
    var NAS_KsiValue v_KsiValue;
    var template (value) EUTRA_FDD_TDD_CellInfo_Type v_EUTRA_FDD_TDD_Info;
    var template (value) PhysicalConfigDedicated_AntennaInfo_Type v_AntennaInfo;

    f_EUTRA_Init ( c1 );

    //Get FDD or TDD mode from Cell-configuration
    v_EUTRA_FDD_TDD_Info := f_EUTRA_CellInfo_GetFDD_TDD_Info ( eutra_Cell1 );
    v_AntennaInfo := f_EUTRA_CellInfo_GetAntennaInfoDedicated (eutra_Cell1);

    //Set cell powel level for cell 1 and 11 to be used at creation
    f_EUTRA_CellInfo_InitMaxReferencePower ( eutra_Cell11, -79 );

    //Set Sys info for cell 1 and 11 to be used at creation
    f_EUTRA_CellInfo_SetSysInfo_AccessBarring ( eutra_Cell1,  cs_AccessBarringInformation_TC_8_1_2_7 );
    f_EUTRA_CellInfo_SetSysInfo_AccessBarring ( eutra_Cell11, cs_AccessBarringInformation_TC_8_1_2_7 );

    //Create and configure cells
    f_EUTRA_CellConfig_Def ( eutra_Cell1 );
    f_EUTRA_CellConfig_Def ( eutra_Cell11 ); //@sic R5s100317 sic@

    f_UT_USIM_Insert ( UT, "USIM set as Type C in 34.108 section 8.3.2.15" ); //@sic R5s100466 @sic

    // The UE is in state Loopback Activated (state 4) with condition UE TEST LOOP MODE B on Cell 1 according to [18].
    f_EUTRA_Preamble ( eutra_Cell1, STATE2A_TESTLOOP_ModeB );
    f_EUTRA_RbEst_Def ( eutra_Cell1 );
    f_EUTRA_CloseUE_TestLoopModeB ( eutra_Cell1, '0A'O );

    //Set initial cell power levels
    v_CellPowerList_AtT0 := {
      cs_CellPower ( eutra_Cell11, -91 )
    };

    f_EUTRA_SetCellPowerList ( v_CellPowerList_AtT0, cs_TimingInfo_Now );

    f_EUTRA_TestBody_Set ( true );
    
    //@siclog "Step 0" siclog@
    //Step 0: The SS transmits one IP packet to the UE on the DRB associated with the default EPS bearer context on Cell 1.
    DRB.send ( cas_DRB_COMMON_REQ_PDCP_SDU(eutra_Cell1, tsc_RbId_DRB1, cs_TimingInfo_Now, {crs_IPv4_AnyIcmpEchoReply_1(px_IPv4_RemoteAddress, px_IPv4_Address)}));
    
    //@siclog "Step 0A" siclog@
    //Wait for 1 s after the IP packet has been transmitted in step 0. (Note 1)
    f_Delay(1.0);

    //@siclog "Step 1" siclog@
    //The SS transmits an RRCConnectionRelease message on Cell 1.
    f_EUTRA_RRC_ConnectionRelease ( eutra_Cell1, tsc_RRC_TI_Def, other );

    v_AuthParams := f_EUTRA_Security_Get(); //@sic R5s100317 sic@

    //@siclog "Step 2" siclog@
    //Check: Does the UE transmit an RRCConnectionRequest message on the Cell 1?
    v_KsiValue := f_EUTRA_SecurityKSIasme_Get ( );
    SRB.receive( car_SRB0_RrcPdu_IND( eutra_Cell1, cr_RRCConnectionRequest ( cr_EstablishmentCause_MoData ) ) );
    f_EUTRA_PreliminaryPass(__FILE__, __LINE__, "Test Case 8.1.2.7 Step 2");

    //@siclog "Step 3" siclog@
    //The SS transmits an RRCConnectionSetup message on Cell 1.
    f_EUTRA_RRC_ConnectionSetup_Def ( eutra_Cell1,
                                      cs_TimingInfo_Now,
                                      tsc_RRC_TI_Def );

    //@siclog "Step 3A" siclog@
    //The UE transmits an RRCConnectionSetupComplete message on Cell 1. This message includes a SERVICE REQUEST message.
    SRB.receive ( car_SRB1_RrcNasPdu_IND ( eutra_Cell1,
                                           cr_508_RRCConnectionSetupComplete ( tsc_RRC_TI_Def, ? ),
                                           cr_NAS_Indication ( tsc_SHT_IntegrityProtected,
                                                               cr_508_SERVICE_REQUEST ( v_KsiValue ) ) ) ) -> value v_ReceivedAsp;

    v_NasCountUL := v_ReceivedAsp.Signalling.Nas[0].SecurityProtection.NasCount;

    //@siclog "Step 3B" siclog@
    //The SS transmits a SecurityModeCommand message on Cell 1.
    //@siclog "Step 3C" siclog@
    //The UE transmits a SecurityModeComplete message on Cell 1.
    v_AuthParams := f_EUTRA_Authentication_InitAS ( v_AuthParams, v_NasCountUL );    // Is this extra - as this is also executed inside f_EUTRA_RRC_ActivateSecurity
    v_AuthParams := f_EUTRA_RRC_ActivateSecurity ( eutra_Cell1, v_AuthParams, v_NasCountUL );
    f_EUTRA_Security_Set ( v_AuthParams );

    //@siclog "Step 3D" siclog@
    //The SS transmits an RRCConnectionReconfiguration message on Cell 1.
    SRB.send ( cas_SRB1_RrcPdu_REQ ( eutra_Cell1,
                                     cs_TimingInfo_Now,
                                     cs_RRCConnectionReconfiguration_SRB2_1AM_DRB_Est ( tsc_RRC_TI_Def,
                                                                                        v_EUTRA_FDD_TDD_Info.cqi_ReportConfig,
                                                                                        v_EUTRA_FDD_TDD_Info.soundingRS_UL_Config,
                                                                                        v_AntennaInfo ) ) );
    
    //@siclog "Step 3E - 3EA" siclog@
    //The UE transmits an RRCConnectionReconfigurationComplete message on Cell 1.
    //UE loop backs the IP packet received in step 0 on the DRB associated with the default EPS bearer context on Cell 1.
    interleave { //@sic R5s100317 & R5-104130 sic@
      [] SRB.receive ( car_SRB1_RrcPdu_IND ( eutra_Cell1, cr_508_RRCConnectionReconfigurationComplete ( tsc_RRC_TI_Def ) ) ) {}
       
      [] DRB.receive (car_DRB_COMMON_IND_PDCP_SDUList(eutra_Cell1, tsc_RbId_DRB1, ?, {crs_IPv4_AnyIcmpEchoReply_1(px_IPv4_RemoteAddress, px_IPv4_Address)})) {}
    }

    //@siclog "Step 3F" siclog@
    //The SS transmits an RRCConnectionRelease message on Cell 1.
    f_EUTRA_RRC_ConnectionRelease ( eutra_Cell1, tsc_RRC_TI_Def, other );

    //@siclog "Step 3G" siclog@
    //Wait for 5 s for the UE to enter E-UTRA RRC_IDLE state.
    f_Delay(5.0);

    //@siclog "Step 4" siclog@
    //The SS changes Cell 1 and Cell 11 level according to the row "T1" in table 8.1.2.7.3.2-1.
    v_CellPowerList_AtT1 := {
      cs_CellPower ( eutra_Cell11, -79 )
    };
    f_EUTRA_SetCellPowerList ( v_CellPowerList_AtT1, cs_TimingInfo_Now );

    //@siclog "Step 4A" siclog@
    //Check: Does the test result of generic test procedure in TS 36.508 subclause 6.4.2.7 indicate that the UE is camped on E-UTRAN Cell 11?
    //NOTE: The UE performs a TAU procedure and the RRC connection is released.
    f_EUTRA_508CheckCampOnNewEutraCell ( eutra_Cell11 );

    //@siclog "Step 5" siclog@
    //Wait for 5 s for the UE to enter E-UTRA RRC_IDLE state.
    f_Delay (f_EUTRA_SetTimerToleranceMax ( eutra_Cell11, 5.0 ));

    //@siclog "Step 6" siclog@
    //Check: Does the test result of generic test procedure in TS 36.508 subclause 6.4.2.2 indicate that the UE is in E-UTRA RRC_IDLE state on Cell 11?
    f_EUTRA_508Check_IdleState ( eutra_Cell11 );

    f_EUTRA_TestBody_Set ( false );

    //Switch off UE and expect Detach Request
    f_EUTRA_Postamble ( eutra_Cell11, E1_IDLE );

    f_UT_USIM_Remove ( UT ); //@sic R5s100466 @sic
    f_UT_USIM_Insert ( UT, "Default USIM" ); //@sic R5s100466 @sic
  }

  function f_TC_8_1_2_8_EUTRA() runs on EUTRA_PTC
  { /* RRC Connection Establishment: range of access baring time */

    var GutiParameters_Type v_GutiParameters;
    timer t_Wait;

    f_EUTRA_Init ( c1 );

    v_GutiParameters := f_EUTRA_CellInfo_GetGuti ( eutra_Cell1 );

    //Create and configure cell
    f_EUTRA_CellConfig_Def ( eutra_Cell1 );

    /* Preamble to enter UE in E-UTRA RRC_IDLE (state 2) */
    f_EUTRA_Preamble (eutra_Cell1, STATE2_IDLEUPDATE);

    f_EUTRA_TestBody_Set ( true );

    //@siclog "Step 1" siclog@
    //The SS transmits a Paging message including a systemInfoModification.
    //@siclog "Step 2" siclog@
    //The SS changes SystemInformationBlockType2 parameters to 0% access probability for MO calls.
    f_EUTRA_CellInfo_SetSysInfo_AccessBarring ( eutra_Cell1, cs_AccessBarringInformation_TC_8_1_2_8 );   // Is this correct order to implement these steps?
    f_EUTRA_ModifySysinfo ( eutra_Cell1);

    //@siclog "Step 3" siclog@
    //Wait for 15 s for the UE to receive system information.
    f_Delay (f_EUTRA_SetTimerToleranceMax ( eutra_Cell1, 15.0 ));

    //@siclog "Step 5" siclog@
    //Make the UE initiate an outgoing call.
    f_UT_RequestActivateDedicatedBearer (UT, hex2int(tsc_EpsDedicatedBearerId), hex2int(tsc_EpsDefaultBearerId), cs_508_EPS_QoS_Dedicated_1, cs_508_Tft_Dedicated_1);

    //@siclog "Step 5a" siclog@
    //The UE does not transmit any RRCConnectionRequest message within 5 s (The UE starts T303) (NOTE 2)

    //@siclog "Step 6" siclog@
    //Make the UE initiate an outgoing call.
    f_UT_RequestActivateDedicatedBearer (UT, hex2int(tsc_EpsDedicatedBearerId), hex2int(tsc_EpsDefaultBearerId), cs_508_EPS_QoS_Dedicated_1, cs_508_Tft_Dedicated_1);

    //@siclog "Step 7" siclog@
    //Check: Does the UE transmit an RRCConnectionRequest message within 5 s?
    t_Wait.start(f_EUTRA_SetTimerToleranceMax ( eutra_Cell1, 5.0 ));
    alt {
      [] t_Wait.timeout { }
      [] SRB.receive( car_SRB0_RrcPdu_IND( eutra_Cell1,
                                             cr_RRCConnectionRequest ( cr_EstablishmentCause_Any ) ) )
        {
          f_EUTRA_SetVerdictFailOrInconc(__FILE__, __LINE__, "Test Case 8.1.2.8 Step 7");
          t_Wait.stop;
        }
    }
 
    //@siclog "Step 8" siclog@
    //Wait for 20s to ensure that T303 expires.
    t_Wait.start(f_EUTRA_SetTimerToleranceMax ( eutra_Cell1, 20.0 ));

    //@siclog "Step 9" siclog@
    //The SS transmits a Paging message including a systemInfoModification.
    //@siclog "Step 10" siclog@
    //The SS changes SystemInformationBlockType2 parameters to default values. (Note 4)
    f_EUTRA_ChangeSystemInformation_ToDefault ( eutra_Cell1 );
    f_EUTRA_ModifySysinfo ( eutra_Cell1);

    //@siclog "Step 11" siclog@
    //Wait for 15 s for the UE to receive system information.
    f_Delay (f_EUTRA_SetTimerToleranceMax ( eutra_Cell1, 15.0 ));

    //@siclog "Step 12" siclog@
    //Make the UE initiate an outgoing call.
    f_UT_RequestActivateDedicatedBearer (UT, hex2int(tsc_EpsDedicatedBearerId), hex2int(tsc_EpsDefaultBearerId), cs_508_EPS_QoS_Dedicated_1, cs_508_Tft_Dedicated_1);

    //@siclog "Step 13" siclog@
    //Check: Does the UE transmit an RRCConnectionRequest message. (The UE starts T300)(NOTE 1)?
    SRB.receive( car_SRB0_RrcPdu_IND( eutra_Cell1,
                                      cr_RRCConnectionRequest ( cr_EstablishmentCause_MoData ) ) );
    f_EUTRA_PreliminaryPass(__FILE__, __LINE__, "Test Case 8.1.2.8 Step 13");

    //@siclog "Step 14 - 22" siclog@
    //Steps 3 to 11 of the generic test procedure in TS 36.508 [18] subclause 6.4.2.2 are performed on Cell1
    f_EUTRA_ServiceRequestAndActivate_SRB2_DRB ( eutra_Cell1,
                                                 0,
                                                 0,
                                                 omit,
                                                 omit,
                                                 omit,
                                                 omit,
                                                 omit,
                                                 true );

    f_EUTRA_RRC_ConnectionRelease(eutra_Cell1, tsc_RRC_TI_Def, other);
    f_EUTRA_PreliminaryPass (__FILE__, __LINE__, "508Check IdleState");

    f_EUTRA_TestBody_Set ( false );

    //Switch off UE and expect Detach Request
    f_EUTRA_Postamble ( eutra_Cell1, E1_IDLE );
  }

}
