/******************************************************************************/
// @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-03 20:04:51 +0200 (Fri, 03 Sep 2010) $
// $Rev: 3810 $
/******************************************************************************/

module UTRAN_Templates {
  import from UTRAN_TypeDefs all;
  import from NAS_24008TypeDefs all;
  import from NAS_CommonTypeDefs all;
  import from NAS_CommonTemplates all;
  import from NAS_24008Templates all;
  import from UTRAN_RRC_ASN1_Definitions language "ASN.1:1997" all;
  import from UTRAN_ASP_Definitions language "ASN.1:1997" all;
  import from Parameters all;
  import from UTRAN_Parameters all;

  // =============================================================================
  // UTRAN Constants
  // -----------------------------------------------------------------------------

  const float tsc_IdleMode_GenericTimer_UTRAN := 360.0;        // Idle mode generic timer according to 36.523-3 cl. 7.8
  const integer         tsc_AICH1 := 7;                        // Physical channel identity for AICH channel associated with first PRACH
  const integer         tsc_BCCH1 := 1;                        // Logical channel identity for logical channel BCCH mapped on BCH
  const integer         tsc_BCCH6 := 6;                        // Logical channel identity for logical channel BCCH mapped on FACH
  const integer         tsc_BCH1 := 11;                        // Identity for transport channel BCH
  const integer         tsc_E_AGCH := 14;
  const integer         tsc_E_DPCH := 22;
  const integer         tsc_E_HICH := 15;
  const integer         tsc_E_RGCH := 16;
  const integer         tsc_FACH1 := 13;                       // transport channel identity for  FACH
  const integer         tsc_FACH2 := 14;                       // transport channel identity for second FACH when it is connected to a secondary CCPCH together with PCH (transport channel identity = 14)
  const integer         tsc_F_DPCH := 28;
  const integer         tsc_HSPDSCH := 18;                     // physical channel identity for HS-PDSCH.
  const integer         tsc_PICH1 := 6;                        // Physical channel identity for PICH channel associated with first secondary CCPCH
  const integer         tsc_PICH2 := 11;                       // Physical channel identity for PICH2 channel associated with second secondary CCPCH
  const integer         tsc_PRACH1 := 8;                       // Physical channel identity for first PRACH channel
  const integer         tsc_PRACH2 := 9;                       // Physical channel identity for second PRACH channel
  const integer         tsc_P_CCPCH := 4;                      // Physical channel identity for primary CCPCH channel
  const integer         tsc_P_CPICH := 0;                      // Physical channel identity for primary CPICH channel
  const integer         tsc_P_SCH := 1;                        // Physical channel identity for primary SCH channel
  const integer         tsc_RACH1 := 15;                       // transport channel identity for RACH

  const integer         tsc_AttOn := 1;                        // Attach flag value On
  const integer         tsc_AttenuationCellOFF := 123;         // Value of attenuator to be used when setting a  Cell OFF (3GPP 34.108 / Table 6.1.4)
  const integer         tsc_AttenuationServingCell := -1;       // Value different for FDD/TDD so this is just a flag to be used in f_UTRAN_SetCellPower
  const integer         tsc_AttenuationSuitableNeigbourCell := -2; // Value different for FDD/TDD so this is just a flag to be used in f_UTRAN_SetCellPower
  const integer         tsc_AttenuationNonSuitableCell := -3; // Value different for FDD/TDD so this is just a flag to be used in f_UTRAN_SetCellPower
  const bitstring       tsc_CellIdCell5 := '0000000000000000000000000000'B;
  const bitstring       tsc_CellIdCell7 := '0000000000000000000000000001'B;
  const bitstring       tsc_CellIdCell8 := '0000000000000000000000000010'B;
  const bitstring       tsc_CellIdCell9 := '0000000000000000000000000011'B;


  const integer         tsc_Now := 512;                        // To indicate the system information change starts immediately.
  const octetstring     tsc_NMO_I := '00'O;                    // Network Mode of Operation I (3GPP 24.008 / 10.5.1.12.3)
  const octetstring     tsc_NMO_II := '01'O;                   // Network Mode of Operation II (3GPP 24.008 / 10.5.1.12.3)
  const octetstring     tsc_RAC_Def := '01'O;                  // Routing Area Code, 1 octet, 3GPP 24.008 clause 10.5.1.12.3
  const integer         tsc_SFN_Offset := 0;                   // SFN offset value
  const octetstring     tsc_T3212_Def := '1E'O;                // infinite
  const integer         tsc_TimingsCCPCH1 := 0;                // timing offset for secondary CCPCH1. default is 0.
  const bitstring       tsc_URA_IdCell5 := '0000000000000001'B;
  const bitstring       tsc_URA_IdCell7 := '0000000000000001'B;
  const bitstring       tsc_URA_IdCell8 := '0000000000000010'B;
  const bitstring       tsc_URA_IdCell9 := '0000000000000010'B;
  const integer         tsc_CellParametersID_Cell5 := 0;                       // CellParametersID for CELL5
  const integer         tsc_CellParametersID_Cell7 := 4;                       // CellParametersID for CELL7
  const integer         tsc_CellParametersID_Cell8 := 8;                       // CellParametersID for CELL8
  const integer         tsc_CellParametersID_Cell9 := 12;                       // CellParametersID for CELL9

