/******************************************************************************/
// @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-06 00:31:38 +0200 (Mon, 06 Sep 2010) $
// $Rev: 3815 $
/******************************************************************************/

module EUTRA_RRC_Templates {
  import from EUTRA_RRC_ASN1_Definitions language "ASN.1:1997" all;
  import from EUTRA_CommonDefs all;
  import from EUTRA_DRB_Templates all;
  import from CommonDefs all;
  import from Parameters all;

  //****************************************************************************
  // Auxilliary templates
  //----------------------------------------------------------------------------

  template EstablishmentCause cr_EstablishmentCause_Any := ?;                               /* @status    APPROVED */
  template EstablishmentCause cr_EstablishmentCause_MoData := mo_Data;                      /* @status    APPROVED */
  template EstablishmentCause cr_EstablishmentCause_mt_Access := mt_Access;                 /* @status    APPROVED */
  template EstablishmentCause cr_EstablishmentCause_MoSignalling := mo_Signalling;          /* @status    APPROVED */
  template ReestablishmentCause cr_ReestablishmentCause_Any := ?;                           /* @status    APPROVED */
  template ReestablishmentCause cr_ReestablishmentCause_OtherFailure := otherFailure;       /* @status    APPROVED */
  template ReestablishmentCause cr_ReestablishmentCause_HandoverFailure := handoverFailure; /* @status    APPROVED */

  //****************************************************************************
  // RLC configuration  (36.331 cl. 6.3.2)
  //----------------------------------------------------------------------------
  // Common templates for SRBs (SS configuration and peer-to-peer signalling)

  template (value) UL_AM_RLC cs_TX_AM_RLC_SRB1_Def :=
  { /* for the UE the tx direction is the UL, for SS it is the DL;
       Default values as given in 36.331 cl. 9.2.1.1 */
    /* @status    APPROVED */
    t_PollRetransmit := ms45,     /* ms0, ms5, ms10, ms15, ms20, ms25, ms30, ms35, ms40, ms45, ms50, ms55, ms60, ms65, ms70, ms75, ms80,
                                     ms85, ms90, ms95, ms100, ms105, ms110, ms115, ms120, ms125, ms130, ms135, ms140, ms145, ms150, ms155,
                                     ms160, ms165, ms170, ms175, ms180, ms185, ms190, ms195, ms200, ms205, ms210, ms215, ms220, ms225,
                                     ms230, ms235, ms240, ms245, ms250, ms300, ms350, ms400, ms450, ms500 */
    pollPDU := pInfinity,         /* p4, p8, p16, p32, p128, p256, p384, pInfinity */
    pollByte := kBinfinity,       /* kB25, kB50, kB75, kB100, kB125, kB250, kB375,
                                     kB500, kB750, kB1000, kB1250, kB1500, kB2000,
                                     kB3000, kBinfinity, spare1 */
    maxRetxThreshold := t4        /* t1, t2, t3, t4, t6, t8, t16, t32 */
  };

  template (value) UL_AM_RLC cs_TX_AM_RLC_SRB2_Def := cs_TX_AM_RLC_SRB1_Def;  /* @status    APPROVED */

  template (value) DL_AM_RLC cs_RX_AM_RLC_SRB1_Def :=
  { /* for the UE the rx direction is the DL, for SS it is the UL
       see default values as given in 36.331 cl. 9.2.1.1 */
    /* @status    APPROVED */
    t_Reordering := ms35,          /* ms0, ms5, ms10, ms15, ms20, ms25, ms30, ms35, ms40, ms45, ms50, ms55, ms60, ms65, ms70, ms75, ms80,
                                      ms85, ms90, ms95, ms100, ms110, ms120, ms130, ms140, ms150, ms160, ms170, ms180, ms190, ms200 */
    t_StatusProhibit := ms0        /* ms0, ms5, ms10, ms15, ms20, ms25, ms30, ms35, ms40, ms45, ms50, ms55, ms60, ms65, ms70,ms75, ms80,
                                      ms85, ms90, ms95, ms100, ms105, ms110, ms115, ms120, ms125, ms130, ms135, ms140, ms145, ms150, ms155,
                                      ms160, ms165, ms170, ms175, ms180, ms185, ms190, ms195, ms200, ms205, ms210, ms215, ms220, ms225,
                                      ((ms230, ms235, ms240, ms245, ms250, ms300, ms350, ms400, ms450, ms500 */
  };

  template (value) DL_AM_RLC cs_RX_AM_RLC_SRB2_Def := cs_RX_AM_RLC_SRB1_Def;  /* @status    APPROVED */

  //----------------------------------------------------------------------------
  // RLC_Config for SRBs (36.331 cl. 6.3.2)

  template (value) RLC_Config cs_RLC_Configuration_SRB1_Default :=
  {
    am := {
      ul_AM_RLC := cs_TX_AM_RLC_SRB1_Def,
      dl_AM_RLC := cs_RX_AM_RLC_SRB1_Def
    }
  };

  template (value) RLC_Config cs_RLC_Configuration_SRB2_Default :=
  {
    am := {
      ul_AM_RLC := cs_TX_AM_RLC_SRB2_Def,
      dl_AM_RLC := cs_RX_AM_RLC_SRB2_Def
    }
  };

  //****************************************************************************
  // Transport channel configuration (36.331 cl. 6.3.2)
  //----------------------------------------------------------------------------

  template (value) UL_SCH_Config_Type cs_508_UL_SCH_Config :=
  { /* @status    APPROVED */
    maxHARQ_Tx := n5,
    periodicBSR_Timer := sf20,
    retxBSR_Timer := sf320,
    ttiBundling := false
  };

  template (value) DRX_Config cs_508_DRX_Config_Release :=
  { /* @desc To be used when no DRX is to be configured in SS and when DRX is released at UE */
    release := NULL
  };

  template (value) DRX_Config cs_508_DRX_Config_DrxS :=
  { /* Default values according to 36.508 cl. 4.8.2.1.5 Table 4.8.2.1.5-1 (using condition DRX_S) */
    /* @status    APPROVED */
    setup := {
      onDurationTimer := psf2,
      drx_InactivityTimer := psf100,
      drx_RetransmissionTimer := psf16,
      longDRX_CycleStartOffset := {
        sf40 := 0
      },
      shortDRX := omit
    }
  };

  template (value) DRX_Config cds_508_DRX_Config_DrxS_L2 modifies cs_508_DRX_Config_DrxS :=
  { /* @sic R5-101178 sic@ */
    /* @status    APPROVED */
    setup := {
      drx_InactivityTimer := psf200
    }
  };

  template (value) DRX_Config cs_508_DRX_Config_DrxL :=
  { /* Default values according to 36.508 cl. 4.8.2.1.5 Table 4.8.2.1.5-1 (using condition DRX_L) */
    /* @status    APPROVED */
    setup := {
      onDurationTimer := psf6,
      drx_InactivityTimer := psf1920,
      drx_RetransmissionTimer := psf16,
      longDRX_CycleStartOffset := {
        sf1280 := 0
      },
      shortDRX := omit
    }
  };

  template (value) MAC_MainConfig cs_508_MAC_MainConfig_RBC(template (omit) DRX_Config p_DRX_Config) :=
  { /* Default values according to 36.508 cl. 4.8.2.1.5 Table 4.8.2.1.5-1 */
    /* @status    APPROVED */
    ul_SCH_Config := cs_508_UL_SCH_Config,
    drx_Config := p_DRX_Config,
    timeAlignmentTimerDedicated := sf750,
    phr_Config := {
      setup := {
        periodicPHR_Timer := sf500,
        prohibitPHR_Timer := sf200,
        dl_PathlossChange := dB3
      }
    }
  };

