/******************************************************************************/
// @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-13 15:05:44 +0200 (Mon, 13 Sep 2010) $
// $Rev: 3858 $
/******************************************************************************/

module LTE_EPS_TS_SelectionExpressions {

  import from Parameters all;

  type enumerated Condition_Type {
    R,
    C01,
    C02,
    C03,
    C04,
    C05,
    C06,
    C07,
    C08,
    C09,
    C10,
    C11,
    C12,
    C13,
    C14,
    C15,
    C16,
    C17,
    C18,
    C19,
    C20,
    C21,
    C22,
    C23,
    C24,
    C25,
    C26,
    C27,
    C28,
    C29,
    C30,
    C31,
    C32,
    C33,
    C34,
    C35,
    C36,
    C37,
    C38,
    C39,
    C40,
    C41,
    C42,
    //C43,
    C44,
    C45,
    C46,
    C47,
    C48,
    C49,
    C50,
    C51,
    C52,
    C53,
    C54,
    C55,
    C56,
    C57,
    C58,
    C59,
    C60,
    C61,
    C62,
    C63,
    C64,
    C65,
    C66,
    C67,
    C68,
    C69,
    C70,
    //C71,
    //C72,
    //C73,
    C74,
    C75,
    //C76,
    C77,
    C78
  }