  const integer         tsc_DL_CCCH5 := 5;                     // Logical channel identity for logical channel CCCH mapped on FACH (downlink)
  const integer         tsc_DL_DCCH1 := 1;                     // Logical channel identity for DCCH1 (downlink), used by signalling radio bearer 1
  const integer         tsc_DL_DCCH2 := 2;                     // Logical channel identity for DCCH2 (downlink), used by signalling radio bearer 2
  const integer         tsc_DL_DCCH3 := 3;                     // Logical channel identity for DCCH3 (downlink), used by signalling radio bearer 3
  const integer         tsc_DL_DCCH4 := 4;                     // Logical channel identity for DCCH4 (downlink), used by signalling radio bearer 4
  const integer         tsc_DL_DCH1 := 6;                      // identity for transport channel DCH1 (downlink),  in AMR speech this transport channel is used for RAB subflow#1
  const integer         tsc_DL_DCH2 := 7;                      // identity for transport channel DCH2 (downlink),  in AMR speech this transport channel is used for RAB subflow#2
  const integer         tsc_DL_DCH3 := 8;                      // identity for transport channel DCH4 (downlink), in AMR speech this transport channel is used for RAB subflow#3
  const integer         tsc_DL_DCH4 := 9;                      // identity for transport channel DCH4 (downlink),  in AMR speech
  const integer         tsc_DL_DCH5 := 10;                     // identity for transport channel DCH5 (downlink), in most case  this transport channel is used for signalling bearers.
  const integer         tsc_DL_DPCH1 := 26;                    // physical channel identity for DPCH1(downlink)
  const integer         tsc_DL_DTCH1 := 7;                     // Logical channel identity for DTCH1 (downlink)
  const integer         tsc_DL_DTCH2 := 8;                     // Logical channel identity for DTCH2 (downlink)
  const integer         tsc_DL_DTCH3 := 9;                     // Logical channel identity for DTCH3 (downlink)
  const integer         tsc_DL_DTCH4 := 10;                    // Logical channel identity for DTCH4 (downlink)
  const integer         tsc_DPCH_PowerOffsetPILOT := 0;        // Power offsett value of PILOT on DPCH
  const integer         tsc_DPCH_PowerOffsetTFCI := 0;         // Power offsett value of TFCI on DPCH
  const integer         tsc_DPCH_PowerOffsetTPC := 0;          // Power offsett value of TPC on DPCH
  const integer         tsc_GainFactorBetaC_Below64k := 11;    // Gain factor Beta C value  to be used for RAB UL below 64kbps
  const integer         tsc_GainFactorBetaC_Higher64k := 9;    // Gain factor Beta C value  to be used for RAB UL higher than 64kbps
  const integer         tsc_GainFactorBetaD := 15;
  const integer         tsc_RB_BCCH := -1;                     // radio bearer idenity for bearer on TM + BCCH + BCH used for broadcasting system information blocks
  const integer         tsc_RB_BCCH_FACH := -3;                // signalling radio bearer on TM + BCCH + FACH + sCCPCH1
  const integer         tsc_RB_DTCH_E_DCH_MAC1 := -21;         // Special RB for DTCH configured in TM for MAC test cases
  const integer         tsc_RB_DTCH_E_DCH_MAC2 := -22;         // Special second RB for DTCH configured in TM for MAC test cases
  const integer         tsc_RB_PCCH := -2;                     // radio bearer idenity for bearer on TM + PCCH + PCH used for sending paging message when there is no RAB subflows for speech.
  const integer         tsc_RB0 := 0;                          // signalling radio bearer on TM + CCCH
  const integer         tsc_RB1 := 1;                          // sibnalling radio bearer on UM + DCCH
  const integer         tsc_RB10 := 10;                        // radio access bearer identity, in AMR speech this RB is RAB subflow#1, in other cases this is a radio access bearer
  const integer         tsc_RB11 := 11;                        // radio access bearer identity, in AMR speech this RB is RAB subflow#2, in some other cases this is the signalling radio bearer for TM + BCCH_FACH.
  const integer         tsc_RB12 := 12;                        // radio access bearer, in AMR speech this RB is RAB subflow#3, in some other cases this is the bearer for TM PCCH
  const integer         tsc_RB13 := 13;                        // radio access bearer, in AMR speech this RB is RAB subflow#3, in some other cases this is the bearer for TM PCCH
  const integer         tsc_RB17 := 17;                        // Fifth PS Radio Bearer associated with a DTCH on HS-DSCH
  const integer         tsc_RB26 := 26;                        // second PS Radio Bearer associated with a DTCH on HS-DSCH
  const integer         tsc_RB27 := 27;                        // Third PS Radio Bearer associated with a DTCH on HS-DSCH
  const integer         tsc_RB28 := 28;                        // Fourth PS Radio Bearer associated with a DTCH on HS-DSCH
  const integer         tsc_RB2 := 2;                          // signalling radio bearer on AM + DCCH
  const integer         tsc_RB20 := 20;                        // radio access bearer for PS RAB
  const integer         tsc_RB21 := 21;                        // radio access bearer for PS RAB
  const integer         tsc_RB22 := 22;                        // Second AM radio access bearer for PS
  const integer         tsc_RB24 := 24;                        // Second AM radio access bearer for PS
  const integer         tsc_RB25 := 25;                        // PS Radio Bearer associated with a DTCH on HS-DSCH
  const integer         tsc_RB29 := 29;                        // RB Id for Radio bearer that carries the 2nd CCCH in the DL
  const integer         tsc_RB3 := 3;                          // signalling radio bearer on AM + DCCH for high priority NAS_DT
  const integer         tsc_RB3_DCCH_RRC := -16;               /* RB identity used for configuration of AM RLC entity
                                                                * in the SS. SS will use it to simulate the high priority
                                                                * NAS SRB mapped to DCH for routing UL NAS messages in
                                                                * RRC test cases.
                                                                * A negative value is used to indicate that the SS
                                                                * configuration is not identical to the UE configuration */
  const integer         tsc_RB30 := 30;                        // radio access bearer for CBS RAB
  const integer         tsc_RB31 := 31;
  const integer         tsc_RB4 := 4;                          // signalling radio bearer on AM + DCCH for low priority NAS_DT
  const integer         tsc_RB5 := 5;                          // signalling radio bearer on TM + DCCH for AMR Signalling
  const integer         tsc_RRC_TI := 0;                       // RRC Transaction Identifier
  const integer         tsc_PCCH1 := 1;                        // Logical channel identity for logical channel PCCH
  const integer         tsc_PCH1 := 12;                        // transport channel identity for PCH
  const integer         tsc_N300 := 3;
  const integer         tsc_S_CCPCH1 := 5;                     // Physical channel identity for first secondary CCPCH channel
  const integer         tsc_S_CCPCH_2ndScrCode := 0;           // Secondary scrambling code for S-CCPCH channels
  const integer         tsc_S_CCPCH_PowerOffsetPILOT := 6;     // Power offsett value of PILOT on sCCPCH
  const integer         tsc_S_CCPCH_PowerOffsetTFCI := 6;      // Power offsett value of TFCI on sCCPCH
  const integer         tsc_S_SCH := 2;                        // Physical channel identity for secondary SCH channel
  const SS_CN_DomainIdentity tsc_SS_PS_Domain := 1;
  const SS_CN_DomainIdentity tsc_SS_CS_Domain := 0;
  const integer         tsc_UL_CCCH5 := 5;                     // Logical channel identity for logical channel CCCH mapped  RACH (uplink)
  const integer         tsc_UL_DCCH1 := 1;                     // Logical channel identity for DCCH1 (uplink), used by signalling radio bearer 1
  const integer         tsc_UL_DCCH2 := 2;                     // Logical channel identity for DCCH2 (uplink), used by signalling radio bearer 2
  const integer         tsc_UL_DCCH3 := 3;                     // Logical channel identity for DCCH3 (uplink), used by signalling radio bearer 3
  const integer         tsc_UL_DCCH4 := 4;                     // Logical channel identity for DCCH4 (uplink), used by signalling radio bearer 4
  const integer         tsc_UL_DCH1 := 1;                      // identity for transport channel DCH1 (uplink),  in AMR speech this transport channel is used for RAB subflow#1
  const integer         tsc_UL_DCH2 := 2;                      // identity for transport channel DCH2 (uplink),  in AMR speech this transport channel is used for RAB subflow#2
  const integer         tsc_UL_DCH3 := 3;                      // identity for transport channel DCH3 (uplink), in AMR speech this transport channel is used for RAB subflow#3
  const integer         tsc_UL_DCH4 := 4;                      // identity for transport channel DCH4 (upink),  in AMR speech
  const integer         tsc_UL_DCH5 := 5;                      // identity for transport channel DCH5 (uplink), in most case  this transport channel is used for signalling bearers.
  const integer         tsc_UL_DPCH1 := 20;                    // physical channel identity for DPCH1(uplink)
  const integer         tsc_UL_DTCH1 := 7;                     // Logical channel identity for DTCH1 (uplink)
  const integer         tsc_UL_DTCH2 := 8;                     // Logical channel identity for DTCH2 (uplink)
  const integer         tsc_UL_DTCH3 := 9;                     // Logical channel identity for DTCH3 (uplink)
  const integer         tsc_UL_DTCH4 := 10;                    // Logical channel identity for DTCH4 (uplink)