  template (value) MAC_MainConfig cs_508_MAC_MainConfig_SRB :=
  { /* Default values according to 36.508 cl. 4.8.2.1.5 Table 4.8.2.1.5-2 */
    /* @status    APPROVED */
    ul_SCH_Config := cs_508_UL_SCH_Config,
    drx_Config := { release := NULL },
    timeAlignmentTimerDedicated := sf750,
    phr_Config := {
      setup := {
        periodicPHR_Timer := sf500,
        prohibitPHR_Timer := sf200,
        dl_PathlossChange := dB3
      }
    }
  };

  template (value) MAC_MainConfig_Type cs_508_MAC_MainConfig_Explicit_RBC_DrxL :=
  { /* Depending on PICS pc_FeatrGrp_5 function returns:
       pc_FeatrGrp_5 supported: DRX_L
       pc_FeatrGrp_5 not supported: DRX not configured/released */
    /* @status    APPROVED */
    explicitValue := cs_508_MAC_MainConfig_RBC(f_GetUeDrxConfig(DRX_L))
  };

  template (value) MAC_MainConfig_Type cs_508_MAC_MainConfig_Explicit_RBC_DrxS :=
  { /* Depending on PICS pc_FeatrGrp_5 function returns:
       pc_FeatrGrp_5 supported: DRX_S
       pc_FeatrGrp_5 not supported: DRX not configured/released */
    /* @status    APPROVED */
    explicitValue := cs_508_MAC_MainConfig_RBC(f_GetUeDrxConfig(DRX_S))
  };

  template (value) MAC_MainConfig_Type cs_508_MAC_MainConfig_Explicit_RBC_DrxS_L2 :=
  { /* @sic R5-101178 sic@ */
    /* @status    APPROVED */
    explicitValue := cs_508_MAC_MainConfig_RBC(f_GetUeDrxConfig(DRX_S_L2))
  };

  template (value) MAC_MainConfig_Type cs_MAC_MainConfig_SRB1 :=
  { /* @status    APPROVED */
    explicitValue := cs_508_MAC_MainConfig_SRB
  };

  //--------------------------------------------------------
  /*
   * @desc      Returns the DRX-Configuration to be used by UE according to 36.508 Table 4.8.2.1.5-1: MAC-MainConfig-RBC
   * @param     p_DrxConfigurationCondition
   * @return    template (omit) DRX_Config
   * @status    APPROVED
   */
  function f_GetUeDrxConfig(DrxConfigurationCondition_Type p_DrxConfigurationCondition) return template (omit) DRX_Config
  {
    var template (omit) DRX_Config v_Drx_Config;

    if (pc_FeatrGrp_5) {
      select (p_DrxConfigurationCondition) {
        case (DRX_L){
          //Configure DRX parameters with condition DRX_L
          v_Drx_Config := cs_508_DRX_Config_DrxL;
          /* DRX_L is the default condition in Idle Updated (No UM bearer(s) configured).
             Reference 36.508 Table 4.6.3-16: RadioResourceConfigDedicated-SRB2-DRB(n,m) */
        }
        case (DRX_S) {
          //Configure DRX parameters with condition DRX_S according to 36.508 Table 4.8.2.1.5-1: MAC-MainConfig-RBC
          v_Drx_Config := cs_508_DRX_Config_DrxS;
        }
        case (DRX_S_L2) { /* @sic R5-101178 sic@ */
          //Configure DRX parameters with condition DRX_S according to 36.508 Table 4.8.2.1.5-1: MAC-MainConfig-RBC but with drx_InactivityTimer := psf200
          v_Drx_Config := cds_508_DRX_Config_DrxS_L2;
        }
        case else {
          FatalError (__FILE__, __LINE__, "DRX Configuration condition not recognised");
        }
      }
    }
    else {
      //If UE does not support pc_FeatrGrp_5 ( Long DRX cycle ) DRX is not configured in the default configuration
      v_Drx_Config := omit;
    }
    return v_Drx_Config;
  };

  //****************************************************************************
  // Physical Layer configuration  (36.508 cl. 4.8.2.1.6)
  //----------------------------------------------------------------------------

  template (value) PDSCH_ConfigDedicated cs_508_PDSCH_ConfigDedicated_Default :=
  { /* Default values according to 36.508 cl. 4.6.3 Table 4.6.3-6 */
    /* @status    APPROVED */
    p_a := dB_3 // @sic R5-100261 sic@
  };

  template (value) PUSCH_ConfigDedicated cs_508_PUSCH_ConfigDedicated_Default :=
  { /* Default values according to 36.508 cl. 4.6.3 Table 4.6.3-11 */
    /* @status    APPROVED */
    betaOffset_ACK_Index := 9,
    betaOffset_RI_Index  := 6,
    betaOffset_CQI_Index := 6
  };

  template (value) UplinkPowerControlDedicated cs_508_UplinkPowerControlDedicated_Default :=
  { /* Default values according to 36.508 cl. 4.6.3 Table 4.6.3-26 */
    /* @status    APPROVED */
    p0_UE_PUSCH := 0,
    deltaMCS_Enabled := en0,
    accumulationEnabled := true,
    p0_UE_PUCCH := 0,
    pSRS_Offset := 3,
    filterCoefficient := fc4
  };

  template (value) TPC_PDCCH_Config cs_508_TPC_PDCCH_Config_Default_PUCCH :=
  { /* Defaule values according to 36.508 cl. 4.6.3 Table 4.6.3-24 (using condition PUCCH) */
    /* @status    APPROVED */
    setup := {
      tpc_RNTI := hex2bit('03FF'H),
      tpc_Index := {
        indexOfFormat3 := 1
      }
    }
  };

  template (value) TPC_PDCCH_Config cs_508_TPC_PDCCH_Config_Default_PUSCH :=
  { /* Defaule values according to 36.508 cl. 4.6.3 Table 4.6.3-24 (using condition PUSCH) */
    /* @status    APPROVED */
    setup := {
      tpc_RNTI := hex2bit('01FA'H),
      tpc_Index := {
        indexOfFormat3 := 1
      }
    }
  };

  template (value) CQI_ReportConfig cs_508_CQI_ReportConfig_Default(template (omit) CQI_ReportPeriodic p_CQI_ReportingPeriodic) :=
  { /* Default values according to 36.508 cl. 4.6.3 Table 4.6.3-2 */
    /* @status    APPROVED */
    cqi_ReportModeAperiodic := rm30,
    nomPDSCH_RS_EPRE_Offset := 0,
    cqi_ReportPeriodic := p_CQI_ReportingPeriodic
  };

  template (value) SchedulingRequestConfig cs_508_SchedulingRequest_Config_Default(SR_PUCCH_ResourceIndex_Type p_SR_PUCCH_ResourceIndex,
                                                                                   SR_ConfigIndex_Type p_SR_ConfigIndex,    // @sic R5-102177 sic@
                                                                                   Dsr_TransMax_Type p_Dsr_TransMax := n4) :=
  { /* Default values according to 36.508 cl. 4.6.3 Table 4.6.3-20 */
    /* @status    APPROVED */
    setup := {
      sr_PUCCH_ResourceIndex := p_SR_PUCCH_ResourceIndex,   // @sic R5s090312 sic@
      sr_ConfigIndex := p_SR_ConfigIndex,  // @sic R5-102177 sic@
      dsr_TransMax := p_Dsr_TransMax
    }
  };