  function f_SelectionExpr ( Condition_Type p_Condition) return boolean {
  /* Set the applicability conditions according to 36.523-2 Table 4-1a: Applicability of tests Conditions */

    var boolean v_ApplCond;

    select (p_Condition) {
      //R: UEs supporting E-UTRA
      case (R) {
        v_ApplCond := true;
      }
      //C01: UEs supporting E-UTRA and UTRA
      case (C01) {
        v_ApplCond := pc_UTRA;
      }
      //C02: UEs supporting E-UTRA and combined EPS/IMSI attach (with or without pre-configuration)
      case (C02) {
        v_ApplCond := pc_Combined_Attach;
      }
      //C03: UEs supporting E-UTRA and USIM removal without power down
      case (C03) {
        v_ApplCond := pc_USIM_Rmv;//FFS - This PICS is not according to 36.523-2.
      }
      //C04: UEs supporting E-UTRA and EPS attach (with or without pre-configuration)
      case (C04) {
        v_ApplCond := pc_Attach;
      }
      //C05: UEs supporting GERAN
      case (C05) {
        v_ApplCond := pc_GERAN;
      }
      //C06: UEs supporting E-UTRA and HRPD
      case (C06) {
        v_ApplCond := pc_HRPD;
      }
      //C07: UEs supporting E-UTRA and 1xRTT
      case (C07) {
        v_ApplCond := pc_1xRTT;
      }
      //C08: UEs supporting E-UTRA and Feature Group 5
      case (C08) {
        v_ApplCond := pc_FeatrGrp_5;
      }
      //C09: UEs supporting E-UTRA and Feature Group Indicator 16
      case (C09) {
        v_ApplCond := pc_FeatrGrp_16;
      }
      //C10: UEs supporting E-UTRA and Feature Group Indicator 25
      case (C10) {
        v_ApplCond := pc_FeatrGrp_25;
      }
      //C11: UEs supporting E-UTRA and Feature Group Indicator 16 and Feature Group Indicator 25
      case (C11) {
        v_ApplCond := pc_FeatrGrp_16 and pc_FeatrGrp_25;
      }
      //C12: UEs supporting E-UTRA and Feature Group Indicator 13 and Feature Group Indicator 16 and Feature Group Indicator 25
      case (C12) {
        v_ApplCond := pc_FeatrGrp_13 and pc_FeatrGrp_16 and pc_FeatrGrp_25;
      }
      //C13: UEs supporting E-UTRA and UTRA and Feature Group Indicator 16 and Feature Group Indicator 22
      case (C13) {
        v_ApplCond := pc_UTRA and pc_FeatrGrp_16 and pc_FeatrGrp_22;
      }
      //C14: UEs supporting E-UTRA and Feature Group Indicator 5 and Feature Group Indicator 17
      case (C14) {
        v_ApplCond := pc_FeatrGrp_5 and pc_FeatrGrp_17;
      }
      //C15: UEs supporting E-UTRA and Feature Group Indicator 3 and Feature Group Indicator 7
      case (C15) {
        v_ApplCond := pc_FeatrGrp_3 and pc_FeatrGrp_7;
      }
      //C16: UEs supporting E-UTRA and Feature Group Indicator 7
      case (C16) {
        v_ApplCond := pc_FeatrGrp_7;
      }
      //C17: UEs supporting E-UTRA, UTRAN, GERAN and Feature Group Indicators 22 and 23
      case (C17) {
        v_ApplCond := pc_UTRA and pc_GERAN and pc_FeatrGrp_22 and pc_FeatrGrp_23;
      }
      //C18: UEs supporting E-UTRA and Feature Group Indicator 3
      case (C18) {
        v_ApplCond := pc_FeatrGrp_3;
      }
      //C19: UEs supporting E-UTRA and Feature Group Indicator 6 and 7
      case (C19) {
        v_ApplCond := pc_FeatrGrp_6 and pc_FeatrGrp_7; // @sic R5-103314 sic@
      }
      //C20: UEs supporting E-UTRA and GERAN and Feature Group Indicator 16 and Feature Group Indicator 23
      case (C20) {
        v_ApplCond := pc_GERAN and pc_FeatrGrp_16 and pc_FeatrGrp_23;
      }
      //C21: UEs supporting E-UTRA and Feature Group Indicator 13 and Feature Group Indicator 25
      case (C21) {
        v_ApplCond := pc_FeatrGrp_13 and pc_FeatrGrp_25;
      }
      //C22: UEs supporting E-UTRA and  MT SMS over SGs
      case (C22) {
        v_ApplCond := pc_SMS_SGs_MT;
      }
      //C23: UEs supporting E-UTRA and MO SMS over SGs
      case (C23) {
        v_ApplCond := pc_SMS_SGs_MO;
      }
      //C24: UEs supporting E-UTRA and HRPD and Feature Group Indicator 16 and Feature Group Indicator 26
      case (C24) {
        v_ApplCond := pc_HRPD and pc_FeatrGrp_16 and pc_FeatrGrp_26;
      }
      //C25: UEs supporting E-UTRA and 1xRTT and Feature Group Indicator 16 and Feature Group Indicator 24
      case (C25) {
        v_ApplCond := pc_1xRTT and pc_FeatrGrp_16 and pc_FeatrGrp_24;
      }
      //C26: UEs supporting E-UTRA and CS fallback
      case (C26) {
        v_ApplCond := pc_CS_Fallback;
      }
      //C27: UEs supporting E-UTRA and UTRAN or GERAN and ISR
      case (C27) {
        v_ApplCond := (pc_UTRA or pc_GERAN) and pc_ISR;
      }
      //C28: UEs supporting E-UTRA and Feature Group Indicator 1
      case (C28) {
        v_ApplCond := pc_FeatrGrp_1;
      }
      //C29: UEs supporting E-UTRA and Feature Group Indicator 1 and Feature Group Indicator 7
      case (C29) {
        v_ApplCond := pc_FeatrGrp_1 and pc_FeatrGrp_7;
      }
      //C30: UEs supporting E-UTRA and Feature Group Indicator 1 and Feature Group Indicator 7 and Feature Group Indicator 20
      case (C30) {
        v_ApplCond := pc_FeatrGrp_1 and pc_FeatrGrp_20;
      }
      //C31: UEs supporting E-UTRA and Feature Group Indicator 1 and Feature Group Indicator 20
      case (C31) {
        v_ApplCond := pc_FeatrGrp_1 and pc_FeatrGrp_7 and pc_FeatrGrp_20;
      }
      //C32: UEs supporting E-UTRA and Feature Group Indicator 7 and Feature Group Indicator 20
      case (C32) {
        v_ApplCond := pc_FeatrGrp_7 and pc_FeatrGrp_20;
      }
      //C33: UEs supporting E-UTRA and Feature Group Indicator 20
      case (C33) {
        v_ApplCond := pc_FeatrGrp_20;
      }
      //C34: UEs supporting E-UTRA, UTRA and GERAN
      case (C34) {
        v_ApplCond := pc_UTRA and pc_GERAN;
      }
      //C35: UEs supporting E-UTRA, and UTRA
      case (C35) {
        v_ApplCond := pc_UTRA;
      }
      //C36: UEs supporting E-UTRA and UTRA and Feature Group Indicator 8 and Feature Group Indicator 22
      case (C36) {
        v_ApplCond := pc_UTRA and pc_FeatrGrp_8 and pc_FeatrGrp_22;
      }
      //C37: UEs supporting E-UTRA and UTRA and inter-RAT PS handover to E-UTRA from UTRA and UTRA Feature Group Indicator 2
      case (C37) {
        v_ApplCond := pc_UTRA and pc_FeatrGrp_8 and pc_UTRA_FeatrGrp_2;
      }
      //C38: UEs supporting E-UTRA and GERAN and  Feature Group Indicator 10
      case (C38) {
        v_ApplCond := pc_GERAN and pc_FeatrGrp_10;
      }
      //C39: UEs supporting E-UTRA and UTRA and Feature Group Indicator 5 and Feature Group Indicator 19 and Feature Group 22
      case (C39) {
        v_ApplCond := pc_FeatrGrp_5 and pc_FeatrGrp_19 and pc_FeatrGrp_22;
      }
      //C40: UEs supporting E-UTRA and GERAN and Feature Group Indicator 5 and Feature Group Indicator 19 and Feature Group 23
      case (C40) {
        v_ApplCond := pc_FeatrGrp_5 and pc_FeatrGrp_19 and pc_FeatrGrp_23;
      }
      //C41: UEs supporting E-UTRA and 1xRTT and 1xCS fallback
      case (C41) {
        v_ApplCond := pc_1xRTT and pc_1xCSfallback;
      }
      //C42: UEs supporting E-UTRA and HRPD and Feature Group Indicator 12
      case (C42) {
        v_ApplCond := pc_HRPD and pc_FeatrGrp_12;
      }
      //C44: UEs supporting E-UTRA and HRPD and Feature Group Indicator 5 and Feature Group Indicator 19 and Feature Group Indicator 26
      case (C44) {
        v_ApplCond := pc_HRPD and pc_FeatrGrp_5 and pc_FeatrGrp_19 and pc_FeatrGrp_26;
      }
      //C45: UEs supporting E-UTRA and 1xRTT and Feature Group Indicator 5 and Feature Group Indicator 19 and Feature Group Indicator 24
      case (C45) {
        v_ApplCond := pc_1xRTT and pc_FeatrGrp_5 and pc_FeatrGrp_19 and pc_FeatrGrp_24;
      }
      //C46: UEs supporting E-UTRA FDD and TDD and not supporting eEMM INFORMATION
      case (C46) {
         v_ApplCond := not pc_EMM_Information;
      }
      //C47: UEs supporting E-UTRA and allowed CSG list and EPS attach (with or without pre-configuration)
      case (C47) {
         v_ApplCond := pc_Allowed_CSG_list and pc_Attach;
      }
      //C48: UE supporting UTRA and CS SMS only or CS fallback
      case (C48) {
         v_ApplCond := pc_UTRA and (pc_CS_SMS_Only or pc_CS_Fallback);
      }
      //C49: UEs supporting E-UTRA and Mobility management based on Dual-Stack Mobile IPv6 and being configured to discover the Home Agent address via DHCPv6
      case (C49) {
         v_ApplCond := false;//pc_DSMIPv6 and pc_HAAddress_via_DHCPv6
      }
      //C50: UEs supporting E-UTRA and Mobility management based on Dual-Stack Mobile IPv6 and being configured to discover the Home Agent address via IKEv2
      case (C50) {
         v_ApplCond := false;//pc_DSMIPv6 and pc_HAAddress_via_IKEv2
      }
      //C51: UEs supporting E-UTRA and  supporting the EMM information message
      case (C51) {
         v_ApplCond := pc_EMM_Information;
      }
      //C52: UEs supporting E-UTRA and 1xRTT and SRVCC from E-UTRA to 1xRTT (CS)
      case (C52) {
         v_ApplCond := false;//pc_1xRTT and pc_SRVCC_1xRTT_CS;
      }
      //C53: UEs supporting E-UTRA and switch on/off
      case (C53) {
        v_ApplCond := pc_SwitchOnOff;
      }
      //C54: UEs supporting E-UTRA and ESM UE requested bearer resource allocation procedure
      case (C54) {
        v_ApplCond := pc_ESM_MO_Bearer_Allocation;
      }
      //C55: UEs supporting E-UTRA and ESM UE requested bearer resource modification procedure
      case (C55) {
        v_ApplCond := pc_ESM_MO_Bearer_Modification;
      }
      //C56: UEs supporting E-UTRA and (UE Category 2 or UE Category3 or UE Category 4 or UE Category 5)
      case (C56) {
        v_ApplCond := (pc_ue_Category_2 or pc_ue_Category_3 or pc_ue_Category_4 or pc_ue_Category_5);
      }
      //C57: UEs supporting E-UTRA and GERAN an CS fallback
      case (C57) {
        v_ApplCond := pc_GERAN and pc_CS_Fallback;
      }
      //C58: UEs supporting E-UTRA and Feature Group Indicator 21
      case (C58) {
        v_ApplCond := pc_FeatrGrp_21;
      }
      //C59: UEs supporting E-UTRAN, UTRAN GERAN and not CS fallback
      case (C59) {
        v_ApplCond := pc_UTRA and pc_GERAN and (not pc_CS_Fallback);
      }
      //C60: UEs supporting E-UTRA and GERAN an CS fallback
      case (C60) {
        v_ApplCond := pc_GERAN and pc_CS_Fallback;
      }
      //C61: UEs supporting E-UTRA, UTRA, GERAN and Feature Group Indicators 16, Feature Group Indicators 22 and Feature Group Indicators 23
      case (C61) {
        v_ApplCond := pc_UTRA and pc_GERAN and pc_FeatrGrp_16 and pc_FeatrGrp_22 and pc_FeatrGrp_23;
      }
      //C62: FFS - No comment exists in 36.523-2
      case (C62) {
        v_ApplCond := ( pc_eFDD or pc_eTDD) and pc_UTRA and pc_GERAN;
      }
      //C63: UEs supporting E-UTRA FDD and TDD
      case (C63) {
        v_ApplCond := pc_eFDD and pc_eTDD;
      }
      //C64: UEs supporting E-UTRA and ETWS reception
      case (C64) {
        v_ApplCond := pc_ETWS_message;
      }
      //C65: Void
      case (C65) {
        v_ApplCond := false;
      }
      //C66: UEs supporting E-UTRA and GSM and GERAN to E-UTRAN neighbour cell measurements
      case (C66) {
        v_ApplCond := pc_GERAN and pc_GERAN_2_E_UTRAN_meas;
      }
      //C67: UEs supporting E-UTRA and UTRA and CS fallback and Feature Group Indicator 8
      case (C67) {
        v_ApplCond := (pc_FDD or pc_TDD_HCR) and pc_CS_Fallback and pc_FeatrGrp_8;
      }
      //C68: UEs supporting E-UTRA and Mobility management based on Dual-Stack Mobile IPv6 and being configured to request the IPv6 address of the Home Agent during Attach procedure
      case (C68) {
        v_ApplCond := pc_DSMIPv6 and pc_RequestIPv6HAAddress_DuringAttach;
      }
      //C69: UEs supporting E-UTRA and Mobility management based on Dual-Stack Mobile IPv6 and being configured to request the IPv4 address of the Home Agent during Attach procedure
      case (C69) {
        v_ApplCond := pc_DSMIPv6 and pc_RequestIPv4HAAddress_DuringAttach;
      }
      //C70: UEs supporting E-UTRA and ETWS reception with security
      case (C70) {
        v_ApplCond := pc_ETWS_message_security;
      }
      //C74: UEs supporting E-UTRA and Disable EPS capability.
      case (C74) {
        v_ApplCond := pc_EPS_Disable;
      }
      //C75: UEs supporting E-UTRA and UTRA and allowed CSG
      case (C75) {
        v_ApplCond := pc_UTRA and pc_Allowed_CSG_list;
      }
      //C77: UEs supporting E-UTRA and UTRA and UTRA Feature Group Indicators 1
      case (C77) {
        v_ApplCond := pc_UTRA and pc_UTRA_FeatrGrp_1;
      }
      //C78: UEs supporting E-UTRA and UTRA and UTRA Feature Group Indicator 2
      case (C78) {
        v_ApplCond := pc_UTRA and pc_UTRA_FeatrGrp_2;
      }
      case else {
        v_ApplCond := false;
      }
    }
    return v_ApplCond;
  }