  const RejCau          tsc_ServiceOptionNotSupported := '20'O;// reject cause: Service option not supported (24.008 cl. 10.5.3.6)

  // =============================================================================

  template (value) EUTRA_FrequencyAndPriorityInfoList cs_Eutra_FreqAndPriList_OneEntry_Common ( EARFCN                                           p_Earfcn,
                                                                                                template (omit) EUTRA_MeasurementBandwidth       p_MeasurementBandwidth,
                                                                                                EutraFrequencyAndPriorityInfoPriorityValue_Type  p_PriorityValue,
                                                                                                EutraFrequencyAndPriorityInfoQrxLevMin_Type      p_QrxLevMinEutra,
                                                                                                EutraFrequencyAndPriorityInfoThreshXhigh_Type    p_ThreshXhigh,
                                                                                                EutraFrequencyAndPriorityInfoThreshXlow_Type     p_ThreshXlow,
                                                                                                template (omit) EUTRA_BlacklistedCellPerFreqList p_Eutra_blackListedCellList,
                                                                                                boolean                                          p_EutraDetection ) := {
    {
      earfcn := p_Earfcn,
      measurementBandwidth := p_MeasurementBandwidth,
      priority       := p_PriorityValue,
      qRxLevMinEUTRA := p_QrxLevMinEutra,
      threshXhigh := p_ThreshXhigh,
      threshXlow := p_ThreshXlow,
      eutra_blackListedCellList := p_Eutra_blackListedCellList,
      eutraDetection := p_EutraDetection
    }
  };

  template (value) EUTRA_FrequencyAndPriorityInfoList cs_Eutra_FreqAndPriList_OneEntry_Def ( EARFCN p_Earfcn,
                                                                                             EUTRA_MeasurementBandwidth p_MeasurementBandwidth,
                                                                                             EutraFrequencyAndPriorityInfoPriorityValue_Type p_PriorityValue := 4  ) :=
   cs_Eutra_FreqAndPriList_OneEntry_Common ( p_Earfcn,
                                             p_MeasurementBandwidth,
                                             p_PriorityValue,
                                             -65,
                                             2,
                                             1,
                                             omit,
                                             true );

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