  template (value) PhysicalConfigDedicated cs_508_PhysicalConfigDedicated_Default_RBC(template (omit) CQI_ReportPeriodic p_CQI_ReportingPeriodic,
                                                                                      template (omit) SoundingRS_UL_ConfigDedicated p_SoundingRsUl_ConfigDedicated,
                                                                                      template (value) PhysicalConfigDedicated_AntennaInfo_Type p_AntennaInfo  // @sic R5-100786 sic@
                                                                                      ) :=
  { /* Defaule values according to 36.508 cl. 4.8.2.1.6 Table 4.8.2.1.6-1 */
    /* @status    APPROVED */
    pdsch_ConfigDedicated := omit,
    pucch_ConfigDedicated := omit,
    pusch_ConfigDedicated := omit,
    uplinkPowerControlDedicated := omit,
    tpc_PDCCH_ConfigPUCCH := cs_508_TPC_PDCCH_Config_Default_PUCCH,
    tpc_PDCCH_ConfigPUSCH := cs_508_TPC_PDCCH_Config_Default_PUSCH,
    cqi_ReportConfig := cs_508_CQI_ReportConfig_Default(p_CQI_ReportingPeriodic),
    soundingRS_UL_ConfigDedicated := p_SoundingRsUl_ConfigDedicated,
    antennaInfo := p_AntennaInfo,  // @sic R5-100786 sic@
    schedulingRequestConfig := omit
  };

  template (value) PhysicalConfigDedicated cds_508_PhysicalConfigDedicated_Default_RBC_HO ( template (omit) CQI_ReportPeriodic p_CQI_ReportingPeriodic,
                                                                                            template (omit) SoundingRS_UL_ConfigDedicated p_SoundingRsUl_ConfigDedicated,
                                                                                            template (value) PhysicalConfigDedicated_AntennaInfo_Type p_AntennaInfo,
                                                                                            SR_PUCCH_ResourceIndex_Type p_SR_PUCCH_ResourceIndex,
                                                                                            SR_ConfigIndex_Type p_SR_ConfigIndex
                                                                                            )
    modifies cs_508_PhysicalConfigDedicated_Default_RBC :=
  { /* Defaule values according to 36.508 cl. 4.8.2.1.6 Table 4.8.2.1.6-1 using condition RBC-HO */
    /* @status    APPROVED */
    /* @sic R5s100256: addtional change sic@ */
    schedulingRequestConfig := cs_508_SchedulingRequest_Config_Default(p_SR_PUCCH_ResourceIndex, p_SR_ConfigIndex)
  };

  template (value) PhysicalConfigDedicated cs_508_PhysicalConfigDedicated_Default_SRB1(template (value) PUCCH_ConfigDedicated p_PUCCH_ConfigDedicated,
                                                                                       SR_PUCCH_ResourceIndex_Type p_SR_PUCCH_ResourceIndex,    // @sic R5s090312 sic@
                                                                                       template (value) PhysicalConfigDedicated_AntennaInfo_Type p_AntennaInfo,   // @sic R5-100786 sic@
                                                                                       SR_ConfigIndex_Type p_SR_ConfigIndex    // @sic R5-102177 sic@
                                                                                       ) :=
  { /* Default values according to 36.508 cl. 4.8.2.1.6 Table 4.8.2.1.6-1 */
    /* @status    APPROVED */
    pdsch_ConfigDedicated := cs_508_PDSCH_ConfigDedicated_Default,
    pucch_ConfigDedicated := p_PUCCH_ConfigDedicated,
    pusch_ConfigDedicated := cs_508_PUSCH_ConfigDedicated_Default,
    uplinkPowerControlDedicated := cs_508_UplinkPowerControlDedicated_Default,
    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) RACH_ConfigDedicated cs_RACH_ConfigDedicated (Ra_PreambleIndex_Type   p_Ra_PreambleIndex := tsc_EUTRA_PrachPreambleIndex_Dedicated_Def,
                                                                 Ra_PRACH_MaskIndex_Type p_Ra_PRACH_MaskIndex := 0) :=
  { /* Value for p_Ra_PreambleIndex arbitrarily selected out of dedicated random access preambles;
       with RACH-ConfigCommon.preambleInfo.numberOfRA-Preambles:=n52 (as signalled by SIB2 or RRCConnectionReconfiguration)
       dedicated random access preambles have index 52..63 (see 36.321 cl. 5.1.1 and 5.1.2);
       Value for ra_PRACH_MaskIndex arbitrarily selected so that PRACH Resource Index 0 is selected */
    /* @sic R5s100138 change 5 sic@ */
    /* @status    APPROVED */
    ra_PreambleIndex    := p_Ra_PreambleIndex,
    ra_PRACH_MaskIndex  := p_Ra_PRACH_MaskIndex
  };

  template (value) PUCCH_ConfigDedicated cs_508_PUCCH_ConfigDedicated_Default_FDD :=
  { /* 36.508 Table 4.6.3-9: PUCCH-ConfigDedicated-DEFAULT */
    /* @status    APPROVED */
    ackNackRepetition := {
      release := NULL
    },
    tdd_AckNackFeedbackMode := omit
  };

  template (value) PUCCH_ConfigDedicated cds_508_PUCCH_ConfigDedicated_Default_TDD
  modifies cs_508_PUCCH_ConfigDedicated_Default_FDD :=
  { /* Default values according to 36.508 Table 4.6.3-9: PUCCH-ConfigDedicated-DEFAULT */
    /* @status    APPROVED */
    tdd_AckNackFeedbackMode := multiplexing
  };

  template (value) SoundingRS_UL_ConfigDedicated cs_508_SoundingRsUl_ConfigDedicated_Default_FDD :=
  { /* 36.508 Table 4.6.3-22: SoundingRsUl-ConfigDedicated-DEFAULT */
    /* @status    APPROVED */
    setup := {
      srs_Bandwidth := bw0,
      srs_HoppingBandwidth := hbw0,
      freqDomainPosition := 0,
      duration := true,
      srs_ConfigIndex := 20,
      transmissionComb := 0,
      cyclicShift := cs0
    }
  };

  template (value) SoundingRS_UL_ConfigDedicated cds_508_SoundingRsUl_ConfigDedicated_Default_TDD
  modifies  cs_508_SoundingRsUl_ConfigDedicated_Default_FDD :=
  { /* Default values according to 36.508 Table 4.6.3-22: SoundingRsUl-ConfigDedicated-DEFAULT */
    /* @status    APPROVED */
    setup := {
      srs_ConfigIndex := 31
    }
  };

  template (value) CQI_ReportPeriodic cs_CQI_ReportingPeriodic_FDD :=
  { /* @status    APPROVED */
    setup := {
      cqi_PUCCH_ResourceIndex := 0,
      cqi_pmi_ConfigIndex := 25,
      cqi_FormatIndicatorPeriodic := {
        widebandCQI := NULL
      },
      ri_ConfigIndex := 483,
      simultaneousAckNackAndCQI := false
    }
  };

  template (value) CQI_ReportPeriodic cds_CQI_ReportingPeriodic_TDD  modifies cs_CQI_ReportingPeriodic_FDD :=
  { /* @status    APPROVED */
    setup := {
      cqi_pmi_ConfigIndex := 24,
      ri_ConfigIndex := 484
    }
  };