  function f_ExecutionGuideline ( charstring p_TestCase ) return boolean
  { /* Set the execution to TRUE or FALSE according to 36.523-3 clause 11 */
    // @sic R5-101050 sic@
    var boolean v_ExecutionGuideline := true;
    
    if ((px_ePrimaryFrequencyBand == 13) or
        (px_ePrimaryFrequencyBand == 12 and px_ePrimaryBandChannelBandwidth == n50 ) or
        (px_ePrimaryFrequencyBand == 17 and px_ePrimaryBandChannelBandwidth == n50 ))
    { // Test cases using more than one radio frequency
        select (p_TestCase) {
          case ("TC_6_1_1_1",
                "TC_6_1_2_5",
                "TC_6_1_2_7",
                "TC_6_1_2_8",
                "TC_6_1_2_9",
                "TC_6_1_2_11",
                "TC_6_1_2_15",
                "TC_6_3_6",
                "TC_8_1_3_4",
                "TC_8_1_3_5",
                "TC_8_2_4_6",
                "TC_8_3_1_3",
                "TC_8_3_1_4",
                "TC_8_3_1_6",
                "TC_8_3_1_9",
                "TC_8_3_1_10",
                "TC_8_3_1_11",
                "TC_9_1_2_6",
                "TC_9_2_1_1_1a",
                "TC_9_2_1_1_7",
                "TC_9_2_1_1_9",
                "TC_9_2_1_1_10",
                "TC_9_2_1_1_11",
                "TC_9_2_1_1_12",
                "TC_9_2_1_1_13",
                "TC_9_2_1_1_15",
                "TC_9_2_1_1_16",
                "TC_9_2_1_1_17",
                "TC_9_2_1_1_18",
                "TC_9_2_1_2_1",
                "TC_9_2_1_2_9",
                "TC_9_2_1_2_10",
                "TC_9_2_1_2_11",
                "TC_9_2_1_2_12",
                "TC_9_2_1_2_13",
                "TC_9_2_3_1_1",
                "TC_9_2_3_1_4",
                "TC_9_2_3_1_9a",
                "TC_9_2_3_1_10",
                "TC_9_2_3_1_11",
                "TC_9_2_3_1_12",
                "TC_9_2_3_1_15",
                "TC_9_2_3_1_16",
                "TC_9_2_3_1_17",
                "TC_9_2_3_1_18",
                "TC_9_2_3_1_19",
                "TC_9_2_3_1_25",
                "TC_9_2_3_1_27",
                "TC_9_2_3_2_1",
                "TC_9_2_3_2_6",
                "TC_9_2_3_2_12",
                "TC_9_2_3_2_15") {
            v_ExecutionGuideline := false;
          }
        }
      };
    if ((px_ePrimaryFrequencyBand == 6) or
        (px_ePrimaryFrequencyBand == 14) or
        (px_ePrimaryFrequencyBand == 17 and px_ePrimaryBandChannelBandwidth == n25 ) or
        (px_ePrimaryFrequencyBand == 38 )  // @sic R5-103813 R5-104796 sic@
        )
    { // Test cases using more than two radio frequencies
        select (p_TestCase) {
          case ("TC_6_1_1_1",
                "TC_6_1_2_7",
                "TC_6_1_2_8",
                "TC_6_1_2_9",
                "TC_6_1_2_15",
                "TC_8_3_1_4",
                "TC_9_1_2_6",
                "TC_9_2_1_1_1a",
                "TC_9_2_1_1_7",
                "TC_9_2_1_1_13",
                "TC_9_2_1_1_15",
                "TC_9_2_1_1_16",
                "TC_9_2_1_2_9",
                "TC_9_2_1_2_11",
                "TC_9_2_1_2_12",
                "TC_9_2_3_1_4",
                "TC_9_2_3_1_15",
                "TC_9_2_3_1_17",
                "TC_9_2_3_1_18") {
            v_ExecutionGuideline := false;
          }
        }
    };
    if ((px_ePrimaryFrequencyBand == 12 and px_ePrimaryBandChannelBandwidth == n25) or
        (px_ePrimaryFrequencyBand == 18) or
        (px_ePrimaryFrequencyBand == 19) or
        (px_ePrimaryFrequencyBand == 20) or
        (px_ePrimaryFrequencyBand == 21) or
        (px_ePrimaryFrequencyBand == 34 ))  // @sic R5-104796 sic@
      { // Test cases using more than three radio frequencies
        select (p_TestCase) {
          case ("TC_6_1_1_1",
                "TC_9_2_1_1_7",
                "TC_9_2_1_2_12",
                "TC_9_2_3_1_4") {
            v_ExecutionGuideline := false;
          }
        }
    };
    return v_ExecutionGuideline;
  }
 
}