  template (value) U_RLC_AM_REQ cas_RLC_Data_Req_Cnf ( UTRAN_CellId_Type                p_CellId,
                                                           integer                          p_RB_Id,
                                                           Mui                              p_Mui,
                                                           template (value) DL_DCCH_Message p_Pdu ) :=
  {
    data := {
      cellId := p_CellId,
      routingInfo := {
        rB_Identity := p_RB_Id
      },
      confirmationRequest := {
        confirmationRequested := p_Mui
      },
      aM_message := {
        dL_DCCH_Message := p_Pdu
      }
    }
  };

  template (value) U_RLC_AM_REQ cas_RLC_Data_Req_NoCnf ( UTRAN_CellId_Type                p_CellId,
                                                             integer                          p_RB_Id,
                                                             template (value) DL_DCCH_Message p_Pdu ) :=
  {
    data := {
      cellId := p_CellId,
      routingInfo := {
        rB_Identity := p_RB_Id
      },
      confirmationRequest := {
        noConfirmationRequest := NULL
      },
      aM_message := {
        dL_DCCH_Message := p_Pdu
      }
    }
  }

  template U_RLC_AM_IND car_RLC_Data_Ind ( UTRAN_CellId_Type        p_CellId,
                                               integer                  p_RB_Id,
                                               template UL_DCCH_Message p_Pdu ) :=
  {
    data := {
      cellId := p_CellId,
      routingInfo := {
        rB_Identity := p_RB_Id
      },
      integrityResult := ?,
      aM_message := {
        uL_DCCH_Message := p_Pdu
      }
    }
  };
  
  template UL_DCCH_Message cr_InitDirectTransfer ( template RoutingParameter p_PTMSI,
                                                   PLMN_Identity    p_PLMN_Identity ) :=
  {
    integrityCheckInfo := *,
    message_ := {
      initialDirectTransfer := {
        cn_DomainIdentity := ps_domain,
        intraDomainNasNodeSelector := {
          version := {
            release99 := {
              cn_Type := {
                gsm_Map_IDNNS := {
                  routingbasis := {
                    localPTMSI := {
                      routingparameter := p_PTMSI
                    }
                  },
                  dummy := ?
                }
              }
            }
          }
        },
        nas_Message := ?,
        measuredResultsOnRACH := *,
        v3a0NonCriticalExtensions := {
          initialDirectTransfer_v3a0ext := {
            start_Value := '00000000000000000000'B
          },
          laterNonCriticalExtensions := {
            initialDirectTransfer_r3_add_ext := *,
            v590NonCriticalExtensions := {
              initialDirectTransfer_v590ext := ?,
              v690NonCriticalExtensions := {
                initialDirectTransfer_v690ext := {
                  plmn_Identity := p_PLMN_Identity,
                  measuredResultsOnRACHinterFreq := *,
                  mbms_JoinedInformation := *
                },
                v770NonCriticalExtensions := *
              }
            }
          }
        }
      }
    }
  };

  template UL_DCCH_Message cr_InitDirectTransfer_TMSI ( template RoutingParameter p_TMSI,
                                                   PLMN_Identity    p_PLMN_Identity ) :=
  {
    integrityCheckInfo := *,
    message_ := {
      initialDirectTransfer := {
        cn_DomainIdentity := ps_domain,
        intraDomainNasNodeSelector := {
          version := {
            release99 := {
              cn_Type := {
                gsm_Map_IDNNS := {
                  routingbasis := {
                    tMSIofsamePLMN := {
                      routingparameter := p_TMSI
                    }
                  },
                  dummy := ?
                }
              }
            }
          }
        },
        nas_Message := ?,
        measuredResultsOnRACH := *,
        v3a0NonCriticalExtensions := {
          initialDirectTransfer_v3a0ext := {
            start_Value := '00000000000000000000'B
          },
          laterNonCriticalExtensions := {
            initialDirectTransfer_r3_add_ext := *,
            v590NonCriticalExtensions := {
              initialDirectTransfer_v590ext := ?,
              v690NonCriticalExtensions := {
                initialDirectTransfer_v690ext := {
                  plmn_Identity := p_PLMN_Identity,
                  measuredResultsOnRACHinterFreq := *,
                  mbms_JoinedInformation := *
                },
                v770NonCriticalExtensions := *
              }
            }
          }
        }
      }
    }
  };

  template (value) UTRA_PriorityInfoList cs_Utra_PriorityInfoList_Common ( UtraServingCellPriorityValue_Type    p_Priority_value,
                                                                           UtraServingCellPrioritySearch1_Type  p_S_PrioritySearch1,
                                                                           UtraServingCellthreshServingLow_Type p_ThreshServingLow ) := {
    utra_ServingCell := {
      priority          := p_Priority_value,
      s_PrioritySearch1 := p_S_PrioritySearch1,
      s_PrioritySearch2 := omit,
      threshServingLow := p_ThreshServingLow
    },
    utran_FDD_FrequencyList := omit,
    utran_TDD_FrequencyList := omit
  }
  
  template (value) UTRA_PriorityInfoList cs_Utra_PriorityInfoList_Def := cs_Utra_PriorityInfoList_Common ( 3, 0, 0 );