  //****************************************************************************
  // Radio Resource configuration (36.331 cl. 6.3.2)
  //----------------------------------------------------------------------------

  template (value) SRB_ToAddMod cs_508_SRB1_ToAddMod_DEFAULT :=
  { /* @status    APPROVED */
    srb_Identity := 1,
    rlc_Config := {
      defaultValue := NULL     /* default values for SRB2 according to cl. 9.2.1.1 */
    },
    logicalChannelConfig := {
      defaultValue := NULL     /* default values for SRB2 according to cl. 9.2.1.1 */
    }
  };

  template (value) SRB_ToAddMod cs_508_SRB2_ToAddMod_DEFAULT :=
  { /* @status    APPROVED */
    srb_Identity := 2,
    rlc_Config := {
      defaultValue := NULL     /* default values for SRB2 according to cl. 9.2.1.2 */
    },
    logicalChannelConfig := {
      defaultValue := NULL     /* default values for SRB2 according to cl. 9.2.1.2 */
    }
  };

  template (value) RadioResourceConfigDedicated cs_508_RadioResourceConfigDedicated_SRB1(template (value) MAC_MainConfig_Type p_MAC_MainConfig,
                                                                                         template (value) PhysicalConfigDedicated p_PhysicalConfigDedicated) :=
  { /* Default value according to 36.508 cl. 4.6.3 Table 4.6.3-15 */
    /* @status    APPROVED */
    srb_ToAddModList := { cs_508_SRB1_ToAddMod_DEFAULT },
    drb_ToAddModList := omit,
    drb_ToReleaseList := omit,
    mac_MainConfig := p_MAC_MainConfig,
    sps_Config := omit,
    physicalConfigDedicated := p_PhysicalConfigDedicated
  };

  template (value) RadioResourceConfigDedicated cs_508_RadioResourceConfigDedicated_Srb2(template (value) DRB_ToAddModList        p_DRB_ToAddModList,
                                                                                         template (value) MAC_MainConfig_Type     p_MAC_MainConfig,
                                                                                         template (value) PhysicalConfigDedicated p_PhysicalConfigDedicated) :=
  { /* Default value according to 36.508 cl. 4.6.3 Table 4.6.3-16 */
    /* @status    APPROVED */
    srb_ToAddModList := { cs_508_SRB2_ToAddMod_DEFAULT },
    drb_ToAddModList := p_DRB_ToAddModList,
    drb_ToReleaseList := omit,
    mac_MainConfig := p_MAC_MainConfig,
    sps_Config := omit,
    physicalConfigDedicated := p_PhysicalConfigDedicated
  };

  template (value) RadioResourceConfigDedicated cs_SRB2_1AM_DRB_Config_Def(template (omit) CQI_ReportPeriodic p_CQI_ReportingPeriodic,
                                                                           template (omit) SoundingRS_UL_ConfigDedicated p_SoundingRsUl_ConfigDedicated,
                                                                           template (value) PhysicalConfigDedicated_AntennaInfo_Type p_AntennaInfo // @sic R5-100786 sic@
                                                                           ) :=
    /* Values according to 36.508 cl. 4.6.3 Table 4.6.3-16 (using condition n=1 & m=0) */
    /* @status    APPROVED */
    cs_508_RadioResourceConfigDedicated_Srb2({ cs_508_DRB_ToAddMod_DEFAULT_AM(tsc_DRB1) },
                                             cs_508_MAC_MainConfig_Explicit_RBC_DrxL,
                                             cs_508_PhysicalConfigDedicated_Default_RBC(p_CQI_ReportingPeriodic, p_SoundingRsUl_ConfigDedicated, p_AntennaInfo));  //@sic R5-100786 sic@


  template (value) RadioResourceConfigDedicated cs_508_RadioResourceConfigDedicated_HO(template (omit) CQI_ReportPeriodic p_CQI_ReportingPeriodic,
                                                                                       template (omit) SoundingRS_UL_ConfigDedicated p_SoundingRsUl_ConfigDedicated,
                                                                                       template (value) PhysicalConfigDedicated_AntennaInfo_Type p_AntennaInfo, // @sic R5-100786 sic@
                                                                                       SR_PUCCH_ResourceIndex_Type p_SR_PUCCH_ResourceIndex, // @sic R5-103678 sic@
                                                                                       SR_ConfigIndex_Type p_SR_ConfigIndex // @sic R5-103678 sic@
                                                                                      ) :=
  { /* Default values according to 36.508 cl. 4.6.3 Table 4.6.3-19 */
    /* @sic R5-103678 sic@ */
    /* @status    APPROVED */
    srb_ToAddModList := omit,
    drb_ToAddModList := omit,
    drb_ToReleaseList := omit,
    mac_MainConfig := omit,
    sps_Config := omit,
    physicalConfigDedicated := cds_508_PhysicalConfigDedicated_Default_RBC_HO ( p_CQI_ReportingPeriodic,
                                                                                p_SoundingRsUl_ConfigDedicated,
                                                                                p_AntennaInfo,
                                                                                p_SR_PUCCH_ResourceIndex, // @sic R5-103678 sic@
                                                                                p_SR_ConfigIndex ) // @sic R5-103678 sic@
  };

  template (value) RadioResourceConfigDedicated cs_508_RadioResourceConfigDedicated_AddAmDrb(DRB_Identity p_DRB_Id) :=
  { /* Values according to 36.508 cl. 4.6.3 Table 4.6.3-17 (using condition n=1 and m=0) */
    /* @status    APPROVED */
    srb_ToAddModList := omit, // Not adding any SRBs at this point
    drb_ToAddModList := { cs_508_DRB_ToAddMod_DEFAULT_AM(p_DRB_Id) },
    drb_ToReleaseList := omit,
    mac_MainConfig := omit,   //Since m=0 (where m represents number of RLC-UM bearers being added
    sps_Config := omit,
    physicalConfigDedicated := omit
  };

  template (value) RadioResourceConfigDedicated cs_RadioResourceConfigDedicated_DRB_Release(DRB_Identity p_DRB_Id) :=
  { /* To release one specific Radio Bearer */
    /* @status    APPROVED */
    srb_ToAddModList := omit,
    drb_ToAddModList := omit,
    drb_ToReleaseList := {p_DRB_Id},
    mac_MainConfig := omit,
    sps_Config := omit,
    physicalConfigDedicated := omit
  };

  template (value) PRACH_Config cs_PRACH_Config_Def(template (value) PRACH_ConfigSIB p_PRACH_Configuration) :=
  { /* as signalled in SIB2 */
    /* @status    APPROVED */
    rootSequenceIndex := p_PRACH_Configuration.rootSequenceIndex,  //INTEGER (0..837)
    prach_ConfigInfo := p_PRACH_Configuration.prach_ConfigInfo
  };

  template (value) RadioResourceConfigCommon cs_RadioResourceConfigCommon_Def(template (value) RACH_ConfigCommon  p_RACH_ConfigCommon,
                                                                              template (value) PRACH_Config p_PRACH_Configuration,
                                                                              template (value) PUSCH_ConfigCommon  p_PUSCH_ConfigCommon,
                                                                              template (value) SoundingRS_UL_ConfigCommon p_SoundingRsUl_ConfigCommon,
                                                                              template (omit) TDD_Config p_Tdd_Configuration,
                                                                              template (omit) AntennaInfoCommon p_AntennaInfoCommon // @sic R5-100786 sic@
                                                                              ) :=
  { /* @status    APPROVED */
    rach_ConfigCommon          := p_RACH_ConfigCommon,      /* @sic R5s100135 sic@ */
    prach_Config               := p_PRACH_Configuration,
    pdsch_ConfigCommon         := omit,
    pusch_ConfigCommon         := p_PUSCH_ConfigCommon,
    phich_Config               := omit,
    pucch_ConfigCommon         := omit,
    soundingRS_UL_ConfigCommon := p_SoundingRsUl_ConfigCommon,
    uplinkPowerControlCommon   := omit,
    antennaInfoCommon          := p_AntennaInfoCommon,  // @sic R5-100786 sic@
    p_Max                      := omit,
    tdd_Config                 := p_Tdd_Configuration,
    ul_CyclicPrefixLength      := len1  //According to 36.508 cl. 4.6.3 Table 4.6.3-13
  };

  //cs_MobilityControlInfo
  template (value) MobilityControlInfo cs_MobilityControlInfo(PhysCellId p_PhysCellId,
                                                              template (omit) CarrierFreqEUTRA      p_EUTRA_CarrierFreq,
                                                              template (omit) CarrierBandwidthEUTRA p_EUTRA_CarrierBandwidth,
                                                              template (omit) integer               p_AdditionalSpectrumEmission,
                                                              MobilityControlInfo.t304              p_T304,
                                                              C_RNTI                                p_C_RNTI,
                                                              template (value) RadioResourceConfigCommon p_RadioResourceConfigCommon,
                                                              template (omit) RACH_ConfigDedicated       p_RACH_ConfigDedicated) :=
  { /* @status    APPROVED */
    targetPhysCellId           := p_PhysCellId,
    carrierFreq                := p_EUTRA_CarrierFreq,
    carrierBandwidth           := p_EUTRA_CarrierBandwidth,
    additionalSpectrumEmission := p_AdditionalSpectrumEmission,
    t304                       := p_T304,
    newUE_Identity             := p_C_RNTI,
    radioResourceConfigCommon  := p_RadioResourceConfigCommon,
    rach_ConfigDedicated       := p_RACH_ConfigDedicated
  };

  //Table 4.6.5-1: MobilityControlInfo-HO
  template (value) MobilityControlInfo cs_508_MobilityControlInfo_HO(PhysCellId p_PhysCellId,
                                                                     template (omit) CarrierFreqEUTRA p_EUTRA_CarrierFreq,
                                                                     C_RNTI p_C_RNTI,
                                                                     template (value) RadioResourceConfigCommon p_RadioResourceConfigCommon) :=
    cs_MobilityControlInfo( p_PhysCellId, p_EUTRA_CarrierFreq, omit, omit, ms1000, p_C_RNTI, p_RadioResourceConfigCommon, omit);

  template (value) CarrierBandwidthEUTRA cs_CarrierBandwidthEUTRA ( Dl_Bandwidth_Type p_Dl_Bandwidth,
                                                                    Ul_Bandwidth_Type p_Ul_Bandwidth ) :=
  { /* @status    APPROVED */
    dl_Bandwidth := p_Dl_Bandwidth,
    ul_Bandwidth := p_Ul_Bandwidth
  };

  //****************************************************************************
  // RECONFIG SRB templates (36.508 cl. 4.6.3)
  //----------------------------------------------------------------------------

  template (value) SRB_ToAddModList cs_508_SRB_ToAddModList_RECONFIG :=
  { /* Defaule values according to 36.508 cl. 4.6.3 Table 4.6.3-22A */
    /* @status    APPROVED */
    {
      srb_Identity := 1,
      rlc_Config := {
        explicitValue := cs_508_RLC_Config_SRB_AM_RECONFIG
      },
      logicalChannelConfig := {
        defaultValue := NULL
      }
    },
    {
      srb_Identity := 2,
      rlc_Config := {
        explicitValue := cs_508_RLC_Config_SRB_AM_RECONFIG
      },
      logicalChannelConfig := {
        defaultValue := NULL
      }
    }
  };

  template (value) RLC_Config cs_508_RLC_Config_SRB_AM_RECONFIG :=
  { /* Default values according to 36.508 cl. 4.6.3 Table 4.6.3-19C */
    /* @status    APPROVED */
    am := {
      ul_AM_RLC := {
        t_PollRetransmit := ms50,
        pollPDU := pInfinity,
        pollByte := kBinfinity,
        maxRetxThreshold := t6
      },
      dl_AM_RLC := {
        t_Reordering := ms40,
        t_StatusProhibit := ms0
      }
    }
  };

  //****************************************************************************
  // Further IEs
  //----------------------------------------------------------------------------

  template (value) SecurityConfigSMC cs_508_SecurityConfig_SMC(IntegrityProtAlgorithm_Type    p_IntegrityProtAlgorithm,
                                                                 CipheringAlgorithm_Type        p_CipheringAlgorithm) :=
  { /* Default values according to 36.508 cl. 4.6.4 Table 4.6.4-2 */
    /* @status    APPROVED */
    securityAlgorithmConfig := {
      cipheringAlgorithm     := p_CipheringAlgorithm,
      integrityProtAlgorithm := p_IntegrityProtAlgorithm
    }
  };

  template (value) SecurityConfigHO cs_SecurityConfigHO_IntraLTE(boolean              p_KeyChangeIndicator,
                                                                 NextHopChainingCount p_NextHopChainingCount) :=
  { /* @status    APPROVED */
    handoverType := {
      intraLTE := {
        securityAlgorithmConfig := omit,
        keyChangeIndicator := p_KeyChangeIndicator,
        nextHopChainingCount := p_NextHopChainingCount
      }
    }
  };

  template (value) SecurityConfigHO cs_508SecurityConfigHO_IntraLTE := cs_SecurityConfigHO_IntraLTE ( false, 0 ); /* @status    APPROVED */
  // As defined in 36.508 cl. 4.6.4 Table 4.6.4-1

  template RegisteredMME cr_RegisteredMME(template PLMN_Identity p_PLMN,
                                          template (present) B16_Type p_MMEGI,
                                          template (present) MMEC p_MMEC) :=
  { /* @status    APPROVED */
    plmn_Identity := p_PLMN,
    mmegi         := p_MMEGI,
    mmec          := p_MMEC
  };
  
  //****************************************************************************
  // Common templates related to system information
  //----------------------------------------------------------------------------

  template (value) PLMN_Identity cs_PLMN_Identity(MCC p_MCC,
                                                  MNC p_MNC) :=
  {
    mcc := p_MCC,
    mnc := p_MNC
  };

  //****************************************************************************
  // Common templates related to antenna information
  //----------------------------------------------------------------------------
    template (value) AntennaInfoCommon cs_AntennaInfoCommon_1Port :=
  { /* @status    APPROVED */
    antennaPortsCount := an1
  };

  template (value) AntennaInfoCommon cs_AntennaInfoCommon_2Port :=
  { /* @status     */
    antennaPortsCount := an2
  };

  template (value) AntennaInfoDedicated cs_AntennaInfoDedicated_Def :=
  { /* @status    APPROVED */
    transmissionMode := tm1,                  /* Transmission modes defined in TS 36.213; tm1: Single-antenna port */
    codebookSubsetRestriction  := omit,       /* omit for tm1 */
    ue_TransmitAntennaSelection := {
      release  := NULL    //  @sic R5s090180 acc. to 36.508 table Table 4.8.2.1.6-1 and 36.331 section 9.2.4. sic@
    }
  };