  template (value) UE_ConnTimersAndConstants_r5 cs_UEConnTimersConst := {
     t_301 := ms2000,
     n_301 :=  2,
     t_302 :=  ms4000,
     n_302 :=  3,
     t_304 :=  ms1000,
     n_304 :=  3,
     t_305 :=  m60,
     t_307 :=  s50,
     t_308 :=  ms320,
     t_309 :=  8,
     t_310 :=  ms320,
     n_310 :=  5,
     t_311 :=  ms500,
     t_312 :=  5,
     n_312 :=  s200,
     t_313 :=  10,
     n_313 :=  s200,
     t_314 :=  s20,
     t_315 :=  s30,
     n_315 :=  s200,
     t_316 :=  s50,
     t_317 :=  infinity7
  };

  template (value) DL_DCCH_Message cs_RRC_UtranMobilityInfo ( IntegrityCheckInfo                                     p_IntegrityCheckInfo,
                                                              RRC_TransactionIdentifier                              p_RRC_Ti,
                                                              template (omit) IntegrityProtectionModeInfo_r7         p_IntegrProtModeInfo,
                                                              template (omit) CipheringModeInfo_r7                   p_CipherModeInfo,
                                                              U_RNTI                                                 p_URNTI,
                                                              C_RNTI                                                 p_CRNTI,
                                                              template (omit) H_RNTI                                 p_HRNTI,
                                                              template (omit) UE_ConnTimersAndConstants_r5           p_UEConnTimersConst,
                                                              template (omit) CN_InformationInfoFull                 p_CNInfo,
                                                              template (omit) PLMN_Identity                          p_PLMNId,
                                                              template (omit) URA_Identity                           p_URAId,
                                                              template (omit) boolean                                p_SupportChangeUECapab,
                                                              template (omit) DL_CounterSynchronisationInfo_r5       p_DlCounterSyncInfo,
                                                              template (omit) bitstring                              p_UtranMobilityInformation_r7_add_ext,
                                                              template (omit) UTRANMobilityInformation_v860ext2_Type p_UtranMobilityInformation_v860ext2_Type ) :=
  {
    integrityCheckInfo := p_IntegrityCheckInfo,
    message_ := {
      utranMobilityInformation := {
        later_than_r3 := {
          rrc_TransactionIdentifier := p_RRC_Ti,
          criticalExtensions := {
            criticalExtensions:= {
              r7 := {
                utranMobilityInformation_r7 := {
                  integrityProtectionModeInfo := p_IntegrProtModeInfo,
                  cipheringModeInfo := p_CipherModeInfo,
                  new_U_RNTI := p_URNTI,
                  new_C_RNTI := p_CRNTI,
                  new_H_RNTI := p_HRNTI,
                  ue_ConnTimersAndConstants := p_UEConnTimersConst,
                  cn_InformationInfo := p_CNInfo,
                  primary_plmn_Identity := p_PLMNId,
                  ura_Identity := p_URAId ,
                  supportForChangeOfUE_Capability := p_SupportChangeUECapab,
                  dl_CounterSynchronisationInfo := p_DlCounterSyncInfo
                },
                utranMobilityInformation_r7_add_ext := p_UtranMobilityInformation_r7_add_ext,
                v860NonCriticalExtensions := p_UtranMobilityInformation_v860ext2_Type
              }
            }
          }
        }
      }
    }
  };

  template UL_DCCH_Message cr_108_UTRAN_MobilityInfoCnf ( RRC_TransactionIdentifier p_RRC_Ti ) := {
  
     integrityCheckInfo := *,
     message_ := {
       utranMobilityInformationConfirm := {
         rrc_TransactionIdentifier := p_RRC_Ti,
         ul_IntegProtActivationInfo := *,
         count_C_ActivationTime := *,
         dummy := *,
         ul_CounterSynchronisationInfo := *,
         laterNonCriticalExtensions := *
       }
     }
  };

  template UL_DCCH_Message cr_HandoverToUTRANComplete := {
    integrityCheckInfo := *,
    message_ := {
      handoverToUTRANComplete := {
        startList := *,
        count_C_ActivationTime := *,
        laterNonCriticalExtensions := *
      }
    }
  };

  template (value) SysInfoType19 cs_SIB19_Common ( template (value) UTRA_PriorityInfoList             p_Utra_PriorityInfoList,
                                                   template (omit) GSM_PriorityInfoList               p_Gsm_PriorityInfoList,
                                                   template (omit) EUTRA_FrequencyAndPriorityInfoList p_Eutra_FrequencyAndPriorityInfoList ) :=
  {
    utra_PriorityInfoList := p_Utra_PriorityInfoList,
    gsm_PriorityInfoList := p_Gsm_PriorityInfoList,
    eutra_FrequencyAndPriorityInfoList := p_Eutra_FrequencyAndPriorityInfoList,
    nonCriticalExtensions := omit
  }

  template (value) SysInfoType19 cs_SIB19_OneEutraEntry ( template (value) EUTRA_FrequencyAndPriorityInfoList p_Eutra_FrequencyAndPriorityInfoList ) :=
    cs_SIB19_Common ( cs_Utra_PriorityInfoList_Def, omit, p_Eutra_FrequencyAndPriorityInfoList );

  template (value) SysInfoType19 cs_SIB19_UtraAndOneEutraEntry ( template (value) UTRA_PriorityInfoList              p_Utra_PriorityInfoList,
                                                                 template (value) EUTRA_FrequencyAndPriorityInfoList p_Eutra_FrequencyAndPriorityInfoList ) :=
    cs_SIB19_Common ( p_Utra_PriorityInfoList, omit, p_Eutra_FrequencyAndPriorityInfoList );