  template (value) AntennaInfoDedicated cs_AntennaInfoDedicated_2TX :=
  { // acc to 36.508 Table 4.8.2.1.6-1
    transmissionMode := tm3,
    codebookSubsetRestriction  := { n2TxAntenna_tm3:='11'B  },
    ue_TransmitAntennaSelection := {
      release  := NULL
    }
  };
  
  template InitialUE_Identity cr_InitialUE_Identity_Random :=
{ /* @status    APPROVED */
randomValue  := ?
};
  
  template (value) PhysicalConfigDedicated_AntennaInfo_Type cs_PhysicalConfigDedicated_AntennaInfo_Def :=
  { /* @status    APPROVED */
    defaultValue := NULL
  };

  template (value) PhysicalConfigDedicated_AntennaInfo_Type cs_PhysicalConfigDedicated_AntennaInfo_2TX :=
  {
    explicitValue := cs_AntennaInfoDedicated_2TX
  };

  //****************************************************************************
  // RRC peer-to-peer messages
  //----------------------------------------------------------------------------
  // RRCConnectionRequest (36.331 cl. 6.2.2)

  template UL_CCCH_Message cr_RRCConnectionRequest(template (present) EstablishmentCause p_EstablishmentCause) :=
  { /* @status    APPROVED */
    message_ := {
      c1 := {
        rrcConnectionRequest := {
          criticalExtensions := {
            rrcConnectionRequest_r8 := {
              ue_Identity        := ?,
              establishmentCause := p_EstablishmentCause,
              spare              := ?
            }
          }
        }
      }
    }
  };

  /* Default values according to 36.508 cl. 4.6.1 Table 4.6.1-16 */
  template UL_CCCH_Message cr_508_RRCConnectionRequest := cr_RRCConnectionRequest(cr_EstablishmentCause_Any);   /* @status    APPROVED */

  template UL_CCCH_Message cr_RRCConnectionRequest_withSTMSI(template (value) InitialUE_Identity p_InitialUE_Identity,
                                                             template (present) EstablishmentCause p_EstablishmentCause) :=
  {
    message_ := {
      c1 := {
        rrcConnectionRequest := {
          criticalExtensions := {
            rrcConnectionRequest_r8 := {
              ue_Identity        := p_InitialUE_Identity,
              establishmentCause := p_EstablishmentCause,
              spare              := ?
            }
          }
        }
      }
    }
  };

  template UL_CCCH_Message cr_RRCConnectionRequest_withUE_Identity(template (present) InitialUE_Identity p_InitialUE_Identity,
                                                                   template (present) EstablishmentCause p_EstablishmentCause) :=
  { /* @status    APPROVED */
    message_ := {
      c1 := {
        rrcConnectionRequest := {
          criticalExtensions := {
            rrcConnectionRequest_r8 := {
              ue_Identity        := p_InitialUE_Identity,
              establishmentCause := p_EstablishmentCause,
              spare              := ?
            }
          }
        }
      }
    }
  };

  //----------------------------------------------------------------------------
  // RRCConnectionSetup (36.331 cl. 6.2.2)

  template (value) DL_CCCH_Message cs_508_RRCConnectionSetup(RRC_TransactionIdentifier p_RRC_TI,
                                                             template (value) PUCCH_ConfigDedicated p_PUCCH_ConfigDedicated,
                                                             SR_PUCCH_ResourceIndex_Type p_SR_PUCCH_ResourceIndex,   // @sic R5s090312 sic@
                                                             template (value) PhysicalConfigDedicated_AntennaInfo_Type p_AntennaInfo, // @sic R5-100786 sic@
                                                             SR_ConfigIndex_Type p_SR_ConfigIndex    // @sic R5-102177 sic@
                                                             ) :=
  { /* Default values according to 36.508 cl. 4.6.1 Table 4.6.1-17 */
    /* @status    APPROVED */
    message_ := {
      c1 := {
        rrcConnectionSetup := {
          rrc_TransactionIdentifier := p_RRC_TI,
          criticalExtensions := {
            c1 := {
              rrcConnectionSetup_r8 := {
                radioResourceConfigDedicated :=
                cs_508_RadioResourceConfigDedicated_SRB1(cs_MAC_MainConfig_SRB1,
                                                         cs_508_PhysicalConfigDedicated_Default_SRB1(p_PUCCH_ConfigDedicated, p_SR_PUCCH_ResourceIndex, p_AntennaInfo, p_SR_ConfigIndex)),
                nonCriticalExtension := omit
              }
            }
          }
        }
      }
    }
  };

  //----------------------------------------------------------------------------
  // RRCConnectionSetupComplete (36.331 cl. 6.2.2)

  template UL_DCCH_Message cr_508_RRCConnectionSetupComplete(template (present) RRC_TransactionIdentifier p_RRC_TI,
                                                               template (present) DedicatedInfoNAS p_NAS_DedicatedInformation,
                                                               template RegisteredMME p_RegisteredMME := *) :=
  { /* Default values according to 36.508 cl. 4.6.1 Table 4.6.1-18 */
    /* @status    APPROVED */
    message_ := {
      c1 := {
        rrcConnectionSetupComplete := {
          rrc_TransactionIdentifier := p_RRC_TI,
          criticalExtensions := {
            c1 := {
              rrcConnectionSetupComplete_r8 := {
                selectedPLMN_Identity    := 1,    /* 36.331 cl. 6.2.2 selectedPLMN-Identity is the index of selected PLMN from the PLMN-Identity list in SIB1
                                                     In SIB 1 there is only one PLMN acc. to default setting in 36.508 */
                registeredMME            := p_RegisteredMME,
                dedicatedInfoNAS         := p_NAS_DedicatedInformation,
                nonCriticalExtension     := *
              }
            }
          }
        }
      }
    }
  };

  //----------------------------------------------------------------------------
  // SecurityModeCommand (36.331 cl. 6.2.2)

  template (value) DL_DCCH_Message cs_508_SecurityModeCommand(RRC_TransactionIdentifier      p_RRC_TI,
                                                                IntegrityProtAlgorithm_Type    p_IntegrityProtAlgorithm,
                                                                CipheringAlgorithm_Type        p_CipheringAlgorithm) :=
  { /* Default values according to 36.508 cl. 4.6.1 Table 4.6.1-19 */
    /* @status    APPROVED */
    message_ := {
      c1 := {
        securityModeCommand := {
          rrc_TransactionIdentifier := p_RRC_TI,
          criticalExtensions := {
            c1 := {
              securityModeCommand_r8 := {
                securityConfigSMC := cs_508_SecurityConfig_SMC(p_IntegrityProtAlgorithm,
                                                                 p_CipheringAlgorithm),
                nonCriticalExtension := omit
              }
            }
          }
        }
      }
    }
  };

  //----------------------------------------------------------------------------
  // SecurityModeComplete (36.331 cl. 6.2.2)

  template UL_DCCH_Message cr_508_SecurityModeComplete(RRC_TransactionIdentifier p_RRC_TI) :=
  { /* @status    APPROVED */
    message_ := {
      c1 := {
        securityModeComplete := {
          rrc_TransactionIdentifier := p_RRC_TI,
          criticalExtensions := {
            securityModeComplete_r8 := {
              nonCriticalExtension := *
            }
          }
        }
      }
    }
  };

  //----------------------------------------------------------------------------
  // RRCConnectionReconfiguration (36.331 cl. 6.2.2)

  template (value) DL_DCCH_Message cs_RRCConnectionReconfiguration_Common(RRC_TransactionIdentifier p_RRC_TI,
                                                                          template (omit) MeasConfig p_MeasurementConfiguration,
                                                                          template (omit) MobilityControlInfo p_MobilityControlInformation,
                                                                          template (omit) RadioResourceConfigDedicated p_RadioResourceConfigDedicated,
                                                                          template (omit) SecurityConfigHO p_SecurityConfiguration) :=
  { /* @status    APPROVED */
    message_ := {
      c1 := {
        rrcConnectionReconfiguration := {
          rrc_TransactionIdentifier := p_RRC_TI,
          criticalExtensions := {
            c1 := {
              rrcConnectionReconfiguration_r8 := {
                measConfig                   := p_MeasurementConfiguration,
                mobilityControlInfo          := p_MobilityControlInformation,
                dedicatedInfoNASList         := omit,
                radioResourceConfigDedicated := p_RadioResourceConfigDedicated,
                securityConfigHO             := p_SecurityConfiguration,
                nonCriticalExtension         := omit
              }
            }
          }
        }
      }
    }
  };

  template (value) DL_DCCH_Message cs_RRCConnectionReconfiguration_RadioResConfig(RRC_TransactionIdentifier p_RRC_TI,
                                                                                  template (value) RadioResourceConfigDedicated  p_RadioResourceConfigDedicated) :=
    /* @status    APPROVED */
    cs_RRCConnectionReconfiguration_Common(p_RRC_TI,
                                           omit,
                                           omit,
                                           p_RadioResourceConfigDedicated,
                                           omit);

  template (value) DL_DCCH_Message cs_RRCConnectionReconfiguration_SRB2_1AM_DRB_Est(RRC_TransactionIdentifier p_RRC_TI,
                                                                                    template (omit) CQI_ReportPeriodic p_CQI_ReportingPeriodic,
                                                                                    template (omit) SoundingRS_UL_ConfigDedicated p_SoundingRsUl_ConfigDedicated,
                                                                                    template (value) PhysicalConfigDedicated_AntennaInfo_Type p_AntennaInfo // @sic R5-100786 sic@
                                                                                    ) :=
    /* Values according to 36.508 cl. 4.6.1 Table 4.6.1-8 (using condition SRB2-DRB(n, m), where n=1 & m=0) */
    /* @status    APPROVED */
    cs_RRCConnectionReconfiguration_Common(p_RRC_TI,
                                           omit,
                                           omit,
                                           cs_SRB2_1AM_DRB_Config_Def(p_CQI_ReportingPeriodic, p_SoundingRsUl_ConfigDedicated,p_AntennaInfo ),
                                           omit);
  
  template (value) DL_DCCH_Message cs_RRCConnReconfig_Resume_SRB2_DRBs(RRC_TransactionIdentifier                                 p_RRC_TI,
                                                                       template (omit) CQI_ReportPeriodic                        p_CQI_ReportingPeriodic,
                                                                       template (omit) SoundingRS_UL_ConfigDedicated             p_SoundingRsUl_ConfigDedicated,
                                                                       template (value) PhysicalConfigDedicated_AntennaInfo_Type p_AntennaInfo,  // @sic R5-100786 sic@
                                                                       SR_PUCCH_ResourceIndex_Type                               p_SR_PUCCH_ResourceIndex, // @sic R5-103678 sic@
                                                                       SR_ConfigIndex_Type                                       p_SR_ConfigIndex) := // @sic R5-103678 sic@
    /* @status    APPROVED */
    cs_RRCConnectionReconfiguration_Common(p_RRC_TI,
                                           omit,
                                           omit,
                                           cs_508_RadioResourceConfigDedicated_HO(p_CQI_ReportingPeriodic,
                                                                                  p_SoundingRsUl_ConfigDedicated,
                                                                                  p_AntennaInfo,
                                                                                  p_SR_PUCCH_ResourceIndex, // @sic R5-103678 sic@
                                                                                  p_SR_ConfigIndex), // @sic R5-103678 sic@
                                           omit);

  template (value) DL_DCCH_Message cs_RRCConnectionReconfiguration_DRB_Release(RRC_TransactionIdentifier p_RRC_TI,
                                                                               DRB_Identity p_DRB_Id) :=
    /* @status    APPROVED */
    cs_RRCConnectionReconfiguration_Common(p_RRC_TI,
                                           omit,
                                           omit,
                                           cs_RadioResourceConfigDedicated_DRB_Release(p_DRB_Id),
                                           omit);

  //----------------------------------------------------------------------------
  // RRCConnectionReconfiguration Handover section

  //----------------------------------------------------------------------------
  // RRCConnectionReconfigurationComplete (36.331 cl. 6.2.2)
  
  template UL_DCCH_Message cr_508_RRCConnectionReconfigurationComplete(RRC_TransactionIdentifier p_RRC_TI) :=
  { /* @status    APPROVED */
    message_ := {
      c1 := {
        rrcConnectionReconfigurationComplete  := {
          rrc_TransactionIdentifier := p_RRC_TI,
          criticalExtensions := {
            rrcConnectionReconfigurationComplete_r8 := {
              nonCriticalExtension := *
            }
          }
        }
      }
    }
  };

  //----------------------------------------------------------------------------
  // RRCConnectionRelease (36.331 cl. 6.2.2)

  template (value) DL_DCCH_Message cs_RRCConnectionRelease(RRC_TransactionIdentifier p_RRC_TI,
                                                           ReleaseCause p_ReleaseCause,
                                                           template (omit) RedirectedCarrierInfo       p_RedirectionInformation := omit,
                                                           template (omit) IdleModeMobilityControlInfo p_Mobility := omit) :=
  { /* @status    APPROVED */
    /* @sic R5s100348 additional changes sic@ */
    message_ := {
      c1 := {
        rrcConnectionRelease := {
          rrc_TransactionIdentifier := p_RRC_TI,
          criticalExtensions := {
            c1 := {
              rrcConnectionRelease_r8 := {
                releaseCause                := p_ReleaseCause,
                redirectedCarrierInfo       := p_RedirectionInformation,
                idleModeMobilityControlInfo := p_Mobility,
                nonCriticalExtension        := omit
              }
            }
          }
        }
      }
    }
  };

  template (value) RedirectedCarrierInfo cs_RedirectionInfo_UtraFdd ( ARFCN_ValueUTRA p_DL_UARFCN ) := {
    utra_FDD := p_DL_UARFCN
  };

  template (value) RedirectedCarrierInfo cs_RedirectionInfo_UtraTdd ( ARFCN_ValueUTRA p_DL_UARFCN ) := {
    utra_TDD := p_DL_UARFCN
  };

  //----------------------------------------------------------------------------
  // RRCConnectionReestablishmentRequest

  template UL_CCCH_Message cr_508_RRCConnectionReestablishmentRequest(template C_RNTI               p_C_RNTI,
                                                                      template PhysCellId           p_PhysCellId,
                                                                      template ReestablishmentCause p_ReestablishmentCause,
                                                                      template ShortMAC_I           p_ShortMAC_I := ?) :=
  { /*  Default values according to 36.508 cl. 4.6.1 Table 4.6.1-13 */
    /* @status    APPROVED */
    message_ := {
      c1 := {
        rrcConnectionReestablishmentRequest := {
          criticalExtensions := {
            rrcConnectionReestablishmentRequest_r8 := {
              ue_Identity := {
                c_RNTI := p_C_RNTI,
                physCellId := p_PhysCellId,
                shortMAC_I := p_ShortMAC_I
              },
              reestablishmentCause := p_ReestablishmentCause,
              spare := ?
            }
          }
        }
      }
    }
  };