  // =============================================================================
  // ASP Constraint
  // The ASP is used to request the transmission of the NAS PDU message using acknowledged operation (NAS -> RRC).
  // -----------------------------------------------------------------------------
  template (value) RRC_DATA_REQ cs_DataReq(UTRAN_CellId_Type p_CellId,
                                           SS_RB_Identity p_Rb,
                                           template(value) RRCDataReqType p_Pdu) :=
  {
    cellId          := p_CellId,
    rB_Id           := p_Rb,
    ch              := omit,       // always set to omit
    sapId           := omit,       // always set to omit
    cN_Domain       := tsc_SS_CS_Domain,
    msg             := p_Pdu
  };

  // =============================================================================
  // ASP Constraint
  // -----------------------------------------------------------------------------
  template (value) RRC_DATA_REQ cs_PS_DataReq(UTRAN_CellId_Type p_CellId,
                                              SS_RB_Identity p_Rb,
                                              template(value) RRCDataReqType p_Pdu) :=
  {
    cellId          := p_CellId,
    rB_Id           := p_Rb,
    ch              := omit,       // always set to omit
    sapId           := omit,       // always set to omit
    cN_Domain       := tsc_SS_PS_Domain,
    msg             := p_Pdu
  };

  // =============================================================================
  // ASP Constraint
  // The ASP is used to indicate the receipt of the NAS PDU message using acknowledged operation (NAS <- RRC).
  // -----------------------------------------------------------------------------
  template RRC_DATA_IND car_InitDirectTransfer(template UTRAN_CellId_Type p_CellId,
                                               template SS_RB_Identity p_Rb,
                                               template RRCDataIndType p_Pdu) :=
  {
    cellId          := p_CellId,
    rB_Id           := p_Rb,
    ch              := omit,       // always set to omit
    sapId           := omit,       // always set to omit
    cN_Domain       := tsc_SS_CS_Domain,
    ttcn_start      := ?,
    msg             := p_Pdu
  };

  // =============================================================================
  // ASP Constraint
  // The ASP is used to indicate the receipt of the NAS PDU message using acknowledged operation (NAS <- RRC).
  // -----------------------------------------------------------------------------
  template RRC_DATA_IND car_PS_InitDirectTransfer(template UTRAN_CellId_Type p_CellId,
                                                  template SS_RB_Identity p_Rb,
                                                  template RRCDataIndType p_Pdu) :=
  {
    cellId          := p_CellId,
    rB_Id           := p_Rb,
    ch              := omit,       // always set to omit
    sapId           := omit,       // always set to omit
    cN_Domain       := tsc_SS_PS_Domain,
    ttcn_start      := ?,
    msg             := p_Pdu
  };

  // =============================================================================
  // ASP Constraint
  // The ASP is used to indicate the receipt of the NAS PDU message using acknowledged operation (NAS <- RRC).
  // -----------------------------------------------------------------------------
  template RRC_DATA_IND car_PS_UplinkDirectTransfer(template UTRAN_CellId_Type p_CellId,
                                                    template SS_RB_Identity p_Rb,
                                                    template RRCDataIndType p_Pdu) :=
  {
    cellId          := p_CellId,
    rB_Id           := p_Rb,
    ch              := omit,       // always set to omit
    sapId           := omit,       // always set to omit
    cN_Domain       := tsc_SS_PS_Domain,
    ttcn_start      := omit,
    msg             := p_Pdu
  };

  // =============================================================================
  // ASP Constraint
  // The ASP is used to indicate the receipt of the NAS PDU message using acknowledged operation (NAS <- RRC).
  // -----------------------------------------------------------------------------
  template RRC_DATA_IND car_UplinkDirectTransfer(template UTRAN_CellId_Type p_CellId,
                                                 template SS_RB_Identity p_Rb,
                                                 template RRCDataIndType p_Pdu) :=
  {
    cellId          := p_CellId,
    rB_Id           := p_Rb,
    ch              := omit,       // always set to omit
    sapId           := omit,       // always set to omit
    cN_Domain       := tsc_SS_CS_Domain,
    ttcn_start      := omit,
    msg             := p_Pdu
  };

  // =============================================================================
  // PDU Constraint
  // -----------------------------------------------------------------------------
  template (value) RRCDataReqType cs_U_AttachAcc(template (value) AttachResult p_AttachRes,
                                                 template (value) RoutingAreaId p_RAI,
                                                 template (omit) PTMSI_Signature p_PTMSIsig,
                                                 template (omit) MobileIdentity p_PTMSI) :=
  {
    attachAccept := cs_AttachAcc_Common(p_AttachRes, p_RAI, p_PTMSIsig, p_PTMSI, omit)
  };

  template (value) RRCDataReqType cs_U_AttachReject( RejCau p_Cause) :=
  {
    AttachReject := cs_AttachRej_Common(p_Cause)
  };


  // =============================================================================
  // PDU Constraint
  // -----------------------------------------------------------------------------
  template RRCDataIndType cr_U_AttachComplete :=
  {
    attachComplete := cr_AttachComplete_Common
  };

  // =============================================================================
  // PDU Constraint
  // -----------------------------------------------------------------------------
  template RRCDataIndType cr_U_DetachRequest(
  template DetachType p_Type,
  template MobileIdentity p_Ptmsi,
  template PTMSI_Signature p_Signature) :=
  {
    detachRequest := cr_DetachReq_Common (p_Type, p_Ptmsi, p_Signature)
  };

  // =============================================================================
  // PDU Constraint
  // -----------------------------------------------------------------------------
  template RRCDataIndType cr_U_AttachReq (template (present)  AttachType p_AttachType,
                                          template (present)  MobileIdentity p_MobId,
                                          template (present)  RoutingAreaId p_RAI,
                                          template (present) KeySeq p_KeySeq) :=
  {
    attachRequest := cr_AttachReq_Common(p_AttachType,
                                         p_MobId,
                                         p_RAI,
                                         p_KeySeq,
                                         cr_MS_RadioAccessCapLVAny,
                                         cr_PTMSI_SignatureAny ifpresent,
                                         cr_GPRS_TimerAny ifpresent,
                                         cr_TMSI_Status ifpresent,
                                         cr_PS_LCS_CapabilityAny ifpresent,
                                         cdr_MS_Clsmk2_Any ifpresent,
                                         cr_MSCLSMK3_Any ifpresent,
                                         cr_CodecListAny ifpresent,
                                         cr_UENetworkCap_Any ('58'O) ifpresent,
                                          cr_MobileIdAny('1A'O) ifpresent,
                                         cr_RoutingAreaId2_Any ifpresent)
  };

  // =============================================================================
  // PDU Constraint
  // -----------------------------------------------------------------------------
  template RRCDataIndType cr_U_AttachReqIMSInoTMSI (template (present)  AttachType p_AttachType,
                                          template (present)  MobileIdentity p_MobIdIMSI,
                                          template (present)  RoutingAreaId p_RAI
                                          ) :=
  {
    attachRequest := cr_AttachReq_Common(p_AttachType,
                                         p_MobIdIMSI,
                                         p_RAI,
                                         '111'B, // No key available
                                         cr_MS_RadioAccessCapLVAny,
                                         omit, // No P-TMSI
                                         cr_GPRS_TimerAny ifpresent,
                                         cr_TMSI_Status ('0'B), // Invalid TMSI status
                                         cr_PS_LCS_CapabilityAny ifpresent,
                                         cdr_MS_Clsmk2_Any ifpresent,
                                         cr_MSCLSMK3_Any ifpresent,
                                         cr_CodecListAny ifpresent,
                                         cr_UENetworkCap_Any ('58'O) ifpresent,
                                         omit,
                                         omit)
  };

  // =============================================================================
  // PDU Constraint
  // -----------------------------------------------------------------------------
  template (value) RRCDataReqType cs_U_AuthReq( template (value) KeySeq p_KeySeq,
                                                template (value) MM_RAND p_RAND,
                                                template (value) AUTN p_AUTN) :=
  {
    authenticationRequest := cs_AuthReq_Common(p_KeySeq, p_RAND, p_AUTN)
  };

  // =============================================================================
  // PDU Constraint
  // -----------------------------------------------------------------------------
  template (value) RRCDataReqType cs_U_AuthAndCiphReq(template (value) RAND p_Rand,
                                                      template (value) CiphKeySeqNum p_CiphKeySeqNum,
                                                      template (value) AUTN p_Autn) :=
  {
    authenticationAndCipheringRequest := cs_AuthAndCiphReq_Common(p_Rand, p_CiphKeySeqNum, px_CipherAlg, p_Autn)
  };

  // =============================================================================
  // PDU Constraint
  // -----------------------------------------------------------------------------
  template RRCDataIndType cr_U_AuthFailAny :=
  {
    authenticationFailure := cr_AuthFailAny_Common
  };

  // =============================================================================
  // PDU Constraint
  // -----------------------------------------------------------------------------
  template RRCDataIndType cr_U_AuthAndCiphFailureAny :=
  {
    authenticationAndCipheringFailure := cr_AuthAndCiphFailureAny_Common
  };

  // =============================================================================
  // PDU Constraint
  // -----------------------------------------------------------------------------
  template RRCDataIndType cr_U_AuthAndCiphRsp (template AuthRsp p_AuthRsp,
                                               template AuthRspExt p_AuthRspExt) :=
  {
    authenticationAndCipheringResponse := cr_AuthAndCiphRsp_Common (p_AuthRsp, p_AuthRspExt)
  };

  // =============================================================================
  // PDU Constraint
  // -----------------------------------------------------------------------------
  template RRCDataIndType cr_U_AuthRspAnyExt :=
  {
    authenticationResponse := cr_AuthRspAnyExt_Common
  };

  // =============================================================================
  // PDU Constraint
  // -----------------------------------------------------------------------------
  template RRCDataIndType cr_U_AuthRspAnyNoExt :=
  {
    authenticationResponse := cr_AuthRspAnyNoExt_Common
  };

  // =============================================================================
  // PDU Constraint
  // -----------------------------------------------------------------------------
  template RRCDataIndType cr_U_LocationUpdatingRequest :=
  {
      locationUpdatingRequest := cr_LocUpdReqAny_Common (?)
  };

  // =============================================================================
  // PDU Constraint
  // -----------------------------------------------------------------------------
  template (value) RRCDataReqType cs_U_LocUpdAcpTMSI(octetstring p_PLMN,
                                                     octetstring p_LAC) :=
  {
    locationUpdatingAccept := cs_LocUpdAcp_Common (p_PLMN, p_LAC, cs_MobileIdTMSIorPTMSI ('13'O, px_TMSI_Def), omit)
  };