  //----------------------------------------------------------------------------
  // RRCConnectionReestablishment

  template (value) DL_CCCH_Message cs_RRCConnectionReestablishment_Common(RRC_TransactionIdentifier                     p_RRC_TI,
                                                                          template (value) RadioResourceConfigDedicated p_RadioResourceConfigDedicated,
                                                                          NextHopChainingCount                          p_NextHopChainingCount) :=
  { /* @status    APPROVED */
    message_ := {
      c1 := {
        rrcConnectionReestablishment := {
          rrc_TransactionIdentifier := p_RRC_TI,
          criticalExtensions := {
            c1 := {
              rrcConnectionReestablishment_r8 := {
                radioResourceConfigDedicated := p_RadioResourceConfigDedicated,
                nextHopChainingCount := p_NextHopChainingCount,
                nonCriticalExtension := omit
              }
            }
          }
        }
      }
    }
  };
  
  template (value) DL_CCCH_Message cs_508_RRCConnectionReestablishment(RRC_TransactionIdentifier p_RRC_TI,
                                                                       template (value) PUCCH_ConfigDedicated p_PUCCH_ConfigDedicated,
                                                                       SR_PUCCH_ResourceIndex_Type p_SR_PUCCH_ResourceIndex,  // @sic R5s090312 sic@
                                                                       template (value) PhysicalConfigDedicated_AntennaInfo_Type p_AntennaInfo,  // @sic R5-100786 sic@
                                                                       SR_ConfigIndex_Type p_SR_ConfigIndex    // @sic R5-102177
                                                                       ) :=
  /* Default values according to 36.508 cl. 4.6.1 Table 4.6.1-10 */
  /* @status    APPROVED */
    cs_RRCConnectionReestablishment_Common(p_RRC_TI,
                                           cs_508_RadioResourceConfigDedicated_SRB1(cs_MAC_MainConfig_SRB1,
                                                                                    cs_508_PhysicalConfigDedicated_Default_SRB1(p_PUCCH_ConfigDedicated,
                                                                                                                                p_SR_PUCCH_ResourceIndex,
                                                                                                                                p_AntennaInfo,
                                                                                                                                p_SR_ConfigIndex)),
                                           0);
  
  //----------------------------------------------------------------------------
  // RRCConnectionReestablishmentComplete
  
  template UL_DCCH_Message cr_508_RRCConnectionReestablishmentComplete(RRC_TransactionIdentifier p_RRC_TI) :=
  { /* Default values according to 36.508 cl. 4.6.1 Table 4.6.1-11 */
    /* @status    APPROVED */
    message_ := {
      c1 := {
        rrcConnectionReestablishmentComplete := {
          rrc_TransactionIdentifier := p_RRC_TI,
          criticalExtensions := {
            rrcConnectionReestablishmentComplete_r8 := {
              nonCriticalExtension := * // @sic R5s100324 Change 2 sic@
            }
          }
        }
      }
    }
  };

  //----------------------------------------------------------------------------
  // RRCConnectionReestablishmentReject

  template (value) DL_CCCH_Message cs_508_RRCConnectionReestablishmentReject :=
  { /* Default values according to 36.508 cl. 4.6.1-12 */
    /* @status    APPROVED */
    message_ := {
      c1 := {
        rrcConnectionReestablishmentReject := {
          criticalExtensions := {
            rrcConnectionReestablishmentReject_r8 := {
              nonCriticalExtension := omit
            }
          }
        }
      }
    }
  };

  //----------------------------------------------------------------------------
  // RRCConnectionReject

  template (value) DL_CCCH_Message cs_RRCConnectionReject(integer p_WaitTime := 10) :=
  { /* @status    APPROVED */
    message_ := {
      c1 := {
        rrcConnectionReject := {

          criticalExtensions := {
            c1 := {
              rrcConnectionReject_r8 := {
                waitTime := p_WaitTime,
                nonCriticalExtension := omit
              }
            }
          }
        }
      }
    }
  };

  //----------------------------------------------------------------------------
  // UECapabilityEnquiry (36.331 cl. 6.2.2)

  template (value) UE_CapabilityRequest cs_UE_CapabilityRequest_EUTRA := {eutra};   /* @status    APPROVED */

  template (value) DL_DCCH_Message cs_508_UeCapabilityEnquiry(RRC_TransactionIdentifier p_RRC_TI,
                                                              template (value) UE_CapabilityRequest p_UE_CapabilityRequest := cs_UE_CapabilityRequest_EUTRA) :=
  { /* According to 36.508 cl. 4.6.1 Table 4.6.1-22 */
    /* @status    APPROVED */
    message_ := {
      c1 := {
        ueCapabilityEnquiry := {
          rrc_TransactionIdentifier := p_RRC_TI,
          criticalExtensions := {
            c1 := {
              ueCapabilityEnquiry_r8 := {
                ue_CapabilityRequest := p_UE_CapabilityRequest,
                nonCriticalExtension := omit
              }
            }
          }
        }
      }
    }
  };

  //----------------------------------------------------------------------------
  // MobilityFromEUTRACommand  (36.331 cl. 6.2.2)

  template (value) DL_DCCH_Message cs_MobilityFromEutraCommand ( RRC_TransactionIdentifier p_RRC_TI,
                                                                 octetstring               p_TargetRAT_MessageContainer,
                                                                 octetstring               p_Nas_SecurityParamFromEUTRA ):=
  {
    message_ := {
      c1 := {
        mobilityFromEUTRACommand := {
          rrc_TransactionIdentifier := p_RRC_TI,
          criticalExtensions := {
            c1 := {
              mobilityFromEUTRACommand_r8 := {
                cs_FallbackIndicator := false,// no specific msg contents in test case 8.4.1.2
                purpose := {
                  handover := {
                    targetRAT_Type := utra,
                    targetRAT_MessageContainer := p_TargetRAT_MessageContainer,
                    nas_SecurityParamFromEUTRA := p_Nas_SecurityParamFromEUTRA,
                    systemInformation := omit
                  }
                },
                nonCriticalExtension := omit
              }
            }
          }
        }
      }
    }
  };

  //----------------------------------------------------------------------------

  template UECapabilityInformation_r8_IEs cr_EutraCapInfo :=
  { /* UECapabilityInformation (36.331 cl. 6.2.2) */
    /* @status    APPROVED */
    ue_CapabilityRAT_ContainerList := {
      {
        rat_Type := eutra,
        ueCapabilityRAT_Container := ? //To be decoded and checked in test case
      }
    },
    nonCriticalExtension := *
  };

  template UL_DCCH_Message cr_508_UeCapabilityInformation(RRC_TransactionIdentifier p_RRC_TI,
                                                          template UECapabilityInformation_r8_IEs p_UECapabilityInformation_r8_IEs) :=
  { /* According to 36.508 cl. 4.6.1 Table 4.6.1-23 */
    /* @status    APPROVED */
    message_ := {
      c1 := {
        ueCapabilityInformation := {
          rrc_TransactionIdentifier := p_RRC_TI,
          criticalExtensions := {
            c1 := {
              ueCapabilityInformation_r8 := p_UECapabilityInformation_r8_IEs
            }
          }
        }
      }
    }
  };

  template UL_DCCH_Message cr_UeCapabilityInformation_Any(RRC_TransactionIdentifier p_RRC_TI) := cr_508_UeCapabilityInformation(p_RRC_TI, ?); /* @status    APPROVED */
}