  // =============================================================================
  // PDU Constraint
  // -----------------------------------------------------------------------------
  template (value) RRCDataReqType cs_U_LocUpdAcpIMSI(octetstring p_PLMN,
                                                     octetstring p_LAC,
                                                     template (value) MobileIdentity p_IMSIMobileIdWithIEI) :=
  {
    locationUpdatingAccept := cs_LocUpdAcp_Common (p_PLMN, p_LAC, p_IMSIMobileIdWithIEI, omit)
  };

// =============================================================================
// PDU Constraint
// -----------------------------------------------------------------------------
  template RRCDataIndType cr_U_RA_UpdReqAny (template (present) UpdateType p_UpdateType,
                                        template (present) RoutingAreaId p_RAI,
                                        template PTMSI_Signature p_PTMSISig,
                                        template (present) KeySeq p_KeySeq) :=
  {
    routingAreaUpdateRequest := cr_RA_UpdReq_Common (p_UpdateType,
                                                     p_RAI,
                                                     p_PTMSISig,
                                                     cr_TMSI_Status ('0'B) ifpresent,
                                                     p_KeySeq)
  };

  // =============================================================================
  // PDU Constraint
  // -----------------------------------------------------------------------------
  template RRCDataIndType cr_U_PagRsp_Common ( template (present) KeySeq         p_KeySeq,
                                               template (present) MobileIdentity p_MobileId ) :=
  {
    pagingResponse := cr_PagRsp_Common ( p_KeySeq, p_MobileId )
  };

  // =============================================================================
  // PDU Constraint
  // -----------------------------------------------------------------------------
  template (value) RRCDataReqType cs_U_RA_UpdAcc3(template (value) UpdateResult p_UpdateResult,
                                                  template (value) RoutingAreaId p_RAI,
                                                  template (value) PTMSI_Signature p_PTMSIsig,
                                                  template (value) MobileIdentity p_PTMSI) :=
  {
    routingAreaUpdateAccept := cs_RA_UpdAcc_Common (p_UpdateResult,
                                                    p_RAI,
                                                    p_PTMSIsig,
                                                    p_PTMSI,
                                                    omit)
  };

  // =============================================================================
  // PDU Constraint
  // -----------------------------------------------------------------------------
  template (value) RRCDataReqType cs_U_RAUpdReject(template (value) GMM_Cause p_RejectCause)  :=
  {
    routingAreaUpdateReject:= cs_RAUpdReject_Common (p_RejectCause)
  };

  // =============================================================================
  // PDU Constraint
  // -----------------------------------------------------------------------------
  template RRCDataIndType cr_U_RAUpdComplete :=
  {
    routingAreaUpdateComplete:= cr_RAUpdComplete_Common
  };

  // =============================================================================
  // PDU Constraint
  // -----------------------------------------------------------------------------
  template (value) RRCDataReqType cs_U_CM_ServRej(RejCau p_RejCau) :=
  {
    cmServiceReject := {
      skipIndicator   := '0000'B,
      mMProtocolDiscriminator := '0101'B,
      msgType         := '00100010'B,
      rejCau          := p_RejCau
    }
  };

  // =============================================================================
  // PDU Constraint
  // -----------------------------------------------------------------------------
  template RRCDataIndType cr_U_ServiceRequest(template ServiceType p_ServiceType,
                                              template MobileIdentity p_PTMSI,
                                              template (present) KeySeq p_KeySeq) :=
  {
    serviceRequest := {
      skipIndicator   := '0000'B,
      gMMProtocolDiscriminator := tsc_GMM_PD,
      msgType         := '00001100'B,
      serviceType     := p_ServiceType,
      ciphKeySeqNo    := cr_CiphKeySeqNum(p_KeySeq),
      ptmsi           := p_PTMSI,
      pDP_ContextStatus := cr_PDP_ContextStatusAny ifpresent,
      mBMS_ContextStatus := cr_MBMS_ContextStatusAny ifpresent,
      uplinkDataStatus := cr_UplinkDataStatusAny
    }
  };

  // =============================================================================
  // PDU Constraint
  // -----------------------------------------------------------------------------
  template (value) RRCDataReqType cs_U_ServiceReject(RejCau p_GmmCause) :=
  {
    serviceReject := {
      skipIndicator   := '0000'B,
      gMMProtocolDiscriminator := tsc_GMM_PD,
      msgType         := '00001110'B,
      gmmCause        := p_GmmCause
    }
  };

  // =============================================================================
  // PDU Constraint
  // -----------------------------------------------------------------------------
  template RRCDataIndType cr_U_TMSI_ReallocCmpl :=
  {
    tmsiReallocationComplete := cr_TMSI_ReallocCmpl_Common
  };

  // =============================================================================
  // PDU Constraint
  // -----------------------------------------------------------------------------
  template RRCDataIndType cr_U_GMM_Status(template (present) RejCau p_Cause) :=
  {
    gmmStatus := {
      skipIndicator   := '0000'B,
      gMMProtocolDiscriminator := tsc_GMM_PD,
      msgType         := '00100000'B,
      cause           := p_Cause
    }
  };

  // =============================================================================
  // PDU Constraint
  // -----------------------------------------------------------------------------
  template (value) SERVICEACCEPT cs_ServiceAccept :=
  {
    skipIndicator   := '0000'B,
    gMMProtocolDiscriminator := tsc_GMM_PD,
    msgType         := '00001101'B,
    pDP_ContextStatus := omit,
    mBMS_ContextStatus := omit
  };
  template RRCDataIndType cr_U_Imsi_DetachInd :=
  {
    imsiDetachIndication := cr_IMSI_DetachInd_Common
  };

  template (value) RRCDataReqType cs_U_DeactPdpContextReqMt := {
    deactivatePDPContextRequest := cs_DeactPdpContextReqMt_Common
  };

  template RRCDataIndType cr_U_DeactPdpContextAcpMo := {
    deactivatePDPContextAccept := cr_DeactPdpContextAcpMo_Common
  };

  template (value) RRCDataReqType cs_U_DetachAcc := {
    detachAcceptMO := cs_DetachAcc_Common
  };

}
